All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Bob Moore <robert.moore@intel.com>, Len Brown <lenb@kernel.org>
Cc: Zhao Yakui <yakui.zhao@intel.com>, linux-acpi@vger.kernel.org
Subject: [PATCH 2/3] ACPICA: Clear GPEs and power button events during wakeup
Date: Fri, 19 Jun 2009 14:57:57 -0600	[thread overview]
Message-ID: <20090619205757.30130.90049.stgit@bob.kio> (raw)
In-Reply-To: <20090619205713.30130.79530.stgit@bob.kio>

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@hp.com>
CC: Zhao Yakui <yakui.zhao@intel.com>
---
 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);


  parent reply	other threads:[~2009-06-19 20:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-19 20:57 [PATCH 0/3] ACPICA/ACPI: clean up power button event management during resume Bjorn Helgaas
2009-06-19 20:57 ` [PATCH 1/3] ACPICA: Use fixed event wrappers to enable/disable/clear Bjorn Helgaas
2009-06-19 20:57 ` Bjorn Helgaas [this message]
2009-06-19 20:58 ` [PATCH 3/3] ACPI: remove clearing of events on resume, now that ACPI CA does it Bjorn Helgaas
2009-06-20  5:06 ` [PATCH 0/3] ACPICA/ACPI: clean up power button event management during resume Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090619205757.30130.90049.stgit@bob.kio \
    --to=bjorn.helgaas@hp.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=robert.moore@intel.com \
    --cc=yakui.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.