From patchwork Sun Nov 25 08:32:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 1799211 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id EE6AB3FC23 for ; Sun, 25 Nov 2012 08:35:46 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TcXdm-0003nA-TT; Sun, 25 Nov 2012 08:32:39 +0000 Received: from mail-da0-f49.google.com ([209.85.210.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TcXdk-0003mr-0f for linux-arm-kernel@lists.infradead.org; Sun, 25 Nov 2012 08:32:36 +0000 Received: by mail-da0-f49.google.com with SMTP id v40so3269662dad.36 for ; Sun, 25 Nov 2012 00:32:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=WfUX1TH3MMtwOq2+ghny2Og+ehFApmqH23Trm5KcCck=; b=awMQHcRveI2WWRHF6Q6Qmpg+g6WAb8wIXz1PSFd8bGP+TzC88KD2o/iZxN2GW7M0fH ytKrdK1ZP8HLtE9AqmhrPd9WVGSusxPFLvOoIjaXVYTdHoKRXBATVB1gm30sPuOMw5WT 8mKHEp+IjGI4beWBPfhvTxNrGhtJ64YWafuqYJpi1hxWKvZuzYy098DaV/LXgFEBxkBm mSb6M+4Wikid/6roCONbVIuwtFOCJ3VLGOOi0CkCEvGislE7DCbPZZTn9xVBztd//3Uv 5IusYG6GvLTxeJ20rPC1rDGjJb52RWybFF92Rr49AxnfA5/7+avYmH2GN63HoF6XHdC3 WCqQ== Received: by 10.68.218.97 with SMTP id pf1mr27991265pbc.96.1353832353174; Sun, 25 Nov 2012 00:32:33 -0800 (PST) Received: from mailhub.coreip.homeip.net (c-67-188-112-76.hsd1.ca.comcast.net. [67.188.112.76]) by mx.google.com with ESMTPS id c7sm6707779pay.10.2012.11.25.00.32.31 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Nov 2012 00:32:32 -0800 (PST) Date: Sun, 25 Nov 2012 00:32:29 -0800 From: Dmitry Torokhov To: Lee Jones Subject: Re: [PATCH 1/2] input: gpio-keys: Disable hardware on suspend Message-ID: <20121125083229.GB21091@core.coreip.homeip.net> References: <1353590617-11466-1-git-send-email-lee.jones@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1353590617-11466-1-git-send-email-lee.jones@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121125_033236_162987_F0EF7B03 X-CRM114-Status: GOOD ( 17.69 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.210.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dmitry.torokhov[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: arnd@arndb.de, Jonas Aaberg , Philippe Langlais , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@stericsson.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Thu, Nov 22, 2012 at 01:23:36PM +0000, Lee Jones wrote: > From: Jonas Aaberg > > Disable hardware if active when suspending if the hw can not > wake the system from suspend. How about below instead (needs the other patch I have just sent out)? Thanks. diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index c7764ca..79435de 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -803,6 +803,7 @@ static int gpio_keys_remove(struct platform_device *pdev) static int gpio_keys_suspend(struct device *dev) { struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); + struct input_dev *input = ddata->input; int i; if (device_may_wakeup(dev)) { @@ -811,6 +812,11 @@ static int gpio_keys_suspend(struct device *dev) if (bdata->button->wakeup) enable_irq_wake(bdata->irq); } + } else { + mutex_lock(&input->mutex); + if (input->users) + gpio_keys_close(input); + mutex_unlock(&input->mutex); } return 0; @@ -819,16 +825,27 @@ static int gpio_keys_suspend(struct device *dev) static int gpio_keys_resume(struct device *dev) { struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); + struct input_dev *input = ddata->input; + int error = 0; int i; - for (i = 0; i < ddata->pdata->nbuttons; i++) { - struct gpio_button_data *bdata = &ddata->data[i]; - if (bdata->button->wakeup && device_may_wakeup(dev)) - disable_irq_wake(bdata->irq); + if (device_may_wakeup(dev)) { + for (i = 0; i < ddata->pdata->nbuttons; i++) { + struct gpio_button_data *bdata = &ddata->data[i]; + if (bdata->button->wakeup) + disable_irq_wake(bdata->irq); + } + } else { + mutex_lock(&input->mutex); + if (input->users) + error = gpio_keys_open(input); + mutex_unlock(&input->mutex); } - gpio_keys_report_state(ddata); + if (error) + return error; + gpio_keys_report_state(ddata); return 0; } #endif