[PATCH 2/3] ACPICA: Clear GPEs and power button events during wakeup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: Bjorn Helgaas <bjorn.helgaas@xxxxxx>
CC: Zhao Yakui <yakui.zhao@xxxxxxxxx>
---
 drivers/acpi/acpica/hwsleep.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index ea51ee6..283e872 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -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);

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux