From patchwork Thu Oct 11 14:15:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 1582201 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 A3ABE3FD9C for ; Thu, 11 Oct 2012 14:17:49 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TMJYM-0001bJ-9l; Thu, 11 Oct 2012 14:15:58 +0000 Received: from mail-wg0-f49.google.com ([74.125.82.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TMJYI-0001af-HF for linux-arm-kernel@lists.infradead.org; Thu, 11 Oct 2012 14:15:55 +0000 Received: by mail-wg0-f49.google.com with SMTP id gg4so1016505wgb.18 for ; Thu, 11 Oct 2012 07:15:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=4m6lXsJlaXNBG8FdojKi+QYeZMdQnKsiTYb5ptCSr68=; b=Z9CQ1GgBVOvF22cSs8eS2d7uR3H7ILclzQzK8XIhEoelwvmcp4IhB+82yxxT9pGQgV 1sveyWagwuaKmc3vsGQneCozXmnDkLS7tmxiZMbvNtozX3sbCsW6l6edvzPUH+lyCw6x 9xp0A/2hRubWM9RWaL3nQ4pYXnrsLJyuYMIeV7UdHDzOg6eZVFqCSARubDgSS5uFOxbE AdUWx41WCUxrmZQ6PhErLpEDGPUWPJcBlV4Ft7bDRAsneLSTyfcA4V5L6UON+WX7RzYZ qm4vzKbGG7iUy7Gz0Ns++L5H1eoQcmITpqpu5GkBnUlZyOZHfS2FO1x2nCM3EaTk7Yw1 o1Aw== Received: by 10.216.201.133 with SMTP id b5mr628580weo.213.1349964953136; Thu, 11 Oct 2012 07:15:53 -0700 (PDT) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id j8sm35579480wiy.9.2012.10.11.07.15.51 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 11 Oct 2012 07:15:52 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] input: gpio-keys: Add runtime support Date: Thu, 11 Oct 2012 15:15:27 +0100 Message-Id: <1349964927-18619-2-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349964927-18619-1-git-send-email-lee.jones@linaro.org> References: <1349964927-18619-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQl9TxPasOIcHhtw8ZswdDjRPmb9f/x3YcDbdQ9jadafE4Rxz1nMrRU5JGsP1m/zec29VDF7 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linus.walleij@stericsson.com, Jonas Aaberg , Philippe Langlais , Dmitry Torokhov , arnd@arndb.de, linux-input@vger.kernel.org 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: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Jonas Aaberg Cc: Dmitry Torokhov Cc: linux-input@vger.kernel.org Acked-by: Lee Jones Signed-off-by: Jonas Aaberg Signed-off-by: Philippe Langlais Reviewed-by: Bengt Jonsson Reviewed-by: Linus Walleij Signed-off-by: Lee Jones --- drivers/input/keyboard/gpio_keys.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 7947315..78de557 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -29,6 +29,7 @@ #include #include #include +#include struct gpio_button_data { const struct gpio_keys_button *button; @@ -526,6 +527,7 @@ static int gpio_keys_open(struct input_dev *input) { struct gpio_keys_drvdata *ddata = input_get_drvdata(input); + pm_runtime_get_sync(input->dev.parent); ddata->enabled = true; return ddata->enable ? ddata->enable(input->dev.parent) : 0; } @@ -537,6 +539,7 @@ static void gpio_keys_close(struct input_dev *input) if (ddata->disable) ddata->disable(input->dev.parent); ddata->enabled = false; + pm_runtime_put(input->dev.parent); } /* @@ -695,6 +698,8 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) input->id.product = 0x0001; input->id.version = 0x0100; + pm_runtime_enable(&pdev->dev); + /* Enable auto repeat feature of Linux input subsystem */ if (pdata->rep) __set_bit(EV_REP, input->evbit); @@ -760,6 +765,8 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev) struct input_dev *input = ddata->input; int i; + pm_runtime_disable(&pdev->dev); + sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); device_init_wakeup(&pdev->dev, 0); @@ -796,8 +803,8 @@ static int gpio_keys_suspend(struct device *dev) } } else { ddata->enable_after_suspend = ddata->enabled; - if (ddata->enabled) - gpio_keys_close(ddata->input); + if (ddata->enabled && ddata->disable) + ddata->disable(dev); } return 0; @@ -817,8 +824,9 @@ static int gpio_keys_resume(struct device *dev) gpio_keys_gpio_report_event(bdata); } - if (!device_may_wakeup(dev) && ddata->enable_after_suspend) - gpio_keys_open(ddata->input); + if (!device_may_wakeup(dev) && ddata->enable_after_suspend + && ddata->enable) + ddata->enable(dev); input_sync(ddata->input);