From f097bc2d8174d4f5161d1e4741a0a5bd5f63d1a3 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Thu, 25 Apr 2013 14:30:04 -0700 Subject: [PATCH] CHROMIUM: input: mouse - Fix trackpoint re-probe on resume. During suspend, power may be cut to the trackpoint. If so, the trackpoint will automatically begin its power-on diagnostics upon being re-powered. If trackpoint_reconnect is called before the diagnostics complete, the probe ID command will be lost, and reconnect will fail. This will lead to re-probe, which takes several seconds on Stout due to the trackpoint / trackpad pass-through design. The fix here is to make a second attempt if the initial commands on reconnect fail, which should give the trackpoint enough time to come out of power-on diagnostics. TEST=suspend/resume test for 3000 iterations without re-enumeration. BUG=chromium:220389 Change-Id: I1ff8d3accdde86184864915d540b870ed33feee4 Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://gerrit.chromium.org/gerrit/49228 Reviewed-by: Chung-yih Wang --- drivers/input/mouse/trackpoint.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 4c16c5b335fb..62ad2564707b 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c @@ -334,8 +334,14 @@ static void trackpoint_disconnect(struct psmouse *psmouse) static int trackpoint_reconnect(struct psmouse *psmouse) { int reset_fail; + int ret; + int tries = 2; - if (trackpoint_start_protocol(psmouse, NULL)) + do { + ret = trackpoint_start_protocol(psmouse, NULL); + } while (ret != 0 && --tries > 0); + + if (ret != 0) return -1; reset_fail = trackpoint_power_on_reset(&psmouse->ps2dev); -- 2.20.1