From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] Input: synaptics: retry query upon error
Date: Tue, 18 Jan 2022 17:28:50 +0100
Message-ID: <s5h35llxb25.wl-tiwai@suse.de>
Patch-mainline: Submitted, linux-input ML
References: bsc#1194086
Some recent laptops such as Lenovo ThinkPad T14 AMD Gen 1 show the
errors at querying synaptics attributes. This results in the driver
falling back to the legacy mode without multi-finger support. It
happens only intermittently at some boots, and it seems that the same
query command seems working fine after retrying.
This patch implements a retry of synaptics_query_hardware() call when
it fails after some delay as a workaround.
Buglink: https://bugzilla.suse.com/show_bug.cgi?id=1194086
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
drivers/input/mouse/synaptics.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index ffad142801b3..0f23fba4c36e 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -416,7 +416,7 @@ static int synaptics_resolution(struct psmouse *psmouse,
return 0;
}
-static int synaptics_query_hardware(struct psmouse *psmouse,
+static int __synaptics_query_hardware(struct psmouse *psmouse,
struct synaptics_device_info *info)
{
int error;
@@ -450,6 +450,21 @@ static int synaptics_query_hardware(struct psmouse *psmouse,
return 0;
}
+static int synaptics_query_hardware(struct psmouse *psmouse,
+ struct synaptics_device_info *info)
+{
+ int err;
+
+ err = __synaptics_query_hardware(psmouse, info);
+ if (err) {
+ psmouse_info(psmouse, "Query error (%d), retrying...\n", err);
+ msleep(100);
+ err = __synaptics_query_hardware(psmouse, info);
+ }
+
+ return err;
+}
+
#endif /* CONFIG_MOUSE_PS2_SYNAPTICS || CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS */
#ifdef CONFIG_MOUSE_PS2_SYNAPTICS
--
2.31.1