Commit 0935ade0 authored by Magnus Damm's avatar Magnus Damm Committed by Paul Mundt

input: migor_ts: add wakeup support

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: default avatarMagnus Damm <damm@igel.co.jp>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent faa9fa8e
...@@ -198,6 +198,7 @@ static int migor_ts_probe(struct i2c_client *client, ...@@ -198,6 +198,7 @@ static int migor_ts_probe(struct i2c_client *client,
goto err2; goto err2;
} }
device_init_wakeup(&client->dev, 1);
return 0; return 0;
err2: err2:
...@@ -224,6 +225,26 @@ static int migor_ts_remove(struct i2c_client *client) ...@@ -224,6 +225,26 @@ static int migor_ts_remove(struct i2c_client *client)
return 0; 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[] = { static const struct i2c_device_id migor_ts_id[] = {
{ "migor_ts", 0 }, { "migor_ts", 0 },
{ } { }
...@@ -236,6 +257,8 @@ static struct i2c_driver migor_ts_driver = { ...@@ -236,6 +257,8 @@ static struct i2c_driver migor_ts_driver = {
}, },
.probe = migor_ts_probe, .probe = migor_ts_probe,
.remove = migor_ts_remove, .remove = migor_ts_remove,
.suspend = migor_ts_suspend,
.resume = migor_ts_resume,
.id_table = migor_ts_id, .id_table = migor_ts_id,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment