Add Nsiway NS2009 touchscreen support
Subsystems (3)
v3 cover Add Nsiway NS2009 touchscreen support
Add the vendor prefix, hardware binding and initial polling driver for the four-wire resistive touchscreen controller.
Changes since v2:
- Use unevaluatedProperties: false and inherit the common touchscreen properties without redundant declarations.
- Simplify description without a literal block marker and keep one complete interrupt/supply example.
- Drop the inappropriate Suggested-by trailer.
- Use consistent author and sender names; include an explicit in-body author line in each patch to preserve authorship through mail relays.
The polling driver and vendor-prefix content are unchanged from v2. IRQ operation, wakeup handling and touch resistance calculation remain separate future driver work.
Based on current mainline 24a19b953e2a. Binding checks and a W=1 driver object build were performed locally; M10 schema validation uses an independent combination tree with the still-unmerged NS2009 dependencies.
Mizuno Miotsuki (3):
dt-bindings: vendor-prefixes: add Nsiway
dt-bindings: input: touchscreen: add Nsiway NS2009
Input: add Nsiway NS2009 resistive touchscreen driver
.../input/touchscreen/nsiway,ns2009.yaml | 78 ++++++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 7 + drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/ns2009.c | 175 ++++++++++++++++++ 6 files changed, 273 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/nsiway,ns2009.yaml create mode 100644 drivers/input/touchscreen/ns2009.c
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
Signature · 1 line
2.56.0
PATCH v3 1/3 dt-bindings: vendor-prefixes: add Nsiway
From: Mizuno Miotsuki <[email protected]>
Nsiway manufactures the NS2009 I2C resistive touchscreen controller. Add its vendor prefix for the touchscreen binding.
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -1214,6 +1214,8 @@ patternProperties: description: Novatek "^novtech,.*": description: NovTech, Inc. + "^nsiway,.*": + description: Shenzhen Nsiway Technology Co., Ltd. "^nuclei,.*": description: Nuclei System Technology "^numonyx,.*":
Signature · 1 line
2.56.0
PATCH v3 2/3 dt-bindings: input: touchscreen: add Nsiway NS2009
In reply to Miotsuki MizunoFrom: Mizuno Miotsuki <[email protected]>
Describe the Nsiway NS2009 four-wire resistive touchscreen controller with optional pen interrupt, power and reference supplies, and touch resistance measurement properties. Include one complete example.
--- .../input/touchscreen/nsiway,ns2009.yaml | 78 +++++++++++++++++++ MAINTAINERS | 6 ++ 2 files changed, 84 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/nsiway,ns2009.yaml
Documentation/devicetree/bindings/input/touchscreen/nsiway,ns2009.yaml new file +78 -0
@@ -0,0 +1,78 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/touchscreen/nsiway,ns2009.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nsiway NS2009 resistive touchscreen controller + +maintainers: + - Mizuno Miotsuki <[email protected]> + +description: + Nsiway NS2009 is an I2C four-wire resistive touchscreen controller with + a 12-bit ADC, an active-low pen interrupt and touch resistance measurement. + +allOf: + - $ref: touchscreen.yaml# + +properties: + compatible: + const: nsiway,ns2009 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + description: + Active-low pen interrupt output. Optional when the signal is not + connected. + + wakeup-source: + type: boolean + + vdd-supply: + description: Main power supply. + + vref-supply: + description: External ADC reference voltage supply. + + touchscreen-min-pressure: + minimum: 1 + maximum: 4095 + default: 80 + description: + Minimum raw Z1 reading considered a touch. This is a contact detection + threshold, not a calibrated pressure value. Boards may require a higher + empirically determined threshold than the historical driver default. + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + touchscreen@48 { + compatible = "nsiway,ns2009"; + reg = <0x48>; + interrupt-parent = <&gpio1>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + wakeup-source; + vdd-supply = <&vdd>; + vref-supply = <&vref>; + touchscreen-x-plate-ohms = <400>; + touchscreen-min-pressure = <150>; + touchscreen-max-pressure = <4095>; + touchscreen-fuzz-pressure = <16>; + touchscreen-inverted-y; + }; + };
MAINTAINERS +6 -0
@@ -19467,6 +19467,12 @@ S: Maintained F: Documentation/core-api/symbol-namespaces.rst F: scripts/nsdeps +NSIWAY NS2009 TOUCHSCREEN CONTROLLER +M: Mizuno Miotsuki <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/input/touchscreen/nsiway,ns2009.yaml + NTB AMD DRIVER M: Basavaraj Natikar <[email protected]> M: Shyam Sundar S K <[email protected]>
Signature · 1 line
2.56.0
PATCH v3 3/3 Input: add Nsiway NS2009 resistive touchscreen driver
In reply to Miotsuki MizunoFrom: Mizuno Miotsuki <[email protected]>
Add polling support for the Nsiway NS2009 I2C touchscreen controller using the input polling API and managed input allocation. Read 12-bit X/Y ADC values and report BTN_TOUCH from the raw Z1 contact threshold. Apply coordinate transforms through the common touchscreen helpers.
This implementation derives from Icenowy Zheng's 2017 polling driver. Keep its historical threshold default while allowing a firmware override, and retain the original copyright and author attribution.
Report the touch key on every successful sample and let the input core filter repeated values. A private pen-down flag would become stale when the core clears key state during inhibit or reset. On a failed, short or malformed I2C read, discard the coordinates and release the contact so a failed bus cannot leave it stuck down. A later valid sample reports a new contact.
Validate the zero padding in the low nibble of the second byte as specified by the 12-bit read-command format. Reject malformed responses before assigning the decoded value, and rate-limit the diagnostic output.
Tested on UNIHIKER M10 V1.2 with a Linux 6.18 validation module: clicks, long presses, drags, release, axis orientation and three held-contact inhibit/uninhibit cycles. The validation module only changes the driver registration name to replace the existing built-in driver.
--- MAINTAINERS | 1 + drivers/input/touchscreen/Kconfig | 10 ++ drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/ns2009.c | 175 +++++++++++++++++++++++++++++ 4 files changed, 187 insertions(+) create mode 100644 drivers/input/touchscreen/ns2009.c
MAINTAINERS +1 -0
@@ -19472,6 +19472,7 @@ M: Mizuno Miotsuki <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/input/touchscreen/nsiway,ns2009.yaml +F: drivers/input/touchscreen/ns2009.c NTB AMD DRIVER M: Basavaraj Natikar <[email protected]>
drivers/input/touchscreen/Kconfig +10 -0
@@ -691,6 +691,16 @@ config TOUCHSCREEN_MTOUCH To compile this driver as a module, choose M here: the module will be called mtouch. +config TOUCHSCREEN_NS2009 + tristate "Nsiway NS2009 touchscreen controller" + depends on I2C + help + Say Y here if you have a resistive touchscreen using the Nsiway + NS2009 controller connected over I2C. + + To compile this driver as a module, choose M here: the module will be + called ns2009. + config TOUCHSCREEN_NOVATEK_NVT_TS tristate "Novatek NT11205 touchscreen support" depends on I2C
drivers/input/touchscreen/Makefile +1 -0
@@ -68,6 +68,7 @@ obj-$(CONFIG_TOUCHSCREEN_MIGOR) += migor_ts.o obj-$(CONFIG_TOUCHSCREEN_MMS114) += mms114.o obj-$(CONFIG_TOUCHSCREEN_MSG2638) += msg2638.o obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o +obj-$(CONFIG_TOUCHSCREEN_NS2009) += ns2009.o obj-$(CONFIG_TOUCHSCREEN_NOVATEK_NVT_TS) += novatek-nvt-ts.o obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o obj-$(CONFIG_TOUCHSCREEN_HP7XX) += jornada720_ts.o
drivers/input/touchscreen/ns2009.c new file +175 -0
175 lines not on this page · raw message
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH v3 3/3] Input: add Nsiway NS2009 resistive touchscreen driver
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] i2c: i2c_device_id array lacks named initializer --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] i2c: i2c_device_id array lacks named initializer
--
commit 1329443f9d0fcc43d7767e5dcaca297c790eca05
Author: Mizuno Miotsuki <[email protected]>
Input: add Nsiway NS2009 resistive touchscreen driver
This commit adds polling support for the Nsiway NS2009 I2C touchscreen controller. It uses the input polling API, managed input allocation, and applies coordinate transforms through common touchscreen helpers.
Quoted 5 lines
drivers/input/touchscreen/ns2009.c new file +0
-0
[ ... ]
drivers/input/touchscreen/ns2009.c line 154
Quoted 4 lines
drivers/input/touchscreen/ns2009.c new file +4
-0+static const struct i2c_device_id ns2009_id[] = { + {"ns2009" }, + { } +};
[Severity: Low]
The I2C subsystem guidelines state that initialized arrays of type struct i2c_device_id must use named initializers. Should the ns2009_id array use a named initializer, such as { .name = "ns2009" }, instead of a positional initializer?
Quoted 6 lines
drivers/input/touchscreen/ns2009.c new file +6
-0+MODULE_DEVICE_TABLE (i2c, ns2009_id); + +static const struct of_device_id ns2009_of_match[] = { + { .compatible ="nsiway,ns2009" }, + { } +};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Re: [PATCH v3 1/3] dt-bindings: vendor-prefixes: add Nsiway
In reply to Miotsuki Mizunopw-bot: not-applicable
Re: [PATCH v3 2/3] dt-bindings: input: touchscreen: add Nsiway NS2009
In reply to Miotsuki MizunoQuoted 61 lines · Miotsuki Mizuno
From: Mizuno Miotsuki <[email protected]>
Describe the Nsiway NS2009 four-wire resistive touchscreen controller with optional pen interrupt, power and reference supplies, and touch resistance measurement properties. Include one complete example.
Signed-off-by Mizuno Miotsuki <[email protected]>--- .../input/touchscreen/nsiway,ns2009.yaml | 78 +++++++++++++++++++ MAINTAINERS | 6 ++ 2 files changed, 84 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/nsiway,ns2009.yamlDocumentation/devicetree/bindings/input/touchscreen/nsiway,ns2009.yaml new file +42
-0@@ -0,0 +1,78 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/touchscreen/nsiway,ns2009.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nsiway NS2009 resistive touchscreen controller + +maintainers: + - Mizuno Miotsuki <[email protected]> + +description: + Nsiway NS2009 is an I2C four-wire resistive touchscreen controller with + a 12-bit ADC, an active-low pen interrupt and touch resistance measurement. + +allOf: + - $ref: touchscreen.yaml# + +properties: + compatible: + const: nsiway,ns2009 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + description: + Active-low pen interrupt output. Optional when the signal is not + connected. + + wakeup-source: + type: boolean + + vdd-supply: + description: Main power supply. + + vref-supply: + description: External ADC reference voltage supply. + + touchscreen-min-pressure: + minimum: 1
Documentation/devicetree/bindings/input/touchscreen/nsiway,ns2009.yaml line 52
Quoted 10 lines
Documentation/devicetree/bindings/input/touchscreen/nsiway,ns2009.yaml new file +10
-0+ maximum: 4095 + default: 80 + description: + Minimum raw Z1 reading considered a touch. This is a contact detection + threshold, not a calibrated pressure value. Boards may require a higher + empirically determined threshold than the historical driver default. + +required: + - compatible + - reg
Sounds like vdd-supply should also be required. I assume vref-supply is optional?
Looks okay otherwise.
pw-bot: changes-requested
Thanks,
Conor.
Quoted 46 lines
Documentation/devicetree/bindings/input/touchscreen/nsiway,ns2009.yaml new file +26
-0+ +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + touchscreen@48 { + compatible = "nsiway,ns2009"; + reg = <0x48>; + interrupt-parent = <&gpio1>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + wakeup-source; + vdd-supply = <&vdd>; + vref-supply = <&vref>; + touchscreen-x-plate-ohms = <400>; + touchscreen-min-pressure = <150>; + touchscreen-max-pressure = <4095>; + touchscreen-fuzz-pressure = <16>; + touchscreen-inverted-y; + }; + };MAINTAINERS +6
-0@@ -19467,6 +19467,12 @@ S: Maintained F: Documentation/core-api/symbol-namespaces.rst F: scripts/nsdeps +NSIWAY NS2009 TOUCHSCREEN CONTROLLER +M: Mizuno Miotsuki <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/input/touchscreen/nsiway,ns2009.yaml + NTB AMD DRIVER M: Basavaraj Natikar <[email protected]> M: Shyam Sundar S K <[email protected]>Signature · 1 line
2.56.0