History

ACPI: PM: Add acpi_[un]register_wakeup_handler()

Since commit fdde0ff8590b ("ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system") the SCI triggering without there being a wakeup cause recognized by the ACPI sleep code will no longer wakeup the system. This works as intended, but this is a problem for devices where the SCI is shared with another device which is also a wakeup source. In the past these, from the pov of the ACPI sleep code, spurious SCIs would still cause a wakeup so the wakeup from the device sharing the interrupt would actually wakeup the system. This now no longer works. This is a problem on e.g. Bay Trail-T and Cherry Trail devices where some peripherals (typically the XHCI controller) can signal a Power Management Event (PME) to the Power Management Controller (PMC) to wakeup the system, this uses the same interrupt as the SCI. These wakeups are handled through a special INT0002 ACPI device which checks for events in the GPE0a_STS for this and takes care of acking the PME so that the shared interrupt stops triggering. The change to the ACPI sleep code to ignore the spurious SCI, causes the system to no longer wakeup on these PME events. To make things worse this means that the INT0002 device driver interrupt handler will no longer run, causing the PME to not get cleared and resulting in the system hanging. Trying to wakeup the system after such a PME through e.g. the power button no longer works. Add an acpi_register_wakeup_handler() function which registers a handler to be called from acpi_s2idle_wake() and when the handler returns true, return true from acpi_s2idle_wake(). The INT0002 driver will use this mechanism to check the GPE0a_STS register from acpi_s2idle_wake() and to tell the system to wakeup if a PME is signaled in the register.

Hans de Goede committed 6 years ago

Commit ddfd9dc1 parent 2ce94bc4 files · +91 −0Browse files

Showing the changes to include/linux (1 of 4 files). Show all

Unified · Split

include/linux/acpi.h+5−0
@@ -488,6 +488,11 @@ void __init acpi_nvs_nosave_s3(void); · 487 unmodified lines
488488 void __init acpi_sleep_no_blacklist(void);
489489 #endif /* CONFIG_PM_SLEEP */
490490
491+int acpi_register_wakeup_handler(
492+ int wake_irq, bool (*wakeup)(void *context), void *context);
493+void acpi_unregister_wakeup_handler(
494+ bool (*wakeup)(void *context), void *context);
495+
491496 struct acpi_osc_context {
492497 char *uuid_str; /* UUID string */
493498 int rev;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t