Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Magnus Damm and committed by
Dmitry Torokhov
64dcddd8 4c75de32

+28
+28
drivers/input/keyboard/tca6416-keypad.c
··· 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 ··· 327 326 return 0; 328 327 } 329 328 329 + #ifdef CONFIG_PM_SLEEP 330 + static int tca6416_keypad_suspend(struct device *dev) 331 + { 332 + struct i2c_client *client = to_i2c_client(dev); 333 + struct tca6416_keypad_chip *chip = i2c_get_clientdata(client); 334 + 335 + if (device_may_wakeup(dev)) 336 + enable_irq_wake(chip->irqnum); 337 + 338 + return 0; 339 + } 340 + 341 + static int tca6416_keypad_resume(struct device *dev) 342 + { 343 + struct i2c_client *client = to_i2c_client(dev); 344 + struct tca6416_keypad_chip *chip = i2c_get_clientdata(client); 345 + 346 + if (device_may_wakeup(dev)) 347 + disable_irq_wake(chip->irqnum); 348 + 349 + return 0; 350 + } 351 + #endif 352 + 353 + static SIMPLE_DEV_PM_OPS(tca6416_keypad_dev_pm_ops, 354 + tca6416_keypad_suspend, tca6416_keypad_resume); 330 355 331 356 static struct i2c_driver tca6416_keypad_driver = { 332 357 .driver = { 333 358 .name = "tca6416-keypad", 359 + .pm = &tca6416_keypad_dev_pm_ops, 334 360 }, 335 361 .probe = tca6416_keypad_probe, 336 362 .remove = __devexit_p(tca6416_keypad_remove),