linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Support for ELAN eKTF2132 touchscreens
@ 2020-11-06 11:24 Jonathan Neuschäfer
  2020-11-06 11:24 ` [PATCH 1/3] dt-bindings: input: ektf2127: Add elan,ektf2132 compatible string Jonathan Neuschäfer
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jonathan Neuschäfer @ 2020-11-06 11:24 UTC (permalink / raw)
  To: linux-input
  Cc: Dmitry Torokhov, Rob Herring, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Jonathan Neuschäfer, devicetree, linux-kernel,
	linux-arm-kernel

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] dt-bindings: input: ektf2127: Add elan,ektf2132 compatible string
  2020-11-06 11:24 [PATCH 0/3] Support for ELAN eKTF2132 touchscreens Jonathan Neuschäfer
@ 2020-11-06 11:24 ` Jonathan Neuschäfer
  2020-11-09  2:30   ` Dmitry Torokhov
  2020-11-06 11:24 ` [PATCH 2/3] Input: ektf2127 - Add support for eKTF2132 touchscreen Jonathan Neuschäfer
  2020-11-06 11:24 ` [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable " Jonathan Neuschäfer
  2 siblings, 1 reply; 9+ messages in thread
From: Jonathan Neuschäfer @ 2020-11-06 11:24 UTC (permalink / raw)
  To: linux-input
  Cc: Dmitry Torokhov, Rob Herring, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Jonathan Neuschäfer, devicetree, linux-kernel,
	linux-arm-kernel

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.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
 .../devicetree/bindings/input/touchscreen/ektf2127.txt          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/ektf2127.txt b/Documentation/devicetree/bindings/input/touchscreen/ektf2127.txt
index 94c4fc6449407..5eef5e7d6aae1 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/ektf2127.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/ektf2127.txt
@@ -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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] Input: ektf2127 - Add support for eKTF2132 touchscreen
  2020-11-06 11:24 [PATCH 0/3] Support for ELAN eKTF2132 touchscreens Jonathan Neuschäfer
  2020-11-06 11:24 ` [PATCH 1/3] dt-bindings: input: ektf2127: Add elan,ektf2132 compatible string Jonathan Neuschäfer
@ 2020-11-06 11:24 ` Jonathan Neuschäfer
  2020-11-09  2:30   ` Dmitry Torokhov
  2020-11-06 11:24 ` [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable " Jonathan Neuschäfer
  2 siblings, 1 reply; 9+ messages in thread
From: Jonathan Neuschäfer @ 2020-11-06 11:24 UTC (permalink / raw)
  To: linux-input
  Cc: Dmitry Torokhov, Rob Herring, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Jonathan Neuschäfer, devicetree, linux-kernel,
	linux-arm-kernel

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.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
 drivers/input/touchscreen/ektf2127.c | 32 +++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c
index eadd389cf81fe..491de67ddbcd7 100644
--- a/drivers/input/touchscreen/ektf2127.c
+++ b/drivers/input/touchscreen/ektf2127.c
@@ -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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable eKTF2132 touchscreen
  2020-11-06 11:24 [PATCH 0/3] Support for ELAN eKTF2132 touchscreens Jonathan Neuschäfer
  2020-11-06 11:24 ` [PATCH 1/3] dt-bindings: input: ektf2127: Add elan,ektf2132 compatible string Jonathan Neuschäfer
  2020-11-06 11:24 ` [PATCH 2/3] Input: ektf2127 - Add support for eKTF2132 touchscreen Jonathan Neuschäfer
@ 2020-11-06 11:24 ` Jonathan Neuschäfer
  2020-11-10  2:35   ` Shawn Guo
  2020-11-10  3:12   ` Shawn Guo
  2 siblings, 2 replies; 9+ messages in thread
From: Jonathan Neuschäfer @ 2020-11-06 11:24 UTC (permalink / raw)
  To: linux-input
  Cc: Dmitry Torokhov, Rob Herring, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Jonathan Neuschäfer, devicetree, linux-kernel,
	linux-arm-kernel

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.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---

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/20201031210729.2804471-1-j.neuschaefer@gmx.net/)
---
 arch/arm/boot/dts/imx50-kobo-aura.dts | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx50-kobo-aura.dts b/arch/arm/boot/dts/imx50-kobo-aura.dts
index b2fbee60271f2..82ce8c43be867 100644
--- a/arch/arm/boot/dts/imx50-kobo-aura.dts
+++ b/arch/arm/boot/dts/imx50-kobo-aura.dts
@@ -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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] dt-bindings: input: ektf2127: Add elan,ektf2132 compatible string
  2020-11-06 11:24 ` [PATCH 1/3] dt-bindings: input: ektf2127: Add elan,ektf2132 compatible string Jonathan Neuschäfer
@ 2020-11-09  2:30   ` Dmitry Torokhov
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2020-11-09  2:30 UTC (permalink / raw)
  To: Jonathan Neuschäfer
  Cc: linux-input, Rob Herring, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	devicetree, linux-kernel, linux-arm-kernel

On Fri, Nov 06, 2020 at 12:24:10PM +0100, Jonathan Neuschäfer wrote:
> 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.
> 
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] Input: ektf2127 - Add support for eKTF2132 touchscreen
  2020-11-06 11:24 ` [PATCH 2/3] Input: ektf2127 - Add support for eKTF2132 touchscreen Jonathan Neuschäfer
@ 2020-11-09  2:30   ` Dmitry Torokhov
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2020-11-09  2:30 UTC (permalink / raw)
  To: Jonathan Neuschäfer
  Cc: linux-input, Rob Herring, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	devicetree, linux-kernel, linux-arm-kernel

On Fri, Nov 06, 2020 at 12:24:11PM +0100, Jonathan Neuschäfer wrote:
> 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.
> 
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable eKTF2132 touchscreen
  2020-11-06 11:24 ` [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable " Jonathan Neuschäfer
@ 2020-11-10  2:35   ` Shawn Guo
  2020-11-10  3:12   ` Shawn Guo
  1 sibling, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2020-11-10  2:35 UTC (permalink / raw)
  To: Jonathan Neuschäfer
  Cc: linux-input, Dmitry Torokhov, Rob Herring, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	devicetree, linux-kernel, linux-arm-kernel

On Fri, Nov 06, 2020 at 12:24:12PM +0100, Jonathan Neuschäfer wrote:
> 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.
> 
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>

Applied, thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable eKTF2132 touchscreen
  2020-11-06 11:24 ` [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable " Jonathan Neuschäfer
  2020-11-10  2:35   ` Shawn Guo
@ 2020-11-10  3:12   ` Shawn Guo
  2020-11-10  8:25     ` Jonathan Neuschäfer
  1 sibling, 1 reply; 9+ messages in thread
From: Shawn Guo @ 2020-11-10  3:12 UTC (permalink / raw)
  To: Jonathan Neuschäfer
  Cc: linux-input, Dmitry Torokhov, Rob Herring, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	devicetree, linux-kernel, linux-arm-kernel

On Fri, Nov 06, 2020 at 12:24:12PM +0100, Jonathan Neuschäfer wrote:
> 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.
> 
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> ---
> 
> 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/20201031210729.2804471-1-j.neuschaefer@gmx.net/)
> ---
>  arch/arm/boot/dts/imx50-kobo-aura.dts | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/imx50-kobo-aura.dts b/arch/arm/boot/dts/imx50-kobo-aura.dts
> index b2fbee60271f2..82ce8c43be867 100644
> --- a/arch/arm/boot/dts/imx50-kobo-aura.dts
> +++ b/arch/arm/boot/dts/imx50-kobo-aura.dts
> @@ -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>;

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

> +	};
>  };
> 
>  &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
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable eKTF2132 touchscreen
  2020-11-10  3:12   ` Shawn Guo
@ 2020-11-10  8:25     ` Jonathan Neuschäfer
  0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Neuschäfer @ 2020-11-10  8:25 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Jonathan Neuschäfer, linux-input, Dmitry Torokhov,
	Rob Herring, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, devicetree, linux-kernel,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 959 bytes --]

On Tue, Nov 10, 2020 at 11:12:52AM +0800, Shawn Guo wrote:
> On Fri, Nov 06, 2020 at 12:24:12PM +0100, Jonathan Neuschäfer wrote:
...
> > -	/* 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

Ooops, indeed.

> Patch dropped.

I'll send a version 2.


Thanks,
Jonathan Neuschäfer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-11-10  8:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06 11:24 [PATCH 0/3] Support for ELAN eKTF2132 touchscreens Jonathan Neuschäfer
2020-11-06 11:24 ` [PATCH 1/3] dt-bindings: input: ektf2127: Add elan,ektf2132 compatible string Jonathan Neuschäfer
2020-11-09  2:30   ` Dmitry Torokhov
2020-11-06 11:24 ` [PATCH 2/3] Input: ektf2127 - Add support for eKTF2132 touchscreen Jonathan Neuschäfer
2020-11-09  2:30   ` Dmitry Torokhov
2020-11-06 11:24 ` [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable " Jonathan Neuschäfer
2020-11-10  2:35   ` Shawn Guo
2020-11-10  3:12   ` Shawn Guo
2020-11-10  8:25     ` Jonathan Neuschäfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).