mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aaron Ma <aaron.ma@canonical.com>
To: aaron.ma@canonical.com, dmitry.torokhov@gmail.com,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Input: psmouse - disable non-wakeup armed PS/2 mouse when s2dile
Date: Wed, 11 Aug 2021 11:50:25 +0800	[thread overview]
Message-ID: <20210811035025.44773-1-aaron.ma@canonical.com> (raw)

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


                 reply	other threads:[~2021-08-11  3:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210811035025.44773-1-aaron.ma@canonical.com \
    --to=aaron.ma@canonical.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®