Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: i8042 - enable keyboard wakeups by default when s2idle is used

Previously, on typical consumer laptops, pressing a key on the keyboard
when the system is in suspend would cause it to wake up (default or
unconditional behaviour). This happens because the EC generates a SCI
interrupt in this scenario.

That is no longer true on modern laptops based on Intel WhiskeyLake,
including Acer Swift SF314-55G, Asus UX333FA, Asus UX433FN and Asus
UX533FD. We confirmed with Asus EC engineers that the "Modern Standby"
design has been modified so that the EC no longer generates a SCI
in this case; the keyboard controller itself should be used for wakeup.

In order to retain the standard behaviour of being able to use the
keyboard to wake up the system, enable serio wakeups by default on
platforms that are using s2idle.

Link: https://lkml.kernel.org/r/CAB4CAwfQ0mPMqCLp95TVjw4J0r5zKPWkSvvkK4cpZUGE--w8bQ@mail.gmail.com
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Daniel Drake <drake@endlessm.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Daniel Drake and committed by
Dmitry Torokhov
684bec10 9735082a

+28 -9
+20 -9
drivers/input/serio/i8042.c
··· 1395 1395 for (i = 0; i < I8042_NUM_PORTS; i++) { 1396 1396 struct serio *serio = i8042_ports[i].serio; 1397 1397 1398 - if (serio) { 1399 - printk(KERN_INFO "serio: %s at %#lx,%#lx irq %d\n", 1400 - serio->name, 1401 - (unsigned long) I8042_DATA_REG, 1402 - (unsigned long) I8042_COMMAND_REG, 1403 - i8042_ports[i].irq); 1404 - serio_register_port(serio); 1405 - device_set_wakeup_capable(&serio->dev, true); 1406 - } 1398 + if (!serio) 1399 + continue; 1400 + 1401 + printk(KERN_INFO "serio: %s at %#lx,%#lx irq %d\n", 1402 + serio->name, 1403 + (unsigned long) I8042_DATA_REG, 1404 + (unsigned long) I8042_COMMAND_REG, 1405 + i8042_ports[i].irq); 1406 + serio_register_port(serio); 1407 + device_set_wakeup_capable(&serio->dev, true); 1408 + 1409 + /* 1410 + * On platforms using suspend-to-idle, allow the keyboard to 1411 + * wake up the system from sleep by enabling keyboard wakeups 1412 + * by default. This is consistent with keyboard wakeup 1413 + * behavior on many platforms using suspend-to-RAM (ACPI S3) 1414 + * by default. 1415 + */ 1416 + if (pm_suspend_via_s2idle() && i == I8042_KBD_PORT_NO) 1417 + device_set_wakeup_enable(&serio->dev, true); 1407 1418 } 1408 1419 } 1409 1420
+2
include/linux/suspend.h
··· 251 251 return unlikely(s2idle_state == S2IDLE_STATE_ENTER); 252 252 } 253 253 254 + extern bool pm_suspend_via_s2idle(void); 254 255 extern void __init pm_states_init(void); 255 256 extern void s2idle_set_ops(const struct platform_s2idle_ops *ops); 256 257 extern void s2idle_wake(void); ··· 283 282 static inline void pm_set_resume_via_firmware(void) {} 284 283 static inline bool pm_suspend_via_firmware(void) { return false; } 285 284 static inline bool pm_resume_via_firmware(void) { return false; } 285 + static inline bool pm_suspend_via_s2idle(void) { return false; } 286 286 287 287 static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} 288 288 static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
+6
kernel/power/suspend.c
··· 62 62 enum s2idle_states __read_mostly s2idle_state; 63 63 static DEFINE_SPINLOCK(s2idle_lock); 64 64 65 + bool pm_suspend_via_s2idle(void) 66 + { 67 + return mem_sleep_current == PM_SUSPEND_TO_IDLE; 68 + } 69 + EXPORT_SYMBOL_GPL(pm_suspend_via_s2idle); 70 + 65 71 void s2idle_set_ops(const struct platform_s2idle_ops *ops) 66 72 { 67 73 lock_system_sleep();