Patchwork [Quantal] UBUNTU: SAUCE: input: fix weird issue of synaptics psmouse sync lost after resume

login
register
mail settings
Submitter James M. Leddy
Date Oct. 3, 2012, 10:20 p.m.
Message ID <1349302856-10769-1-git-send-email-james.leddy@canonical.com>
Download mbox | patch
Permalink /patch/188943/
State New
Headers show

Comments

James M. Leddy - Oct. 3, 2012, 10:20 p.m.
From: Eric Miao <eric.miao@canonical.com>

This patch has already been sent upstream by Eric. Unfortunately,
after a little back and forth between Eric and Dmitry Torokhov, the
patch did get included, and there is still an open question to Dmitry.

However, this is a known issue on at least 4 systems, and it causes
them to lose their mouse device on suspend. So I was hoping we could
get it in to quantal. Original email follows:

So in summary, the symptom is intermittent key events lost after resume
on some machines with synaptics touchpad (seems this is synaptics _only_),
and key events loss is due to serio port reconnect after psmouse sync lost.
Removing psmouse and inserting it back during the suspend/resume process
is able to work around the issue, so the difference between psmouse_connect()
and psmouse_reconnect() is the key to the root cause of this problem.

After comparing the two different paths, synaptics driver has its own
implementation of synaptics_reconnect(), and the missing psmouse_probe()
seems significant, the patch below added psmouse_probe() to the reconnect
process, and has been verified many times that the issue could not be reliably
reproduced.

There are two PS/2 commands in psmouse_probe():

  1. PSMOUSE_CMD_GETID
  2. PSMOUSE_CMD_RESET_DIS

The weird thing is, the PSMOUSE_CMD_GETID seems to be significant, and the
PSMOUSE_CMD_RESET_DIS is irrelevant to this issue after trying several times.
Now it's rather difficult to form a sane theory. So this patch is
really for RFC.
Note it does fix a real problem though.

BugLink: https://bugs.launchpad.net/bugs/717970
http://thread.gmane.org/gmane.linux.kernel.input/25599
Signed-off-by: James M Leddy <james.leddy@canonical.com>
---
 drivers/input/mouse/synaptics.c |    2 ++
 1 file changed, 2 insertions(+)
James M. Leddy - Oct. 3, 2012, 10:23 p.m.
On 10/03/2012 06:20 PM, James M Leddy wrote:

> patch did get included, and there is still an open question to Dmitry.

Should read "did _not_ get included"
Tim Gardner - Oct. 4, 2012, 2:07 p.m.
On 10/03/2012 04:20 PM, James M Leddy wrote:
> From: Eric Miao <eric.miao@canonical.com>
> 
> This patch has already been sent upstream by Eric. Unfortunately,
> after a little back and forth between Eric and Dmitry Torokhov, the
> patch did get included, and there is still an open question to Dmitry.
> 
> However, this is a known issue on at least 4 systems, and it causes
> them to lose their mouse device on suspend. So I was hoping we could
> get it in to quantal. Original email follows:
> 
> So in summary, the symptom is intermittent key events lost after resume
> on some machines with synaptics touchpad (seems this is synaptics _only_),
> and key events loss is due to serio port reconnect after psmouse sync lost.
> Removing psmouse and inserting it back during the suspend/resume process
> is able to work around the issue, so the difference between psmouse_connect()
> and psmouse_reconnect() is the key to the root cause of this problem.
> 
> After comparing the two different paths, synaptics driver has its own
> implementation of synaptics_reconnect(), and the missing psmouse_probe()
> seems significant, the patch below added psmouse_probe() to the reconnect
> process, and has been verified many times that the issue could not be reliably
> reproduced.
> 
> There are two PS/2 commands in psmouse_probe():
> 
>   1. PSMOUSE_CMD_GETID
>   2. PSMOUSE_CMD_RESET_DIS
> 
> The weird thing is, the PSMOUSE_CMD_GETID seems to be significant, and the
> PSMOUSE_CMD_RESET_DIS is irrelevant to this issue after trying several times.
> Now it's rather difficult to form a sane theory. So this patch is
> really for RFC.
> Note it does fix a real problem though.
> 
> BugLink: https://bugs.launchpad.net/bugs/717970
> http://thread.gmane.org/gmane.linux.kernel.input/25599
> Signed-off-by: James M Leddy <james.leddy@canonical.com>
> ---
>  drivers/input/mouse/synaptics.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index ab6d145..44690b0 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -1324,6 +1324,7 @@ static int synaptics_reconnect(struct psmouse *psmouse)
>  {
>  	struct synaptics_data *priv = psmouse->private;
>  	struct synaptics_data old_priv = *priv;
> +	unsigned char param[2];
>  	int retry = 0;
>  	int error;
>  
> @@ -1339,6 +1340,7 @@ static int synaptics_reconnect(struct psmouse *psmouse)
>  			 */
>  			ssleep(1);
>  		}
> +		ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETID);
>  		error = synaptics_detect(psmouse, 0);
>  	} while (error && ++retry < 3);
>  
> 

Seems harmless.
Seth Forshee - Oct. 4, 2012, 2:19 p.m.

Tim Gardner - Oct. 5, 2012, 5:30 p.m.
Applied to quantal, precise, and oneiric

Patch

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index ab6d145..44690b0 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -1324,6 +1324,7 @@  static int synaptics_reconnect(struct psmouse *psmouse)
 {
 	struct synaptics_data *priv = psmouse->private;
 	struct synaptics_data old_priv = *priv;
+	unsigned char param[2];
 	int retry = 0;
 	int error;
 
@@ -1339,6 +1340,7 @@  static int synaptics_reconnect(struct psmouse *psmouse)
 			 */
 			ssleep(1);
 		}
+		ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETID);
 		error = synaptics_detect(psmouse, 0);
 	} while (error && ++retry < 3);