From patchwork Mon Jul 20 04:50:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 6825061 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1A0EAC05AD for ; Mon, 20 Jul 2015 04:54:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 23CF12062D for ; Mon, 20 Jul 2015 04:54:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 304E520626 for ; Mon, 20 Jul 2015 04:53:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZH32v-0008Ld-07; Mon, 20 Jul 2015 04:51:21 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZH32j-0008Ck-3M for linux-arm-kernel@lists.infradead.org; Mon, 20 Jul 2015 04:51:09 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id t6K4oSbH001555; Sun, 19 Jul 2015 23:50:28 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t6K4oSfW009832; Sun, 19 Jul 2015 23:50:28 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Sun, 19 Jul 2015 23:49:57 -0500 Received: from uda0132425.apr.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t6K4oGGi003636; Sun, 19 Jul 2015 23:50:23 -0500 From: Vignesh R To: Dmitry Torokhov , Tony Lindgren , Benoit Cousson , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Russell King Subject: [PATCH v2 1/2] input: touchscreen: pixcir_i2c_ts: Add support for optional wakeup interrupt Date: Mon, 20 Jul 2015 10:20:13 +0530 Message-ID: <1437367814-27785-2-git-send-email-vigneshr@ti.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1437367814-27785-1-git-send-email-vigneshr@ti.com> References: <1437367814-27785-1-git-send-email-vigneshr@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150719_215109_405943_1797E38A X-CRM114-Status: GOOD ( 14.20 ) X-Spam-Score: -8.1 (--------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frodo Lai , devicetree@vger.kernel.org, Henrik Rydberg , Vignesh R , Jingoo Han , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Roger Quadros Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 On am437x-gp-evm, pixcir touchscreen can wake the system from low power state by generating wake-up interrupt via pinctrl and IO daisy chain. Add support for optional wakeup interrupt source by regsitering to automated wake IRQ framework introduced by commit 4990d4fe327b ("PM / Wakeirq: Add automated device wake IRQ handling"). This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add support for optional wake-up") Signed-off-by: Vignesh R --- v2: * use of_irq_get_byname() * remove enable/disable_wake_irq() drivers/input/touchscreen/pixcir_i2c_ts.c | 17 +++++++++++++---- include/linux/input/pixcir_ts.h | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c index 8f3e243a62bf..b9cebf274678 100644 --- a/drivers/input/touchscreen/pixcir_i2c_ts.c +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #define PIXCIR_MAX_SLOTS 5 /* Max fingers supported by driver */ @@ -364,8 +366,6 @@ static int __maybe_unused pixcir_i2c_ts_suspend(struct device *dev) goto unlock; } } - - enable_irq_wake(client->irq); } else if (input->users) { ret = pixcir_stop(ts); } @@ -386,8 +386,6 @@ static int __maybe_unused pixcir_i2c_ts_resume(struct device *dev) mutex_lock(&input->mutex); if (device_may_wakeup(&client->dev)) { - disable_irq_wake(client->irq); - if (!input->users) { ret = pixcir_stop(ts); if (ret) { @@ -445,6 +443,8 @@ static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev) dev_dbg(dev, "%s: x %d, y %d, gpio %d\n", __func__, pdata->x_max + 1, pdata->y_max + 1, pdata->gpio_attb); + pdata->wakeirq = of_irq_get_byname(dev->of_node, "wakeupirq"); + return pdata; } #else @@ -564,11 +564,20 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client, i2c_set_clientdata(client, tsdata); device_init_wakeup(&client->dev, 1); + /* Register wakeirq */ + error = pdata->wakeirq ? + dev_pm_set_dedicated_wake_irq(dev, pdata->wakeirq) : + dev_pm_set_wake_irq(dev, client->irq); + if (error) + dev_info(dev, "unable to get wakeirq %d\n", + error); + return 0; } static int pixcir_i2c_ts_remove(struct i2c_client *client) { + dev_pm_clear_wake_irq(&client->dev); device_init_wakeup(&client->dev, 0); return 0; diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h index 7bae83b7c396..da573de5a5ee 100644 --- a/include/linux/input/pixcir_ts.h +++ b/include/linux/input/pixcir_ts.h @@ -58,6 +58,7 @@ struct pixcir_ts_platform_data { int x_max; int y_max; int gpio_attb; /* GPIO connected to ATTB line */ + int wakeirq; struct pixcir_i2c_chip_data chip; };