public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] migor_ts: add wakeup support
@ 2009-04-01 14:49 Magnus Damm
  0 siblings, 0 replies; only message in thread
From: Magnus Damm @ 2009-04-01 14:49 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@igel.co.jp>

Add wakeup support to the migor_ts driver. If user space has enabled
wakeup, use set_irq_wake() during suspend and resume. With this patch
the migor_ts driver can be used to wake the system from suspend.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 Tested with wakeup enabled and disabled on a Migo-R board.

 drivers/input/touchscreen/migor_ts.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

--- 0001/drivers/input/touchscreen/migor_ts.c
+++ work/drivers/input/touchscreen/migor_ts.c	2009-04-01 22:59:07.000000000 +0900
@@ -198,6 +198,7 @@ static int migor_ts_probe(struct i2c_cli
 		goto err2;
 	}
 
+	device_init_wakeup(&client->dev, 1);
 	return 0;
 
  err2:
@@ -224,6 +225,26 @@ static int migor_ts_remove(struct i2c_cl
 	return 0;
 }
 
+static int migor_ts_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+	struct migor_ts_priv *priv = dev_get_drvdata(&client->dev);
+
+	if (device_may_wakeup(&client->dev))
+		enable_irq_wake(priv->irq);
+
+	return 0;
+}
+
+static int migor_ts_resume(struct i2c_client *client)
+{
+	struct migor_ts_priv *priv = dev_get_drvdata(&client->dev);
+
+	if (device_may_wakeup(&client->dev))
+		disable_irq_wake(priv->irq);
+
+	return 0;
+}
+
 static const struct i2c_device_id migor_ts_id[] = {
 	{ "migor_ts", 0 },
 	{ }
@@ -236,6 +257,8 @@ static struct i2c_driver migor_ts_driver
 	},
 	.probe = migor_ts_probe,
 	.remove = migor_ts_remove,
+	.suspend = migor_ts_suspend,
+	.resume = migor_ts_resume,
 	.id_table = migor_ts_id,
 };
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-01 14:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-01 14:49 [PATCH] migor_ts: add wakeup support Magnus Damm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox