linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Input: atmel_mxt_ts: Add wake-up support
@ 2021-06-23 13:56 Loic Poulain
  2021-06-23 13:56 ` [PATCH 2/2] Input: atmel_mxt_ts: atmel_mxt_ts: Fix event loss Loic Poulain
  2021-06-24  0:41 ` [PATCH 1/2] Input: atmel_mxt_ts: Add wake-up support Dmitry Torokhov
  0 siblings, 2 replies; 7+ messages in thread
From: Loic Poulain @ 2021-06-23 13:56 UTC (permalink / raw)
  To: nick, dmitry.torokhov; +Cc: linux-input, Loic Poulain

Add capability for the touchscreen to wakeup the host on touch event.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/input/touchscreen/atmel_mxt_ts.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 05de92c..807f449 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -3223,6 +3223,8 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		return error;
 	}
 
+	device_set_wakeup_capable(&client->dev, true);
+
 	error = regulator_bulk_enable(ARRAY_SIZE(data->regulators),
 				      data->regulators);
 	if (error) {
@@ -3309,8 +3311,12 @@ static int __maybe_unused mxt_suspend(struct device *dev)
 
 	mutex_lock(&input_dev->mutex);
 
-	if (input_device_enabled(input_dev))
-		mxt_stop(data);
+	if (input_device_enabled(input_dev)) {
+		if (device_may_wakeup(dev))
+			enable_irq_wake(data->irq);
+		else
+			mxt_stop(data);
+	}
 
 	mutex_unlock(&input_dev->mutex);
 
@@ -3332,8 +3338,12 @@ static int __maybe_unused mxt_resume(struct device *dev)
 
 	mutex_lock(&input_dev->mutex);
 
-	if (input_device_enabled(input_dev))
-		mxt_start(data);
+	if (input_device_enabled(input_dev)) {
+		if (device_may_wakeup(dev))
+			disable_irq_wake(data->irq);
+		else
+			mxt_start(data);
+	}
 
 	mutex_unlock(&input_dev->mutex);
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-24  7:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 13:56 [PATCH 1/2] Input: atmel_mxt_ts: Add wake-up support Loic Poulain
2021-06-23 13:56 ` [PATCH 2/2] Input: atmel_mxt_ts: atmel_mxt_ts: Fix event loss Loic Poulain
2021-06-24  0:48   ` Dmitry Torokhov
2021-06-24  5:57     ` Peter Hutterer
2021-06-24  8:05       ` Loic Poulain
2021-06-24  0:41 ` [PATCH 1/2] Input: atmel_mxt_ts: Add wake-up support Dmitry Torokhov
2021-06-24  7:56   ` Loic Poulain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).