Skip to contentSkip to conversation

Support for ELAN eKTF2132 touchscreens

PATCH Applied Jonathan Neuschäfer 3 participants 9 messages Nov 6, 2020 – Nov 10, 2020

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

cover Support for ELAN eKTF2132 touchscreens

This series adds support for the ELAN eKTF2132 touchscreen controller to the existing ektf2127 driver. It is similar to the eKTF2127, but it uses a different packet type and format to report touch events.

My understanding of the packet format is based on the Kobo Arua vendor
kernel: https://github.com/neuschaefer/linux/blob/vendor/kobo-aura/drivers/input/touchscreen/elan_touch_i2c.c#L237

Jonathan Neuschäfer (3):
dt-bindings: input: ektf2127: Add elan,ektf2132 compatible string
Input: ektf2127 - Add support for eKTF2132 touchscreen
ARM: dts: imx50-kobo-aura: Enable eKTF2132 touchscreen

 .../bindings/input/touchscreen/ektf2127.txt   |  2 +-
 arch/arm/boot/dts/imx50-kobo-aura.dts         | 16 +++++++++-
 drivers/input/touchscreen/ektf2127.c          | 32 ++++++++++++++++++-
 3 files changed, 47 insertions(+), 3 deletions(-)

--
2.28.0

#1 lore raw

PATCH 1/3 dt-bindings: input: ektf2127: Add elan,ektf2132 compatible string

The eKTF2132 is a touchscreen controller found, for example, in the Kobo Aura ebook reader. It is similar to the ektf2127, but it uses a different packet type to report touch events.

---
 .../devicetree/bindings/input/touchscreen/ektf2127.txt          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/input/touchscreen/ektf2127.txt +1 -1
index 94c4fc6449407..5eef5e7d6aae1 100644
@@ -1,7 +1,7 @@
 * Elan eKTF2127 I2C touchscreen controller
 
 Required properties:
- - compatible		  : "elan,ektf2127"
+ - compatible		  : "elan,ektf2127" or "elan,ektf2132"
  - reg			  : I2C slave address of the chip (0x40)
  - interrupts		  : interrupt specification for the ektf2127 interrupt
  - power-gpios		  : GPIO specification for the pin connected to the

--
2.28.0

maintainer Applied
#2 lore raw

Re: [PATCH 1/3] dt-bindings: input: ektf2127: Add elan,ektf2132 compatible string

Quoted 5 lines · Jonathan Neuschäfer

The eKTF2132 is a touchscreen controller found, for example, in the Kobo Aura ebook reader. It is similar to the ektf2127, but it uses a different packet type to report touch events.

Applied, thank you.

Signature · 1 line
Dmitry
#3 lore raw

PATCH 2/3 Input: ektf2127 - Add support for eKTF2132 touchscreen

In reply to Jonathan Neuschäfer

The eKTF2132 is a touchscreen controller found, for example, in the Kobo Aura ebook reader. It is similar to the ektf2127, but it uses a different packet type to report touch events.

---
 drivers/input/touchscreen/ektf2127.c | 32 +++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)
drivers/input/touchscreen/ektf2127.c +31 -1
index eadd389cf81fe..491de67ddbcd7 100644
@@ -28,6 +28,7 @@
 #define EKTF2127_RESPONSE		0x52
 #define EKTF2127_REQUEST		0x53
 #define EKTF2127_HELLO			0x55
+#define EKTF2127_REPORT2		0x5a
 #define EKTF2127_REPORT			0x5d
 #define EKTF2127_CALIB_DONE		0x66
 
@@ -95,6 +96,29 @@ static void ektf2127_report_event(struct ektf2127_ts *ts, const u8 *buf)
 	input_sync(ts->input);
 }
 
+static void ektf2127_report2_contact(struct ektf2127_ts *ts, int slot,
+				     const u8 *buf, bool active)
+{
+	input_mt_slot(ts->input, slot);
+	input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, active);
+
+	if (active) {
+		int x = (buf[0] & 0xf0) << 4 | buf[1];
+		int y = (buf[0] & 0x0f) << 8 | buf[2];
+
+		touchscreen_report_pos(ts->input, &ts->prop, x, y, true);
+	}
+}
+
+static void ektf2127_report2_event(struct ektf2127_ts *ts, const u8 *buf)
+{
+	ektf2127_report2_contact(ts, 0, &buf[1], !!(buf[7] & 2));
+	ektf2127_report2_contact(ts, 1, &buf[4], !!(buf[7] & 4));
+
+	input_mt_sync_frame(ts->input);
+	input_sync(ts->input);
+}
+
 static irqreturn_t ektf2127_irq(int irq, void *dev_id)
 {
 	struct ektf2127_ts *ts = dev_id;
@@ -113,6 +137,10 @@ static irqreturn_t ektf2127_irq(int irq, void *dev_id)
 		ektf2127_report_event(ts, buf);
 		break;
 
+	case EKTF2127_REPORT2:
+		ektf2127_report2_event(ts, buf);
+		break;
+
 	case EKTF2127_NOISE:
 		if (buf[1] == EKTF2127_ENV_NOISY)
 			dev_dbg(dev, "Environment is electrically noisy\n");
@@ -305,6 +333,7 @@ static int ektf2127_probe(struct i2c_client *client,
 #ifdef CONFIG_OF
 static const struct of_device_id ektf2127_of_match[] = {
 	{ .compatible = "elan,ektf2127" },
+	{ .compatible = "elan,ektf2132" },
 	{}
 };
 MODULE_DEVICE_TABLE(of, ektf2127_of_match);
@@ -312,6 +341,7 @@ MODULE_DEVICE_TABLE(of, ektf2127_of_match);
 
 static const struct i2c_device_id ektf2127_i2c_id[] = {
 	{ "ektf2127", 0 },
+	{ "ektf2132", 0 },
 	{}
 };
 MODULE_DEVICE_TABLE(i2c, ektf2127_i2c_id);
@@ -327,6 +357,6 @@ static struct i2c_driver ektf2127_driver = {
 };
 module_i2c_driver(ektf2127_driver);
 
-MODULE_DESCRIPTION("ELAN eKTF2127 I2C Touchscreen Driver");
+MODULE_DESCRIPTION("ELAN eKTF2127/eKTF2132 I2C Touchscreen Driver");
 MODULE_AUTHOR("Michel Verlaan, Siebren Vroegindeweij");
 MODULE_LICENSE("GPL");

--
2.28.0

maintainer Applied
#4 lore raw

Re: [PATCH 2/3] Input: ektf2127 - Add support for eKTF2132 touchscreen

Quoted 5 lines · Jonathan Neuschäfer

The eKTF2132 is a touchscreen controller found, for example, in the Kobo Aura ebook reader. It is similar to the ektf2127, but it uses a different packet type to report touch events.

Applied, thank you.

Signature · 1 line
Dmitry
#5 lore raw

PATCH 3/3 ARM: dts: imx50-kobo-aura: Enable eKTF2132 touchscreen

In reply to Jonathan Neuschäfer

The Kobo Aura has an eKTF2132 touchscreen controller.

Although the vendor kernel toggles a reset pin (GPIO5-12) during the startup sequence, the touchscreen works without it.

---

This patch requires "[PATCH] ARM: dts: imx50-kobo-aura: Add 'grp' suffix to pinctrl node names" in order to apply cleanly.
(https://lore.kernel.org/lkml/[email protected]/)

---
 arch/arm/boot/dts/imx50-kobo-aura.dts | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx50-kobo-aura.dts +15 -1
index b2fbee60271f2..82ce8c43be867 100644
@@ -120,7 +120,14 @@ &i2c1 {
 	pinctrl-0 = <&pinctrl_i2c1>;
 	status = "okay";
 
-	/* TODO: ektf2132 touch controller at 0x15 */
+	touchscreen@15 {
+		reg = <0x15>;
+		compatible = "elan,ektf2132";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_ts>;
+		power-gpios = <&gpio4 9 GPIO_ACTIVE_HIGH>;
+		interrupts-extended = <&gpio5 13 IRQ_TYPE_EDGE_FALLING>;
+	};
 };
 
 &i2c2 {
@@ -240,6 +247,13 @@ MX50_PAD_SD3_D7__ESDHC3_DAT7		0x1d4
 		>;
 	};
 
+	pinctrl_ts: tsgrp {
+		fsl,pins = <
+			MX50_PAD_CSPI_MOSI__GPIO4_9		0x0
+			MX50_PAD_SD2_D5__GPIO5_13		0x0
+		>;
+	};
+
 	pinctrl_uart2: uart2grp {
 		fsl,pins = <
 			MX50_PAD_UART2_TXD__UART2_TXD_MUX	0x1e4

--
2.28.0

Applied
#6 lore raw

Re: [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable eKTF2132 touchscreen

Quoted 6 lines · Jonathan Neuschäfer

The Kobo Aura has an eKTF2132 touchscreen controller.

Although the vendor kernel toggles a reset pin (GPIO5-12) during the startup sequence, the touchscreen works without it.

Applied, thanks.

#7 lore raw

Re: [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable eKTF2132 touchscreen

In reply to Jonathan Neuschäfer
Quoted 21 lines · Jonathan Neuschäfer

The Kobo Aura has an eKTF2132 touchscreen controller.

Although the vendor kernel toggles a reset pin (GPIO5-12) during the startup sequence, the touchscreen works without it.

---

This patch requires "[PATCH] ARM: dts: imx50-kobo-aura: Add 'grp' suffix to pinctrl node names" in order to apply cleanly.
(https://lore.kernel.org/lkml/[email protected]/)

---
 arch/arm/boot/dts/imx50-kobo-aura.dts | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx50-kobo-aura.dts +0 -0
index b2fbee60271f2..82ce8c43be867 100644
@@ -120,7 +120,14 @@ &i2c1 {
 	pinctrl-0 = <&pinctrl_i2c1>;

arch/arm/boot/dts/imx50-kobo-aura.dts &i2c1 { · line 129

Quoted 10 lines
arch/arm/boot/dts/imx50-kobo-aura.dts +7 -1
 	status = "okay";
 
-	/* TODO: ektf2132 touch controller at 0x15 */
+	touchscreen@15 {
+		reg = <0x15>;
+		compatible = "elan,ektf2132";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_ts>;
+		power-gpios = <&gpio4 9 GPIO_ACTIVE_HIGH>;
+		interrupts-extended = <&gpio5 13 IRQ_TYPE_EDGE_FALLING>;

It needs include of <dt-bindings/interrupt-controller/irq.h>.

DTC arch/arm/boot/dts/imx50-kobo-aura.dtb
Error: ../arch/arm/boot/dts/imx50-kobo-aura.dts:128.36-37 syntax error FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:326: recipe for target 'arch/arm/boot/dts/imx50-kobo-aura.dtb' failed make[2]: *** [arch/arm/boot/dts/imx50-kobo-aura.dtb] Error 1

Patch dropped.

Shawn

Quoted 21 lines
arch/arm/boot/dts/imx50-kobo-aura.dts +8 -1
+	};
 };
 
 &i2c2 {
@@ -240,6 +247,13 @@ MX50_PAD_SD3_D7__ESDHC3_DAT7		0x1d4
 		>;
 	};
 
+	pinctrl_ts: tsgrp {
+		fsl,pins = <
+			MX50_PAD_CSPI_MOSI__GPIO4_9		0x0
+			MX50_PAD_SD2_D5__GPIO5_13		0x0
+		>;
+	};
+
 	pinctrl_uart2: uart2grp {
 		fsl,pins = <
 			MX50_PAD_UART2_TXD__UART2_TXD_MUX	0x1e4
--

2.28.0

#8 lore raw

Re: [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable eKTF2132 touchscreen

Quoted 1 line · Shawn Guo

On Fri, Nov 06, 2020 at 12:24:12PM +0100, Jonathan Neuschäfer wrote:

...

Quoted 11 lines

arch/arm/boot/dts/imx50-kobo-aura.dts &i2c1 { · line 129

Quoted 8 lines
arch/arm/boot/dts/imx50-kobo-aura.dts +7 -1
-	/* TODO: ektf2132 touch controller at 0x15 */
+	touchscreen@15 {
+		reg = <0x15>;
+		compatible = "elan,ektf2132";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_ts>;
+		power-gpios = <&gpio4 9 GPIO_ACTIVE_HIGH>;
+		interrupts-extended = <&gpio5 13 IRQ_TYPE_EDGE_FALLING>;

It needs include of <dt-bindings/interrupt-controller/irq.h>.

Quoted 5 lines

DTC arch/arm/boot/dts/imx50-kobo-aura.dtb
Error: ../arch/arm/boot/dts/imx50-kobo-aura.dts:128.36-37 syntax error FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:326: recipe for target 'arch/arm/boot/dts/imx50-kobo-aura.dtb' failed make[2]: *** [arch/arm/boot/dts/imx50-kobo-aura.dtb] Error 1

Ooops, indeed.

Quoted 1 line

Patch dropped.

I'll send a version 2.

Thanks,
Jonathan Neuschäfer