diff options
author | Magnus Damm <damm@opensource.se> | 2011-03-16 01:32:39 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-03-16 02:18:28 -0400 |
commit | 64dcddd888998f7db9929e19fc063e75e3ea21f5 (patch) | |
tree | 3005487865a6fe5eca16c2e00a8436f8507d9a19 /drivers/input/keyboard | |
parent | 4c75de32eb9fcaa14925e2e444748f8b71e4f6fc (diff) |
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: Magnus Damm <damm@opensource.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/tca6416-keypad.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/input/keyboard/tca6416-keypad.c b/drivers/input/keyboard/tca6416-keypad.c index 800fbccf1f0f..3afea3f89718 100644 --- a/drivers/input/keyboard/tca6416-keypad.c +++ b/drivers/input/keyboard/tca6416-keypad.c | |||
@@ -297,6 +297,7 @@ static int __devinit tca6416_keypad_probe(struct i2c_client *client, | |||
297 | } | 297 | } |
298 | 298 | ||
299 | i2c_set_clientdata(client, chip); | 299 | i2c_set_clientdata(client, chip); |
300 | device_init_wakeup(&client->dev, 1); | ||
300 | 301 | ||
301 | return 0; | 302 | return 0; |
302 | 303 | ||
@@ -326,10 +327,37 @@ static int __devexit tca6416_keypad_remove(struct i2c_client *client) | |||
326 | return 0; | 327 | return 0; |
327 | } | 328 | } |
328 | 329 | ||
330 | #ifdef CONFIG_PM_SLEEP | ||
331 | static int tca6416_keypad_suspend(struct device *dev) | ||
332 | { | ||
333 | struct i2c_client *client = to_i2c_client(dev); | ||
334 | struct tca6416_keypad_chip *chip = i2c_get_clientdata(client); | ||
335 | |||
336 | if (device_may_wakeup(dev)) | ||
337 | enable_irq_wake(chip->irqnum); | ||
338 | |||
339 | return 0; | ||
340 | } | ||
341 | |||
342 | static int tca6416_keypad_resume(struct device *dev) | ||
343 | { | ||
344 | struct i2c_client *client = to_i2c_client(dev); | ||
345 | struct tca6416_keypad_chip *chip = i2c_get_clientdata(client); | ||
346 | |||
347 | if (device_may_wakeup(dev)) | ||
348 | disable_irq_wake(chip->irqnum); | ||
349 | |||
350 | return 0; | ||
351 | } | ||
352 | #endif | ||
353 | |||
354 | static SIMPLE_DEV_PM_OPS(tca6416_keypad_dev_pm_ops, | ||
355 | tca6416_keypad_suspend, tca6416_keypad_resume); | ||
329 | 356 | ||
330 | static struct i2c_driver tca6416_keypad_driver = { | 357 | static struct i2c_driver tca6416_keypad_driver = { |
331 | .driver = { | 358 | .driver = { |
332 | .name = "tca6416-keypad", | 359 | .name = "tca6416-keypad", |
360 | .pm = &tca6416_keypad_dev_pm_ops, | ||
333 | }, | 361 | }, |
334 | .probe = tca6416_keypad_probe, | 362 | .probe = tca6416_keypad_probe, |
335 | .remove = __devexit_p(tca6416_keypad_remove), | 363 | .remove = __devexit_p(tca6416_keypad_remove), |