Skip to contentSkip to conversation

Input: Add TouchNetix axiom touchscreen driver

PATCH Superseded Kamel Bouhara 3 participants 7 messages Jan 31, 2024 – Feb 2, 2024

Subsystems (3)

v7 of 16 Superseded Latest is v16 →

lore
Share & tools
lore
#0 lore raw

v7 cover Input: Add TouchNetix axiom touchscreen driver

Add a new driver for the TouchNetix's axiom family of touchscreen controller. This driver only support i2c and can be later adapted for SPI and USB support.

---
Changes in v2:
- Add device tree binding documentation
- Move core functions in axiom_i2c as we only care about i2c support now
- Use static function when required
- Use syntax dev_err_probe()
- Add an hardware based reset

Changes in v3:
- Remove irq-gpios property in dt-binding
- Use a generic node name
- Fix issues reported in https://lore.kernel.org/oe-kbuild-all/[email protected]/

Changes in v4:
- Cleanup unused headers and macros
- Use standard kernel type
- Namespace structures and functions
- Use packed struct when possible to avoid bitfield operators
- Fix missing break when address is found in axiom_populate_target_address()
- Split reads in two steps for the reports, first length then report itself so we only read required bytes
- Get poll-interval from devicetree
- Add VDDI/VDDA regulators
- Add a startup delay of 110 ms required after VDDA/VDDI is applied
- Remove axiom_i2c_write() as it is no more used

Changes in v5:
- Fix wrong message constructed in axiom_i2c_read
- Delay required between i2c reads is >= 250us
- Do not split report reading in two phases as we'll
have to wait 500us
- Use lower-case in properties names
- Make regulators properties are required in dt-binding
- Fix bug report: https://lore.kernel.org/lkml/[email protected]/
- Fix bug report: https://lore.kernel.org/lkml/[email protected]/

Changes in v6:
- Fix missing unevaluatedProperties.in dt-binding
- Use __le16 to correctly deal with device endianness
- Use standart kernel types s/char/u8/
- Use regmap api as driver might support spi later
- Use get_unaligned_le16() for the sake of clarity
- Use devm_regulator_enable_optional()

Changes in v7:
- Remove startup time from dt-binding
- Fix usage table not correctly populated

Kamel Bouhara (3):
dt-bindings: vendor-prefixes: Add TouchNetix AS
dt-bindings: input: Add TouchNetix axiom touchscreen
Input: Add TouchNetix axiom i2c touchscreen driver

 .../input/touchscreen/touchnetix,ax54a.yaml   |  62 ++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |   7 +
 drivers/input/touchscreen/Kconfig             |  12 +
 drivers/input/touchscreen/Makefile            |   1 +
 drivers/input/touchscreen/touchnetix_axiom.c  | 666 ++++++++++++++++++
 6 files changed, 750 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/touchnetix,ax54a.yaml
 create mode 100644 drivers/input/touchscreen/touchnetix_axiom.c

--
2.25.1

#1 lore raw

PATCH v7 1/3 dt-bindings: vendor-prefixes: Add TouchNetix AS

Add vendor prefix for TouchNetix AS (https://www.touchnetix.com/products/).

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 1a0dc04f1db4..88954a286107 100644
@@ -1444,6 +1444,8 @@ patternProperties:
     description: Toradex AG
   "^toshiba,.*":
     description: Toshiba Corporation
+  "^touchnetix,.*":
+    description: TouchNetix AS
   "^toumaz,.*":
     description: Toumaz
   "^tpk,.*":
Signature · 1 line
2.25.1
#2 lore raw

PATCH v7 2/3 dt-bindings: input: Add TouchNetix axiom touchscreen

In reply to Kamel Bouhara

Add the TouchNetix axiom I2C touchscreen device tree bindings documentation.

---
 .../input/touchscreen/touchnetix,ax54a.yaml   | 62 +++++++++++++++++++
 MAINTAINERS                                   |  6 ++
 2 files changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/touchnetix,ax54a.yaml
Documentation/devicetree/bindings/input/touchscreen/touchnetix,ax54a.yaml new file +62 -0
new file mode 100644
index 000000000000..66229a4d6f15
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/touchnetix,ax54a.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TouchNetix Axiom series touchscreen controller
+
+maintainers:
+  - Kamel Bouhara <[email protected]>
+
+allOf:
+  - $ref: /schemas/input/touchscreen/touchscreen.yaml#
+  - $ref: /schemas/input/input.yaml#
+
+properties:
+  compatible:
+    const: touchnetix,ax54a
+
+  reg:
+    const: 0x66
+
+  interrupts:
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  vdda-supply:
+    description: Analog power supply regulator on VDDA pin
+
+  vddi-supply:
+    description: I/O power supply regulator on VDDI pin
+
+required:
+  - compatible
+  - reg
+  - vdda-supply
+  - vddi-supply
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      touchscreen@66 {
+        compatible = "touchnetix,ax54a";
+        reg = <0x66>;
+        interrupt-parent = <&gpio2>;
+        interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+        reset-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;
+        vdda-supply = <&vdda_reg>;
+        vddi-supply = <&vddi_reg>;
+        poll-interval = <20>;
+      };
+    };
+...
MAINTAINERS +6 -0
index c4828ab15f1a..4b3ed2f22b89 100644
@@ -22257,6 +22257,12 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/platform/x86/toshiba-wmi.c
 
+TOUCHNETIX AXIOM I2C TOUCHSCREEN DRIVER
+M:	Kamel Bouhara <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/input/touchscreen/touchnetix,ax54a.yaml
+
 TPM DEVICE DRIVER
 M:	Peter Huewe <[email protected]>
 M:	Jarkko Sakkinen <[email protected]>
Signature · 1 line
2.25.1
#4 lore raw

PATCH v7 3/3 Input: Add TouchNetix axiom i2c touchscreen driver

In reply to Kamel Bouhara

Add a new driver for the TouchNetix's axiom family of touchscreen controllers. This driver only supports i2c and can be later adapted for SPI and USB support.

---
 MAINTAINERS                                  |   1 +
 drivers/input/touchscreen/Kconfig            |  12 +
 drivers/input/touchscreen/Makefile           |   1 +
 drivers/input/touchscreen/touchnetix_axiom.c | 666 +++++++++++++++++++
 4 files changed, 680 insertions(+)
 create mode 100644 drivers/input/touchscreen/touchnetix_axiom.c
MAINTAINERS +1 -0
index 4b3ed2f22b89..de5fad8f317a 100644
@@ -22262,6 +22262,7 @@ M:	Kamel Bouhara <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/input/touchscreen/touchnetix,ax54a.yaml
+F:	drivers/input/touchscreen/touchnetix_axiom.c
 
 TPM DEVICE DRIVER
 M:	Peter Huewe <[email protected]>
drivers/input/touchscreen/Kconfig +12 -0
index e3e2324547b9..f36bee8d8696 100644
@@ -803,6 +803,18 @@ config TOUCHSCREEN_MIGOR
 	  To compile this driver as a module, choose M here: the
 	  module will be called migor_ts.
 
+config TOUCHSCREEN_TOUCHNETIX_AXIOM
+	tristate "TouchNetix AXIOM based touchscreen controllers"
+	depends on I2C
+	help
+	  Say Y here if you have a axiom touchscreen connected to
+	  your system.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called axiom.
+
 config TOUCHSCREEN_TOUCHRIGHT
 	tristate "Touchright serial touchscreen"
 	select SERIO
drivers/input/touchscreen/Makefile +1 -0
index 62bd24f3ac8e..8e32a2df5e18 100644
@@ -88,6 +88,7 @@ obj-$(CONFIG_TOUCHSCREEN_SUR40)		+= sur40.o
 obj-$(CONFIG_TOUCHSCREEN_SURFACE3_SPI)	+= surface3_spi.o
 obj-$(CONFIG_TOUCHSCREEN_TI_AM335X_TSC)	+= ti_am335x_tsc.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213)	+= touchit213.o
+obj-$(CONFIG_TOUCHSCREEN_TOUCHNETIX_AXIOM)	+= touchnetix_axiom.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT)	+= touchright.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN)	+= touchwin.o
 obj-$(CONFIG_TOUCHSCREEN_TS4800)	+= ts4800-ts.o
drivers/input/touchscreen/touchnetix_axiom.c new file +666 -0

666 lines not on this page · raw message

Signature · 1 line
2.25.1
#5 lore raw

Re: [PATCH v7 3/3] Input: Add TouchNetix axiom i2c touchscreen driver

kernel test robot noticed the following build warnings:

Hi Kamel,

kernel test robot noticed the following build warnings:

[auto build test WARNING on dtor-input/next]
[also build test WARNING on dtor-input/for-linus robh/for-next krzk-dt/for-next linus/master v6.8-rc2 next-20240201] [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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Kamel-Bouhara/dt-bindings-vendor-prefixes-Add-TouchNetix-AS/20240131-221925
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link:    https://lore.kernel.org/r/20240131141158.3350344-4-kamel.bouhara%40bootlin.com
patch subject: [PATCH v7 3/3] Input: Add TouchNetix axiom i2c touchscreen driver
config: s390-randconfig-r131-20240201 (https://download.01.org/0day-ci/archive/20240202/[email protected]/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project fdac7d0b6f74f919d319b31a0680c77f66732586)
reproduce: (https://download.01.org/0day-ci/archive/20240202/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)

>> drivers/input/touchscreen/touchnetix_axiom.c:181:18: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] preamble @@     got unsigned int @@
   drivers/input/touchscreen/touchnetix_axiom.c:181:18: sparse:     expected restricted __le32 [usertype] preamble
   drivers/input/touchscreen/touchnetix_axiom.c:181:18: sparse:     got unsigned int
>> drivers/input/touchscreen/touchnetix_axiom.c:183:40: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned int reg @@     got restricted __le32 [usertype] preamble @@

drivers/input/touchscreen/touchnetix_axiom.c:183:40: sparse: expected unsigned int reg
drivers/input/touchscreen/touchnetix_axiom.c:183:40: sparse: got restricted __le32 [usertype] preamble

vim +181 drivers/input/touchscreen/touchnetix_axiom.c

171
172 static int axiom_read(struct axiom_data *ts, u8 usage, u8 page, void *buf, u16 len)
173 {
174 struct axiom_cmd_header cmd_header;
175 __le32 preamble;
176 int ret;
177
178 cmd_header.target_address = cpu_to_le16(axiom_usage_to_target_address(ts, usage, page, 0));
179 cmd_header.length = cpu_to_le16(len | AXIOM_CMD_HEADER_READ_MASK);
180

 > 181		preamble = get_unaligned_le32((u8 *)&cmd_header);
   182	
 > 183		ret = regmap_write(ts->regmap, preamble, 0);

184 if (ret) {
185 dev_err(ts->dev, "failed to write preamble, error %d\n", ret);
186 return ret;
187 }
188
189 ret = regmap_raw_read(ts->regmap, 0, buf, len);
190 if (ret) {
191 dev_err(ts->dev, "failed to read target address %04x, error %d\n",
192 cmd_header.target_address, ret);
193 return ret;
194 }
195
196 /* Wait device's DMA operations */
197 usleep_range(AXIOM_DMA_OPS_DELAY_USEC, AXIOM_DMA_OPS_DELAY_USEC + 50);
198
199 return 0;
200 }
201

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#6 lore raw

Re: [PATCH v7 3/3] Input: Add TouchNetix axiom i2c touchscreen driver

In reply to Kamel Bouhara
kernel test robot noticed the following build warnings:

Hi Kamel,

kernel test robot noticed the following build warnings:

[auto build test WARNING on dtor-input/next]
[also build test WARNING on dtor-input/for-linus robh/for-next krzk-dt/for-next linus/master v6.8-rc2 next-20240202] [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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Kamel-Bouhara/dt-bindings-vendor-prefixes-Add-TouchNetix-AS/20240131-221925
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link:    https://lore.kernel.org/r/20240131141158.3350344-4-kamel.bouhara%40bootlin.com
patch subject: [PATCH v7 3/3] Input: Add TouchNetix axiom i2c touchscreen driver
config: s390-randconfig-r131-20240201 (https://download.01.org/0day-ci/archive/20240203/[email protected]/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project fdac7d0b6f74f919d319b31a0680c77f66732586)
reproduce: (https://download.01.org/0day-ci/archive/20240203/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)

>> drivers/input/touchscreen/touchnetix_axiom.c:181:18: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] preamble @@     got unsigned int @@
   drivers/input/touchscreen/touchnetix_axiom.c:181:18: sparse:     expected restricted __le32 [usertype] preamble
   drivers/input/touchscreen/touchnetix_axiom.c:181:18: sparse:     got unsigned int
>> drivers/input/touchscreen/touchnetix_axiom.c:183:40: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned int reg @@     got restricted __le32 [usertype] preamble @@

drivers/input/touchscreen/touchnetix_axiom.c:183:40: sparse: expected unsigned int reg
drivers/input/touchscreen/touchnetix_axiom.c:183:40: sparse: got restricted __le32 [usertype] preamble

vim +181 drivers/input/touchscreen/touchnetix_axiom.c

171
172 static int axiom_read(struct axiom_data *ts, u8 usage, u8 page, void *buf, u16 len)
173 {
174 struct axiom_cmd_header cmd_header;
175 __le32 preamble;
176 int ret;
177
178 cmd_header.target_address = cpu_to_le16(axiom_usage_to_target_address(ts, usage, page, 0));
179 cmd_header.length = cpu_to_le16(len | AXIOM_CMD_HEADER_READ_MASK);
180

 > 181		preamble = get_unaligned_le32((u8 *)&cmd_header);
   182	
 > 183		ret = regmap_write(ts->regmap, preamble, 0);

184 if (ret) {
185 dev_err(ts->dev, "failed to write preamble, error %d\n", ret);
186 return ret;
187 }
188
189 ret = regmap_raw_read(ts->regmap, 0, buf, len);
190 if (ret) {
191 dev_err(ts->dev, "failed to read target address %04x, error %d\n",
192 cmd_header.target_address, ret);
193 return ret;
194 }
195
196 /* Wait device's DMA operations */
197 usleep_range(AXIOM_DMA_OPS_DELAY_USEC, AXIOM_DMA_OPS_DELAY_USEC + 50);
198
199 return 0;
200 }
201

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki