From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "james.chen" <james.chen@emc.com.tw>
Cc: Herman Lin <herman.lin@emc.com.tw>,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
charliemooney@chromium.org,
Jennifer Tsai <jennifer.tsai@emc.com.tw>,
Scott Liu <scott.liu@emc.com.tw>
Subject: Re: [PATCH 2/2] Input: elants_i2c: fixed wake-on-touch issue
Date: Mon, 4 Jan 2016 17:02:40 -0800 [thread overview]
Message-ID: <20160105010240.GC11801@dtor-ws> (raw)
In-Reply-To: <1451890670-29705-1-git-send-email-james.chen@emc.com.tw>
Hi James,
On Mon, Jan 04, 2016 at 02:57:50PM +0800, james.chen wrote:
> From: "james.chen" <james.chen@emc.com.tw>
>
> Fix function of wake-on-touch on suspend/resume.
> The function of device_may_wakeup will return true if
> the device supports wake-on-touch (for example, kitty and buddy).
> So, modify the code from "if (device_may_wakeup(dev))" to
> "if (!device_may_wakeup(dev))". And adjust the condition check of
> keep_power_in_suspend (designed for minnie).
> 2016.1.4: modify retry back to retry_cnt.
>
> Signed-off-by: james.chen <james.chen@emc.com.tw>
I already applied a version of this patch and it is in mainline.
Thanks.
> ---
> drivers/input/touchscreen/elants_i2c.c | 29 +++++++++++++++--------------
> 1 file changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
> index 17cc20e..3739646 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -1316,24 +1316,25 @@ static int __maybe_unused elants_i2c_suspend(struct device *dev)
>
> disable_irq(client->irq);
>
> - if (device_may_wakeup(dev) || ts->keep_power_in_suspend) {
> + if (device_may_wakeup(dev)) {
> + /*
> + * The device will automatically enter idle mode
> + * that has reduced power consumption.
> + */
> + ts->wake_irq_enabled = (enable_irq_wake(client->irq) == 0);
> + } else if (ts->keep_power_in_suspend) {
> for (retry_cnt = 0; retry_cnt < MAX_RETRIES; retry_cnt++) {
> error = elants_i2c_send(client, set_sleep_cmd,
> - sizeof(set_sleep_cmd));
> + sizeof(set_sleep_cmd));
> if (!error)
> break;
>
> dev_err(&client->dev,
> "suspend command failed: %d\n", error);
> }
> -
> - if (device_may_wakeup(dev))
> - ts->wake_irq_enabled =
> - (enable_irq_wake(client->irq) == 0);
> } else {
> - elants_i2c_power_off(ts);
> + elants_i2c_power_off(ts);
> }
> -
> return 0;
> }
>
> @@ -1345,13 +1346,14 @@ static int __maybe_unused elants_i2c_resume(struct device *dev)
> int retry_cnt;
> int error;
>
> - if (device_may_wakeup(dev) && ts->wake_irq_enabled)
> - disable_irq_wake(client->irq);
> -
> - if (ts->keep_power_in_suspend) {
> + if (device_may_wakeup(dev)) {
> + if (ts->wake_irq_enabled)
> + disable_irq_wake(client->irq);
> + elants_i2c_sw_reset(client);
> + } else if (ts->keep_power_in_suspend) {
> for (retry_cnt = 0; retry_cnt < MAX_RETRIES; retry_cnt++) {
> error = elants_i2c_send(client, set_active_cmd,
> - sizeof(set_active_cmd));
> + sizeof(set_active_cmd));
> if (!error)
> break;
>
> @@ -1362,7 +1364,6 @@ static int __maybe_unused elants_i2c_resume(struct device *dev)
> elants_i2c_power_on(ts);
> elants_i2c_initialize(ts);
> }
> -
> ts->state = ELAN_STATE_NORMAL;
> enable_irq(client->irq);
>
> --
> 1.8.3.2
>
--
Dmitry
prev parent reply other threads:[~2016-01-05 1:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-04 6:57 [PATCH 2/2] Input: elants_i2c: fixed wake-on-touch issue james.chen
2016-01-05 1:02 ` Dmitry Torokhov [this message]
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=20160105010240.GC11801@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=charliemooney@chromium.org \
--cc=herman.lin@emc.com.tw \
--cc=james.chen@emc.com.tw \
--cc=jennifer.tsai@emc.com.tw \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=scott.liu@emc.com.tw \
/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.