From patchwork Tue Jul 8 06:57:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 4502821 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E26719F39B for ; Tue, 8 Jul 2014 07:00:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A6832035C for ; Tue, 8 Jul 2014 07:00:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C255820351 for ; Tue, 8 Jul 2014 07:00:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753301AbaGHHAD (ORCPT ); Tue, 8 Jul 2014 03:00:03 -0400 Received: from mga09.intel.com ([134.134.136.24]:24851 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753189AbaGHHAB (ORCPT ); Tue, 8 Jul 2014 03:00:01 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 07 Jul 2014 23:54:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,624,1400050800"; d="scan'208";a="540100146" Received: from lantianyu-ws.sh.intel.com (HELO localhost) ([10.239.37.18]) by orsmga001.jf.intel.com with ESMTP; 07 Jul 2014 23:59:44 -0700 From: Lan Tianyu To: rjw@rjwysocki.net, lenb@kernel.org Cc: Lan Tianyu , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 2/2] ACPI/Wakup: Enable button wakeup GPEs if these GPEs have associated GPE methods. Date: Tue, 8 Jul 2014 14:57:58 +0800 Message-Id: <1404802679-24019-2-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1404802679-24019-1-git-send-email-tianyu.lan@intel.com> References: <1404802679-24019-1-git-send-email-tianyu.lan@intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The button wakeup GPEs are enabled unconditionally in the current world by commit 2a5d24(ACPI / Wakeup: Enable button GPEs unconditionally during initialization). Because button's GPE methods needs to be run to clear GPE status on some machines when there is GPE interrupt. If not, it will cause machines resume immediately after being suspended since GPE status isn't cleared correctly. But if there is no GPE method for button wakeup GPE, these GPEs should not be enabled since nothing needs to be done when they are triggered and this also causes LID GPE storm on Lenovo Ideapad y560p. This patch is to check Button GPE method and enable it if there is associated GPE method. Reference: https://bugzilla.kernel.org/show_bug.cgi?id=61051 Reported-by: James Tocknell Signed-off-by: Lan Tianyu --- drivers/acpi/wakeup.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c index 1638401..5b20ae4 100644 --- a/drivers/acpi/wakeup.c +++ b/drivers/acpi/wakeup.c @@ -86,9 +86,14 @@ int __init acpi_wakeup_device_init(void) struct acpi_device, wakeup_list); if (device_can_wakeup(&dev->dev)) { - /* Button GPEs are supposed to be always enabled. */ - acpi_enable_gpe(dev->wakeup.gpe_device, - dev->wakeup.gpe_number); + /* + * Button GPEs are supposed to be always enabled if + * they have associated GPE methods. + */ + if (ACPI_SUCCESS(acpi_check_gpe_method( + dev->wakeup.gpe_device, dev->wakeup.gpe_number))) + acpi_enable_gpe(dev->wakeup.gpe_device, + dev->wakeup.gpe_number); device_set_wakeup_enable(&dev->dev, true); } }