ACPI: enable wakeup GPE in freeze mode
RFC PATCH 1/1 ACPI: enable wakeup GPE in freeze mode
Currently, in freeze state, wakeup GPE for PCI devices are handled properly because acpi_pci_sleep_wake() invokes acpi_enable_gpe() to enable the wakeup GPE directly. But for the other wakeup-capable devices in ACPI bus, acpi_enable_wakeup_devices() should be invoked to update enable_for_wake mask in gpe_register_info structure, thus acpi_enable_all_wakeup_gpes() can enable the wakeup GPE referred in _PRW methods.
This patch fixes a power button wakeup problem on Surface Pro 3, on which platform power button uses EC to deliver event (EC GPE is referred in _PRW).
Note: enabling EC GPE during freeze state may bring some risks because EC events are expected to fire more frequently than others. Thus it may bring the system out of freeze state unnecessarily. (We already have comments about this in bugzilla)
Fixes https://bugzilla.kernel.org/show_bug.cgi?id=84651
--- drivers/acpi/sleep.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/sleep.c +1 -0
@@ -629,6 +629,7 @@ static int acpi_freeze_begin(void)static int acpi_freeze_prepare (void ) { +acpi_enable_wakeup_devices (ACPI_STATE_S0 );acpi_enable_all_wakeup_gpes ();acpi_os_wait_events_complete ();enable_irq_wake (acpi_gbl_FADT.sci_interrupt);
Signature · 1 line
1.8.4.2
Quoted 36 lines · Chen Yu
Currently, in freeze state, wakeup GPE for PCI devices are handled properly because
acpi_pci_sleep_wake()invokesacpi_enable_gpe()to enable the wakeup GPE directly. But for the other wakeup-capable devices in ACPI bus,acpi_enable_wakeup_devices()should be invoked to updateenable_for_wakemask ingpe_register_infostructure, thusacpi_enable_all_wakeup_gpes()can enable the wakeup GPE referred in_PRWmethods.This patch fixes a power button wakeup problem on Surface Pro 3, on which platform power button uses EC to deliver event (EC GPE is referred in
_PRW).Note: enabling EC GPE during freeze state may bring some risks because EC events are expected to fire more frequently than others. Thus it may bring the system out of freeze state unnecessarily. (We already have comments about this in bugzilla)
Fixes https://bugzilla.kernel.org/show_bug.cgi?id=84651
Reported-and-tested-by Ethan Schoonover <[email protected]>Tested-by Peter Amidon <[email protected]>Tested-by Yani Ioadnnou <[email protected]>Tested-by Mister Wardrop <[email protected]>Tested-by Anton Anikin <[email protected]>Tested-by Keith McClelland <[email protected]>Reviewed-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>--- drivers/acpi/sleep.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/sleep.c +0
-0
drivers/acpi/sleep.c static int acpi_freeze_begin(void) · line 635
Quoted 7 lines
drivers/acpi/sleep.c +1
-0@@ -629,6 +629,7 @@ static int acpi_freeze_begin(void)static int acpi_freeze_prepare (void ) { +acpi_enable_wakeup_devices (ACPI_STATE_S0 );acpi_enable_all_wakeup_gpes ();acpi_os_wait_events_complete ();enable_irq_wake (acpi_gbl_FADT.sci_interrupt);
This looks OK to me, but I think that we need a complementary acpi_disable_wakeup_devices() call in acpi_freeze_restore().
Without it, user space may not be able to prevent devices from waking up the system from suspend-to-idle. Or am I missing anything?
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Quoted 38 lines · Rafael J. Wysocki
Quoted 37 lines · Chen Yu
Currently, in freeze state, wakeup GPE for PCI devices are handled properly because
acpi_pci_sleep_wake()invokesacpi_enable_gpe()to enable the wakeup GPE directly. But for the other wakeup-capable devices in ACPI bus,acpi_enable_wakeup_devices()should be invoked to updateenable_for_wakemask ingpe_register_infostructure, thusacpi_enable_all_wakeup_gpes()can enable the wakeup GPE referred in_PRWmethods.This patch fixes a power button wakeup problem on Surface Pro 3, on which platform power button uses EC to deliver event (EC GPE is referred in
_PRW).Note: enabling EC GPE during freeze state may bring some risks because EC events are expected to fire more frequently than others. Thus it may bring the system out of freeze state unnecessarily. (We already have comments about this in bugzilla)
Fixes https://bugzilla.kernel.org/show_bug.cgi?id=84651
Reported-and-tested-by Ethan Schoonover <[email protected]>Tested-by Peter Amidon <[email protected]>Tested-by Yani Ioadnnou <[email protected]>Tested-by Mister Wardrop <[email protected]>Tested-by Anton Anikin <[email protected]>Tested-by Keith McClelland <[email protected]>Reviewed-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>--- drivers/acpi/sleep.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/sleep.c +0
-0@@ -629,6 +629,7 @@ static int acpi_freeze_begin(void)
Quoted 10 lines
drivers/acpi/sleep.c static int acpi_freeze_begin(void) · line 635
Quoted 6 lines
drivers/acpi/sleep.c +1
-0static int acpi_freeze_prepare (void ) { +acpi_enable_wakeup_devices (ACPI_STATE_S0 );acpi_enable_all_wakeup_gpes ();acpi_os_wait_events_complete ();enable_irq_wake (acpi_gbl_FADT.sci_interrupt);This looks OK to me, but I think that we need a complementary
acpi_disable_wakeup_devices()call inacpi_freeze_restore().
Yes, I'll add acpi_disable_wakeup_devices() before disable_irq_wake(), and send another patch, thanks you!
Quoted 5 lines
Without it, user space may not be able to prevent devices from waking up the system from suspend-to-idle. Or am I missing anything?