diff mbox

Reset ps/2 port should psmouse_probe fail before retrying

Message ID 1272769662.3315.36.camel@lovely (mailing list archive)
State Accepted
Headers show

Commit Message

Christoph Fritz May 2, 2010, 3:07 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index d8c0c8d..5e726df 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -597,7 +597,6 @@  static int cortron_detect(struct psmouse *psmouse, bool set_properties)
 static int psmouse_extensions(struct psmouse *psmouse,
 			      unsigned int max_proto, bool set_properties)
 {
-	bool synaptics_hardware = false;
 
 /*
  * We always check for lifebook because it does not disturb mouse
@@ -621,10 +620,10 @@  static int psmouse_extensions(struct psmouse *psmouse,
 /*
  * Try Synaptics TouchPad. Note that probing is done even if Synaptics protocol
  * support is disabled in config - we need to know if it is synaptics so we
- * can reset it properly after probing for intellimouse.
+ * can reset it properly at reconnect and after probing for intellimouse.
  */
 	if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse, set_properties) == 0) {
-		synaptics_hardware = true;
+		psmouse->model = PSMOUSE_MODEL_NEEDRESET;
 
 		if (max_proto > PSMOUSE_IMEX) {
 /*
@@ -740,7 +739,7 @@  static int psmouse_extensions(struct psmouse *psmouse,
  */
 	ps2bare_detect(psmouse, set_properties);
 
-	if (synaptics_hardware) {
+	if (psmouse->model == PSMOUSE_MODEL_NEEDRESET) {
 /*
  * We detected Synaptics hardware but it did not respond to IMPS/2 probes.
  * We need to reset the touchpad because if there is a track point on the
@@ -1401,10 +1400,14 @@  static int psmouse_reconnect(struct serio *serio)
 	if (psmouse->reconnect) {
 		if (psmouse->reconnect(psmouse))
 			goto out;
-	} else if (psmouse_probe(psmouse) < 0 ||
+	} else {
+		if (psmouse->model == PSMOUSE_MODEL_NEEDRESET)
+			psmouse_reset(psmouse);
+		if (psmouse_probe(psmouse) < 0 ||
 		   psmouse->type != psmouse_extensions(psmouse,
 						psmouse_max_proto, false)) {
-		goto out;
+			goto out;
+		}
 	}
 
 	/* ok, the device type (and capabilities) match the old one,
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index e053bdd..c45b5ef 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -20,6 +20,9 @@ 
 #define PSMOUSE_RET_ACK		0xfa
 #define PSMOUSE_RET_NAK		0xfe
 
+#define PSMOUSE_MODEL_UNKNOWN		0x00
+#define PSMOUSE_MODEL_NEEDRESET	0x01
+
 enum psmouse_state {
 	PSMOUSE_IGNORE,
 	PSMOUSE_INITIALIZING,