platform/x86: ideapad-laptop: Disable touchpad_switch

Message ID 20221018061457.26937-1-limanyi@uniontech.com
State New
Headers
Series platform/x86: ideapad-laptop: Disable touchpad_switch |

Commit Message

Manyi Li Oct. 18, 2022, 6:14 a.m. UTC
  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.

Signed-off-by: Manyi Li <limanyi@uniontech.com>
---
 drivers/platform/x86/ideapad-laptop.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
  

Comments

Hans de Goede Oct. 18, 2022, 7:48 a.m. UTC | #1
Hi,

On 10/18/22 08:14, Manyi Li wrote:
> 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.
> 
> Signed-off-by: Manyi Li <limanyi@uniontech.com>
> ---
>  drivers/platform/x86/ideapad-laptop.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
> index abd0c81d62c4..20b8a94934b4 100644
> --- a/drivers/platform/x86/ideapad-laptop.c
> +++ b/drivers/platform/x86/ideapad-laptop.c
> @@ -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);

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



>  
>  	if (!read_ec_data(handle, VPCCMD_R_FAN, &val))
>  		priv->features.fan_mode = true;
  
Manyi Li Oct. 18, 2022, 10:09 a.m. UTC | #2
在 2022/10/18 15:48, Hans de Goede 写道:
> Hi,
> 
> On 10/18/22 08:14, Manyi Li wrote:
>> 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.
>>
>> Signed-off-by: Manyi Li <limanyi@uniontech.com>
>> ---
>>   drivers/platform/x86/ideapad-laptop.c | 19 +++++++++++++++++++
>>   1 file changed, 19 insertions(+)
>>
>> diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
>> index abd0c81d62c4..20b8a94934b4 100644
>> --- a/drivers/platform/x86/ideapad-laptop.c
>> +++ b/drivers/platform/x86/ideapad-laptop.c
>> @@ -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);
> 
> 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.

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

> 
> Regards,
> 
> Hans
> 
> 
> 
>>   
>>   	if (!read_ec_data(handle, VPCCMD_R_FAN, &val))
>>   		priv->features.fan_mode = true;
> 
>
  

Patch

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index abd0c81d62c4..20b8a94934b4 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -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;