Commit 64dcddd8 authored by Magnus Damm's avatar Magnus Damm Committed by Dmitry Torokhov

Input: tca6416-keypad - suspend/resume wakeup support

Extend the tca6416 driver to use enable_irq_wake() and disable_irq_wake()
in the suspend/resume hooks.

This makes it possible to wake up from suspend-to-ram using a tca6416 key
on the sh7372 mackerel board.
Signed-off-by: default avatarMagnus Damm <damm@opensource.se>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 4c75de32
...@@ -297,6 +297,7 @@ static int __devinit tca6416_keypad_probe(struct i2c_client *client, ...@@ -297,6 +297,7 @@ static int __devinit tca6416_keypad_probe(struct i2c_client *client,
} }
i2c_set_clientdata(client, chip); i2c_set_clientdata(client, chip);
device_init_wakeup(&client->dev, 1);
return 0; return 0;
...@@ -326,10 +327,37 @@ static int __devexit tca6416_keypad_remove(struct i2c_client *client) ...@@ -326,10 +327,37 @@ static int __devexit tca6416_keypad_remove(struct i2c_client *client)
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP
static int tca6416_keypad_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct tca6416_keypad_chip *chip = i2c_get_clientdata(client);
if (device_may_wakeup(dev))
enable_irq_wake(chip->irqnum);
return 0;
}
static int tca6416_keypad_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct tca6416_keypad_chip *chip = i2c_get_clientdata(client);
if (device_may_wakeup(dev))
disable_irq_wake(chip->irqnum);
return 0;
}
#endif
static SIMPLE_DEV_PM_OPS(tca6416_keypad_dev_pm_ops,
tca6416_keypad_suspend, tca6416_keypad_resume);
static struct i2c_driver tca6416_keypad_driver = { static struct i2c_driver tca6416_keypad_driver = {
.driver = { .driver = {
.name = "tca6416-keypad", .name = "tca6416-keypad",
.pm = &tca6416_keypad_dev_pm_ops,
}, },
.probe = tca6416_keypad_probe, .probe = tca6416_keypad_probe,
.remove = __devexit_p(tca6416_keypad_remove), .remove = __devexit_p(tca6416_keypad_remove),
......
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