From patchwork Fri Jun 19 20:57:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 31454 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5JKvp8Z032148 for ; Fri, 19 Jun 2009 20:57:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752576AbZFSU54 (ORCPT ); Fri, 19 Jun 2009 16:57:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752698AbZFSU5z (ORCPT ); Fri, 19 Jun 2009 16:57:55 -0400 Received: from g5t0007.atlanta.hp.com ([15.192.0.44]:7588 "EHLO g5t0007.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752576AbZFSU5z (ORCPT ); Fri, 19 Jun 2009 16:57:55 -0400 Received: from smtp2.fc.hp.com (smtp.cnd.hp.com [15.11.136.114]) by g5t0007.atlanta.hp.com (Postfix) with ESMTP id 383DF14323; Fri, 19 Jun 2009 20:57:58 +0000 (UTC) Received: from localhost.localdomain (lart.fc.hp.com [15.11.146.31]) by smtp2.fc.hp.com (Postfix) with ESMTP id D71982CD14C; Fri, 19 Jun 2009 20:28:09 +0000 (UTC) Received: from bob.kio (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id CDAA42616C; Fri, 19 Jun 2009 14:57:57 -0600 (MDT) Subject: [PATCH 2/3] ACPICA: Clear GPEs and power button events during wakeup To: Bob Moore , Len Brown From: Bjorn Helgaas Cc: Zhao Yakui , linux-acpi@vger.kernel.org Date: Fri, 19 Jun 2009 14:57:57 -0600 Message-ID: <20090619205757.30130.90049.stgit@bob.kio> In-Reply-To: <20090619205713.30130.79530.stgit@bob.kio> References: <20090619205713.30130.79530.stgit@bob.kio> User-Agent: StGit/0.14.3.385.gd87a.dirty MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 CC: Zhao Yakui --- drivers/acpi/acpica/hwsleep.c | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);