aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2007-02-18 01:40:24 -0500
committerDmitry Torokhov <dtor@insightbb.com>2007-02-18 01:40:24 -0500
commita1cec06177386ecc320af643de11cfa77e8945bd (patch)
tree1c335b711acb5c2f9186da2d08da8b7a7810f755
parent8a03d9a498eaf02c8a118752050a5154852c13bf (diff)
Input: psmouse - properly reset mouse on shutdown/suspend
Some people report that they need psmouse module unloaded for suspend to ram/disk to work properly. Let's make port cleanup behave the same way as driver unload. This fixes "bad state" roblem on various HP laptops, such as nx7400. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/input/mouse/psmouse-base.c28
-rw-r--r--drivers/input/mouse/psmouse.h1
-rw-r--r--drivers/input/mouse/synaptics.c1
3 files changed, 30 insertions, 0 deletions
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index a0e4a033e2db..9a6e4b6bdbf4 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -987,8 +987,36 @@ static void psmouse_resync(struct work_struct *work)
987static void psmouse_cleanup(struct serio *serio) 987static void psmouse_cleanup(struct serio *serio)
988{ 988{
989 struct psmouse *psmouse = serio_get_drvdata(serio); 989 struct psmouse *psmouse = serio_get_drvdata(serio);
990 struct psmouse *parent = NULL;
991
992 mutex_lock(&psmouse_mutex);
993
994 if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) {
995 parent = serio_get_drvdata(serio->parent);
996 psmouse_deactivate(parent);
997 }
998
999 psmouse_deactivate(psmouse);
1000
1001 if (psmouse->cleanup)
1002 psmouse->cleanup(psmouse);
990 1003
991 psmouse_reset(psmouse); 1004 psmouse_reset(psmouse);
1005
1006/*
1007 * Some boxes, such as HP nx7400, get terribly confused if mouse
1008 * is not fully enabled before suspending/shutting down.
1009 */
1010 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE);
1011
1012 if (parent) {
1013 if (parent->pt_deactivate)
1014 parent->pt_deactivate(parent);
1015
1016 psmouse_activate(parent);
1017 }
1018
1019 mutex_unlock(&psmouse_mutex);
992} 1020}
993 1021
994/* 1022/*
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 1b74cae8a556..cf1de95b6f27 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -68,6 +68,7 @@ struct psmouse {
68 68
69 int (*reconnect)(struct psmouse *psmouse); 69 int (*reconnect)(struct psmouse *psmouse);
70 void (*disconnect)(struct psmouse *psmouse); 70 void (*disconnect)(struct psmouse *psmouse);
71 void (*cleanup)(struct psmouse *psmouse);
71 int (*poll)(struct psmouse *psmouse); 72 int (*poll)(struct psmouse *psmouse);
72 73
73 void (*pt_activate)(struct psmouse *psmouse); 74 void (*pt_activate)(struct psmouse *psmouse);
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 49ac696d6cff..f0f9413d762c 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -652,6 +652,7 @@ int synaptics_init(struct psmouse *psmouse)
652 psmouse->set_rate = synaptics_set_rate; 652 psmouse->set_rate = synaptics_set_rate;
653 psmouse->disconnect = synaptics_disconnect; 653 psmouse->disconnect = synaptics_disconnect;
654 psmouse->reconnect = synaptics_reconnect; 654 psmouse->reconnect = synaptics_reconnect;
655 psmouse->cleanup = synaptics_reset;
655 psmouse->pktsize = 6; 656 psmouse->pktsize = 6;
656 /* Synaptics can usually stay in sync without extra help */ 657 /* Synaptics can usually stay in sync without extra help */
657 psmouse->resync_time = 0; 658 psmouse->resync_time = 0;