Skip to content

Commit

Permalink
Input: elantech - adjust hw_version detection logic
Browse files Browse the repository at this point in the history
This patch fixes some v3 hardware (fw_version: 0x150500) wrongly detected
as v2 hardware.

Reported-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: JJ Ding <jj_ding@emc.com.tw>
Tested-By: Marc Dietrich <marvin24@gmx.de>
Acked-by: Éric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
JJ Ding authored and Dmitry Torokhov committed Nov 10, 2011
1 parent b42c909 commit 3940d61
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions drivers/input/mouse/elantech.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,18 +1210,28 @@ static int elantech_reconnect(struct psmouse *psmouse)
*/
static int elantech_set_properties(struct elantech_data *etd)
{
/* This represents the version of IC body. */
int ver = (etd->fw_version & 0x0f0000) >> 16;

/* Early version of Elan touchpads doesn't obey the rule. */
if (etd->fw_version < 0x020030 || etd->fw_version == 0x020600)
etd->hw_version = 1;
else if (etd->fw_version < 0x150600)
etd->hw_version = 2;
else if (ver == 5)
etd->hw_version = 3;
else if (ver == 6)
etd->hw_version = 4;
else
return -1;
else {
switch (ver) {
case 2:
case 4:
etd->hw_version = 2;
break;
case 5:
etd->hw_version = 3;
break;
case 6:
etd->hw_version = 4;
break;
default:
return -1;
}
}

/*
* Turn on packet checking by default.
Expand Down

0 comments on commit 3940d61

Please sign in to comment.