diff options
author | Arjan Opmeer <arjan@opmeer.net> | 2009-04-18 22:10:17 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-04-18 22:11:59 -0400 |
commit | b2546df69b6bef19513112fd54ffb5d37cb3eb7a (patch) | |
tree | 319491c104dde49d4b439f2f3beaf2d5eb0abd6a /drivers/input | |
parent | 3f8c0df43dec51fbdfb2627f7574aa00a5fce98c (diff) |
Input: elantech - make sure touchpad is really in absolute mode
There exist laptops with Elantech touchpads where switching to absolute mode
does not happen, although writing the configuration register succeeds
without error. Reading back the register afterwards reveils that the
absolute mode bit is not set as if masked out by the touchpad firmware.
Always read back register 0x10, make sure that for hardware version 1 the
absolute mode bit is actually set and fail otherwise. This prevents the case
where the touchpad is claimed by the Elantech driver but is nonetheless not
working.
Signed-off-by: Arjan Opmeer <arjan@opmeer.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/mouse/elantech.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index d3b591673792..4bc78892ba91 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -375,9 +375,14 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse) | |||
375 | rc = -1; | 375 | rc = -1; |
376 | break; | 376 | break; |
377 | } | 377 | } |
378 | } | ||
379 | |||
380 | if (rc == 0) { | ||
378 | /* | 381 | /* |
379 | * Read back reg 0x10. The touchpad is probably initalising | 382 | * Read back reg 0x10. For hardware version 1 we must make |
380 | * and not ready until we read back the value we just wrote. | 383 | * sure the absolute mode bit is set. For hardware version 2 |
384 | * the touchpad is probably initalising and not ready until | ||
385 | * we read back the value we just wrote. | ||
381 | */ | 386 | */ |
382 | do { | 387 | do { |
383 | rc = elantech_read_reg(psmouse, 0x10, &val); | 388 | rc = elantech_read_reg(psmouse, 0x10, &val); |
@@ -385,12 +390,18 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse) | |||
385 | break; | 390 | break; |
386 | tries--; | 391 | tries--; |
387 | elantech_debug("elantech.c: retrying read (%d).\n", | 392 | elantech_debug("elantech.c: retrying read (%d).\n", |
388 | tries); | 393 | tries); |
389 | msleep(ETP_READ_BACK_DELAY); | 394 | msleep(ETP_READ_BACK_DELAY); |
390 | } while (tries > 0); | 395 | } while (tries > 0); |
391 | if (rc) | 396 | |
397 | if (rc) { | ||
392 | pr_err("elantech.c: failed to read back register 0x10.\n"); | 398 | pr_err("elantech.c: failed to read back register 0x10.\n"); |
393 | break; | 399 | } else if (etd->hw_version == 1 && |
400 | !(val & ETP_R10_ABSOLUTE_MODE)) { | ||
401 | pr_err("elantech.c: touchpad refuses " | ||
402 | "to switch to absolute mode.\n"); | ||
403 | rc = -1; | ||
404 | } | ||
394 | } | 405 | } |
395 | 406 | ||
396 | if (rc) | 407 | if (rc) |