Skip to contentSkip to conversation

Add Novatek NT36xxx touchscreen driver

PATCH Superseded [email protected] 2 participants 6 messages Sep 26, 2020

Subsystems (3)

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

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)

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           | 741 ++++++++++++++++++
 drivers/input/touchscreen/nt36xxx.h           | 122 +++
 6 files changed, 934 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/novatek,nt36xxx.yaml
 create mode 100644 drivers/input/touchscreen/nt36xxx.c
 create mode 100644 drivers/input/touchscreen/nt36xxx.h
Signature · 1 line
2.28.0
#1 lore raw

PATCH 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 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 | 741 ++++++++++++++++++++++++++++
 drivers/input/touchscreen/nt36xxx.h | 122 +++++
 4 files changed, 876 insertions(+)
 create mode 100644 drivers/input/touchscreen/nt36xxx.c
 create mode 100644 drivers/input/touchscreen/nt36xxx.h
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 +741 -0

741 lines not on this page · raw message

drivers/input/touchscreen/nt36xxx.h new file +122 -0

122 lines not on this page · raw message

Signature · 1 line
2.28.0
#5 lore raw

PATCH 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
#3 lore raw

Re: [PATCH 2/3] Input: Add Novatek NT36xxx touchscreen driver

In reply to [email protected]
Thank you for the patch! Perhaps something to improve:

Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on input/next]
[also build test WARNING on robh/for-next v5.9-rc6 next-20200925] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/kholk11-gmail-com/Add-Novatek-NT36xxx-touchscreen-driver/20200926-204916
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: x86_64-randconfig-s032-20200927 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-201-g24bdaac6-dirty
        # https://github.com/0day-ci/linux/commit/6d9ee3df7e7fa769137ec343ea91ebf87bcf24cb
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review kholk11-gmail-com/Add-Novatek-NT36xxx-touchscreen-driver/20200926-204916
        git checkout 6d9ee3df7e7fa769137ec343ea91ebf87bcf24cb
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

sparse warnings: (new ones prefixed by >>)

>> drivers/input/touchscreen/nt36xxx.c:17:30: sparse: sparse: symbol 'nt36xxx_memory_maps' was not declared. Should it be static?
>> drivers/input/touchscreen/nt36xxx.c:25:33: sparse: sparse: symbol 'trim_id_table' was not declared. Should it be static?
>> drivers/input/touchscreen/nt36xxx.c:396:58: sparse: sparse: invalid access past the end of 'buf' (3 3)

drivers/input/touchscreen/nt36xxx.c:395:58: sparse: sparse: invalid access past the end of 'buf' (3 3)

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#4 lore raw

[RFC PATCH] Input: nt36xxx_memory_maps[] can be static

In reply to [email protected]
Signed-off-by: kernel test robot <[email protected]>
---
 nt36xxx.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/nt36xxx.c +2 -2
index 2434c1ac880899..c5c3ba643ce5e4 100644
@@ -14,7 +14,7 @@
 
 #include "nt36xxx.h"
 
-const struct nt36xxx_mem_map nt36xxx_memory_maps[] = {
+static const struct nt36xxx_mem_map nt36xxx_memory_maps[] = {
 	[NT36525_IC]  = { 0x11a00, 0x10000, 0x12000, 0x14000, 0x14002 },
 	[NT36672A_IC] = { 0x21c00, 0x20000, 0x23000, 0x24000, 0x24002 },
 	[NT36676F_IC] = { 0x11a00, 0x10000, 0x12000, 0x14000, 0x14002 },
@@ -22,7 +22,7 @@ const struct nt36xxx_mem_map nt36xxx_memory_maps[] = {
 	[NT36870_IC]  = { 0x25000, 0x20000, 0x23000, 0x24000, 0x24002 },
 };
 
-const struct nt36xxx_trim_table trim_id_table[] = {
+static const struct nt36xxx_trim_table trim_id_table[] = {
 	{
 	 .id = { 0x0A, 0xFF, 0xFF, 0x72, 0x66, 0x03 },
 	 .mask = { 1, 0, 0, 1, 1, 1 },