* [PATCH fixes v4] platform/x86: ideapad-laptop: Disable touchpad_switch for ELAN0634
@ 2021-01-07 14:44 Jiaxun Yang
2021-01-13 9:24 ` Hans de Goede
0 siblings, 1 reply; 2+ messages in thread
From: Jiaxun Yang @ 2021-01-07 14:44 UTC (permalink / raw)
To: platform-driver-x86
Cc: Jiaxun Yang, stable, Ike Panhc, Hans de Goede, Mark Gross, linux-kernel
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)
---
drivers/platform/x86/ideapad-laptop.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 7598cd46cf60..5b81bafa5c16 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -92,6 +92,7 @@ struct ideapad_private {
struct dentry *debug;
unsigned long cfg;
bool has_hw_rfkill_switch;
+ bool has_touchpad_switch;
const char *fnesc_guid;
};
@@ -535,7 +536,9 @@ static umode_t ideapad_is_visible(struct kobject *kobj,
} else if (attr == &dev_attr_fn_lock.attr) {
supported = acpi_has_method(priv->adev->handle, "HALS") &&
acpi_has_method(priv->adev->handle, "SALS");
- } else
+ } else if (attr == &dev_attr_touchpad.attr)
+ supported = priv->has_touchpad_switch;
+ else
supported = true;
return supported ? attr->mode : 0;
@@ -867,6 +870,9 @@ static void ideapad_sync_touchpad_state(struct ideapad_private *priv)
{
unsigned long value;
+ if (!priv->has_touchpad_switch)
+ return;
+
/* Without reading from EC touchpad LED doesn't switch state */
if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) {
/* Some IdeaPads don't really turn off touchpad - they only
@@ -989,6 +995,9 @@ static int ideapad_acpi_add(struct platform_device *pdev)
priv->platform_device = pdev;
priv->has_hw_rfkill_switch = dmi_check_system(hw_rfkill_list);
+ /* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */
+ priv->has_touchpad_switch = !acpi_dev_present("ELAN0634", NULL, -1);
+
ret = ideapad_sysfs_init(priv);
if (ret)
return ret;
@@ -1006,6 +1015,10 @@ static int ideapad_acpi_add(struct platform_device *pdev)
if (!priv->has_hw_rfkill_switch)
write_ec_cmd(priv->adev->handle, VPCCMD_W_RF, 1);
+ /* The same for Touchpad */
+ if (!priv->has_touchpad_switch)
+ write_ec_cmd(priv->adev->handle, VPCCMD_W_TOUCHPAD, 1);
+
for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg))
ideapad_register_rfkill(priv, i);
--
2.30.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH fixes v4] platform/x86: ideapad-laptop: Disable touchpad_switch for ELAN0634
2021-01-07 14:44 [PATCH fixes v4] platform/x86: ideapad-laptop: Disable touchpad_switch for ELAN0634 Jiaxun Yang
@ 2021-01-13 9:24 ` Hans de Goede
0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2021-01-13 9:24 UTC (permalink / raw)
To: Jiaxun Yang, platform-driver-x86
Cc: stable, Ike Panhc, Mark Gross, linux-kernel
Hi,
On 1/7/21 3:44 PM, Jiaxun Yang wrote:
> 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+
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
I will also cherry-pick this into the fixes branch and include
it in a future fixes pull-req for 5.11 .
Regards,
Hans
> --
> v2: Specify touchpad to ELAN0634
> v3: Stupid missing ! in v2
> v4: Correct acpi_dev_present usage (Hans)
> ---
> drivers/platform/x86/ideapad-laptop.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
> index 7598cd46cf60..5b81bafa5c16 100644
> --- a/drivers/platform/x86/ideapad-laptop.c
> +++ b/drivers/platform/x86/ideapad-laptop.c
> @@ -92,6 +92,7 @@ struct ideapad_private {
> struct dentry *debug;
> unsigned long cfg;
> bool has_hw_rfkill_switch;
> + bool has_touchpad_switch;
> const char *fnesc_guid;
> };
>
> @@ -535,7 +536,9 @@ static umode_t ideapad_is_visible(struct kobject *kobj,
> } else if (attr == &dev_attr_fn_lock.attr) {
> supported = acpi_has_method(priv->adev->handle, "HALS") &&
> acpi_has_method(priv->adev->handle, "SALS");
> - } else
> + } else if (attr == &dev_attr_touchpad.attr)
> + supported = priv->has_touchpad_switch;
> + else
> supported = true;
>
> return supported ? attr->mode : 0;
> @@ -867,6 +870,9 @@ static void ideapad_sync_touchpad_state(struct ideapad_private *priv)
> {
> unsigned long value;
>
> + if (!priv->has_touchpad_switch)
> + return;
> +
> /* Without reading from EC touchpad LED doesn't switch state */
> if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) {
> /* Some IdeaPads don't really turn off touchpad - they only
> @@ -989,6 +995,9 @@ static int ideapad_acpi_add(struct platform_device *pdev)
> priv->platform_device = pdev;
> priv->has_hw_rfkill_switch = dmi_check_system(hw_rfkill_list);
>
> + /* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */
> + priv->has_touchpad_switch = !acpi_dev_present("ELAN0634", NULL, -1);
> +
> ret = ideapad_sysfs_init(priv);
> if (ret)
> return ret;
> @@ -1006,6 +1015,10 @@ static int ideapad_acpi_add(struct platform_device *pdev)
> if (!priv->has_hw_rfkill_switch)
> write_ec_cmd(priv->adev->handle, VPCCMD_W_RF, 1);
>
> + /* The same for Touchpad */
> + if (!priv->has_touchpad_switch)
> + write_ec_cmd(priv->adev->handle, VPCCMD_W_TOUCHPAD, 1);
> +
> for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
> if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg))
> ideapad_register_rfkill(priv, i);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-13 9:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 14:44 [PATCH fixes v4] platform/x86: ideapad-laptop: Disable touchpad_switch for ELAN0634 Jiaxun Yang
2021-01-13 9:24 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).