Commit 64dcddd888998f7db9929e19fc063e75e3ea21f5

Authored by Magnus Damm
Committed by Dmitry Torokhov
1 parent 4c75de32eb

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>

Showing 1 changed file with 28 additions and 0 deletions Side-by-side Diff

drivers/input/keyboard/tca6416-keypad.c
... ... @@ -297,6 +297,7 @@
297 297 }
298 298  
299 299 i2c_set_clientdata(client, chip);
  300 + device_init_wakeup(&client->dev, 1);
300 301  
301 302 return 0;
302 303  
303 304  
304 305  
... ... @@ -326,10 +327,37 @@
326 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);
329 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);
  356 +
330 357 static struct i2c_driver tca6416_keypad_driver = {
331 358 .driver = {
332 359 .name = "tca6416-keypad",
  360 + .pm = &tca6416_keypad_dev_pm_ops,
333 361 },
334 362 .probe = tca6416_keypad_probe,
335 363 .remove = __devexit_p(tca6416_keypad_remove),