Skip to content

Commit a69ce59

Browse files
jonodenodtor
authored andcommitted
Input: elantech - fix touchpad state on resume for Lenovo N24
The Lenovo N24 on resume becomes stuck in a state where it sends incorrect packets, causing elantech_packet_check_v4 to fail. The only way for the device to resume sending the correct packets is for it to be disabled and then re-enabled. This change adds a dmi check to trigger this behavior on resume. Signed-off-by: Jonathan Denose <[email protected]> Link: https://lore.kernel.org/r/20240503155020.v2.1.Ifa0e25ebf968d8f307f58d678036944141ab17e6@changeid Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 2ec0028 commit a69ce59

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

drivers/input/mouse/elantech.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,16 +1476,47 @@ static void elantech_disconnect(struct psmouse *psmouse)
14761476
psmouse->private = NULL;
14771477
}
14781478

1479+
/*
1480+
* Some hw_version 4 models fail to properly activate absolute mode on
1481+
* resume without going through disable/enable cycle.
1482+
*/
1483+
static const struct dmi_system_id elantech_needs_reenable[] = {
1484+
#if defined(CONFIG_DMI) && defined(CONFIG_X86)
1485+
{
1486+
/* Lenovo N24 */
1487+
.matches = {
1488+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1489+
DMI_MATCH(DMI_PRODUCT_NAME, "81AF"),
1490+
},
1491+
},
1492+
#endif
1493+
{ }
1494+
};
1495+
14791496
/*
14801497
* Put the touchpad back into absolute mode when reconnecting
14811498
*/
14821499
static int elantech_reconnect(struct psmouse *psmouse)
14831500
{
1501+
int err;
1502+
14841503
psmouse_reset(psmouse);
14851504

14861505
if (elantech_detect(psmouse, 0))
14871506
return -1;
14881507

1508+
if (dmi_check_system(elantech_needs_reenable)) {
1509+
err = ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE);
1510+
if (err)
1511+
psmouse_warn(psmouse, "failed to deactivate mouse on %s: %d\n",
1512+
psmouse->ps2dev.serio->phys, err);
1513+
1514+
err = ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE);
1515+
if (err)
1516+
psmouse_warn(psmouse, "failed to reactivate mouse on %s: %d\n",
1517+
psmouse->ps2dev.serio->phys, err);
1518+
}
1519+
14891520
if (elantech_set_absolute_mode(psmouse)) {
14901521
psmouse_err(psmouse,
14911522
"failed to put touchpad back into absolute mode.\n");

0 commit comments

Comments
 (0)