* [PATCH 0/2] Add nokbdwakeup quirk and enable it for MSI Claw
@ 2025-06-17 5:19 Matthew Schwartz
2025-06-17 5:19 ` [PATCH 1/2] Input: i8042 - Add nokbdwakeup quirk to stop keyboard wakeup from s2idle Matthew Schwartz
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Matthew Schwartz @ 2025-06-17 5:19 UTC (permalink / raw)
To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Matthew Schwartz
This patch series aims to solve an issue on the MSI Claw, a series of
handheld gaming PCs, where their volume buttons will wake the system out
of s2idle because they are registered via an i8042 keyboard device. This
is not expected behavior on a handheld device that lacks an actual
keyboard, as it is very easy to press the volume buttons while handling
the device in its suspended state.
To solve this, introduce a new quirk based on DMI match that will disable
the wakeup property of an i8042 keyboard device and enable it for current
MSI Claw models.
Matthew Schwartz (2):
Input: i8042 - Add nokbdwakeup quirk to stop keyboard wakeup from
s2idle
Input: i8042 - Disable keyboard wakeup from s2idle on MSI Claw devices
drivers/input/serio/i8042-acpipnpio.h | 32 +++++++++++++++++++++++++--
drivers/input/serio/i8042.c | 8 +++++--
2 files changed, 36 insertions(+), 4 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] Input: i8042 - Add nokbdwakeup quirk to stop keyboard wakeup from s2idle
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
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
2 siblings, 0 replies; 7+ messages in thread
From: Matthew Schwartz @ 2025-06-17 5:19 UTC (permalink / raw)
To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Matthew Schwartz
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] Input: i8042 - Disable keyboard wakeup from s2idle on MSI Claw devices
2025-06-17 5:19 [PATCH 0/2] Add nokbdwakeup quirk and enable it for MSI Claw Matthew Schwartz
2025-06-17 5:19 ` [PATCH 1/2] Input: i8042 - Add nokbdwakeup quirk to stop keyboard wakeup from s2idle Matthew Schwartz
@ 2025-06-17 5:19 ` Matthew Schwartz
2025-06-17 20:50 ` [PATCH 0/2] Add nokbdwakeup quirk and enable it for MSI Claw Dmitry Torokhov
2 siblings, 0 replies; 7+ messages in thread
From: Matthew Schwartz @ 2025-06-17 5:19 UTC (permalink / raw)
To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Matthew Schwartz
On MSI Claw handheld gaming PCs, the volume buttons are considered a part
of an i8042 keyboard device and can wake the system from s2idle. This is
not expected behavior on a handheld gaming device, as the volume buttons
can easily be pressed while handling the device in its s2idle state.
To avoid this behavior, enable the SERIO_QUIRK_NOKBDWAKEUP quirk for all
current MSI Claw models to disallow wakeup via the i8042 keyboard device
while maintaining volume button functionality.
Signed-off-by: Matthew Schwartz <matthew.schwartz@linux.dev>
---
drivers/input/serio/i8042-acpipnpio.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h
index 6dbe9d8523f49..c1874a309c69b 100644
--- a/drivers/input/serio/i8042-acpipnpio.h
+++ b/drivers/input/serio/i8042-acpipnpio.h
@@ -897,6 +897,30 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = {
},
.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
},
+ {
+ /* MSI Claw A1M */
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Micro-Star International Co., Ltd."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Claw A1M"),
+ },
+ .driver_data = (void *)(SERIO_QUIRK_NOKBDWAKEUP)
+ },
+ {
+ /* MSI Claw 7 AI+ A2VM */
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Micro-Star International Co., Ltd."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Claw 7 AI+ A2VM"),
+ },
+ .driver_data = (void *)(SERIO_QUIRK_NOKBDWAKEUP)
+ },
+ {
+ /* MSI Claw 8 AI+ A2VM */
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Micro-Star International Co., Ltd."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Claw 8 AI+ A2VM"),
+ },
+ .driver_data = (void *)(SERIO_QUIRK_NOKBDWAKEUP)
+ },
{
/* MSI Wind U-100 */
.matches = {
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Add nokbdwakeup quirk and enable it for MSI Claw
2025-06-17 5:19 [PATCH 0/2] Add nokbdwakeup quirk and enable it for MSI Claw Matthew Schwartz
2025-06-17 5:19 ` [PATCH 1/2] Input: i8042 - Add nokbdwakeup quirk to stop keyboard wakeup from s2idle Matthew Schwartz
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 ` Dmitry Torokhov
2025-06-17 21:33 ` Matthew Schwartz
2 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2025-06-17 20:50 UTC (permalink / raw)
To: Matthew Schwartz; +Cc: linux-input, linux-kernel
Hi Matthew,
On Mon, Jun 16, 2025 at 10:19:28PM -0700, Matthew Schwartz wrote:
> This patch series aims to solve an issue on the MSI Claw, a series of
> handheld gaming PCs, where their volume buttons will wake the system out
> of s2idle because they are registered via an i8042 keyboard device. This
> is not expected behavior on a handheld device that lacks an actual
> keyboard, as it is very easy to press the volume buttons while handling
> the device in its suspended state.
>
> To solve this, introduce a new quirk based on DMI match that will disable
> the wakeup property of an i8042 keyboard device and enable it for current
> MSI Claw models.
Why does this need to be done in kernel instead of having a udev rule
to toggle this through sysfs:
/sys/devices/platform/i8042/serio0/power/wakeup
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Add nokbdwakeup quirk and enable it for MSI Claw
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
0 siblings, 1 reply; 7+ messages in thread
From: Matthew Schwartz @ 2025-06-17 21:33 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
> On Jun 17, 2025, at 1:50 PM, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
>
> Hi Matthew,
>
> On Mon, Jun 16, 2025 at 10:19:28PM -0700, Matthew Schwartz wrote:
>> This patch series aims to solve an issue on the MSI Claw, a series of
>> handheld gaming PCs, where their volume buttons will wake the system out
>> of s2idle because they are registered via an i8042 keyboard device. This
>> is not expected behavior on a handheld device that lacks an actual
>> keyboard, as it is very easy to press the volume buttons while handling
>> the device in its suspended state.
>>
>> To solve this, introduce a new quirk based on DMI match that will disable
>> the wakeup property of an i8042 keyboard device and enable it for current
>> MSI Claw models.
>
> Why does this need to be done in kernel instead of having a udev rule
> to toggle this through sysfs:
>
> /sys/devices/platform/i8042/serio0/power/wakeup
>
> Thanks.
Yes this would work, but it would also mean relying on individual distros to discover such a udev rule is necessary and figure out how to ship this as a device specific workaround within userspace such that it won’t apply to other devices that do want to maintain i8042 keyboard wakeup functionality. I will investigate implementing this via udev in some sort of packaged fashion, but a kernel quirk seemed like the better option here in my opinion, especially because a quirk system is already in place for i8042 within the kernel.
>
> --
> Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Add nokbdwakeup quirk and enable it for MSI Claw
2025-06-17 21:33 ` Matthew Schwartz
@ 2025-06-17 21:45 ` Dmitry Torokhov
2025-06-17 21:50 ` Matthew Schwartz
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2025-06-17 21:45 UTC (permalink / raw)
To: Matthew Schwartz; +Cc: linux-input, linux-kernel
On Tue, Jun 17, 2025 at 02:33:34PM -0700, Matthew Schwartz wrote:
>
>
> > On Jun 17, 2025, at 1:50 PM, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> >
> > Hi Matthew,
> >
> > On Mon, Jun 16, 2025 at 10:19:28PM -0700, Matthew Schwartz wrote:
> >> This patch series aims to solve an issue on the MSI Claw, a series of
> >> handheld gaming PCs, where their volume buttons will wake the system out
> >> of s2idle because they are registered via an i8042 keyboard device. This
> >> is not expected behavior on a handheld device that lacks an actual
> >> keyboard, as it is very easy to press the volume buttons while handling
> >> the device in its suspended state.
> >>
> >> To solve this, introduce a new quirk based on DMI match that will disable
> >> the wakeup property of an i8042 keyboard device and enable it for current
> >> MSI Claw models.
> >
> > Why does this need to be done in kernel instead of having a udev rule
> > to toggle this through sysfs:
> >
> > /sys/devices/platform/i8042/serio0/power/wakeup
> >
> > Thanks.
>
> Yes this would work, but it would also mean relying on individual
> distros to discover such a udev rule is necessary and figure out how
> to ship this as a device specific workaround within userspace such
> that it won’t apply to other devices that do want to maintain i8042
> keyboard wakeup functionality.
If you submit the rule to systemd repository then distributions will
get it when they update to the new systemd release. Very similar to the
kernel.
> I will investigate implementing this
> via udev in some sort of packaged fashion, but a kernel quirk seemed
> like the better option here in my opinion, especially because a quirk
> system is already in place for i8042 within the kernel.
>
Quirks in the kernel should be used when they are needed for booting.
When configuration can be delayed to [early] userspace then we should
try to use userspace solutions. This way we are not wasting unswappable
kernel memory.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Add nokbdwakeup quirk and enable it for MSI Claw
2025-06-17 21:45 ` Dmitry Torokhov
@ 2025-06-17 21:50 ` Matthew Schwartz
0 siblings, 0 replies; 7+ messages in thread
From: Matthew Schwartz @ 2025-06-17 21:50 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
> On Jun 17, 2025, at 2:45 PM, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
>
> On Tue, Jun 17, 2025 at 02:33:34PM -0700, Matthew Schwartz wrote:
>>
>>
>>> On Jun 17, 2025, at 1:50 PM, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
>>>
>>> Hi Matthew,
>>>
>>> On Mon, Jun 16, 2025 at 10:19:28PM -0700, Matthew Schwartz wrote:
>>>> This patch series aims to solve an issue on the MSI Claw, a series of
>>>> handheld gaming PCs, where their volume buttons will wake the system out
>>>> of s2idle because they are registered via an i8042 keyboard device. This
>>>> is not expected behavior on a handheld device that lacks an actual
>>>> keyboard, as it is very easy to press the volume buttons while handling
>>>> the device in its suspended state.
>>>>
>>>> To solve this, introduce a new quirk based on DMI match that will disable
>>>> the wakeup property of an i8042 keyboard device and enable it for current
>>>> MSI Claw models.
>>>
>>> Why does this need to be done in kernel instead of having a udev rule
>>> to toggle this through sysfs:
>>>
>>> /sys/devices/platform/i8042/serio0/power/wakeup
>>>
>>> Thanks.
>>
>> Yes this would work, but it would also mean relying on individual
>> distros to discover such a udev rule is necessary and figure out how
>> to ship this as a device specific workaround within userspace such
>> that it won’t apply to other devices that do want to maintain i8042
>> keyboard wakeup functionality.
>
> If you submit the rule to systemd repository then distributions will
> get it when they update to the new systemd release. Very similar to the
> kernel.
>
>
>> I will investigate implementing this
>> via udev in some sort of packaged fashion, but a kernel quirk seemed
>> like the better option here in my opinion, especially because a quirk
>> system is already in place for i8042 within the kernel.
>>
>
> Quirks in the kernel should be used when they are needed for booting.
> When configuration can be delayed to [early] userspace then we should
> try to use userspace solutions. This way we are not wasting unswappable
> kernel memory.
I see, I will look into implementing this via systemd in that case. Thanks!
>
> Thanks.
>
> --
> Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-06-17 21:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 5:19 [PATCH 0/2] Add nokbdwakeup quirk and enable it for MSI Claw Matthew Schwartz
2025-06-17 5:19 ` [PATCH 1/2] Input: i8042 - Add nokbdwakeup quirk to stop keyboard wakeup from s2idle Matthew Schwartz
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
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).