From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755032AbbGQVv3 (ORCPT ); Fri, 17 Jul 2015 17:51:29 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:33363 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752085AbbGQVv1 (ORCPT ); Fri, 17 Jul 2015 17:51:27 -0400 Date: Fri, 17 Jul 2015 14:51:22 -0700 From: Dmitry Torokhov To: Vignesh R Cc: Tony Lindgren , Benoit Cousson , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Russell King , Roger Quadros , Henrik Rydberg , Frodo Lai , Jingoo Han , linux-omap@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: Re: [PATCH 1/2] input: touchscreen: pixcir_i2c_ts: Add support for optional wakeup interrupt Message-ID: <20150717215122.GC39282@dtor-ws> References: <1437115241-17859-1-git-send-email-vigneshr@ti.com> <1437115241-17859-2-git-send-email-vigneshr@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1437115241-17859-2-git-send-email-vigneshr@ti.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vignesh, On Fri, Jul 17, 2015 at 12:10:40PM +0530, Vignesh R wrote: > 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 > --- > drivers/input/touchscreen/pixcir_i2c_ts.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c > index 8f3e243a62bf..f7c602027fbd 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 */ > > @@ -38,6 +40,7 @@ struct pixcir_i2c_ts_data { > const struct pixcir_ts_platform_data *pdata; > bool running; > int max_fingers; /* Max fingers supported in this instance */ > + int wakeirq; > }; > > struct pixcir_touch { > @@ -564,11 +567,22 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client, > i2c_set_clientdata(client, tsdata); > device_init_wakeup(&client->dev, 1); > > + /* Register wakeirq, if available */ > + tsdata->wakeirq = of_irq_get(dev->of_node, 1); Can we put this in platform data and parse in pixcir_parse_dt() please? Also, why not of_irq_get_byname()? > + if (tsdata->wakeirq) { > + error = dev_pm_set_dedicated_wake_irq(dev, > + tsdata->wakeirq); > + if (error) > + dev_dbg(dev, "unable to get wakeirq %d\n", > + error); > + } Shouldn't his actually be: error = tsdata->wakeirq ? dev_pm_set_dedicated_wake_irq(dev, tsdata->wakeirq) : dev_pm_set_wake_irq(dev, client->irq); if (error) { ... } and then we can get rid of enable_irq_wake()/disable_irq_wake() in pixcir_i2c_ts_suspend() and pixcir_i2c_ts_resume(). > + > 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); I wonder if driver core should be responsible for clearing wake irq and also for clearing wakeup flag. Thanks. -- Dmitry