Skip to content

Commit 6b30c73

Browse files
dusonlindtor
authored andcommitted
Input: elantech - add special check for fw_version 0x470f01 touchpad
It is no need to check the packet[0] for sanity check when doing elantech_packet_check_v4() function for fw_version = 0x470f01 touchpad. Signed-off by: Duson Lin <dusonlin@emc.com.tw> Reviewed-by: Ulrik De Bie <ulrik.debie-os@e2big.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent e661d0a commit 6b30c73

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

drivers/input/mouse/elantech.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,19 +783,26 @@ static int elantech_packet_check_v4(struct psmouse *psmouse)
783783
struct elantech_data *etd = psmouse->private;
784784
unsigned char *packet = psmouse->packet;
785785
unsigned char packet_type = packet[3] & 0x03;
786+
unsigned int ic_version;
786787
bool sanity_check;
787788

788789
if (etd->tp_dev && (packet[3] & 0x0f) == 0x06)
789790
return PACKET_TRACKPOINT;
790791

792+
/* This represents the version of IC body. */
793+
ic_version = (etd->fw_version & 0x0f0000) >> 16;
794+
791795
/*
792796
* Sanity check based on the constant bits of a packet.
793797
* The constant bits change depending on the value of
794-
* the hardware flag 'crc_enabled' but are the same for
795-
* every packet, regardless of the type.
798+
* the hardware flag 'crc_enabled' and the version of
799+
* the IC body, but are the same for every packet,
800+
* regardless of the type.
796801
*/
797802
if (etd->crc_enabled)
798803
sanity_check = ((packet[3] & 0x08) == 0x00);
804+
else if (ic_version == 7 && etd->samples[1] == 0x2A)
805+
sanity_check = ((packet[3] & 0x1c) == 0x10);
799806
else
800807
sanity_check = ((packet[0] & 0x0c) == 0x04 &&
801808
(packet[3] & 0x1c) == 0x10);
@@ -1116,6 +1123,7 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
11161123
* Avatar AVIU-145A2 0x361f00 ? clickpad
11171124
* Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons
11181125
* Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons
1126+
* Fujitsu T725 0x470f01 05, 12, 09 2 hw buttons
11191127
* Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**)
11201128
* Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons
11211129
* Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*)
@@ -1651,6 +1659,16 @@ int elantech_init(struct psmouse *psmouse)
16511659
etd->capabilities[0], etd->capabilities[1],
16521660
etd->capabilities[2]);
16531661

1662+
if (etd->hw_version != 1) {
1663+
if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY, etd->samples)) {
1664+
psmouse_err(psmouse, "failed to query sample data\n");
1665+
goto init_fail;
1666+
}
1667+
psmouse_info(psmouse,
1668+
"Elan sample query result %02x, %02x, %02x\n",
1669+
etd->samples[0], etd->samples[1], etd->samples[2]);
1670+
}
1671+
16541672
if (elantech_set_absolute_mode(psmouse)) {
16551673
psmouse_err(psmouse,
16561674
"failed to put touchpad into absolute mode.\n");

drivers/input/mouse/elantech.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct elantech_data {
129129
unsigned char reg_26;
130130
unsigned char debug;
131131
unsigned char capabilities[3];
132+
unsigned char samples[3];
132133
bool paritycheck;
133134
bool jumpy_cursor;
134135
bool reports_pressure;

0 commit comments

Comments
 (0)