Skip to content

Commit 883a2a8

Browse files
khfengdtor
authored andcommitted
Input: elantech - enable SMBus on new (2018+) systems
There are some new HP laptops with Elantech touchpad that don't support multitouch. Currently we use ETP_NEW_IC_SMBUS_HOST_NOTIFY() to check if SMBus is supported, but in addition to firmware version, the bus type also informs us whether the IC can support SMBus. To avoid breaking old ICs, we will only enable SMbus support based the bus type on systems manufactured after 2018. Lastly, let's consolidate all checks into elantech_use_host_notify() and use it to determine whether to use PS/2 or SMBus. Signed-off-by: Kai-Heng Feng <[email protected]> Acked-by: Benjamin Tissoires <[email protected]> Cc: [email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent b1cbb2f commit 883a2a8

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed

drivers/input/mouse/elantech.c

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,30 @@ static int elantech_create_smbus(struct psmouse *psmouse,
18271827
leave_breadcrumbs);
18281828
}
18291829

1830+
static bool elantech_use_host_notify(struct psmouse *psmouse,
1831+
struct elantech_device_info *info)
1832+
{
1833+
if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version))
1834+
return true;
1835+
1836+
switch (info->bus) {
1837+
case ETP_BUS_PS2_ONLY:
1838+
/* expected case */
1839+
break;
1840+
case ETP_BUS_SMB_HST_NTFY_ONLY:
1841+
case ETP_BUS_PS2_SMB_HST_NTFY:
1842+
/* SMbus implementation is stable since 2018 */
1843+
if (dmi_get_bios_year() >= 2018)
1844+
return true;
1845+
default:
1846+
psmouse_dbg(psmouse,
1847+
"Ignoring SMBus bus provider %d\n", info->bus);
1848+
break;
1849+
}
1850+
1851+
return false;
1852+
}
1853+
18301854
/**
18311855
* elantech_setup_smbus - called once the PS/2 devices are enumerated
18321856
* and decides to instantiate a SMBus InterTouch device.
@@ -1846,7 +1870,7 @@ static int elantech_setup_smbus(struct psmouse *psmouse,
18461870
* i2c_blacklist_pnp_ids.
18471871
* Old ICs are up to the user to decide.
18481872
*/
1849-
if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) ||
1873+
if (!elantech_use_host_notify(psmouse, info) ||
18501874
psmouse_matches_pnp_id(psmouse, i2c_blacklist_pnp_ids))
18511875
return -ENXIO;
18521876
}
@@ -1866,34 +1890,6 @@ static int elantech_setup_smbus(struct psmouse *psmouse,
18661890
return 0;
18671891
}
18681892

1869-
static bool elantech_use_host_notify(struct psmouse *psmouse,
1870-
struct elantech_device_info *info)
1871-
{
1872-
if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version))
1873-
return true;
1874-
1875-
switch (info->bus) {
1876-
case ETP_BUS_PS2_ONLY:
1877-
/* expected case */
1878-
break;
1879-
case ETP_BUS_SMB_ALERT_ONLY:
1880-
/* fall-through */
1881-
case ETP_BUS_PS2_SMB_ALERT:
1882-
psmouse_dbg(psmouse, "Ignoring SMBus provider through alert protocol.\n");
1883-
break;
1884-
case ETP_BUS_SMB_HST_NTFY_ONLY:
1885-
/* fall-through */
1886-
case ETP_BUS_PS2_SMB_HST_NTFY:
1887-
return true;
1888-
default:
1889-
psmouse_dbg(psmouse,
1890-
"Ignoring SMBus bus provider %d.\n",
1891-
info->bus);
1892-
}
1893-
1894-
return false;
1895-
}
1896-
18971893
int elantech_init_smbus(struct psmouse *psmouse)
18981894
{
18991895
struct elantech_device_info info;

0 commit comments

Comments
 (0)