Skip to contentSkip to conversation

Add support for the Cypress cyttsp5

PATCH Applied Alistair Francis 5 participants 12 messages Oct 26, 2022 – Sep 25, 2023

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v10 cover Add support for the Cypress cyttsp5

This patch series builds on top of [1] and adds support for the cyttsp5 touchscreen controller for the reMarkable 2.

I first tried to add an I2C HID device. Although the cyttsp5 has some HID looking aspects it is not HID compatible. Just in trying to probe the device I found:
- The HID descriptor has extra padding
- The HID descriptor sets the high bytes of the descriptor length
- The HID descriptor has extra unrecognised tags
- The HID reset command doesn't appear to work

I don't think there is a way to use the I2C HID framework with the cyttsp5. For anyone interested you can see the work here [2]. In that branch though I can only obtain a HID descriptor, nothing else works without more core changes.

So instead I rebased the series from [1]. Converted to the new yaml DTS documentation, added regulator support and fixed a x/y miscalculation bug.

1: https://lwn.net/ml/linux-kernel/[email protected]/
2: https://github.com/alistair23/linux/commits/rM2-mainline-cyttsp5-hid

v10:
- Fix device tree binding errors
- Add commit message about defcofig cahnges
v9:
- Fixup kernel robot failures
v8:
- Rebase and resend
v7:
- Fix device tree warnings
v6:
- Use reg for the button properties
v5:
- Address review comments from v4

Alistair Francis (4):
Input: Add driver for Cypress Generation 5 touchscreen
dt-bindings: input: Add Cypress TT21000 touchscreen controller
ARM: imx_v6_v7_defconfig: Enable the cyttsp5 touchscreen
ARM: dts: imx7d-remarkable2: Enable the cyttsp5

 .../input/touchscreen/cypress,tt21000.yaml    | 106 ++
 arch/arm/boot/dts/imx7d-remarkable2.dts       | 100 ++
 arch/arm/configs/imx_v6_v7_defconfig          |   1 +
 drivers/input/touchscreen/Kconfig             |  16 +
 drivers/input/touchscreen/Makefile            |   1 +
 drivers/input/touchscreen/cyttsp5.c           | 902 ++++++++++++++++++
 6 files changed, 1126 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.yaml
 create mode 100644 drivers/input/touchscreen/cyttsp5.c
Signature · 1 line
2.37.3
#1 lore raw

PATCH v10 1/4 Input: Add driver for Cypress Generation 5 touchscreen

This is the basic driver for the Cypress TrueTouch Gen5 touchscreen controllers. This driver supports only the I2C bus but it uses regmap so SPI support could be added later.
The touchscreen can retrieve some defined zone that are handled as buttons (according to the hardware). That is why it handles button and multitouch events.

---
 drivers/input/touchscreen/Kconfig   |  16 +
 drivers/input/touchscreen/Makefile  |   1 +
 drivers/input/touchscreen/cyttsp5.c | 902 ++++++++++++++++++++++++++++
 3 files changed, 919 insertions(+)
 create mode 100644 drivers/input/touchscreen/cyttsp5.c
drivers/input/touchscreen/Kconfig +16 -0
index dc90a3ea51ee..f332afcb2541 100644
@@ -284,6 +284,22 @@ config TOUCHSCREEN_CYTTSP4_SPI
 	  To compile this driver as a module, choose M here: the
 	  module will be called cyttsp4_spi.
 
+config TOUCHSCREEN_CYTTSP5
+	tristate "Cypress TrueTouch Gen5 Touchscreen Driver"
+	depends on I2C
+	select REGMAP_I2C
+	select CRC_ITU_T
+	help
+	  Driver for Parade TrueTouch Standard Product Generation 5
+	  touchscreen controllers. I2C bus interface support only.
+
+	  Say Y here if you have a Cypress Gen5 touchscreen.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called cyttsp5.
+
 config TOUCHSCREEN_DA9034
 	tristate "Touchscreen support for Dialog Semiconductor DA9034"
 	depends on PMIC_DA903X
drivers/input/touchscreen/Makefile +1 -0
index 557f84fd2075..044324c9dd13 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_TOUCHSCREEN_CYTTSP_SPI)	+= cyttsp_spi.o
 obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_CORE)	+= cyttsp4_core.o
 obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_I2C)	+= cyttsp4_i2c.o cyttsp_i2c_common.o
 obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_SPI)	+= cyttsp4_spi.o
+obj-$(CONFIG_TOUCHSCREEN_CYTTSP5)	+= cyttsp5.o
 obj-$(CONFIG_TOUCHSCREEN_DA9034)	+= da9034-ts.o
 obj-$(CONFIG_TOUCHSCREEN_DA9052)	+= da9052_tsi.o
 obj-$(CONFIG_TOUCHSCREEN_DYNAPRO)	+= dynapro.o
drivers/input/touchscreen/cyttsp5.c new file +902 -0

902 lines not on this page · raw message

Signature · 1 line
2.37.3
maintainer Applied
#2 lore raw

Re: [PATCH v10 1/4] Input: Add driver for Cypress Generation 5 touchscreen

Quoted 7 lines · Alistair Francis

This is the basic driver for the Cypress TrueTouch Gen5 touchscreen controllers. This driver supports only the I2C bus but it uses regmap so SPI support could be added later.
The touchscreen can retrieve some defined zone that are handled as buttons (according to the hardware). That is why it handles button and multitouch events.

Quoted 5 lines

While I wish we did not have to parse what is essentially HID data ourselves and basically repeated what i2c-hid does, I understand that the firmware is not exactly i2c-hid compatible...

Applied, thank you.

Signature · 1 line
Dmitry
#3 lore raw

Re: [PATCH v10 1/4] Input: Add driver for Cypress Generation 5 touchscreen

In reply to Alistair Francis
Quoted 41 lines · Alistair Francis

This is the basic driver for the Cypress TrueTouch Gen5 touchscreen controllers. This driver supports only the I2C bus but it uses regmap so SPI support could be added later.
The touchscreen can retrieve some defined zone that are handled as buttons (according to the hardware). That is why it handles button and multitouch events.

---
 drivers/input/touchscreen/Kconfig   |  16 +
 drivers/input/touchscreen/Makefile  |   1 +
 drivers/input/touchscreen/cyttsp5.c | 902 ++++++++++++++++++++++++++++
 3 files changed, 919 insertions(+)
 create mode 100644 drivers/input/touchscreen/cyttsp5.c
drivers/input/touchscreen/cyttsp5.c new file +21 -0
+
+static int cyttsp5_hid_output_bl_launch_app(struct cyttsp5 *ts)
+{
+       int rc;
+       u8 cmd[HID_OUTPUT_BL_LAUNCH_APP];
+       u16 crc;
+
+       put_unaligned_le16(HID_OUTPUT_BL_LAUNCH_APP_SIZE, cmd);
+       cmd[2] = HID_BL_OUTPUT_REPORT_ID;
+       cmd[3] = 0x0; /* Reserved */
+       cmd[4] = HID_OUTPUT_BL_SOP;
+       cmd[5] = HID_OUTPUT_BL_LAUNCH_APP;
+       put_unaligned_le16(0x00, &cmd[6]);
+       crc = crc_itu_t(0xFFFF, &cmd[4], 4);
+       put_unaligned_le16(crc, &cmd[8]);
+       cmd[10] = HID_OUTPUT_BL_EOP;
+
+       rc = cyttsp5_write(ts, HID_OUTPUT_REG, cmd,
+                          HID_OUTPUT_BL_LAUNCH_APP_SIZE);
+       if (rc) {
+               dev_err(ts->dev, "Failed to write command %d", rc);

drivers/input/touchscreen/cyttsp5.c line 587

Quoted 10 lines
drivers/input/touchscreen/cyttsp5.c new file +10 -0
+               return rc;
+       }
+
+       rc = wait_for_completion_interruptible_timeout(&ts->cmd_done,
+                                               msecs_to_jiffies(CY_HID_OUTPUT_TIMEOUT_MS));
+       if (rc <= 0) {
+               dev_err(ts->dev, "HID output cmd execution timed out\n");
+               rc = -ETIMEDOUT;
+               return rc;
+       }

I've been seeing this timeout error somewhat randomly on a Variscite i.MX6 QUAD/DUAL VAR-SOM-MX6 Custom Board based device at startup:

[    2.234089] cyttsp5 2-0024: HID output cmd execution timed out
[    2.239957] cyttsp5 2-0024: Error on launch app r=-110
[    2.245150] cyttsp5 2-0024: Fail initial startup r=-110
[    2.257502] cyttsp5: probe of 2-0024 failed with error -110

When it doesn't error I just see this:

[    2.061176] input: cyttsp5 as

/devices/platform/soc/2100000.bus/21a8000.i2c/i2c-2/2-0024/input/input0

I'm not sure if this is a driver issue or potentially a device tree issue, the upstream kernel device tree node looks like this:

touchscreen@24 {
    compatible = "cypress,tt21000";
    reg = <0x24>;
    interrupt-parent = <&gpio3>;
    interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
    reset-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
    vdd-supply = <&reg_3p3v>;
    touchscreen-size-x = <880>;
    touchscreen-size-y = <1280>;
};

Full device tree here:
https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git/tree/arch/arm/boot/dts/nxp/imx/imx6q-var-mx6customboard.dts?h=for-next

The original vendor device tree node for the downstream kernel looked like this:

tsc@0x24 {
    compatible = "cy,cyttsp5_i2c_adapter";
    reg = <0x24>;
    interrupts = <0x07 0x02>;
    interrupt-parent = <0x07>;
    cy,adapter_id = "cyttsp5_i2c_adapter";

    cy,core {
        cy,name = "cyttsp5_core";

        cy,irq_gpio = <71>;
        cy,rst_gpio = <141>;
        cy,hid_desc_register = <0x01>;
        /* CY_CORE_FLAG_RESTORE_PARAMETERS */
        cy,flags = <4>;
        /* CY_CORE_EWG_NONE */
        cy,easy_wakeup_gesture = <0>;
        cy,btn_keys-tag = <0>;

        cy,mt {
            cy,name = "cyttsp5_mt";

            cy,inp_dev_name = "cyttsp5_mt";
            /* CY_MT_FLAG_NONE */
            cy,flags = <0x00>;
            cy,abs =
                /* ABS_MT_POSITION_X, CY_ABS_MIN_X, CY_ABS_MAX_X, 0, 0 */
                <0x35 0 880 0 0
                /* ABS_MT_POSITION_Y, CY_ABS_MIN_Y, CY_ABS_MAX_Y, 0, 0 */
                0x36 0 1280 0 0
                /* ABS_MT_PRESSURE, CY_ABS_MIN_P, CY_ABS_MAX_P, 0, 0 */
                0x3a 0 255 0 0
                /* CY_IGNORE_VALUE, CY_ABS_MIN_W, CY_ABS_MAX_W, 0, 0 */
                0xffff 0 255 0 0
                /* ABS_MT_TRACKING_ID, CY_ABS_MIN_T, CY_ABS_MAX_T, 0, 0 */
                0x39 0 15 0 0
                /* ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0 */
                0x30 0 255 0 0
                /* ABS_MT_TOUCH_MINOR, 0, 255, 0, 0 */
                0x31 0 255 0 0
                /* ABS_MT_ORIENTATION, -127, 127, 0, 0 */
                0x34 0xffffff81 127 0 0
                /* ABS_MT_TOOL_TYPE, 0, MT_TOOL_MAX, 0, 0 */
                0x37 0 1 0 0
                /* ABS_MT_DISTANCE, 0, 255, 0, 0 */
                0x3b 0 255 0 0>;
        };
    };
};
#4 lore raw

PATCH v10 2/4 dt-bindings: input: Add Cypress TT21000 touchscreen controller

In reply to Alistair Francis

Add the Cypress TrueTouch Generation 5 touchscreen device tree bindings documentation. It can use I2C or SPI bus.
This touchscreen can handle some defined zone that are designed and sent as button. To be able to customize the keycode sent, the "linux,code" property in a "button" sub-node can be used.

---
 .../input/touchscreen/cypress,tt21000.yaml    | 106 ++++++++++++++++++
 1 file changed, 106 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.yaml
Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.yaml new file +106 -0
new file mode 100644
index 000000000000..1959ec394768
@@ -0,0 +1,106 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/cypress,tt21000.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cypress TT21000 touchscreen controller
+
+description: The Cypress TT21000 series (also known as "CYTTSP5" after
+  the marketing name Cypress TrueTouch Standard Product series 5).
+
+maintainers:
+  - Alistair Francis <[email protected]>
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    const: cypress,tt21000
+
+  reg:
+    maxItems: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+  interrupts:
+    maxItems: 1
+
+  vdd-supply:
+    description: Regulator for voltage.
+
+  reset-gpios:
+    maxItems: 1
+
+  linux,keycodes:
+    description: EV_ABS specific event code generated by the axis.
+
+patternProperties:
+  "^button@[0-9]+$":
+    type: object
+    $ref: ../input.yaml#
+    properties:
+      reg:
+        maxItems: 1
+      linux,keycodes:
+        description: Keycode to emit
+
+    required:
+      - reg
+      - linux,keycodes
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - vdd-supply
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/input/linux-event-codes.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        touchscreen@24 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            compatible = "cypress,tt21000";
+            reg = <0x24>;
+            pinctrl-names = "default";
+            pinctrl-0 = <&tp_reset_ds203>;
+            interrupt-parent = <&pio>;
+            interrupts = <1 5 IRQ_TYPE_LEVEL_LOW>;
+            reset-gpios = <&pio 7 1 GPIO_ACTIVE_LOW>;
+            vdd-supply = <&reg_touch>;
+
+            button@0 {
+                reg = <0>;
+                linux,keycodes = <KEY_HOMEPAGE>;
+            };
+
+            button@1 {
+                reg = <1>;
+                linux,keycodes = <KEY_MENU>;
+            };
+
+            button@2 {
+                reg = <2>;
+                linux,keycodes = <KEY_BACK>;
+            };
+        };
+    };
+...
Signature · 1 line
2.37.3
maintainer Applied
#5 lore raw

Re: [PATCH v10 2/4] dt-bindings: input: Add Cypress TT21000 touchscreen controller

Quoted 9 lines · Alistair Francis

Add the Cypress TrueTouch Generation 5 touchscreen device tree bindings documentation. It can use I2C or SPI bus.
This touchscreen can handle some defined zone that are designed and sent as button. To be able to customize the keycode sent, the "linux,code" property in a "button" sub-node can be used.

Applied, thank you.

Signature · 1 line
Dmitry
#6 lore raw

Re: [PATCH v10 2/4] dt-bindings: input: Add Cypress TT21000 touchscreen controller

Quoted 8 lines · Dmitry Torokhov
Quoted 6 lines · Alistair Francis

Add the Cypress TrueTouch Generation 5 touchscreen device tree bindings documentation. It can use I2C or SPI bus.
This touchscreen can handle some defined zone that are designed and sent as button. To be able to customize the keycode sent, the "linux,code" property in a "button" sub-node can be used.

Quoted 5 lines
Quoted 3 lines

Applied, thank you.

It looks like you applied v8, not this version. linux-next now has a warning:

/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.example.dtb:
touchscreen@24: Unevaluated properties are not allowed
('#address-cells', '#size-cells' were unexpected)
From schema:
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.yaml

Quoted 3 lines

--
Dmitry

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#7 lore raw

Re: [PATCH v10 2/4] dt-bindings: input: Add Cypress TT21000 touchscreen controller

Quoted 16 lines · Rob Herring
Quoted 8 lines · Dmitry Torokhov
Quoted 6 lines · Alistair Francis

Add the Cypress TrueTouch Generation 5 touchscreen device tree bindings documentation. It can use I2C or SPI bus.
This touchscreen can handle some defined zone that are designed and sent as button. To be able to customize the keycode sent, the "linux,code" property in a "button" sub-node can be used.

Quoted 5 lines
Quoted 3 lines

Applied, thank you.

Quoted 7 lines

It looks like you applied v8, not this version. linux-next now has a warning:

/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.example.dtb:
touchscreen@24: Unevaluated properties are not allowed
('#address-cells', '#size-cells' were unexpected)
From schema:
/builds/robherring/linux-dt/Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.yaml

Oops, should be fixed now.

Signature · 6 lines
Dmitry

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#8 lore raw

PATCH v10 3/4 ARM: imx_v6_v7_defconfig: Enable the cyttsp5 touchscreen

In reply to Alistair Francis

The imx6/7 based devices Remarkable 2, Kobo Clara HD, Kobo Libra H2O, Tolino Shine 3, Tolino Vision 5 all contain a Cypress TT2100 touchscreen so enable the corresponding driver.

---
 arch/arm/configs/imx_v6_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/imx_v6_v7_defconfig +1 -0
index 078d61b758a9..8665b192d83c 100644
@@ -166,6 +166,7 @@ CONFIG_TOUCHSCREEN_ADS7846=y
 CONFIG_TOUCHSCREEN_AD7879=y
 CONFIG_TOUCHSCREEN_AD7879_I2C=y
 CONFIG_TOUCHSCREEN_ATMEL_MXT=y
+CONFIG_TOUCHSCREEN_CYTTSP5=y
 CONFIG_TOUCHSCREEN_DA9052=y
 CONFIG_TOUCHSCREEN_EGALAX=y
 CONFIG_TOUCHSCREEN_GOODIX=y
Signature · 1 line
2.37.3
Applied
#9 lore raw

Re: [PATCH v10 3/4] ARM: imx_v6_v7_defconfig: Enable the cyttsp5 touchscreen

Quoted 5 lines · Alistair Francis

The imx6/7 based devices Remarkable 2, Kobo Clara HD, Kobo Libra H2O, Tolino Shine 3, Tolino Vision 5 all contain a Cypress TT2100 touchscreen so enable the corresponding driver.

Applied, thanks!

#10 lore raw

PATCH v10 4/4 ARM: dts: imx7d-remarkable2: Enable the cyttsp5

In reply to Alistair Francis

Add support for the cyttsp5 touchscreen controller for the reMarkable 2.

---
 arch/arm/boot/dts/imx7d-remarkable2.dts | 100 ++++++++++++++++++++++++
 1 file changed, 100 insertions(+)
arch/arm/boot/dts/imx7d-remarkable2.dts +100 -0
index a2a91bfdd98e..fea480af8e48 100644
@@ -8,6 +8,7 @@
 /dts-v1/;
 
 #include "imx7d.dtsi"
+#include <dt-bindings/input/linux-event-codes.h>
 
 / {
 	model = "reMarkable 2.0";
@@ -47,6 +48,18 @@ reg_digitizer: regulator-digitizer {
 		startup-delay-us = <100000>; /* 100 ms */
 	};
 
+	reg_touch: regulator-touch {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_3V3_TOUCH";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		pinctrl-names = "default", "sleep";
+		pinctrl-0 = <&pinctrl_touch_reg>;
+		pinctrl-1 = <&pinctrl_touch_reg>;
+		gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
 	wifi_pwrseq: wifi_pwrseq {
 		compatible = "mmc-pwrseq-simple";
 		pinctrl-names = "default";
@@ -84,6 +97,70 @@ wacom_digitizer: digitizer@9 {
 	};
 };
 
+&i2c3 {
+	clock-frequency = <100000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c3>;
+	status = "okay";
+
+	tsc@24 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		compatible = "cypress,tt21000";
+		reg = <0x24>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_touch>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <14 IRQ_TYPE_EDGE_FALLING>;
+		reset-gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
+		vdd-supply = <&reg_touch>;
+		touchscreen-size-x = <880>;
+		touchscreen-size-y = <1280>;
+
+		button@0 {
+			reg = <0>;
+			linux,keycodes = <KEY_HOMEPAGE>;
+		};
+
+		button@1 {
+			reg = <1>;
+			linux,keycodes = <KEY_MENU>;
+		};
+
+		button@2 {
+			reg = <2>;
+			linux,keycodes = <KEY_BACK>;
+		};
+
+		button@3 {
+			reg = <3>;
+			linux,keycodes = <KEY_SEARCH>;
+		};
+
+		button@4 {
+			reg = <4>;
+			linux,keycodes = <KEY_VOLUMEDOWN>;
+		};
+
+		button@5 {
+			reg = <5>;
+			linux,keycodes = <KEY_VOLUMEUP>;
+		};
+
+		button@6 {
+			reg = <6>;
+			linux,keycodes = <KEY_CAMERA>;
+		};
+
+		button@7 {
+			reg = <7>;
+			linux,keycodes = <KEY_POWER>;
+		};
+	};
+};
+
 &snvs_pwrkey {
 	status = "okay";
 };
@@ -177,6 +254,15 @@ MX7D_PAD_SAI1_TX_BCLK__GPIO6_IO13	0x14
 		>;
 	};
 
+	pinctrl_touch: touchgrp {
+		fsl,pins = <
+			/* CYTTSP interrupt */
+			MX7D_PAD_GPIO1_IO14__GPIO1_IO14		0x54
+			/* CYTTSP reset */
+			MX7D_PAD_GPIO1_IO13__GPIO1_IO13		0x04
+		>;
+	};
+
 	pinctrl_i2c1: i2c1grp {
 		fsl,pins = <
 			MX7D_PAD_I2C1_SDA__I2C1_SDA		0x4000007f
@@ -184,6 +270,20 @@ MX7D_PAD_I2C1_SCL__I2C1_SCL		0x4000007f
 		>;
 	};
 
+	pinctrl_i2c3: i2c3grp {
+		fsl,pins = <
+			MX7D_PAD_I2C3_SDA__I2C3_SDA		0x4000007f
+			MX7D_PAD_I2C3_SCL__I2C3_SCL		0x4000007f
+		>;
+	};
+
+	pinctrl_touch_reg: touchreggrp {
+		fsl,pins = <
+			/* TOUCH_PWR_EN */
+			MX7D_PAD_GPIO1_IO11__GPIO1_IO11		0x14
+		>;
+	};
+
 	pinctrl_uart1: uart1grp {
 		fsl,pins = <
 			MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX	0x79
Signature · 1 line
2.37.3
#11 lore raw

Re: [PATCH v10 4/4] ARM: dts: imx7d-remarkable2: Enable the cyttsp5

Quoted 39 lines · Alistair Francis

Add support for the cyttsp5 touchscreen controller for the reMarkable 2.

---
 arch/arm/boot/dts/imx7d-remarkable2.dts | 100 ++++++++++++++++++++++++
 1 file changed, 100 insertions(+)
arch/arm/boot/dts/imx7d-remarkable2.dts +13 -0
index a2a91bfdd98e..fea480af8e48 100644
@@ -8,6 +8,7 @@
 /dts-v1/;
 
 #include "imx7d.dtsi"
+#include <dt-bindings/input/linux-event-codes.h>
 
 / {
 	model = "reMarkable 2.0";
@@ -47,6 +48,18 @@ reg_digitizer: regulator-digitizer {
 		startup-delay-us = <100000>; /* 100 ms */
 	};
 
+	reg_touch: regulator-touch {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_3V3_TOUCH";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		pinctrl-names = "default", "sleep";
+		pinctrl-0 = <&pinctrl_touch_reg>;
+		pinctrl-1 = <&pinctrl_touch_reg>;
+		gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
 	wifi_pwrseq: wifi_pwrseq {
 		compatible = "mmc-pwrseq-simple";
 		pinctrl-names = "default";

arch/arm/boot/dts/imx7d-remarkable2.dts wacom_digitizer: digitizer@9 { · line 106

Quoted 10 lines
arch/arm/boot/dts/imx7d-remarkable2.dts +7 -0
@@ -84,6 +97,70 @@ wacom_digitizer: digitizer@9 {
 	};
 };
 
+&i2c3 {
+	clock-frequency = <100000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c3>;
+	status = "okay";
+
+	tsc@24 {

touchscreen for node name?

arch/arm/boot/dts/imx7d-remarkable2.dts wacom_digitizer: digitizer@9 { · line 109

Quoted 3 lines
arch/arm/boot/dts/imx7d-remarkable2.dts +3 -0
+		#address-cells = <1>;
+		#size-cells = <0>;
+

Unnecessary newline.

arch/arm/boot/dts/imx7d-remarkable2.dts wacom_digitizer: digitizer@9 { · line 110

Quoted 1 line
arch/arm/boot/dts/imx7d-remarkable2.dts +1 -0
+		compatible = "cypress,tt21000";

We idiomatically begin property list with compatible.

arch/arm/boot/dts/imx7d-remarkable2.dts wacom_digitizer: digitizer@9 { · line 112

Quoted 2 lines
arch/arm/boot/dts/imx7d-remarkable2.dts +2 -0
+		reg = <0x24>;
+

Unnecessary newline.

Shawn

Quoted 94 lines
arch/arm/boot/dts/imx7d-remarkable2.dts +74 -0
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_touch>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <14 IRQ_TYPE_EDGE_FALLING>;
+		reset-gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
+		vdd-supply = <&reg_touch>;
+		touchscreen-size-x = <880>;
+		touchscreen-size-y = <1280>;
+
+		button@0 {
+			reg = <0>;
+			linux,keycodes = <KEY_HOMEPAGE>;
+		};
+
+		button@1 {
+			reg = <1>;
+			linux,keycodes = <KEY_MENU>;
+		};
+
+		button@2 {
+			reg = <2>;
+			linux,keycodes = <KEY_BACK>;
+		};
+
+		button@3 {
+			reg = <3>;
+			linux,keycodes = <KEY_SEARCH>;
+		};
+
+		button@4 {
+			reg = <4>;
+			linux,keycodes = <KEY_VOLUMEDOWN>;
+		};
+
+		button@5 {
+			reg = <5>;
+			linux,keycodes = <KEY_VOLUMEUP>;
+		};
+
+		button@6 {
+			reg = <6>;
+			linux,keycodes = <KEY_CAMERA>;
+		};
+
+		button@7 {
+			reg = <7>;
+			linux,keycodes = <KEY_POWER>;
+		};
+	};
+};
+
 &snvs_pwrkey {
 	status = "okay";
 };
@@ -177,6 +254,15 @@ MX7D_PAD_SAI1_TX_BCLK__GPIO6_IO13	0x14
 		>;
 	};
 
+	pinctrl_touch: touchgrp {
+		fsl,pins = <
+			/* CYTTSP interrupt */
+			MX7D_PAD_GPIO1_IO14__GPIO1_IO14		0x54
+			/* CYTTSP reset */
+			MX7D_PAD_GPIO1_IO13__GPIO1_IO13		0x04
+		>;
+	};
+
 	pinctrl_i2c1: i2c1grp {
 		fsl,pins = <
 			MX7D_PAD_I2C1_SDA__I2C1_SDA		0x4000007f
@@ -184,6 +270,20 @@ MX7D_PAD_I2C1_SCL__I2C1_SCL		0x4000007f
 		>;
 	};
 
+	pinctrl_i2c3: i2c3grp {
+		fsl,pins = <
+			MX7D_PAD_I2C3_SDA__I2C3_SDA		0x4000007f
+			MX7D_PAD_I2C3_SCL__I2C3_SCL		0x4000007f
+		>;
+	};
+
+	pinctrl_touch_reg: touchreggrp {
+		fsl,pins = <
+			/* TOUCH_PWR_EN */
+			MX7D_PAD_GPIO1_IO11__GPIO1_IO11		0x14
+		>;
+	};
+
 	pinctrl_uart1: uart1grp {
 		fsl,pins = <
 			MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX	0x79
Signature · 1 line
2.37.3