Skip to contentSkip to conversation

ACPI: Enable wakeup GPE in freeze mode

PATCH Applied Chen Yu 2 participants 2 messages Mar 27, 2015 – Mar 30, 2015 ACPI

lore
Share & tools
lore

Chen Yu

author
#0 lore raw

PATCH v2 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. And acpi_disable_wakeup_devices() will be called before disable_irq_wake() in acpi_freeze_restore() to restore the mask.

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 | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/sleep.c +2 -0
index 7f251dd..81e5bd4 100644
@@ -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);
@@ -637,6 +638,7 @@ static int acpi_freeze_prepare(void)
 
 static void acpi_freeze_restore(void)
 {
+	acpi_disable_wakeup_devices(ACPI_STATE_S0);
 	disable_irq_wake(acpi_gbl_FADT.sci_interrupt);
 	acpi_enable_all_runtime_gpes();
 }
Signature · 1 line
1.8.4.2
#1 lore raw
Quoted 20 lines · Chen Yu

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. And acpi_disable_wakeup_devices() will be called before disable_irq_wake() in acpi_freeze_restore() to restore the mask.

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

Quoted 8 lines

Queued up for 4.1 with minor changes in the changelog/subject, thanks!

Quoted 25 lines
---
 drivers/acpi/sleep.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/sleep.c +2 -0
index 7f251dd..81e5bd4 100644
@@ -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);
@@ -637,6 +638,7 @@ static int acpi_freeze_prepare(void)
 
 static void acpi_freeze_restore(void)
 {
+	acpi_disable_wakeup_devices(ACPI_STATE_S0);
 	disable_irq_wake(acpi_gbl_FADT.sci_interrupt);
 	acpi_enable_all_runtime_gpes();
 }
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.