diff mbox series

[v3,7/9] input: elants: support 0x66 reply opcode for reporting touches

Message ID f442f4e0e79d4acaff8481729bee73d33f77a9ef.1586784389.git.mirq-linux@rere.qmqm.pl (mailing list archive)
State Superseded
Headers show
Series input: elants: Support Asus TF300T touchscreen | expand

Commit Message

Michał Mirosław April 13, 2020, 1:32 p.m. UTC
From: Dmitry Osipenko <digetx@gmail.com>

eKTF3624 touchscreen firmware uses two variants of the reply opcodes for
reporting touch events: one is 0x63 (used by older firmware) and other is
0x66 (used by newer firmware). The 0x66 variant is equal to 0x63 of
eKTH3500, while 0x63 needs small adjustment of the touch pressure value.

Nexus 7 tablet device has eKTF3624 touchscreen and it uses 0x66 opcode for
reporting touch events, let's support it now. Other devices, eg. ASUS TF300T,
use 0x63.

Note: CMD_HEADER_REK is used for replying to calibration requests, it has
the same 0x66 opcode number which eKTF3624 uses for reporting touches.
The calibration replies are handled separately from the the rest of the
commands in the driver by entering into ELAN_WAIT_RECALIBRATION state
and thus this change shouldn't change the old behavior.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/input/touchscreen/elants_i2c.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Dmitry Torokhov April 26, 2020, 5:15 a.m. UTC | #1
On Mon, Apr 13, 2020 at 03:32:26PM +0200, Michał Mirosław wrote:
> From: Dmitry Osipenko <digetx@gmail.com>
> 
> eKTF3624 touchscreen firmware uses two variants of the reply opcodes for
> reporting touch events: one is 0x63 (used by older firmware) and other is
> 0x66 (used by newer firmware). The 0x66 variant is equal to 0x63 of
> eKTH3500, while 0x63 needs small adjustment of the touch pressure value.
> 
> Nexus 7 tablet device has eKTF3624 touchscreen and it uses 0x66 opcode for
> reporting touch events, let's support it now. Other devices, eg. ASUS TF300T,
> use 0x63.
> 
> Note: CMD_HEADER_REK is used for replying to calibration requests, it has
> the same 0x66 opcode number which eKTF3624 uses for reporting touches.
> The calibration replies are handled separately from the the rest of the
> commands in the driver by entering into ELAN_WAIT_RECALIBRATION state
> and thus this change shouldn't change the old behavior.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> Tested-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
>  drivers/input/touchscreen/elants_i2c.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
> index 2b936e920874..9751139e8507 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -60,6 +60,15 @@
>  #define QUEUE_HEADER_NORMAL	0X63
>  #define QUEUE_HEADER_WAIT	0x64
>  
> +/*
> + * Depending on firmware version, eKTF3624 touchscreens may utilize one of
> + * these opcodes for the touch events: 0x63 and 0x66. The 0x63 is used by
> + * older firmware version and differs from 0x66 such that touch pressure
> + * value needs to be adjusted.

Who is responsible for the adjustment? Where does it happen?

Thanks.
Dmitry Osipenko April 26, 2020, 5:21 a.m. UTC | #2
26.04.2020 08:15, Dmitry Torokhov пишет:
> On Mon, Apr 13, 2020 at 03:32:26PM +0200, Michał Mirosław wrote:
>> From: Dmitry Osipenko <digetx@gmail.com>
>>
>> eKTF3624 touchscreen firmware uses two variants of the reply opcodes for
>> reporting touch events: one is 0x63 (used by older firmware) and other is
>> 0x66 (used by newer firmware). The 0x66 variant is equal to 0x63 of
>> eKTH3500, while 0x63 needs small adjustment of the touch pressure value.
>>
>> Nexus 7 tablet device has eKTF3624 touchscreen and it uses 0x66 opcode for
>> reporting touch events, let's support it now. Other devices, eg. ASUS TF300T,
>> use 0x63.
>>
>> Note: CMD_HEADER_REK is used for replying to calibration requests, it has
>> the same 0x66 opcode number which eKTF3624 uses for reporting touches.
>> The calibration replies are handled separately from the the rest of the
>> commands in the driver by entering into ELAN_WAIT_RECALIBRATION state
>> and thus this change shouldn't change the old behavior.
>>
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> Tested-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
>> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
>> ---
>>  drivers/input/touchscreen/elants_i2c.c | 11 ++++++++++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
>> index 2b936e920874..9751139e8507 100644
>> --- a/drivers/input/touchscreen/elants_i2c.c
>> +++ b/drivers/input/touchscreen/elants_i2c.c
>> @@ -60,6 +60,15 @@
>>  #define QUEUE_HEADER_NORMAL	0X63
>>  #define QUEUE_HEADER_WAIT	0x64
>>  
>> +/*
>> + * Depending on firmware version, eKTF3624 touchscreens may utilize one of
>> + * these opcodes for the touch events: 0x63 and 0x66. The 0x63 is used by
>> + * older firmware version and differs from 0x66 such that touch pressure
>> + * value needs to be adjusted.
> 
> Who is responsible for the adjustment? Where does it happen?


Please see the patch #2 ("support old touch report format") which adds
support for parsing of the older packet format that requires the
pressure value adjustment.
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index 2b936e920874..9751139e8507 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -60,6 +60,15 @@ 
 #define QUEUE_HEADER_NORMAL	0X63
 #define QUEUE_HEADER_WAIT	0x64
 
+/*
+ * Depending on firmware version, eKTF3624 touchscreens may utilize one of
+ * these opcodes for the touch events: 0x63 and 0x66. The 0x63 is used by
+ * older firmware version and differs from 0x66 such that touch pressure
+ * value needs to be adjusted. The 0x66 opcode of newer firmware is equal
+ * to 0x63 of eKTH3500.
+ */
+#define QUEUE_HEADER_NORMAL2	0x66
+
 /* Command header definition */
 #define CMD_HEADER_WRITE	0x54
 #define CMD_HEADER_READ		0x53
@@ -1050,7 +1059,6 @@  static irqreturn_t elants_i2c_irq(int irq, void *_dev)
 		switch (ts->buf[FW_HDR_TYPE]) {
 		case CMD_HEADER_HELLO:
 		case CMD_HEADER_RESP:
-		case CMD_HEADER_REK:
 			break;
 
 		case QUEUE_HEADER_WAIT:
@@ -1070,6 +1078,7 @@  static irqreturn_t elants_i2c_irq(int irq, void *_dev)
 			break;
 
 		case QUEUE_HEADER_NORMAL:
+		case QUEUE_HEADER_NORMAL2:
 			report_count = ts->buf[FW_HDR_COUNT];
 			if (report_count == 0 || report_count > 3) {
 				dev_err(&client->dev,