summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJJ Ding <jj_ding@emc.com.tw>2011-11-08 22:13:14 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-11-09 21:19:47 -0800
commit3940d6185a982a970ff562e085caccbdd62f40bb (patch)
treec162bbf91f5cd5cd00e8acc2797ca365716ca004 /drivers
parentb42c909743595208f7987e331f0921b73af2ce25 (diff)
downloadlinux-3940d6185a982a970ff562e085caccbdd62f40bb.tar.gz
linux-3940d6185a982a970ff562e085caccbdd62f40bb.tar.bz2
linux-3940d6185a982a970ff562e085caccbdd62f40bb.zip
Input: elantech - adjust hw_version detection logic
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/mouse/elantech.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 09b93b11a274..e2a9867c19d5 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -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.