summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@debian.org>2008-07-31 13:06:33 -0400
committerDeepak Saxena <dsaxena@laptop.org>2008-08-13 12:26:26 -0700
commitcc866cfe0c31220bd03a44e6c5d9e86decd63aaa (patch)
tree20236281bf21f261975e70fd4d8b0bf00fb0035a
parent9b42ff8eb9564f72d12f64af100e17be8a0ee395 (diff)
downloadlwn-cc866cfe0c31220bd03a44e6c5d9e86decd63aaa.tar.gz
lwn-cc866cfe0c31220bd03a44e6c5d9e86decd63aaa.zip
OLPC: psmouse: don't race with irq/resync handlers when recalibrating
I was seeing a race with irq and resync handlers that sometimes caused commands to fail. In particularly bad cases, it would cause the keyboard to stop working. Hopefully this fixes it. Signed-off-by: Andres Salomon <dilinger@debian.org>
-rw-r--r--drivers/input/mouse/olpc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/input/mouse/olpc.c b/drivers/input/mouse/olpc.c
index f1b6ebafbfe2..d65d8015c7bd 100644
--- a/drivers/input/mouse/olpc.c
+++ b/drivers/input/mouse/olpc.c
@@ -205,6 +205,9 @@ static int hgpk_force_recalibrate(struct psmouse *psmouse)
/* C-series touchpads added the recalibrate command */
if (psmouse->model < HGPK_MODEL_C)
return 0;
+
+ /* we don't want to race with the irq handler, nor with resyncs */
+ psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
/* start by resetting the device */
psmouse_reset(psmouse);
@@ -229,6 +232,8 @@ static int hgpk_force_recalibrate(struct psmouse *psmouse)
if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE))
return -1;
+ psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
+
/*
* After we recalibrate, we shouldn't get any packets for 2s. If
* we do, it's likely that someone's finger was on the touchpad.