All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Daniel Mack <daniel@zonque.org>
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
	robh+dt@kernel.org, kernel@pengutronix.de,
	linux-input@vger.kernel.org, fabio.estevam@nxp.com,
	shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/3] input: touchscreen: edt-ft5x06: assert reset during suspend
Date: Wed, 16 May 2018 10:05:16 -0700	[thread overview]
Message-ID: <20180516170516.GB21971@dtor-ws> (raw)
In-Reply-To: <20180516122829.23694-3-daniel@zonque.org>

On Wed, May 16, 2018 at 02:28:28PM +0200, Daniel Mack wrote:
> If the device is not configured as wakeup source, it can be put in reset
> during suspend to save some power.
> 
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> ---
>  drivers/input/touchscreen/edt-ft5x06.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> index 955f085627fa..c34a0b23f90a 100644
> --- a/drivers/input/touchscreen/edt-ft5x06.c
> +++ b/drivers/input/touchscreen/edt-ft5x06.c
> @@ -1036,9 +1036,12 @@ static int edt_ft5x06_ts_remove(struct i2c_client *client)
>  static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
> +	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
>  
>  	if (device_may_wakeup(dev))
>  		enable_irq_wake(client->irq);
> +	else if (tsdata->reset_gpio)
> +		gpiod_set_value_cansleep(tsdata->reset_gpio, 1);
>  
>  	return 0;
>  }
> @@ -1046,9 +1049,12 @@ static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
>  static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
> +	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
>  
>  	if (device_may_wakeup(dev))
>  		disable_irq_wake(client->irq);
> +	else if (tsdata->reset_gpio)
> +		gpiod_set_value_cansleep(tsdata->reset_gpio, 0);

I think you need msleep() here as the chip needs a bit to get out of
reset before it is ready. FWIW we have 300 ms delay in probe().

Thanks.

-- 
Dmitry

WARNING: multiple messages have this Message-ID (diff)
From: dmitry.torokhov@gmail.com (Dmitry Torokhov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] input: touchscreen: edt-ft5x06: assert reset during suspend
Date: Wed, 16 May 2018 10:05:16 -0700	[thread overview]
Message-ID: <20180516170516.GB21971@dtor-ws> (raw)
In-Reply-To: <20180516122829.23694-3-daniel@zonque.org>

On Wed, May 16, 2018 at 02:28:28PM +0200, Daniel Mack wrote:
> If the device is not configured as wakeup source, it can be put in reset
> during suspend to save some power.
> 
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> ---
>  drivers/input/touchscreen/edt-ft5x06.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> index 955f085627fa..c34a0b23f90a 100644
> --- a/drivers/input/touchscreen/edt-ft5x06.c
> +++ b/drivers/input/touchscreen/edt-ft5x06.c
> @@ -1036,9 +1036,12 @@ static int edt_ft5x06_ts_remove(struct i2c_client *client)
>  static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
> +	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
>  
>  	if (device_may_wakeup(dev))
>  		enable_irq_wake(client->irq);
> +	else if (tsdata->reset_gpio)
> +		gpiod_set_value_cansleep(tsdata->reset_gpio, 1);
>  
>  	return 0;
>  }
> @@ -1046,9 +1049,12 @@ static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
>  static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
> +	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
>  
>  	if (device_may_wakeup(dev))
>  		disable_irq_wake(client->irq);
> +	else if (tsdata->reset_gpio)
> +		gpiod_set_value_cansleep(tsdata->reset_gpio, 0);

I think you need msleep() here as the chip needs a bit to get out of
reset before it is ready. FWIW we have 300 ms delay in probe().

Thanks.

-- 
Dmitry

  reply	other threads:[~2018-05-16 17:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 12:28 [PATCH 0/3] input: touchscreen: edt-ft5x06: make wakeup source behavior configurable Daniel Mack
2018-05-16 12:28 ` Daniel Mack
2018-05-16 12:28 ` [PATCH 1/3] " Daniel Mack
2018-05-16 12:28   ` Daniel Mack
2018-05-16 17:03   ` Dmitry Torokhov
2018-05-16 17:03     ` Dmitry Torokhov
2018-05-17  8:48     ` Daniel Mack
2018-05-17  8:48       ` Daniel Mack
2018-05-16 12:28 ` [PATCH 2/3] input: touchscreen: edt-ft5x06: assert reset during suspend Daniel Mack
2018-05-16 12:28   ` Daniel Mack
2018-05-16 17:05   ` Dmitry Torokhov [this message]
2018-05-16 17:05     ` Dmitry Torokhov
2018-05-16 12:28 ` [PATCH 3/3] ARM: dts: imx28/imx53: enable edt-ft5x06 wakeup source Daniel Mack
2018-05-16 12:28   ` Daniel Mack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180516170516.GB21971@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=daniel@zonque.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.