diff mbox series

[v2,6/6] platform/x86: ideapad-laptop: Make touchpad_ctrl_via_ec a module option

Message ID 20221117110244.67811-7-hdegoede@redhat.com (mailing list archive)
State Accepted, archived
Headers show
Series platform/x86: ideapad-laptop: Rework touchpad control code | expand

Commit Message

Hans de Goede Nov. 17, 2022, 11:02 a.m. UTC
Remove the ACPI-HID + DMI-id deny-lists for touchpad_ctrl_via_ec and
instead make it a module option which defaults to false.

The touchpad sysfs attribute allowing directly writing VPCCMD_W_TOUCHPAD
from userspace has been leading to a lot of bug-reports / patches adding
both ACPI HID + dmi-id based deny-lists for it which then need to be
expanded all the time going forward leading to a high maintenance load.

At the same time the touchpad sysfs attribute is not a standard Linux
userspace API. So it is not used in standard desktop-enviroments, instead
it is only used in the following 2 rare circumstances:

1. Ideapad specific control-panel like applets
2. Custom scripts written by users

For 1. these applets need to already deal with the touchpad sysfs attr
sometimes not being there because of the existing deny lists so hiding
it be default should not cause an issue; and most desktop environments
already have a touchpad-disable option in their native control-panel,
so having an ideapad specific toggle for this is not necessary.

For 2. since these users are already customizing their systems they
can add the module option if they want to keep using the touchpad
sysfs attribute.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/ideapad-laptop.c | 33 ++++++---------------------
 1 file changed, 7 insertions(+), 26 deletions(-)
diff mbox series

Patch

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index fc3d47a75944..435d2d3d903b 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -182,6 +182,12 @@  MODULE_PARM_DESC(ctrl_ps2_aux_port,
 	"Enable driver based PS/2 aux port en-/dis-abling on touchpad on/off toggle. "
 	"If you need this please report this to: platform-driver-x86@vger.kernel.org");
 
+static bool touchpad_ctrl_via_ec;
+module_param(touchpad_ctrl_via_ec, bool, 0444);
+MODULE_PARM_DESC(touchpad_ctrl_via_ec,
+	"Enable registering a 'touchpad' sysfs-attribute which can be used to manually "
+	"tell the EC to enable/disable the touchpad. This may not work on all models.");
+
 /*
  * shared data
  */
@@ -1654,24 +1660,6 @@  static const struct dmi_system_id ctrl_ps2_aux_port_list[] = {
 	{}
 };
 
-static const struct dmi_system_id no_touchpad_switch_list[] = {
-	{
-	.ident = "Lenovo Yoga 3 Pro 1370",
-	.matches = {
-		DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-		DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 3"),
-		},
-	},
-	{
-	.ident = "ZhaoYang K4e-IML",
-	.matches = {
-		DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-		DMI_MATCH(DMI_PRODUCT_VERSION, "ZhaoYang K4e-IML"),
-		},
-	},
-	{}
-};
-
 static void ideapad_check_features(struct ideapad_private *priv)
 {
 	acpi_handle handle = priv->adev->handle;
@@ -1683,14 +1671,7 @@  static void ideapad_check_features(struct ideapad_private *priv)
 		hw_rfkill_switch || dmi_check_system(hw_rfkill_list);
 	priv->features.ctrl_ps2_aux_port =
 		ctrl_ps2_aux_port || dmi_check_system(ctrl_ps2_aux_port_list);
-
-	/* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */
-	if (acpi_dev_present("ELAN0634", NULL, -1))
-		priv->features.touchpad_ctrl_via_ec = 0;
-	else if (dmi_check_system(no_touchpad_switch_list))
-		priv->features.touchpad_ctrl_via_ec = 0;
-	else
-		priv->features.touchpad_ctrl_via_ec = 1;
+	priv->features.touchpad_ctrl_via_ec = touchpad_ctrl_via_ec;
 
 	if (!read_ec_data(handle, VPCCMD_R_FAN, &val))
 		priv->features.fan_mode = true;