Commit ea47439b authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Len Brown

ACPICA: Clear GPEs and power button events during wakeup

Per spec section 4.7.2.2.1.1, OSPM should clear power button status when
waking the system.  This must be done before enabling interrupts to prevent
spurious power button events.

Linux currently clears these events in acpi_suspend_enter() just after
calling acpi_leave_sleep_state_prep().  Other OSes should be doing
something similar.  But it seems more robust to do this in the CA.

The clear in acpi_leave_sleep_state() should be unnecessary.

Thanks to Zhao Yakui for patiently educating me about this.

This patch may be used under either the GPL v2 or the BSD-style license
used for the Intel ACPICA.
Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
CC: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 97730430
......@@ -534,6 +534,12 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
}
}
/* Clear any pending events before enabling interrupts */
acpi_hw_disable_all_gpes();
acpi_clear_event(ACPI_EVENT_POWER_BUTTON);
return_ACPI_STATUS(status);
}
......@@ -578,15 +584,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
/*
* GPEs must be enabled before _WAK is called as GPEs
* might get fired there
*
* Restore the GPEs:
* 1) Disable/Clear all GPEs
* 2) Enable all runtime GPEs
*/
status = acpi_hw_disable_all_gpes();
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
status = acpi_hw_enable_all_runtime_gpes();
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
......@@ -611,7 +609,6 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
/* Enable power button */
acpi_enable_event(ACPI_EVENT_POWER_BUTTON, 0);
acpi_clear_event(ACPI_EVENT_POWER_BUTTON);
arg.integer.value = ACPI_SST_WORKING;
status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment