Skip to content

Commit df07723

Browse files
bentissdtor
authored andcommitted
Input: elantech - detect new ICs and setup Host Notify for them
New ICs are using a different scheme for the alternate bus parameter. Given that they are new and are only using either PS2 only or PS2 + SMBus Host Notify, we force those new ICs to use the SMBus solution for enhanced reporting. This allows the touchpad found on the Lenovo T480s to report 5 fingers every 8 ms, instead of having a limit of 2 every 8 ms. Signed-off-by: Benjamin Tissoires <[email protected]> Acked-by: KT Liao <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 21c48db commit df07723

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

drivers/input/mouse/elantech.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,11 +1793,11 @@ static int elantech_setup_smbus(struct psmouse *psmouse,
17931793

17941794
if (elantech_smbus == ELANTECH_SMBUS_NOT_SET) {
17951795
/*
1796-
* FIXME:
1797-
* constraint the I2C capable devices by using FW version,
1798-
* board version, or by using DMI matching
1796+
* New ICs are enabled by default.
1797+
* Old ICs are up to the user to decide.
17991798
*/
1800-
return -ENXIO;
1799+
if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version))
1800+
return -ENXIO;
18011801
}
18021802

18031803
psmouse_info(psmouse, "Trying to set up SMBus access\n");
@@ -1818,6 +1818,9 @@ static int elantech_setup_smbus(struct psmouse *psmouse,
18181818
static bool elantech_use_host_notify(struct psmouse *psmouse,
18191819
struct elantech_device_info *info)
18201820
{
1821+
if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version))
1822+
return true;
1823+
18211824
switch (info->bus) {
18221825
case ETP_BUS_PS2_ONLY:
18231826
/* expected case */

drivers/input/mouse/elantech.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,21 @@
115115
#define ETP_BUS_PS2_SMB_ALERT 3
116116
#define ETP_BUS_PS2_SMB_HST_NTFY 4
117117

118+
/*
119+
* New ICs are either using SMBus Host Notify or just plain PS2.
120+
*
121+
* ETP_FW_VERSION_QUERY is:
122+
* Byte 1:
123+
* - bit 0..3: IC BODY
124+
* Byte 2:
125+
* - bit 4: HiddenButton
126+
* - bit 5: PS2_SMBUS_NOTIFY
127+
* - bit 6: PS2CRCCheck
128+
*/
129+
#define ETP_NEW_IC_SMBUS_HOST_NOTIFY(fw_version) \
130+
((((fw_version) & 0x0f2000) == 0x0f2000) && \
131+
((fw_version) & 0x0000ff) > 0)
132+
118133
/*
119134
* The base position for one finger, v4 hardware
120135
*/

0 commit comments

Comments
 (0)