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

platform/x86: ideapad-laptop: Disable touchpad_switch for ELAN0634

Newer ideapads (e.g.: Yoga 14s, 720S 14) come with ELAN0634 touchpad do not
use EC to switch touchpad.

Reading VPCCMD_R_TOUCHPAD will return zero thus touchpad may be blocked
unexpectedly.
Writing VPCCMD_W_TOUCHPAD may cause a spurious key press.

Add has_touchpad_switch to workaround these machines.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: stable@vger.kernel.org # 5.4+
--
v2: Specify touchpad to ELAN0634
v3: Stupid missing ! in v2
v4: Correct acpi_dev_present usage (Hans)
Link: https://lore.kernel.org/r/20210107144438.12605-1-jiaxun.yang@flygoat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Jiaxun Yang and committed by
Hans de Goede
d69cd7ee fc00bc8a

+14 -1
+14 -1
drivers/platform/x86/ideapad-laptop.c
··· 92 92 struct dentry *debug; 93 93 unsigned long cfg; 94 94 bool has_hw_rfkill_switch; 95 + bool has_touchpad_switch; 95 96 const char *fnesc_guid; 96 97 }; 97 98 ··· 536 535 } else if (attr == &dev_attr_fn_lock.attr) { 537 536 supported = acpi_has_method(priv->adev->handle, "HALS") && 538 537 acpi_has_method(priv->adev->handle, "SALS"); 539 - } else 538 + } else if (attr == &dev_attr_touchpad.attr) 539 + supported = priv->has_touchpad_switch; 540 + else 540 541 supported = true; 541 542 542 543 return supported ? attr->mode : 0; ··· 870 867 { 871 868 unsigned long value; 872 869 870 + if (!priv->has_touchpad_switch) 871 + return; 872 + 873 873 /* Without reading from EC touchpad LED doesn't switch state */ 874 874 if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) { 875 875 /* Some IdeaPads don't really turn off touchpad - they only ··· 995 989 priv->platform_device = pdev; 996 990 priv->has_hw_rfkill_switch = dmi_check_system(hw_rfkill_list); 997 991 992 + /* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */ 993 + priv->has_touchpad_switch = !acpi_dev_present("ELAN0634", NULL, -1); 994 + 998 995 ret = ideapad_sysfs_init(priv); 999 996 if (ret) 1000 997 return ret; ··· 1014 1005 */ 1015 1006 if (!priv->has_hw_rfkill_switch) 1016 1007 write_ec_cmd(priv->adev->handle, VPCCMD_W_RF, 1); 1008 + 1009 + /* The same for Touchpad */ 1010 + if (!priv->has_touchpad_switch) 1011 + write_ec_cmd(priv->adev->handle, VPCCMD_W_TOUCHPAD, 1); 1017 1012 1018 1013 for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) 1019 1014 if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg))