From: Javier Carrasco <javier.carrasco@wolfvision.net>
To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Linus Walleij <linus.walleij@linaro.org>,
Uwe Kleine-g <u.kleine-koenig@pengutronix.de>,
Michael Riesch <michael.riesch@wolfvision.net>,
Javier Carrasco <javier.carrasco@wolfvision.net>
Subject: [PATCH 2/2] Input: st1232 - add wake up event counting
Date: Mon, 3 Apr 2023 14:47:07 +0200 [thread overview]
Message-ID: <20230403124707.102986-3-javier.carrasco@wolfvision.net> (raw)
In-Reply-To: <20230403124707.102986-1-javier.carrasco@wolfvision.net>
This device driver provides wakeup capabilities but the wakeup events
are not reflected in sysfs. Add pm_wakeup_event to the interrupt handler
in order to do so.
Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net>
---
drivers/input/touchscreen/st1232.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
index faa0be3993f4..f175bea464e1 100644
--- a/drivers/input/touchscreen/st1232.c
+++ b/drivers/input/touchscreen/st1232.c
@@ -59,6 +59,7 @@ struct st1232_ts_data {
const struct st_chip_info *chip_info;
int read_buf_len;
u8 *read_buf;
+ bool suspended;
};
static int st1232_ts_read_data(struct st1232_ts_data *ts, u8 reg,
@@ -173,9 +174,13 @@ static int st1232_ts_parse_and_report(struct st1232_ts_data *ts)
static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id)
{
struct st1232_ts_data *ts = dev_id;
+ struct i2c_client *client = ts->client;
int count;
int error;
+ if (ts->suspended && device_may_wakeup(&client->dev))
+ pm_wakeup_event(&client->dev, 0);
+
error = st1232_ts_read_data(ts, REG_XY_COORDINATES, ts->read_buf_len);
if (error)
goto out;
@@ -344,10 +349,16 @@ static int st1232_ts_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct st1232_ts_data *ts = i2c_get_clientdata(client);
+ struct input_dev *input = ts->input_dev;
+
+ mutex_lock(&input->mutex);
+ ts->suspended = true;
if (!device_may_wakeup(&client->dev))
st1232_ts_power(ts, false);
+ mutex_unlock(&input->mutex);
+
return 0;
}
@@ -355,10 +366,16 @@ static int st1232_ts_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct st1232_ts_data *ts = i2c_get_clientdata(client);
+ struct input_dev *input = ts->input_dev;
+
+ mutex_lock(&input->mutex);
+ ts->suspended = false;
if (!device_may_wakeup(&client->dev))
st1232_ts_power(ts, true);
+ mutex_unlock(&input->mutex);
+
return 0;
}
--
2.37.2
next prev parent reply other threads:[~2023-04-03 12:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 12:47 [PATCH 0/2] Input: st1232: wakeup in Suspend to idle Javier Carrasco
2023-04-03 12:47 ` [PATCH 1/2] Input: st1232 - remove enable/disable irq in resume/suspend callbacks Javier Carrasco
2023-04-03 12:47 ` Javier Carrasco [this message]
2023-04-18 4:12 ` [PATCH 0/2] Input: st1232: wakeup in Suspend to idle Javier Carrasco Cruz
2023-05-10 8:42 ` Javier Carrasco
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=20230403124707.102986-3-javier.carrasco@wolfvision.net \
--to=javier.carrasco@wolfvision.net \
--cc=Jonathan.Cameron@huawei.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.riesch@wolfvision.net \
--cc=u.kleine-koenig@pengutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox