diff options
author | Bo Shen <voice.shen@atmel.com> | 2013-08-13 18:46:40 +0200 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-08-13 18:52:18 +0200 |
commit | 3719b54bc62318db7dd8ac7c39a09dfb991a208f (patch) | |
tree | a61c9157a697e18f42873c41c6db80e3852fbabf /drivers/input | |
parent | Input: wistron_btns - add MODULE_DEVICE_TABLE (diff) | |
download | linux-3719b54bc62318db7dd8ac7c39a09dfb991a208f.tar.xz linux-3719b54bc62318db7dd8ac7c39a09dfb991a208f.zip |
Input: qt1070 - add power management ops
Add power management ops for qt1070, it may be a wakeup source.
Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/keyboard/qt1070.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c index 42b773b3125a..6c561ec3cc09 100644 --- a/drivers/input/keyboard/qt1070.c +++ b/drivers/input/keyboard/qt1070.c @@ -243,6 +243,32 @@ static int qt1070_remove(struct i2c_client *client) return 0; } +#ifdef CONFIG_PM_SLEEP +static int qt1070_suspend(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct qt1070_data *data = i2c_get_clientdata(client); + + if (device_may_wakeup(dev)) + enable_irq_wake(data->irq); + + return 0; +} + +static int qt1070_resume(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct qt1070_data *data = i2c_get_clientdata(client); + + if (device_may_wakeup(dev)) + disable_irq_wake(data->irq); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(qt1070_pm_ops, qt1070_suspend, qt1070_resume); + static const struct i2c_device_id qt1070_id[] = { { "qt1070", 0 }, { }, @@ -253,6 +279,7 @@ static struct i2c_driver qt1070_driver = { .driver = { .name = "qt1070", .owner = THIS_MODULE, + .pm = &qt1070_pm_ops, }, .id_table = qt1070_id, .probe = qt1070_probe, |