Skip to contentSkip to conversation

dt-bindings: input: touchscreen: iqs5xx: Add bindings

PATCH Superseded Jeff LaBundy 2 participants 5 messages Feb 10, 2019 – Feb 19, 2019

Subsystems (2)

v6 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/2 dt-bindings: input: touchscreen: iqs5xx: Add bindings

This patch adds binding documentation for the Azoteq IQS550/572/525 family of trackpad/touchscreen controllers.

---
Changes in v6:
- None

Changes in v5:
- None

Changes in v4:
- None

Changes in v3:
- Added Reviewed-by trailer

Changes in v2:
- Separated each valid "compatible" property with a line break
- Specified the polarity of the RDY and NRST pins
- Replaced duplicate definitions of common touchscreen properties with a reference to touchscreen.txt
- Specified the example node as "touchscreen@74"

 .../bindings/input/touchscreen/iqs5xx.txt          | 109 +++++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 2 files changed, 110 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/iqs5xx.txt
Documentation/devicetree/bindings/input/touchscreen/iqs5xx.txt new file +109 -0
new file mode 100644
index 0000000..25ee2a0
@@ -0,0 +1,109 @@
+Azoteq IQS550/572/525 Trackpad/Touchscreen Controller
+
+Required properties:
+
+- compatible			: Must be equal to one of the following:
+				  "azoteq,iqs550"
+				  "azoteq,iqs572"
+				  "azoteq,iqs525"
+
+- reg				: I2C slave address for the device.
+
+- interrupts			: GPIO to which the device's active-high RDY
+				  output is connected (see [0]).
+
+- reset-gpios			: GPIO to which the device's active-low NRST
+				  input is connected (see [1]). Hardware reset
+				  access is required in order to to facilitate
+				  in-system firmware replacement.
+
+Optional properties:
+
+- azoteq,exp-ver-major		: Major field of the export file version number
+				  (0 through 255 inclusive). This property must
+				  be specified as a '/bits/ 8' value.
+
+- azoteq,exp-ver-minor		: Minor field of the export file version number
+				  (0 through 255 inclusive). This property must
+				  be specified as a '/bits/ 8' value.
+
+				  The export file version number is a customer-
+				  assigned parameter embedded in the device's
+				  firmware at the time it is exported from the
+				  manufacturer's PC-based configuration tool.
+
+				  If the export file version number stored in
+				  the device's nonvolatile memory does not match
+				  the number specified here, the driver replaces
+				  the firmware on the device with that which is
+				  stored on the local filesystem (for which the
+				  export file version number must match).
+
+				  If both major and minor fields are omitted or
+				  specified as zero, the driver does not query
+				  the device's export file version number.
+
+- touchscreen-min-x		: See [2].
+
+- touchscreen-min-y		: See [2].
+
+- touchscreen-size-x		: See [2]. If this property is omitted, the
+				  maximum x-coordinate is specified by the
+				  device's "X Resolution" register.
+
+- touchscreen-size-y		: See [2]. If this property is omitted, the
+				  maximum y-coordinate is specified by the
+				  device's "Y Resolution" register.
+
+- touchscreen-max-pressure	: See [2]. Pressure is expressed as the sum of
+				  the deltas across all channels impacted by a
+				  touch event. A channel's delta is calculated
+				  as its count value minus a reference, where
+				  the count value is inversely proportional to
+				  the channel's capacitance.
+
+- touchscreen-fuzz-x		: See [2].
+
+- touchscreen-fuzz-y		: See [2].
+
+- touchscreen-fuzz-pressure	: See [2].
+
+- touchscreen-inverted-x	: See [2]. Inversion is applied relative to that
+				  which may already be specified by the device's
+				  FLIP_X and FLIP_Y register fields.
+
+- touchscreen-inverted-y	: See [2]. Inversion is applied relative to that
+				  which may already be specified by the device's
+				  FLIP_X and FLIP_Y register fields.
+
+- touchscreen-swapped-x-y	: See [2]. Swapping is applied relative to that
+				  which may already be specified by the device's
+				  SWITCH_XY_AXIS register fields.
+
+[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+[1]: Documentation/devicetree/bindings/gpio/gpio.txt
+[2]: Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
+
+Example:
+
+	&i2c1 {
+		/* ... */
+
+		touchscreen@74 {
+			compatible = "azoteq,iqs550";
+			reg = <0x74>;
+			interrupt-parent = <&gpio>;
+			interrupts = <17 1>;
+			reset-gpios = <&gpio 27 0>;
+
+			azoteq,exp-ver-major = /bits/ 8 <1>;
+			azoteq,exp-ver-minor = /bits/ 8 <0>;
+
+			touchscreen-size-x = <640>;
+			touchscreen-size-y = <480>;
+
+			touchscreen-max-pressure = <16000>;
+		};
+
+		/* ... */
+	};
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index 4b1a2a8..51f9954 100644
@@ -53,6 +53,7 @@ avic	Shanghai AVIC Optoelectronics Co., Ltd.
 avnet	Avnet, Inc.
 axentia	Axentia Technologies AB
 axis	Axis Communications AB
+azoteq	Azoteq (Pty) Ltd
 bananapi BIPAI KEJI LIMITED
 bhf	Beckhoff Automation GmbH & Co. KG
 bitmain	Bitmain Technologies

--
2.7.4

#1 lore raw

PATCH v6 2/2 input: touchscreen: Add support for Azoteq IQS550/572/525

This patch adds support for the Azoteq IQS550/572/525 family of trackpad/touchscreen controllers.

The driver has been tested with an IQS550EV02 evaluation board. A demonstration of the driver's capabilities is available here:

https://youtu.be/sRNNx4XZBts

---
Changes in v6:
- None

Changes in v5:
- Demoted the first instance of dev_err in iqs5xx_update_firmware to dev_info
- Updated the commit message to describe the test setup and provide a link to a demonstration of the driver's capabilities

Changes in v4:
- Replaced 'ret' with 'error' where applicable
- Made use of packed structures to parse device ID and touch data registers as well as firmware records
- Overhauled iqs5xx_update_firmware to make use of existing helper functions and to be robust against erroneous firmware files
- Refactored and fortified the bootloader steps in iqs5xx_update_firmware by allowing additional retries upon failure
- Optimized register read/write functions and added wrappers for single-byte transactions
- Updated the error handling in iqs5xx_set_state and removed the superfluous 'disabled' flag
- General improvements to error messages returned via dev_err

Changes in v3:
- None

Changes in v2:
- Rebased on top of updated iqs5xx.txt
- Refactored the axis configuration logic in iqs5xx_dev_init to adhere to the behavior defined in touchscreen.txt

 drivers/input/touchscreen/Kconfig  |   10 +
 drivers/input/touchscreen/Makefile |    1 +
 drivers/input/touchscreen/iqs5xx.c | 1015 ++++++++++++++++++++++++++++++++++++
 3 files changed, 1026 insertions(+)
 create mode 100644 drivers/input/touchscreen/iqs5xx.c
drivers/input/touchscreen/Kconfig +10 -0
index 6c16aae..d8337ed 100644
@@ -1311,4 +1311,14 @@ config TOUCHSCREEN_ROHM_BU21023
 	  To compile this driver as a module, choose M here: the
 	  module will be called bu21023_ts.
 
+config TOUCHSCREEN_IQS5XX
+	tristate "Azoteq IQS550/572/525 trackpad/touchscreen controller"
+	depends on I2C
+	help
+	  Say Y to enable support for the Azoteq IQS550/572/525
+	  family of trackpad/touchscreen controllers.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called iqs5xx.
+
 endif
drivers/input/touchscreen/Makefile +1 -0
index fcc7605..084a596 100644
@@ -110,3 +110,4 @@ obj-$(CONFIG_TOUCHSCREEN_ZFORCE)	+= zforce_ts.o
 obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50)	+= colibri-vf50-ts.o
 obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023)	+= rohm_bu21023.o
 obj-$(CONFIG_TOUCHSCREEN_RASPBERRYPI_FW)	+= raspberrypi-ts.o
+obj-$(CONFIG_TOUCHSCREEN_IQS5XX)	+= iqs5xx.o
drivers/input/touchscreen/iqs5xx.c new file +1015 -0

1,015 lines not on this page · raw message

--
2.7.4

maintainer
#2 lore raw

Re: [PATCH v6 2/2] input: touchscreen: Add support for Azoteq IQS550/572/525

Hi Jeff,

Quoted 7 lines · Jeff LaBundy

This patch adds support for the Azoteq IQS550/572/525 family of trackpad/touchscreen controllers.

The driver has been tested with an IQS550EV02 evaluation board. A demonstration of the driver's capabilities is available here:

https://youtu.be/sRNNx4XZBts

A few comments:

- we have request_ihex_firmware that requests and validates biary representation of ihex into the kernel. There is not really a good reason to parse text ihex in kernel.
There is idex2bin in ./firmware to convert it.

- I would recommend against doing this whole business of automatic uprevving and updating firmware on probe. The controller mees to have persistent firmware, so just check whether the device comes up in bootloader or normal mode, and if it is in bootloader mode simply forego creating and registering input device and wait for the userspace to update firmware ad fix it up.
Not having to deal with firmware on probe will also allow compiling the driver into the kernel (vs being a module) as firmware loading is not normally available until after root filesystem is mounted.

- firmware update is usually keyed off device model, not DT name.

Review

Quoted 2 lines
(quoted diff) +2 -0
+static int iqs5xx_read_burst(struct i2c_client *client,
+				u16 reg, u8 *val8, u8 len)

If you make val8 void * you won't need to cast.

drivers/input/touchscreen/iqs5xx.c line 188

Quoted 3 lines
drivers/input/touchscreen/iqs5xx.c new file +3 -0
+
+static int iqs5xx_write_burst(struct i2c_client *client,
+				u16 reg, u8 *val8, u8 len)

const void *.

drivers/input/touchscreen/iqs5xx.c line 970

Quoted 3 lines
drivers/input/touchscreen/iqs5xx.c new file +3 -0
+	error = devm_request_threaded_irq(&client->dev, client->irq,
+			NULL, iqs5xx_irq,
+			IRQF_ONESHOT | IRQF_TRIGGER_RISING,

Please do not specify IRQ trigger, let it come from device tree, so only use IRQF_ONESHOT.

By the way, I'd recommend using level interrupts so you never miss the edge.

Thanks.

Signature · 1 line
Dmitry
#3 lore raw

Re: [PATCH v6 2/2] input: touchscreen: Add support for Azoteq IQS550/572/525

Hi Dmitry,

Many thanks for your kind review. All of your comments sound great to me; would just like to provide some background behind the first one before spinning a v7 (comments below).

Quoted 9 lines · Dmitry Torokhov

Hi Jeff,

Quoted 6 lines · Jeff LaBundy

This patch adds support for the Azoteq IQS550/572/525 family of trackpad/touchscreen controllers.

The driver has been tested with an IQS550EV02 evaluation board. A demonstration of the driver's capabilities is available here:

Quoted 8 lines
Quoted 1 line

https://youtu.be/sRNNx4XZBts

A few comments:

- we have request_ihex_firmware that requests and validates biary representation of ihex into the kernel. There is not really a good reason to parse text ihex in kernel.
There is idex2bin in ./firmware to convert it.

Agreed on all counts; using request_ihex_firmware was my original intent. However the vendor's ihex format is slightly nonstandard in that the checksum field is not calculated for every record, and the EOF record contains a nonzero address (0xFFFF), both of which cause ihex2bin to produce an error.

This means the vendor's firmware would have to be passed through a second (custom) fixup tool before being converted yet again with ihex2bin. Therefore I (reluctantly) made the decision to handle the vendor's semi-custom ihex format in the driver directly.

If that's a deal breaker, I'm happy to adopt request_ihex_firmware and contact the vendor to suggest that their configuration tool is updated to export true ihex files. However, there is no guarantee as to when/if that would happen, and it seems I would need to offer said fixup tool in the meantime (which I can certainly do).

Let me know if that background changes your mind, or if you would still like to see this changed (either way works for me).

Quoted 9 lines

- I would recommend against doing this whole business of automatic uprevving and updating firmware on probe. The controller mees to have persistent firmware, so just check whether the device comes up in bootloader or normal mode, and if it is in bootloader mode simply forego creating and registering input device and wait for the userspace to update firmware ad fix it up.
Not having to deal with firmware on probe will also allow compiling the driver into the kernel (vs being a module) as firmware loading is not normally available until after root filesystem is mounted.

Agreed on all counts; I like that idea much better.

Quoted 1 line

- firmware update is usually keyed off device model, not DT name.

Agreed; I wasn't sold on my original method.

My new plan is to let user space specify the name of the firmware, as the vendor's configuration tool appends some customer-specific revision information to the exported file's name that customers may opt to keep.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+static int iqs5xx_read_burst(struct i2c_client *client,
+				u16 reg, u8 *val8, u8 len)

If you make val8 void * you won't need to cast.

Thanks for the tip; will do.

Quoted 5 lines

drivers/input/touchscreen/iqs5xx.c line 188

Quoted 3 lines
drivers/input/touchscreen/iqs5xx.c new file +3 -0
+
+static int iqs5xx_write_burst(struct i2c_client *client,
+				u16 reg, u8 *val8, u8 len)

const void *.

Thanks for the tip; will do.

Quoted 6 lines

drivers/input/touchscreen/iqs5xx.c line 970

Quoted 3 lines
drivers/input/touchscreen/iqs5xx.c new file +3 -0
+	error = devm_request_threaded_irq(&client->dev, client->irq,
+			NULL, iqs5xx_irq,
+			IRQF_ONESHOT | IRQF_TRIGGER_RISING,

Please do not specify IRQ trigger, let it come from device tree, so only use IRQF_ONESHOT.

Agreed; will do.

Quoted 2 lines

By the way, I'd recommend using level interrupts so you never miss the edge.

Sounds good; I will update the example in the bindings doc to reflect.

Quoted 5 lines

Thanks.

Signature · 1 line
Dmitry
maintainer
#4 lore raw

Re: [PATCH v6 2/2] input: touchscreen: Add support for Azoteq IQS550/572/525

Quoted 36 lines · Jeff LaBundy

Hi Dmitry,

Many thanks for your kind review. All of your comments sound great to me; would just like to provide some background behind the first one before spinning a v7 (comments below).

Quoted 9 lines · Dmitry Torokhov

Hi Jeff,

Quoted 6 lines · Jeff LaBundy

This patch adds support for the Azoteq IQS550/572/525 family of trackpad/touchscreen controllers.

The driver has been tested with an IQS550EV02 evaluation board. A demonstration of the driver's capabilities is available here:

Quoted 8 lines
Quoted 1 line

https://youtu.be/sRNNx4XZBts

A few comments:

- we have request_ihex_firmware that requests and validates biary representation of ihex into the kernel. There is not really a good reason to parse text ihex in kernel.
There is idex2bin in ./firmware to convert it.

Agreed on all counts; using request_ihex_firmware was my original intent. However the vendor's ihex format is slightly nonstandard in that the checksum field is not calculated for every record, and the EOF record contains a nonzero address (0xFFFF), both of which cause ihex2bin to produce an error.

This means the vendor's firmware would have to be passed through a second (custom) fixup tool before being converted yet again with ihex2bin. Therefore I (reluctantly) made the decision to handle the vendor's semi-custom ihex format in the driver directly.

Quoted 8 lines

If that's a deal breaker, I'm happy to adopt request_ihex_firmware and contact the vendor to suggest that their configuration tool is updated to export true ihex files. However, there is no guarantee as to when/if that would happen, and it seems I would need to offer said fixup tool in the meantime (which I can certainly do).

Let me know if that background changes your mind, or if you would still like to see this changed (either way works for me).

OK, I guess we can keep the parser in the driver then. Can you please call out in the comments that standard parser is not suitable?

Thanks.

Signature · 1 line
Dmitry