mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Input: psmouse - disable non-wakeup armed PS/2 mouse when s2dile
@ 2021-08-11  3:50 Aaron Ma
  0 siblings, 0 replies; only message in thread
From: Aaron Ma @ 2021-08-11  3:50 UTC (permalink / raw)
  To: aaron.ma, dmitry.torokhov, linux-input, linux-kernel

After commit 684bec1092b6 ("Input: i8042 - enable keyboard wakeups by
default when s2idle is used"), kdb is enabled to wakeup laptops.
Kbd fails to wakeup when touchpad/trackpoint is used on ThinkPad.
The touchpad is not set to wakeup, and it shares buffer with kbd.
Send disable command to PS/2 mouse when s2idle, make it clean for
kdb to wakeup.
Enable PS/2 mouse when wakeup enabled.

Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
---
 drivers/input/mouse/psmouse-base.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 0b4a3039f312..85dc9810d6ec 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -21,6 +21,7 @@
 #include <linux/libps2.h>
 #include <linux/mutex.h>
 #include <linux/types.h>
+#include <linux/suspend.h>
 
 #include "psmouse.h"
 #include "synaptics.h"
@@ -1457,11 +1458,13 @@ static void psmouse_cleanup(struct serio *serio)
 	 */
 	ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
 
-	/*
-	 * Some boxes, such as HP nx7400, get terribly confused if mouse
-	 * is not fully enabled before suspending/shutting down.
-	 */
-	ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE);
+	if (!pm_suspend_default_s2idle() || device_may_wakeup(&serio->dev)) {
+		/*
+		 * Some boxes, such as HP nx7400, get terribly confused if mouse
+		 * is not fully enabled before suspending/shutting down.
+		 */
+		ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE);
+	}
 
 	if (parent) {
 		if (parent->pt_deactivate)
-- 
2.30.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-11  3:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11  3:50 [PATCH] Input: psmouse - disable non-wakeup armed PS/2 mouse when s2dile Aaron Ma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®