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: 12166 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 333C01A55A1 for ; Thu, 11 Oct 2012 14:15:56 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id B7467A188FC for ; Thu, 11 Oct 2012 14:15:55 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so1252926iag.11 for ; Thu, 11 Oct 2012 07:15:55 -0700 (PDT) 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=4m6lXsJlaXNBG8FdojKi+QYeZMdQnKsiTYb5ptCSr68=; b=iC3M46w9vjwzlw5A24rteSdYWdodtYMFIY8qGGjXtUepoef4cmW88vaiLd8OmkuJxM SravlK6aLrCaKs4SOT6A11vBgXvsUYW2jbUZ1+iv1MtKNN2+HkyDCrU3cbBOyTGKJx4l jsRGmIBwjlB/fpal73/YdR4urNNyY9xUqFKu2kujh7FbGwj4oa0JIJDuYXmsqt/eD4l2 1jGFj7BIqS+eqnE8+jhAM3oWtYTZMh2atlqSsGghp66hTc+BZ5u6wSVQVkhDoS9IAR01 3YBnBzQuxl1QsGUuWWvOO1ag1LQ5jH/0WHcsD9+FIFewyqXAeYut7Kz3Oo2k/wrG/Ul6 /6uw== Received: by 10.50.91.195 with SMTP id cg3mr8785993igb.57.1349964955414; Thu, 11 Oct 2012 07:15:55 -0700 (PDT) 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 n20csp41476igt; Thu, 11 Oct 2012 07:15:54 -0700 (PDT) Received: by 10.180.99.133 with SMTP id eq5mr21098024wib.21.1349964953679; Thu, 11 Oct 2012 07:15:53 -0700 (PDT) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id o8si5254256wea.75.2012.10.11.07.15.53 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 11 Oct 2012 07:15:53 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.178 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-we0-f178.google.com with SMTP id r6so1263443wey.37 for ; Thu, 11 Oct 2012 07:15:53 -0700 (PDT) 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 Cc: arnd@arndb.de, linus.walleij@stericsson.com, Jonas Aaberg , Dmitry Torokhov , linux-input@vger.kernel.org, Philippe Langlais 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: ALoCoQk2wn8+mca19tIfZEhYJWJpbGCbG6BmPImE7DjZJNFVQ+e5fo9GvMkaeFkSrcoTyggzk5fC 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 --- 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);