Skip to content

Commit

Permalink
Input: elantech - make sure touchpad is really in absolute mode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Arjan Opmeer authored and Dmitry Torokhov committed Apr 19, 2009
1 parent 3f8c0df commit b2546df
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions drivers/input/mouse/elantech.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,22 +375,33 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
rc = -1;
break;
}
}

if (rc == 0) {
/*
* Read back reg 0x10. The touchpad is probably initalising
* and not ready until we read back the value we just wrote.
* Read back reg 0x10. For hardware version 1 we must make
* sure the absolute mode bit is set. For hardware version 2
* the touchpad is probably initalising and not ready until
* we read back the value we just wrote.
*/
do {
rc = elantech_read_reg(psmouse, 0x10, &val);
if (rc == 0)
break;
tries--;
elantech_debug("elantech.c: retrying read (%d).\n",
tries);
tries);
msleep(ETP_READ_BACK_DELAY);
} while (tries > 0);
if (rc)

if (rc) {
pr_err("elantech.c: failed to read back register 0x10.\n");
break;
} else if (etd->hw_version == 1 &&
!(val & ETP_R10_ABSOLUTE_MODE)) {
pr_err("elantech.c: touchpad refuses "
"to switch to absolute mode.\n");
rc = -1;
}
}

if (rc)
Expand Down

0 comments on commit b2546df

Please sign in to comment.