Skip to content

Commit f419e59

Browse files
FlyGoatjwrdegoede
authored andcommitted
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 <[email protected]> Cc: [email protected] # 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/[email protected] Signed-off-by: Hans de Goede <[email protected]>
1 parent 5b56930 commit f419e59

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/platform/x86/ideapad-laptop.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ struct ideapad_private {
9292
struct dentry *debug;
9393
unsigned long cfg;
9494
bool has_hw_rfkill_switch;
95+
bool has_touchpad_switch;
9596
const char *fnesc_guid;
9697
};
9798

@@ -535,7 +536,9 @@ static umode_t ideapad_is_visible(struct kobject *kobj,
535536
} else if (attr == &dev_attr_fn_lock.attr) {
536537
supported = acpi_has_method(priv->adev->handle, "HALS") &&
537538
acpi_has_method(priv->adev->handle, "SALS");
538-
} else
539+
} else if (attr == &dev_attr_touchpad.attr)
540+
supported = priv->has_touchpad_switch;
541+
else
539542
supported = true;
540543

541544
return supported ? attr->mode : 0;
@@ -867,6 +870,9 @@ static void ideapad_sync_touchpad_state(struct ideapad_private *priv)
867870
{
868871
unsigned long value;
869872

873+
if (!priv->has_touchpad_switch)
874+
return;
875+
870876
/* Without reading from EC touchpad LED doesn't switch state */
871877
if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) {
872878
/* Some IdeaPads don't really turn off touchpad - they only
@@ -989,6 +995,9 @@ static int ideapad_acpi_add(struct platform_device *pdev)
989995
priv->platform_device = pdev;
990996
priv->has_hw_rfkill_switch = dmi_check_system(hw_rfkill_list);
991997

998+
/* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */
999+
priv->has_touchpad_switch = !acpi_dev_present("ELAN0634", NULL, -1);
1000+
9921001
ret = ideapad_sysfs_init(priv);
9931002
if (ret)
9941003
return ret;
@@ -1006,6 +1015,10 @@ static int ideapad_acpi_add(struct platform_device *pdev)
10061015
if (!priv->has_hw_rfkill_switch)
10071016
write_ec_cmd(priv->adev->handle, VPCCMD_W_RF, 1);
10081017

1018+
/* The same for Touchpad */
1019+
if (!priv->has_touchpad_switch)
1020+
write_ec_cmd(priv->adev->handle, VPCCMD_W_TOUCHPAD, 1);
1021+
10091022
for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
10101023
if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg))
10111024
ideapad_register_rfkill(priv, i);

0 commit comments

Comments
 (0)