linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Input: atmel_mxt_ts - add wakeup support
@ 2019-05-17 21:17 Stefano Manni
  2019-05-17 21:17 ` [PATCH 2/2] dt-bindings: input: Add wakeup-source for atmel,maxtouch Stefano Manni
  2019-05-17 21:30 ` [PATCH 1/2] Input: atmel_mxt_ts - add wakeup support Dmitry Torokhov
  0 siblings, 2 replies; 6+ messages in thread
From: Stefano Manni @ 2019-05-17 21:17 UTC (permalink / raw)
  To: nick, dmitry.torokhov, robh+dt, mark.rutland
  Cc: Stefano Manni, linux-input, devicetree, linux-kernel

Add wakeup support to the maxtouch driver.
The device can wake up the system from suspend,
mark the IRQ as wakeup capable, so that device
irq is not disabled during system suspend.

Signed-off-by: Stefano Manni <stefano.manni@gmail.com>
---
 drivers/input/touchscreen/atmel_mxt_ts.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 5c63d25ce84e..2e0abc0b665d 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -3041,6 +3041,7 @@ static const struct dmi_system_id chromebook_T9_suspend_dmi[] = {
 static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
 {
 	struct mxt_data *data;
+	struct device_node *node = client->dev.of_node;
 	int error;
 
 	/*
@@ -3125,6 +3126,12 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		goto err_free_object;
 	}
 
+	if (node) {
+		if (of_property_read_bool(node, "wakeup-source") ||
+			of_property_read_bool(node, "linux,wakeup"))
+			device_init_wakeup(&client->dev, true);
+	}
+
 	return 0;
 
 err_free_object:
@@ -3156,6 +3163,9 @@ static int __maybe_unused mxt_suspend(struct device *dev)
 
 	mutex_lock(&input_dev->mutex);
 
+	if (device_may_wakeup(&client->dev))
+		enable_irq_wake(client->irq);
+
 	if (input_dev->users)
 		mxt_stop(data);
 
@@ -3175,6 +3185,9 @@ static int __maybe_unused mxt_resume(struct device *dev)
 
 	mutex_lock(&input_dev->mutex);
 
+	if (device_may_wakeup(&client->dev))
+		disable_irq_wake(client->irq);
+
 	if (input_dev->users)
 		mxt_start(data);
 
-- 
2.20.1


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

* [PATCH 2/2] dt-bindings: input: Add wakeup-source for atmel,maxtouch
  2019-05-17 21:17 [PATCH 1/2] Input: atmel_mxt_ts - add wakeup support Stefano Manni
@ 2019-05-17 21:17 ` Stefano Manni
  2019-06-13 22:52   ` Rob Herring
  2019-05-17 21:30 ` [PATCH 1/2] Input: atmel_mxt_ts - add wakeup support Dmitry Torokhov
  1 sibling, 1 reply; 6+ messages in thread
From: Stefano Manni @ 2019-05-17 21:17 UTC (permalink / raw)
  To: nick, dmitry.torokhov, robh+dt, mark.rutland
  Cc: Stefano Manni, linux-input, devicetree, linux-kernel

Add wakeup support to the maxtouch driver.

Signed-off-by: Stefano Manni <stefano.manni@gmail.com>
---
 Documentation/devicetree/bindings/input/atmel,maxtouch.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
index c88919480d37..7491a8843c85 100644
--- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
+++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
@@ -31,6 +31,10 @@ Optional properties for main touchpad device:
 
 - reset-gpios: GPIO specifier for the touchscreen's reset pin (active low)
 
+- wakeup-source: use any event on touchscreen as wakeup event.
+    (Legacy property support: "linux,wakeup")
+
+
 Example:
 
 	touch@4b {
@@ -38,4 +42,5 @@ Example:
 		reg = <0x4b>;
 		interrupt-parent = <&gpio>;
 		interrupts = <TEGRA_GPIO(W, 3) IRQ_TYPE_LEVEL_LOW>;
+		wakeup-source;
 	};
-- 
2.20.1


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

* Re: [PATCH 1/2] Input: atmel_mxt_ts - add wakeup support
  2019-05-17 21:17 [PATCH 1/2] Input: atmel_mxt_ts - add wakeup support Stefano Manni
  2019-05-17 21:17 ` [PATCH 2/2] dt-bindings: input: Add wakeup-source for atmel,maxtouch Stefano Manni
@ 2019-05-17 21:30 ` Dmitry Torokhov
  2019-05-18 16:55   ` stefano.manni
  1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2019-05-17 21:30 UTC (permalink / raw)
  To: Stefano Manni
  Cc: nick, robh+dt, mark.rutland, linux-input, devicetree, linux-kernel

Hi Sefano,

On Fri, May 17, 2019 at 11:17:40PM +0200, Stefano Manni wrote:
> Add wakeup support to the maxtouch driver.
> The device can wake up the system from suspend,
> mark the IRQ as wakeup capable, so that device
> irq is not disabled during system suspend.

This should already be handled by I2C core, see lines after "if
(client->flags & I2C_CLIENT_WAKE)" in drivers/i2c/i2c-core-base.c.

Unless there is dedicated wakeup interrupt we configure main interrupt
as wake source.

Thanks.

-- 
Dmitry

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

* Re: [PATCH 1/2] Input: atmel_mxt_ts - add wakeup support
  2019-05-17 21:30 ` [PATCH 1/2] Input: atmel_mxt_ts - add wakeup support Dmitry Torokhov
@ 2019-05-18 16:55   ` stefano.manni
  2019-05-21  5:33     ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: stefano.manni @ 2019-05-18 16:55 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: nick, robh+dt, mark.rutland, linux-input, devicetree, linux-kernel

Hi Dmitry,

On Fri, 2019-05-17 at 14:30 -0700, Dmitry Torokhov wrote:
> Hi Sefano,
> 
> On Fri, May 17, 2019 at 11:17:40PM +0200, Stefano Manni wrote:
> > Add wakeup support to the maxtouch driver.
> > The device can wake up the system from suspend,
> > mark the IRQ as wakeup capable, so that device
> > irq is not disabled during system suspend.
> 
> This should already be handled by I2C core, see lines after "if
> (client->flags & I2C_CLIENT_WAKE)" in drivers/i2c/i2c-core-base.c.
> 
> Unless there is dedicated wakeup interrupt we configure main
> interrupt
> as wake source.
> 

what's about the other drivers (e.g. ili210x.c) doing like this?
Shall they be purged?

Thank you.


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

* Re: [PATCH 1/2] Input: atmel_mxt_ts - add wakeup support
  2019-05-18 16:55   ` stefano.manni
@ 2019-05-21  5:33     ` Dmitry Torokhov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2019-05-21  5:33 UTC (permalink / raw)
  To: stefano.manni
  Cc: nick, robh+dt, mark.rutland, linux-input, devicetree, linux-kernel

On Sat, May 18, 2019 at 06:55:10PM +0200, stefano.manni@gmail.com wrote:
> Hi Dmitry,
> 
> On Fri, 2019-05-17 at 14:30 -0700, Dmitry Torokhov wrote:
> > Hi Sefano,
> > 
> > On Fri, May 17, 2019 at 11:17:40PM +0200, Stefano Manni wrote:
> > > Add wakeup support to the maxtouch driver.
> > > The device can wake up the system from suspend,
> > > mark the IRQ as wakeup capable, so that device
> > > irq is not disabled during system suspend.
> > 
> > This should already be handled by I2C core, see lines after "if
> > (client->flags & I2C_CLIENT_WAKE)" in drivers/i2c/i2c-core-base.c.
> > 
> > Unless there is dedicated wakeup interrupt we configure main
> > interrupt
> > as wake source.
> > 
> 
> what's about the other drivers (e.g. ili210x.c) doing like this?
> Shall they be purged?

They were likely done before I2C and driver core were enhanced to handle
wakeup automatically. We might want to clean them up, as long as we
verify that they keep working.

Thanks.

-- 
Dmitry

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

* Re: [PATCH 2/2] dt-bindings: input: Add wakeup-source for atmel,maxtouch
  2019-05-17 21:17 ` [PATCH 2/2] dt-bindings: input: Add wakeup-source for atmel,maxtouch Stefano Manni
@ 2019-06-13 22:52   ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2019-06-13 22:52 UTC (permalink / raw)
  To: Stefano Manni
  Cc: nick, dmitry.torokhov, robh+dt, mark.rutland, Stefano Manni,
	linux-input, devicetree, linux-kernel

On Fri, 17 May 2019 23:17:41 +0200, Stefano Manni wrote:
> Add wakeup support to the maxtouch driver.
> 
> Signed-off-by: Stefano Manni <stefano.manni@gmail.com>
> ---
>  Documentation/devicetree/bindings/input/atmel,maxtouch.txt | 5 +++++
>  1 file changed, 5 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

end of thread, other threads:[~2019-06-13 22:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-17 21:17 [PATCH 1/2] Input: atmel_mxt_ts - add wakeup support Stefano Manni
2019-05-17 21:17 ` [PATCH 2/2] dt-bindings: input: Add wakeup-source for atmel,maxtouch Stefano Manni
2019-06-13 22:52   ` Rob Herring
2019-05-17 21:30 ` [PATCH 1/2] Input: atmel_mxt_ts - add wakeup support Dmitry Torokhov
2019-05-18 16:55   ` stefano.manni
2019-05-21  5:33     ` Dmitry Torokhov

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).