From patchwork Thu Jun 19 00:51:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aubrey Li X-Patchwork-Id: 4380001 Return-Path: X-Original-To: patchwork-linux-input@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 C63CB9F3DF for ; Thu, 19 Jun 2014 00:51:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EFDBE20382 for ; Thu, 19 Jun 2014 00:51:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 16D9F20266 for ; Thu, 19 Jun 2014 00:51:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753327AbaFSAva (ORCPT ); Wed, 18 Jun 2014 20:51:30 -0400 Received: from mga01.intel.com ([192.55.52.88]:1524 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752978AbaFSAv2 (ORCPT ); Wed, 18 Jun 2014 20:51:28 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 18 Jun 2014 17:51:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="355784429" Received: from cli6-desk.ccr.corp.intel.com (HELO [10.239.37.134]) ([10.239.37.134]) by FMSMGA003.fm.intel.com with ESMTP; 18 Jun 2014 17:47:04 -0700 Message-ID: <53A2340D.9030503@linux.intel.com> Date: Thu, 19 Jun 2014 08:51:25 +0800 From: "Li, Aubrey" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: "dmitry.torokhov@gmail.com" , "Rafael J. Wysocki" , "linux-input@vger.kernel.org" , LKML Subject: [PATCH] GPIO button wth wakeup attribute is supposed to wake the system up Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 When the wakeup attribute is set, the GPIO button is capable of waking up the system from sleep states, including the "freeze" sleep state. For that to work, its driver needs to pass the IRQF_NO_SUSPEND flag to devm_request_any_context_irq(), or the interrupt will be disabled by suspend_device_irqs() and the system won't be woken up by it from the "freeze" sleep state. The suspend_device_irqs() routine is a workaround for drivers that mishandle interrupts triggered when the devices handled by them are suspended, so it is safe to use IRQF_NO_SUSPEND in all drivers that don't have that problem. The affected/tested machines include Dell Venue 11 Pro and Asus T100TA. Signed-off-by: Aubrey Li Reviewed-by: Rafael J. Wysocki Reviewed-by: Alan Cox --- drivers/input/keyboard/gpio_keys.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 8c98e97..b046dc6 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -527,6 +527,14 @@ static int gpio_keys_setup_key(struct platform_device *pdev, if (!button->can_disable) irqflags |= IRQF_SHARED; + /* + * If platform has specified the wakeup attribute of the button, + * we add IRQF_NO_SUSPEND to desc->action->flag. So the wake up + * interrupt will not be disabled in suspend_device_irqs + */ + if (button->wakeup) + irqflags |= IRQF_NO_SUSPEND; + error = devm_request_any_context_irq(&pdev->dev, bdata->irq, isr, irqflags, desc, bdata); if (error < 0) {