Commit d0478d0a authored by Michael Hennerich's avatar Michael Hennerich Committed by Dmitry Torokhov

Input: bf54x-keys - add infrastructure for keypad wakeups

Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarBryan Wu <cooloney@kernel.org>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent d7b5247b
...@@ -312,6 +312,8 @@ static int __devinit bfin_kpad_probe(struct platform_device *pdev) ...@@ -312,6 +312,8 @@ static int __devinit bfin_kpad_probe(struct platform_device *pdev)
bfin_write_KPAD_CTL(bfin_read_KPAD_CTL() | KPAD_EN); bfin_write_KPAD_CTL(bfin_read_KPAD_CTL() | KPAD_EN);
device_init_wakeup(&pdev->dev, 1);
printk(KERN_ERR DRV_NAME printk(KERN_ERR DRV_NAME
": Blackfin BF54x Keypad registered IRQ %d\n", bf54x_kpad->irq); ": Blackfin BF54x Keypad registered IRQ %d\n", bf54x_kpad->irq);
...@@ -354,13 +356,40 @@ static int __devexit bfin_kpad_remove(struct platform_device *pdev) ...@@ -354,13 +356,40 @@ static int __devexit bfin_kpad_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM
static int bfin_kpad_suspend(struct platform_device *pdev, pm_message_t state)
{
struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
if (device_may_wakeup(&pdev->dev))
enable_irq_wake(bf54x_kpad->irq);
return 0;
}
static int bfin_kpad_resume(struct platform_device *pdev)
{
struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
if (device_may_wakeup(&pdev->dev))
disable_irq_wake(bf54x_kpad->irq);
return 0;
}
#else
# define bfin_kpad_suspend NULL
# define bfin_kpad_resume NULL
#endif
struct platform_driver bfin_kpad_device_driver = { struct platform_driver bfin_kpad_device_driver = {
.probe = bfin_kpad_probe,
.remove = __devexit_p(bfin_kpad_remove),
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
} },
.probe = bfin_kpad_probe,
.remove = __devexit_p(bfin_kpad_remove),
.suspend = bfin_kpad_suspend,
.resume = bfin_kpad_resume,
}; };
static int __init bfin_kpad_init(void) static int __init bfin_kpad_init(void)
......
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