Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df077237 authored by Benjamin Tissoires's avatar Benjamin Tissoires Committed by Dmitry Torokhov
Browse files

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: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: default avatarKT Liao <kt.liao@emc.com.tw>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 21c48dbd
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -1793,10 +1793,10 @@ static int elantech_setup_smbus(struct psmouse *psmouse,

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

@@ -1818,6 +1818,9 @@ static int elantech_setup_smbus(struct psmouse *psmouse,
static bool elantech_use_host_notify(struct psmouse *psmouse,
				     struct elantech_device_info *info)
{
	if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version))
		return true;

	switch (info->bus) {
	case ETP_BUS_PS2_ONLY:
		/* expected case */
+15 −0
Original line number Diff line number Diff line
@@ -115,6 +115,21 @@
#define ETP_BUS_PS2_SMB_ALERT		3
#define ETP_BUS_PS2_SMB_HST_NTFY	4

/*
 * New ICs are either using SMBus Host Notify or just plain PS2.
 *
 * ETP_FW_VERSION_QUERY is:
 * Byte 1:
 *  - bit 0..3: IC BODY
 * Byte 2:
 *  - bit 4: HiddenButton
 *  - bit 5: PS2_SMBUS_NOTIFY
 *  - bit 6: PS2CRCCheck
 */
#define ETP_NEW_IC_SMBUS_HOST_NOTIFY(fw_version)	\
		((((fw_version) & 0x0f2000) == 0x0f2000) && \
		 ((fw_version) & 0x0000ff) > 0)

/*
 * The base position for one finger, v4 hardware
 */