Skip to contentSkip to conversation

platform/x86: ideapad-laptop: Disable touchpad_switch

PATCH Superseded Manyi Li 2 participants 5 messages Oct 18, 2022 – Nov 7, 2022 x86 platform drivers

lore
Share & tools
lore

Manyi Li

author
#0 lore raw

PATCH 1/1 platform/x86: ideapad-laptop: Disable touchpad_switch

Ideapads for "Lenovo Yoga 3 Pro 1370" and "ZhaoYang K4e-IML" do not use EC to switch touchpad.

Reading VPCCMD_R_TOUCHPAD will return zero thus touchpad may be blocked unexpectedly.

---
 drivers/platform/x86/ideapad-laptop.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/platform/x86/ideapad-laptop.c +19 -0
index abd0c81d62c4..20b8a94934b4 100644
@@ -1533,6 +1533,24 @@ static const struct dmi_system_id hw_rfkill_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;
@@ -1542,6 +1560,7 @@ static void ideapad_check_features(struct ideapad_private *priv)
 
 	/* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */
 	priv->features.touchpad_ctrl_via_ec = !acpi_dev_present("ELAN0634", NULL, -1);
+	priv->features.touchpad_ctrl_via_ec = !dmi_check_system(no_touchpad_switch_list);
 
 	if (!read_ec_data(handle, VPCCMD_R_FAN, &val))
 		priv->features.fan_mode = true;
Signature · 1 line
2.20.1
#1 lore raw

Hi,

Quoted 41 lines · Manyi Li

Ideapads for "Lenovo Yoga 3 Pro 1370" and "ZhaoYang K4e-IML" do not use EC to switch touchpad.

Reading VPCCMD_R_TOUCHPAD will return zero thus touchpad may be blocked unexpectedly.

---
 drivers/platform/x86/ideapad-laptop.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/platform/x86/ideapad-laptop.c +18 -0
index abd0c81d62c4..20b8a94934b4 100644
@@ -1533,6 +1533,24 @@ static const struct dmi_system_id hw_rfkill_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;

drivers/platform/x86/ideapad-laptop.c static void ideapad_check_features(struct ideapad_private *priv) · line 1563

Quoted 4 lines
drivers/platform/x86/ideapad-laptop.c +1 -0
@@ -1542,6 +1560,7 @@ static void ideapad_check_features(struct ideapad_private *priv)
 
 	/* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */
 	priv->features.touchpad_ctrl_via_ec = !acpi_dev_present("ELAN0634", NULL, -1);
+	priv->features.touchpad_ctrl_via_ec = !dmi_check_system(no_touchpad_switch_list);

This needs to be:

	priv->features.touchpad_ctrl_via_ec =
		!acpi_dev_present("ELAN0634", NULL, -1) &&
		!dmi_check_system(no_touchpad_switch_list);

Otherwise you over overriding the results of the ELAN0634 check. Also I wonder if there is not a better way to check for this (for both cases) ?

Is the touchpad on these devices perhaps connected over I2C ? Maybe we need to figure out a way to check for that.

Regards,

Hans

Quoted 3 lines
drivers/platform/x86/ideapad-laptop.c +0 -0
 	if (!read_ec_data(handle, VPCCMD_R_FAN, &val))
 		priv->features.fan_mode = true;
author
#2 lore raw

PATCH v2 1/1 platform/x86: ideapad-laptop: Disable touchpad_switch

Ideapads for "Lenovo Yoga 3 Pro 1370" and "ZhaoYang K4e-IML" do not use EC to switch touchpad.

Reading VPCCMD_R_TOUCHPAD will return zero thus touchpad may be blocked unexpectedly.

---
 drivers/platform/x86/ideapad-laptop.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/platform/x86/ideapad-laptop.c +24 -1
index abd0c81d62c4..33b3dfdd1b08 100644
@@ -1533,6 +1533,24 @@ static const struct dmi_system_id hw_rfkill_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;
@@ -1541,7 +1559,12 @@ static void ideapad_check_features(struct ideapad_private *priv)
 	priv->features.hw_rfkill_switch = dmi_check_system(hw_rfkill_list);
 
 	/* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */
-	priv->features.touchpad_ctrl_via_ec = !acpi_dev_present("ELAN0634", NULL, -1);
+	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;
 
 	if (!read_ec_data(handle, VPCCMD_R_FAN, &val))
 		priv->features.fan_mode = true;
Signature · 1 line
2.20.1
#3 lore raw

Hi Manyi,

Quoted 7 lines · Manyi Li

Ideapads for "Lenovo Yoga 3 Pro 1370" and "ZhaoYang K4e-IML" do not use EC to switch touchpad.

Reading VPCCMD_R_TOUCHPAD will return zero thus touchpad may be blocked unexpectedly.

I have applied this patch for now, since it should be safe to do so as the exceptions added are DMI string based.

But I would really like to see a better fix for this, by for example checking if the touchpad is connected over I2C. Can you run "acpidump -o acpidump.txt" and then send me a private email with the
generated acpidump.txt ? Please do this for both models if possible.

Also I don't entirely understand why this patch is necessary in the first place. You say that the touchpad is connected over I2C; and when priv->features.touchpad_ctrl_via_ec = 1 the following 2 commands are possibly run by the driver:

i8042_command(&param, value ? I8042_CMD_AUX_ENABLE : I8042_CMD_AUX_DISABLE);

        if (!priv->features.touchpad_ctrl_via_ec)
                write_ec_cmd(priv->adev->handle, VPCCMD_W_TOUCHPAD, 1);

Note the second command actually gets enabled by this patch setting priv->features.touchpad_ctrl_via_ec = 0.

What (undesirable) behavior are you seeing without this patch ?

And can you try a kernel without this patch and then comment out the i8042_command() command and see if that helps ?

If that does not help, can you try removing the "if" part of:

        if (!priv->features.touchpad_ctrl_via_ec)
                write_ec_cmd(priv->adev->handle, VPCCMD_W_TOUCHPAD, 1);

So that the write_ec_cmd() happens unconditionally and see if that helps ?

Regards,

Hans

Quoted 47 lines
---
 drivers/platform/x86/ideapad-laptop.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/platform/x86/ideapad-laptop.c +24 -1
index abd0c81d62c4..33b3dfdd1b08 100644
@@ -1533,6 +1533,24 @@ static const struct dmi_system_id hw_rfkill_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;
@@ -1541,7 +1559,12 @@ static void ideapad_check_features(struct ideapad_private *priv)
 	priv->features.hw_rfkill_switch = dmi_check_system(hw_rfkill_list);
 
 	/* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */
-	priv->features.touchpad_ctrl_via_ec = !acpi_dev_present("ELAN0634", NULL, -1);
+	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;
 
 	if (!read_ec_data(handle, VPCCMD_R_FAN, &val))
 		priv->features.fan_mode = true;
author
#4 lore raw
In reply to Hans de Goede
Quoted 55 lines · Hans de Goede

Hi,

Quoted 41 lines · Manyi Li

Ideapads for "Lenovo Yoga 3 Pro 1370" and "ZhaoYang K4e-IML" do not use EC to switch touchpad.

Reading VPCCMD_R_TOUCHPAD will return zero thus touchpad may be blocked unexpectedly.

---
  drivers/platform/x86/ideapad-laptop.c | 19 +++++++++++++++++++
  1 file changed, 19 insertions(+)
drivers/platform/x86/ideapad-laptop.c +18 -0
index abd0c81d62c4..20b8a94934b4 100644
@@ -1533,6 +1533,24 @@ static const struct dmi_system_id hw_rfkill_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;

drivers/platform/x86/ideapad-laptop.c static void ideapad_check_features(struct ideapad_private *priv) · line 1563

Quoted 4 lines
drivers/platform/x86/ideapad-laptop.c +1 -0
@@ -1542,6 +1560,7 @@ static void ideapad_check_features(struct ideapad_private *priv)
 
  	/* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */
  	priv->features.touchpad_ctrl_via_ec = !acpi_dev_present("ELAN0634", NULL, -1);
+	priv->features.touchpad_ctrl_via_ec = !dmi_check_system(no_touchpad_switch_list);

This needs to be:

	priv->features.touchpad_ctrl_via_ec =
		!acpi_dev_present("ELAN0634", NULL, -1) &&
		!dmi_check_system(no_touchpad_switch_list);
Quoted 5 lines

Otherwise you over overriding the results of the ELAN0634 check. Also I wonder if there is not a better way to check for this (for both cases) ?

Is the touchpad on these devices perhaps connected over I2C ? Maybe we need to figure out a way to check for that.

Yes,the touchpad on these devices is connected over I2C.

Quoted 12 lines

Regards,

Hans

Quoted 3 lines
drivers/platform/x86/ideapad-laptop.c +0 -0
  	if (!read_ec_data(handle, VPCCMD_R_FAN, &val))
  		priv->features.fan_mode = true;
Signature · 1 line
Manyi Li