Skip to contentSkip to conversation

Add Novatek NT36xxx touchscreen driver

PATCH Superseded [email protected] 3 participants 6 messages Oct 7, 2020 – Oct 8, 2020

Subsystems (3)

v3 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add Novatek NT36xxx touchscreen driver

From: AngeloGioacchino Del Regno <[email protected]>

This patch series adds support for the Novatek NT36xxx Series' In-Cell touchscreen (integrated into the DriverIC).

This patch series has been tested against the following devices:
- Sony Xperia 10 (SDM630 Ganges Kirin)
- Sony Xperia 10 Plus (SDM636 Ganges Mermaid)

Changes in v2:
- Fixed sparse warnings from lkp kernel test robot

Changes in v3 (as requested by Dmitry Torokhov):
- Using shorthand u16/u32 (sorry for the overlook!)
- Now using more input and touchscreen APIs
- Fixed useless workqueue involvements
- Removed useless locking
- Switched reads and writes to use regmap
- Moved header contents to nt36xxx.c
- Fixed reset gpio handling
- Other cleanups
- P.S.: Thanks, Dmitry!

AngeloGioacchino Del Regno (3):
dt-bindings: Add vendor prefix for Novatek Microelectronics Corp.
Input: Add Novatek NT36xxx touchscreen driver
dt-bindings: touchscreen: Add binding for Novatek NT36xxx series
driver

 .../input/touchscreen/novatek,nt36xxx.yaml    |  56 ++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 drivers/input/touchscreen/Kconfig             |  12 +
 drivers/input/touchscreen/Makefile            |   1 +
 drivers/input/touchscreen/nt36xxx.c           | 816 ++++++++++++++++++
 5 files changed, 887 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml
 create mode 100644 drivers/input/touchscreen/nt36xxx.c
Signature · 1 line
2.28.0
#1 lore raw

PATCH v3 1/3 dt-bindings: Add vendor prefix for Novatek Microelectronics Corp.

From: AngeloGioacchino Del Regno <[email protected]>

Add prefix for Novatek Microelectronics Corp.

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 66e45112a8d7..f98ea0af487d 100644
@@ -740,6 +740,8 @@ patternProperties:
     description: Nokia
   "^nordic,.*":
     description: Nordic Semiconductor
+  "^novatek,.*":
+    description: Novatek Microelectronics Corp.
   "^novtech,.*":
     description: NovTech, Inc.
   "^nutsboard,.*":
Signature · 1 line
2.28.0
#2 lore raw

PATCH v3 2/3 Input: Add Novatek NT36xxx touchscreen driver

In reply to [email protected]

From: AngeloGioacchino Del Regno <[email protected]>

This is a driver for the Novatek in-cell touch controller and supports various chips from the NT36xxx family, currently including NT36525, NT36672A, NT36676F, NT36772 and NT36870.

Functionality like wake gestures and firmware flashing is not
included: I am not aware of any of these DrIC+Touch combo chips not including a non-volatile memory and it should be highly unlikely to find one, since the touch firmware is embedded into the DriverIC one, which is obviously necessary to drive the display unit.

However, the necessary address for the firmware update procedure was included into the address table in this driver so, in the event that someone finds the need to implement it for a reason or another, it will be pretty straightforward to.

This driver is lightly based on the downstream implementation [1].
[1] https://github.com/Rasenkai/caf-tsoft-Novatek-nt36xxx

---
 drivers/input/touchscreen/Kconfig   |  12 +
 drivers/input/touchscreen/Makefile  |   1 +
 drivers/input/touchscreen/nt36xxx.c | 816 ++++++++++++++++++++++++++++
 3 files changed, 829 insertions(+)
 create mode 100644 drivers/input/touchscreen/nt36xxx.c
drivers/input/touchscreen/Kconfig +12 -0
index 35c867b2d9a7..6d118b967021 100644
@@ -605,6 +605,18 @@ config TOUCHSCREEN_MTOUCH
 	  To compile this driver as a module, choose M here: the
 	  module will be called mtouch.
 
+config TOUCHSCREEN_NT36XXX
+	tristate "Novatek NT36XXX In-Cell I2C touchscreen controller"
+	depends on I2C
+	help
+	  Say Y here if you have a Novatek NT36xxx series In-Cell
+	  touchscreen connected to your system over I2C.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called nt36xxx.
+
 config TOUCHSCREEN_IMX6UL_TSC
 	tristate "Freescale i.MX6UL touchscreen controller"
 	depends on (OF && GPIOLIB) || COMPILE_TEST
drivers/input/touchscreen/Makefile +1 -0
index 30d1e1b42492..424a555e03d5 100644
@@ -61,6 +61,7 @@ obj-$(CONFIG_TOUCHSCREEN_MIGOR)		+= migor_ts.o
 obj-$(CONFIG_TOUCHSCREEN_MMS114)	+= mms114.o
 obj-$(CONFIG_TOUCHSCREEN_MTOUCH)	+= mtouch.o
 obj-$(CONFIG_TOUCHSCREEN_MK712)		+= mk712.o
+obj-$(CONFIG_TOUCHSCREEN_NT36XXX)	+= nt36xxx.o
 obj-$(CONFIG_TOUCHSCREEN_HP600)		+= hp680_ts_input.o
 obj-$(CONFIG_TOUCHSCREEN_HP7XX)		+= jornada720_ts.o
 obj-$(CONFIG_TOUCHSCREEN_IPAQ_MICRO)	+= ipaq-micro-ts.o
drivers/input/touchscreen/nt36xxx.c new file +816 -0

816 lines not on this page · raw message

Signature · 1 line
2.28.0
#3 lore raw

PATCH v3 3/3 dt-bindings: touchscreen: Add binding for Novatek NT36xxx series driver

In reply to [email protected]

From: AngeloGioacchino Del Regno <[email protected]>

Add binding for the Novatek NT36xxx series touchscreen driver.

---
 .../input/touchscreen/novatek,nt36xxx.yaml    | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml
Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml new file +56 -0
new file mode 100644
index 000000000000..9f350f4e6d6a
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/novatek,nt36xxx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Novatek NT36xxx series touchscreen controller Bindings
+
+maintainers:
+  - TBD
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    enum:
+      - novatek,nt36xxx
+
+  reg:
+    enum: [ 0x62 ]
+
+  interrupts:
+    maxItems: 1
+
+  reset-gpio:
+    maxItems: 1
+
+  vdd-supply:
+    description: Power supply regulator for VDD pin
+
+  vio-reg-name:
+    description: Power supply regulator on VDD-IO pin
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      nt36xxx@62 {
+        compatible = "novatek,nt36xxx";
+        reg = <0x62>;
+        interrupt-parent = <&tlmm>;
+        interrupts = <45 IRQ_TYPE_EDGE_RISING>;
+        reset-gpio = <&tlmm 102 GPIO_ACTIVE_HIGH>;
+      };
+    };
+
+...
Signature · 1 line
2.28.0
#4 lore raw

Re: [PATCH v3 3/3] dt-bindings: touchscreen: Add binding for Novatek NT36xxx series driver

Quoted 17 lines · On Wed, 7 Oct 2020 at 20:22, <[email protected]> wrote:

From: AngeloGioacchino Del Regno <[email protected]>

Add binding for the Novatek NT36xxx series touchscreen driver.

---
 .../input/touchscreen/novatek,nt36xxx.yaml    | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml
Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml new file +0 -0
new file mode 100644
index 000000000000..9f350f4e6d6a

Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml line 10

Quoted 10 lines
Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml new file +10 -0
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/novatek,nt36xxx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Novatek NT36xxx series touchscreen controller Bindings
+
+maintainers:
+  - TBD

Hi,

It is surprising that this is your v3 and you put here TBD. In such case, add here subsystem maintainer:
Dmitry Torokhov <[email protected]>

Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml line 18

Quoted 8 lines
Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml new file +8 -0
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    enum:
+      - novatek,nt36xxx

This is not an enum, but one const.

Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml line 21

Quoted 3 lines
Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml new file +3 -0
+
+  reg:
+    enum: [ 0x62 ]

Usually addresses are fixed in schema, because they could change (e.g. by some pin configuration). Just use maxItems: 1.

Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml line 33

Quoted 12 lines
Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml new file +12 -0
+
+  interrupts:
+    maxItems: 1
+
+  reset-gpio:
+    maxItems: 1
+
+  vdd-supply:
+    description: Power supply regulator for VDD pin
+
+  vio-reg-name:
+    description: Power supply regulator on VDD-IO pin

What is this for? Is it a supply for the device or the device is a regulator provider?

Quoted 4 lines
Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml new file +4 -0
+
+additionalProperties: false
+
+required:

Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml line 47

Quoted 10 lines
Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml new file +10 -0
+  - compatible
+  - reg
+  - interrupts
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      nt36xxx@62 {

Incorrect node name - should be touchscreen.

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH v3 3/3] dt-bindings: touchscreen: Add binding for Novatek NT36xxx series driver

In reply to [email protected]
Quoted 2 lines · On Wed, Oct 7, 2020 at 1:05 PM <[email protected]> wrote:

From: AngeloGioacchino Del Regno <[email protected]>

Please send to DT list so checks run and it's in my review queue.

Quoted 74 lines

Add binding for the Novatek NT36xxx series touchscreen driver.

---
 .../input/touchscreen/novatek,nt36xxx.yaml    | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml
Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml new file +56 -1
new file mode 100644
index 000000000000..9f350f4e6d6a
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/novatek,nt36xxx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Novatek NT36xxx series touchscreen controller Bindings
+
+maintainers:
+  - TBD
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    enum:
+      - novatek,nt36xxx
+
+  reg:
+    enum: [ 0x62 ]
+
+  interrupts:
+    maxItems: 1
+
+  reset-gpio:
+    maxItems: 1
+
+  vdd-supply:
+    description: Power supply regulator for VDD pin
+
+  vio-reg-name:
+    description: Power supply regulator on VDD-IO pin
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      nt36xxx@62 {
+        compatible = "novatek,nt36xxx";
+        reg = <0x62>;
+        interrupt-parent = <&tlmm>;
+        interrupts = <45 IRQ_TYPE_EDGE_RISING>;
+        reset-gpio = <&tlmm 102 GPIO_ACTIVE_HIGH>;
+      };
+    };
+
+...
--

2.28.0