Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <jdenose@google.com>
Link: https://lore.kernel.org/r/20240503155020.v2.1.Ifa0e25ebf968d8f307f58d678036944141ab17e6@changeid
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Jonathan Denose and committed by
Dmitry Torokhov
a69ce592 2ec0028a

+31
+31
drivers/input/mouse/elantech.c
··· 1477 1477 } 1478 1478 1479 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 + 1496 + /* 1480 1497 * Put the touchpad back into absolute mode when reconnecting 1481 1498 */ 1482 1499 static int elantech_reconnect(struct psmouse *psmouse) 1483 1500 { 1501 + int err; 1502 + 1484 1503 psmouse_reset(psmouse); 1485 1504 1486 1505 if (elantech_detect(psmouse, 0)) 1487 1506 return -1; 1507 + 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 + } 1488 1519 1489 1520 if (elantech_set_absolute_mode(psmouse)) { 1490 1521 psmouse_err(psmouse,