2021-11-03 11:50:50

by Alistair Francis

[permalink] [raw]
Subject: [PATCH v2 0/4] 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



Alistair Francis (2):

ARM: imx_v6_v7_defconfig: Enable the cyttsp5 touchscreen

ARM: dts: imx7d: remarkable2: Enable the cyttsp5



Mylène Josserand (2):

Input: Add driver for Cypress Generation 5 touchscreen

Documentation: DT: bindings: input: Add documentation for cyttsp5



.../input/touchscreen/cypress,tt21000.yaml | 92 ++

arch/arm/boot/dts/imx7d-remarkable2.dts | 89 ++

arch/arm/configs/imx_v6_v7_defconfig | 1 +

drivers/input/touchscreen/Kconfig | 14 +

drivers/input/touchscreen/Makefile | 1 +

drivers/input/touchscreen/cyttsp5.c | 1135 +++++++++++++++++

6 files changed, 1332 insertions(+)

create mode 100644 Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.yaml

create mode 100644 drivers/input/touchscreen/cyttsp5.c



--

2.31.1




2021-11-03 11:52:01

by Alistair Francis

[permalink] [raw]
Subject: [PATCH v2 4/4] ARM: dts: imx7d: remarkable2: Enable the cyttsp5

Signed-off-by: Alistair Francis <[email protected]>
---
arch/arm/boot/dts/imx7d-remarkable2.dts | 89 +++++++++++++++++++++++++
1 file changed, 89 insertions(+)

diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts
index 89cbf13097a4..cb5c63963a3c 100644
--- a/arch/arm/boot/dts/imx7d-remarkable2.dts
+++ b/arch/arm/boot/dts/imx7d-remarkable2.dts
@@ -8,6 +8,7 @@
/dts-v1/;

#include "imx7d.dtsi"
+#include <dt-bindings/input/linux-event-codes.h>

/ {
model = "reMarkable 2.0";
@@ -34,6 +35,18 @@ reg_brcm: regulator-brcm {
startup-delay-us = <150>;
};

+ 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";
@@ -51,6 +64,59 @@ &clks {
assigned-clock-rates = <0>, <32768>;
};

+&i2c3 {
+ clock-frequency = <100000>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_i2c3>;
+ status = "okay";
+
+ tsc@24 {
+ 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 0>;
+ vdd-supply = <&reg_touch>;
+ touchscreen-size-x = <880>;
+ touchscreen-size-y = <1280>;
+
+ button@0 {
+ linux,code = <KEY_HOMEPAGE>;
+ };
+
+ button@1 {
+ linux,code = <KEY_MENU>;
+ };
+
+ button@2 {
+ linux,code = <KEY_BACK>;
+ };
+
+ button@3 {
+ linux,code = <KEY_SEARCH>;
+ };
+
+ button@4 {
+ linux,code = <KEY_VOLUMEDOWN>;
+ };
+
+ button@5 {
+ linux,code = <KEY_VOLUMEUP>;
+ };
+
+ button@6 {
+ linux,code = <KEY_CAMERA>;
+ };
+
+ button@7 {
+ linux,code = <KEY_POWER>;
+ };
+ };
+};
+
&snvs_pwrkey {
status = "okay";
};
@@ -125,6 +191,29 @@ 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_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
--
2.31.1

2021-11-05 14:56:14

by Andreas Kemnade

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] Add support for the Cypress cyttsp5

Hallo Alistair,

my Xorg (debian buster installation) does not like that:
[ 3112.462] (**) cyttsp5: Applying InputClass "evdev touchscreen catchall"
[ 3112.462] (**) cyttsp5: Applying InputClass "libinput touchscreen catchall"
[ 3112.462] (II) Using input driver 'libinput' for 'cyttsp5'
[ 3112.463] (**) cyttsp5: always reports core events
[ 3112.463] (**) Option "Device" "/dev/input/event1"
[ 3112.463] (**) Option "_source" "server/udev"
[ 3112.496] (II) event1 - cyttsp5: is tagged by udev as: Touchscreen
[ 3112.498] (EE) event1 - cyttsp5: kernel bug: device has min == max on ABS_X
[ 3112.498] (II) event1 - cyttsp5: was rejected
[ 3112.498] (II) event1 - not using input device '/dev/input/event1'.
[ 3112.499] (EE) libinput: cyttsp5: Failed to create a device for /dev/input/event1

# evtest /dev/input/event1
Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "cyttsp5"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 330 (BTN_TOUCH)
Event type 2 (EV_REL)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 0
Min 0
Max 0 <-- upsets xorg
Event code 1 (ABS_Y)
Value 0
Min 0
Max 0
Event code 47 (ABS_MT_SLOT)
Value 0
Min 0
Max 31
Event code 48 (ABS_MT_TOUCH_MAJOR)
Value 0
Min 0
Max 255
Event code 49 (ABS_MT_TOUCH_MINOR)
Value 0
Min 0
Max 255
Event code 53 (ABS_MT_POSITION_X)
Value 0
Min 0
Max 1447
Event code 54 (ABS_MT_POSITION_Y)
Value 0
Min 0
Max 1071
Event code 57 (ABS_MT_TRACKING_ID)
Value 0
Min 0
Max 65535
Event code 58 (ABS_MT_PRESSURE)
Value 0
Min 0
Max 255

I specified touchscreen-size-x and touchscreen-size-y in my devicetree.
No idea why it is like this yet.

Regards,
Andreas

On Wed, 3 Nov 2021 21:48:26 +1000
Alistair Francis <[email protected]> wrote:

> 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
>
> Alistair Francis (2):
> ARM: imx_v6_v7_defconfig: Enable the cyttsp5 touchscreen
> ARM: dts: imx7d: remarkable2: Enable the cyttsp5
>
> Mylène Josserand (2):
> Input: Add driver for Cypress Generation 5 touchscreen
> Documentation: DT: bindings: input: Add documentation for cyttsp5
>
> .../input/touchscreen/cypress,tt21000.yaml | 92 ++
> arch/arm/boot/dts/imx7d-remarkable2.dts | 89 ++
> arch/arm/configs/imx_v6_v7_defconfig | 1 +
> drivers/input/touchscreen/Kconfig | 14 +
> drivers/input/touchscreen/Makefile | 1 +
> drivers/input/touchscreen/cyttsp5.c | 1135 +++++++++++++++++
> 6 files changed, 1332 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.yaml
> create mode 100644 drivers/input/touchscreen/cyttsp5.c
>

2021-11-06 09:24:19

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] ARM: dts: imx7d: remarkable2: Enable the cyttsp5

On Wed, Nov 03, 2021 at 09:48:30PM +1000, Alistair Francis wrote:
> + tsc@24 {
> + 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 0>;

Reset lines are almost universally active low. Are you sure it is active
high in your case?

Thanks.

--
Dmitry

2021-11-25 09:46:32

by Alistair Francis

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] Add support for the Cypress cyttsp5

On Sat, Nov 6, 2021 at 12:52 AM Andreas Kemnade <[email protected]> wrote:
>
> Hallo Alistair,
>
> my Xorg (debian buster installation) does not like that:
> [ 3112.462] (**) cyttsp5: Applying InputClass "evdev touchscreen catchall"
> [ 3112.462] (**) cyttsp5: Applying InputClass "libinput touchscreen catchall"
> [ 3112.462] (II) Using input driver 'libinput' for 'cyttsp5'
> [ 3112.463] (**) cyttsp5: always reports core events
> [ 3112.463] (**) Option "Device" "/dev/input/event1"
> [ 3112.463] (**) Option "_source" "server/udev"
> [ 3112.496] (II) event1 - cyttsp5: is tagged by udev as: Touchscreen
> [ 3112.498] (EE) event1 - cyttsp5: kernel bug: device has min == max on ABS_X
> [ 3112.498] (II) event1 - cyttsp5: was rejected
> [ 3112.498] (II) event1 - not using input device '/dev/input/event1'.
> [ 3112.499] (EE) libinput: cyttsp5: Failed to create a device for /dev/input/event1
>
> # evtest /dev/input/event1
> Input driver version is 1.0.1
> Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
> Input device name: "cyttsp5"
> Supported events:
> Event type 0 (EV_SYN)
> Event type 1 (EV_KEY)
> Event code 330 (BTN_TOUCH)
> Event type 2 (EV_REL)
> Event type 3 (EV_ABS)
> Event code 0 (ABS_X)
> Value 0
> Min 0
> Max 0 <-- upsets xorg
> Event code 1 (ABS_Y)
> Value 0
> Min 0
> Max 0
> Event code 47 (ABS_MT_SLOT)
> Value 0
> Min 0
> Max 31
> Event code 48 (ABS_MT_TOUCH_MAJOR)
> Value 0
> Min 0
> Max 255
> Event code 49 (ABS_MT_TOUCH_MINOR)
> Value 0
> Min 0
> Max 255
> Event code 53 (ABS_MT_POSITION_X)
> Value 0
> Min 0
> Max 1447
> Event code 54 (ABS_MT_POSITION_Y)
> Value 0
> Min 0
> Max 1071
> Event code 57 (ABS_MT_TRACKING_ID)
> Value 0
> Min 0
> Max 65535
> Event code 58 (ABS_MT_PRESSURE)
> Value 0
> Min 0
> Max 255
>
> I specified touchscreen-size-x and touchscreen-size-y in my devicetree.
> No idea why it is like this yet.

Thanks! I see the same problem on my side as well. I'm not using X so
I don't see a crash and didn't notice the error.

I'll work on fixing this.

Alistair