From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Anson Huang <Anson.Huang@nxp.com>
Cc: robh+dt@kernel.org, mark.rutland@arm.com, marco.franchi@nxp.com,
fabio.estevam@nxp.com, linux-input@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Linux-imx@nxp.com
Subject: Re: [PATCH 1/2] input: egalax_ts: add system wakeup support
Date: Wed, 5 Sep 2018 10:27:00 -0700 [thread overview]
Message-ID: <20180905172700.GA257188@dtor-ws> (raw)
In-Reply-To: <1536139607-16848-1-git-send-email-Anson.Huang@nxp.com>
Hi Anson,
On Wed, Sep 05, 2018 at 05:26:46PM +0800, Anson Huang wrote:
> This patch adds wakeup function support for egalax touch
> screen, if "wakeup-source" is added to device tree's egalax
> touch screen node, the wakeup function will be enabled, and
> egalax touch screen will be able to wakeup system from suspend.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
> drivers/input/touchscreen/egalax_ts.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c
> index 80e69bb..74984ed 100644
> --- a/drivers/input/touchscreen/egalax_ts.c
> +++ b/drivers/input/touchscreen/egalax_ts.c
> @@ -164,6 +164,7 @@ static int egalax_firmware_version(struct i2c_client *client)
> static int egalax_ts_probe(struct i2c_client *client,
> const struct i2c_device_id *id)
> {
> + struct device_node *np = client->dev.of_node;
> struct egalax_ts *ts;
> struct input_dev *input_dev;
> int error;
> @@ -224,6 +225,9 @@ static int egalax_ts_probe(struct i2c_client *client,
> if (error)
> return error;
>
> + if (of_property_read_bool(np, "wakeup-source"))
> + device_init_wakeup(&client->dev, true);
This is done in i2c core, there is no need to do it in the driver.
> +
> return 0;
> }
>
> @@ -241,6 +245,9 @@ static int __maybe_unused egalax_ts_suspend(struct device *dev)
> struct i2c_client *client = to_i2c_client(dev);
> int ret;
>
> + if (device_may_wakeup(dev))
> + return enable_irq_wake(client->irq);
> +
> ret = i2c_master_send(client, suspend_cmd, MAX_I2C_DATA_LEN);
> return ret > 0 ? 0 : ret;
> }
> @@ -249,6 +256,9 @@ static int __maybe_unused egalax_ts_resume(struct device *dev)
> {
> struct i2c_client *client = to_i2c_client(dev);
>
> + if (device_may_wakeup(dev))
> + return 0;
This will end up with unbalanced enable_irq_wake() from suspend.
> +
> return egalax_wake_up_device(client);
> }
>
> --
> 2.7.4
>
Thanks.
--
Dmitry
next prev parent reply other threads:[~2018-09-05 17:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-05 9:26 [PATCH 1/2] input: egalax_ts: add system wakeup support Anson Huang
2018-09-05 9:26 ` [PATCH 2/2] dt-bindings: egalax-ts: add support for wakeup event action Anson Huang
2018-09-16 22:54 ` Rob Herring
2018-09-17 18:07 ` Dmitry Torokhov
2018-09-19 1:01 ` Rob Herring
2018-09-05 10:34 ` [PATCH 1/2] input: egalax_ts: add system wakeup support Andi Shyti
2018-09-05 17:27 ` Dmitry Torokhov [this message]
2018-09-06 3:30 ` Anson Huang
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=20180905172700.GA257188@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=Anson.Huang@nxp.com \
--cc=Linux-imx@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=fabio.estevam@nxp.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marco.franchi@nxp.com \
--cc=mark.rutland@arm.com \
--cc=robh+dt@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.