Add nokbdwakeup quirk and enable it for MSI Claw
Subsystems (2)
cover Add nokbdwakeup quirk and enable it for MSI Claw
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(-)
Signature · 1 line
2.49.0
PATCH 1/2 Input: i8042 - Add nokbdwakeup quirk to stop keyboard wakeup from s2idle
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.
--- drivers/input/serio/i8042-acpipnpio.h | 8 ++++++-- drivers/input/serio/i8042.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/input/serio/i8042-acpipnpio.h +6 -2
@@ -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)
drivers/input/serio/i8042.c +6 -2
@@ -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);
Signature · 1 line
2.49.0
PATCH 2/2 Input: i8042 - Disable keyboard wakeup from s2idle on MSI Claw devices
In reply to Matthew SchwartzOn 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.
--- drivers/input/serio/i8042-acpipnpio.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/input/serio/i8042-acpipnpio.h +24 -0
@@ -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 = {
Signature · 1 line
2.49.0
Dmitry Torokhov
maintainerHi Matthew,
Quoted 10 lines · 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.
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.
Signature · 1 line
Dmitry
Quoted 18 lines · Dmitry Torokhov
Hi Matthew,
Quoted 10 lines · 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.
Quoted 6 lines
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/wakeupThanks.
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.
Quoted 3 lines
Signature · 2 lines
-- Dmitry
Dmitry Torokhov
maintainerQuoted 23 lines · Matthew Schwartz
Quoted 23 lines · Dmitry Torokhov
Hi Matthew,
Quoted 10 lines · 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.
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
Quoted 7 lines
Quoted 1 line
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.
Quoted 5 lines
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.
Signature · 1 line
Dmitry
Quoted 47 lines · Dmitry Torokhov
Quoted 23 lines · Matthew Schwartz
Quoted 23 lines · Dmitry Torokhov
Hi Matthew,
Quoted 10 lines · 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.
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/wakeupQuoted 7 lines
Quoted 1 line
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.
Quoted 5 lines
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.
Quoted 4 lines
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!
Quoted 5 lines
Thanks.
Signature · 1 line
Dmitry