From: Matthew Schwartz <matthew.schwartz@linux.dev>
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Matthew Schwartz <matthew.schwartz@linux.dev>
Subject: [PATCH 1/2] Input: i8042 - Add nokbdwakeup quirk to stop keyboard wakeup from s2idle
Date: Mon, 16 Jun 2025 22:19:29 -0700 [thread overview]
Message-ID: <20250617051930.3376981-2-matthew.schwartz@linux.dev> (raw)
In-Reply-To: <20250617051930.3376981-1-matthew.schwartz@linux.dev>
Some platforms will register volume buttons via an i8042 keyboard device,
even though they lack a physical keyboard or lid like a traditional laptop.
In such cases, allowing the i8042 keyboard to wake the device from s2idle
may not be desirable behavior.
In order to account for this, add a new quirk, nokbdwakeup, to disable
the keyboard wakeup functionality in i8042 on such platforms.
Signed-off-by: Matthew Schwartz <matthew.schwartz@linux.dev>
---
drivers/input/serio/i8042-acpipnpio.h | 8 ++++++--
drivers/input/serio/i8042.c | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h
index 6ed9fc34948cb..6dbe9d8523f49 100644
--- a/drivers/input/serio/i8042-acpipnpio.h
+++ b/drivers/input/serio/i8042-acpipnpio.h
@@ -84,6 +84,7 @@ static inline void i8042_write_command(int val)
#define SERIO_QUIRK_DRITEK BIT(13)
#define SERIO_QUIRK_NOPNP BIT(14)
#define SERIO_QUIRK_FORCENORESTORE BIT(15)
+#define SERIO_QUIRK_NOKBDWAKEUP BIT(16)
/* Quirk table for different mainboards. Options similar or identical to i8042
* module parameters.
@@ -1725,6 +1726,8 @@ static void __init i8042_check_quirks(void)
#endif
if (quirks & SERIO_QUIRK_FORCENORESTORE)
i8042_forcenorestore = true;
+ if (quirks & SERIO_QUIRK_NOKBDWAKEUP)
+ i8042_nokbdwakeup = true;
}
#else
static inline void i8042_check_quirks(void) {}
@@ -1758,7 +1761,7 @@ static int __init i8042_platform_init(void)
i8042_check_quirks();
- pr_debug("Active quirks (empty means none):%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ pr_debug("Active quirks (empty means none):%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
i8042_nokbd ? " nokbd" : "",
i8042_noaux ? " noaux" : "",
i8042_nomux ? " nomux" : "",
@@ -1782,7 +1785,8 @@ static int __init i8042_platform_init(void)
#else
"",
#endif
- i8042_forcenorestore ? " forcenorestore" : "");
+ i8042_forcenorestore ? " forcenorestore" : "",
+ i8042_nokbdwakeup ? " nokbdwakeup" : "");
retval = i8042_pnp_init();
if (retval)
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index cab5a4c5baf52..056a83cb69d66 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -49,6 +49,10 @@ static bool i8042_probe_defer;
module_param_named(probe_defer, i8042_probe_defer, bool, 0);
MODULE_PARM_DESC(probe_defer, "Allow deferred probing.");
+static bool i8042_nokbdwakeup;
+module_param_named(nokbdwakeup, i8042_nokbdwakeup, bool, 0);
+MODULE_PARM_DESC(nokbdwakeup, "Disable keyboard port from waking up the system.");
+
enum i8042_controller_reset_mode {
I8042_RESET_NEVER,
I8042_RESET_ALWAYS,
@@ -423,13 +427,13 @@ static int i8042_start(struct serio *serio)
/*
* On platforms using suspend-to-idle, allow the keyboard to
* wake up the system from sleep by enabling keyboard wakeups
- * by default. This is consistent with keyboard wakeup
+ * by default unless quirked. This is consistent with keyboard wakeup
* behavior on many platforms using suspend-to-RAM (ACPI S3)
* by default.
*/
if (pm_suspend_default_s2idle() &&
serio == i8042_ports[I8042_KBD_PORT_NO].serio) {
- device_set_wakeup_enable(&serio->dev, true);
+ device_set_wakeup_enable(&serio->dev, !i8042_nokbdwakeup);
}
guard(spinlock_irq)(&i8042_lock);
--
2.49.0
next prev parent reply other threads:[~2025-06-17 5:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 5:19 [PATCH 0/2] Add nokbdwakeup quirk and enable it for MSI Claw Matthew Schwartz
2025-06-17 5:19 ` Matthew Schwartz [this message]
2025-06-17 5:19 ` [PATCH 2/2] Input: i8042 - Disable keyboard wakeup from s2idle on MSI Claw devices Matthew Schwartz
2025-06-17 20:50 ` [PATCH 0/2] Add nokbdwakeup quirk and enable it for MSI Claw Dmitry Torokhov
2025-06-17 21:33 ` Matthew Schwartz
2025-06-17 21:45 ` Dmitry Torokhov
2025-06-17 21:50 ` Matthew Schwartz
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=20250617051930.3376981-2-matthew.schwartz@linux.dev \
--to=matthew.schwartz@linux.dev \
--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;
as well as URLs for NNTP newsgroup(s).