diff options
author | Michael Hennerich <michael.hennerich@analog.com> | 2008-04-18 00:25:00 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2008-04-24 13:25:03 -0400 |
commit | d0478d0ad7a58f36afa03e57afe14955c2943466 (patch) | |
tree | c742e28a23597abb5cff6dcee660aceffac6a79e /drivers/input/keyboard/bf54x-keys.c | |
parent | d7b5247bbcfba2bc96d4b3dec9086a4f1a31363b (diff) |
Input: bf54x-keys - add infrastructure for keypad wakeups
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard/bf54x-keys.c')
-rw-r--r-- | drivers/input/keyboard/bf54x-keys.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c index d87ac3322a6d..54ed8e2e1c02 100644 --- a/drivers/input/keyboard/bf54x-keys.c +++ b/drivers/input/keyboard/bf54x-keys.c | |||
@@ -312,6 +312,8 @@ static int __devinit bfin_kpad_probe(struct platform_device *pdev) | |||
312 | 312 | ||
313 | bfin_write_KPAD_CTL(bfin_read_KPAD_CTL() | KPAD_EN); | 313 | bfin_write_KPAD_CTL(bfin_read_KPAD_CTL() | KPAD_EN); |
314 | 314 | ||
315 | device_init_wakeup(&pdev->dev, 1); | ||
316 | |||
315 | printk(KERN_ERR DRV_NAME | 317 | printk(KERN_ERR DRV_NAME |
316 | ": Blackfin BF54x Keypad registered IRQ %d\n", bf54x_kpad->irq); | 318 | ": Blackfin BF54x Keypad registered IRQ %d\n", bf54x_kpad->irq); |
317 | 319 | ||
@@ -354,13 +356,40 @@ static int __devexit bfin_kpad_remove(struct platform_device *pdev) | |||
354 | return 0; | 356 | return 0; |
355 | } | 357 | } |
356 | 358 | ||
359 | #ifdef CONFIG_PM | ||
360 | static int bfin_kpad_suspend(struct platform_device *pdev, pm_message_t state) | ||
361 | { | ||
362 | struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev); | ||
363 | |||
364 | if (device_may_wakeup(&pdev->dev)) | ||
365 | enable_irq_wake(bf54x_kpad->irq); | ||
366 | |||
367 | return 0; | ||
368 | } | ||
369 | |||
370 | static int bfin_kpad_resume(struct platform_device *pdev) | ||
371 | { | ||
372 | struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev); | ||
373 | |||
374 | if (device_may_wakeup(&pdev->dev)) | ||
375 | disable_irq_wake(bf54x_kpad->irq); | ||
376 | |||
377 | return 0; | ||
378 | } | ||
379 | #else | ||
380 | # define bfin_kpad_suspend NULL | ||
381 | # define bfin_kpad_resume NULL | ||
382 | #endif | ||
383 | |||
357 | struct platform_driver bfin_kpad_device_driver = { | 384 | struct platform_driver bfin_kpad_device_driver = { |
358 | .probe = bfin_kpad_probe, | ||
359 | .remove = __devexit_p(bfin_kpad_remove), | ||
360 | .driver = { | 385 | .driver = { |
361 | .name = DRV_NAME, | 386 | .name = DRV_NAME, |
362 | .owner = THIS_MODULE, | 387 | .owner = THIS_MODULE, |
363 | } | 388 | }, |
389 | .probe = bfin_kpad_probe, | ||
390 | .remove = __devexit_p(bfin_kpad_remove), | ||
391 | .suspend = bfin_kpad_suspend, | ||
392 | .resume = bfin_kpad_resume, | ||
364 | }; | 393 | }; |
365 | 394 | ||
366 | static int __init bfin_kpad_init(void) | 395 | static int __init bfin_kpad_init(void) |