From patchwork Thu Nov 22 13:23:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13073 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D45A023FC6 for ; Thu, 22 Nov 2012 13:23:46 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 7CE2DA18B18 for ; Thu, 22 Nov 2012 13:23:46 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so554892ieb.11 for ; Thu, 22 Nov 2012 05:23:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=x8I8NIabuFUX0Omow23y3LlzPYyVttZN99P/YIyYmkk=; b=hty7CQn5UeSTIdTOZ1gvf2jnrgiV7MBCpVu5d3gc9XlfvhyC3yGHkTbRQk4K1ozscu dAN9At3Okdlv1Iim8uczs9/lF131P6Cf2OuJgsRIEm33V5BiOd5MCCo6fQ25QI4k3vKn rAcviy14jOoESOTvpqZcDDdUVH0MohiYv0u9yRzwlrCpzooE/tWH9RE4u5zKAbupZ611 wUM/JVQyOaxLCx1xB8rDRmY1t3InsQuYXk2wcYWt3X95YE7/LAIIVnN1W7Xm7tqrR3PW c+RBh6p1r/gdDW98zS+Zh+6Wdq+0LS1TzLcj0CUOmbMsWeJP0Q2h9zsrOQOw/7JDvKGw PrXQ== Received: by 10.50.187.197 with SMTP id fu5mr459160igc.70.1353590626270; Thu, 22 Nov 2012 05:23:46 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp208409igt; Thu, 22 Nov 2012 05:23:45 -0800 (PST) Received: by 10.216.212.87 with SMTP id x65mr265837weo.84.1353590624451; Thu, 22 Nov 2012 05:23:44 -0800 (PST) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by mx.google.com with ESMTPS id en3si2733452wib.28.2012.11.22.05.23.44 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Nov 2012 05:23:44 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.172 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.172; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.172 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wi0-f172.google.com with SMTP id o1so634148wic.17 for ; Thu, 22 Nov 2012 05:23:44 -0800 (PST) Received: by 10.216.210.142 with SMTP id u14mr221007weo.105.1353590623943; Thu, 22 Nov 2012 05:23:43 -0800 (PST) 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 bz12sm4507489wib.5.2012.11.22.05.23.42 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Nov 2012 05:23:43 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, Jonas Aaberg , Dmitry Torokhov , linux-input@vger.kernel.org, Lee Jones , Philippe Langlais Subject: [PATCH 2/2] input: gpio-keys: Add runtime support Date: Thu, 22 Nov 2012 13:23:37 +0000 Message-Id: <1353590617-11466-2-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1353590617-11466-1-git-send-email-lee.jones@linaro.org> References: <1353590617-11466-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQneHVX2l27QK63JIei+/HC/90KpvPthklpYF3oXd3penfgLXEu1P7nSeSJoSA1/Kd1Tepwk From: Jonas Aaberg Cc: Dmitry Torokhov Cc: linux-input@vger.kernel.org Signed-off-by: Lee Jones Signed-off-by: Jonas Aaberg Signed-off-by: Philippe Langlais Reviewed-by: Bengt Jonsson --- drivers/input/keyboard/gpio_keys.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 2cf6757..cff548c 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; @@ -533,6 +534,7 @@ static int gpio_keys_open(struct input_dev *input) struct gpio_keys_drvdata *ddata = input_get_drvdata(input); const struct gpio_keys_platform_data *pdata = ddata->pdata; + pm_runtime_get_sync(input->dev.parent); ddata->enabled = true; return pdata->enable ? pdata->enable(input->dev.parent) : 0; @@ -547,6 +549,8 @@ static void gpio_keys_close(struct input_dev *input) if (pdata->disable) pdata->disable(input->dev.parent); + + pm_runtime_put(input->dev.parent); } /* @@ -708,6 +712,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); @@ -773,6 +779,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); @@ -805,8 +813,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; @@ -826,8 +834,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);