diff mbox series

Input: synaptics: retry query upon error

Message ID s5h35llxb25.wl-tiwai@suse.de
State New
Headers show
Series Input: synaptics: retry query upon error | expand

Commit Message

Takashi Iwai Jan. 18, 2022, 4:28 p.m. UTC
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 after
some delay when it fails as a workaround.

BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1194086
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---

It's rather an RFC, as I'm not sure whether it's the best way to fix
the problem.  At least, the retry of query seems working reliably, as
well as re-binding via sysfs.  And, I have no idea in which condition
this happens; it might be a flaky BIOS issue, of course :)

Above all, the device should have been connected via SMBUS.  But the
binding with SMBUS fails, so some other pieces are missing.  Maybe the
support with psmouse is suboptimal in anyway, but it's currently the
only way to make it working.

Any suggestions are appreciated.


thanks,

Takashi


 drivers/input/mouse/synaptics.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
diff mbox series

Patch

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