2020-11-06 11:26:36

by J. Neuschäfer

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


2020-11-06 11:26:41

by J. Neuschäfer

[permalink] [raw]
Subject: [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.

Signed-off-by: Jonathan Neuschäfer <[email protected]>
---
.../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

2020-11-06 11:26:55

by J. Neuschäfer

[permalink] [raw]
Subject: [PATCH 3/3] ARM: dts: imx50-kobo-aura: Enable eKTF2132 touchscreen

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 <[email protected]>
---

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(-)

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

2020-11-06 11:27:21

by J. Neuschäfer

[permalink] [raw]
Subject: [PATCH 2/3] Input: ektf2127 - Add support for eKTF2132 touchscreen

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 <[email protected]>
---
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

2020-11-09 02:32:33

by Dmitry Torokhov

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

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 <[email protected]>

Applied, thank you.

--
Dmitry

2020-11-09 02:33:15

by Dmitry Torokhov

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

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 <[email protected]>

Applied, thank you.

--
Dmitry

2020-11-10 02:39:10

by Shawn Guo

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

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 <[email protected]>

Applied, thanks.

2020-11-10 03:17:17

by Shawn Guo

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

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 <[email protected]>
> ---
>
> 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(-)
>
> 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
>

2020-11-10 08:28:11

by J. Neuschäfer

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

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


Attachments:
(No filename) (959.00 B)
signature.asc (849.00 B)
Download all attachments