diff options
author | Mike Frysinger <vapier.adi@gmail.com> | 2008-08-05 16:01:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-05 17:33:47 -0400 |
commit | 813006f4bb4a39afdde8ab2e3559971c029d1dc0 (patch) | |
tree | 599c70a70ba38f557ec439e73f9fe4620af0b970 /drivers/rtc | |
parent | 5aeb776d0c2bb1dd3ef01f4805929e2bc2923e7b (diff) |
blackfin RTC driver: add support for power management framework
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-bfin.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index a568d29b0742..23b991d41ef1 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Blackfin On-Chip Real Time Clock Driver | 2 | * Blackfin On-Chip Real Time Clock Driver |
3 | * Supports BF52[257]/BF53[123]/BF53[467]/BF54[24789] | 3 | * Supports BF52[257]/BF53[123]/BF53[467]/BF54[24789] |
4 | * | 4 | * |
5 | * Copyright 2004-2007 Analog Devices Inc. | 5 | * Copyright 2004-2008 Analog Devices Inc. |
6 | * | 6 | * |
7 | * Enter bugs at http://blackfin.uclinux.org/ | 7 | * Enter bugs at http://blackfin.uclinux.org/ |
8 | * | 8 | * |
@@ -412,6 +412,8 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev) | |||
412 | 412 | ||
413 | platform_set_drvdata(pdev, rtc); | 413 | platform_set_drvdata(pdev, rtc); |
414 | 414 | ||
415 | device_init_wakeup(&pdev->dev, 1); | ||
416 | |||
415 | return 0; | 417 | return 0; |
416 | 418 | ||
417 | err: | 419 | err: |
@@ -433,25 +435,28 @@ static int __devexit bfin_rtc_remove(struct platform_device *pdev) | |||
433 | #ifdef CONFIG_PM | 435 | #ifdef CONFIG_PM |
434 | static int bfin_rtc_suspend(struct platform_device *pdev, pm_message_t state) | 436 | static int bfin_rtc_suspend(struct platform_device *pdev, pm_message_t state) |
435 | { | 437 | { |
436 | #ifdef PM_WAKEUP_SIC_IWR | ||
437 | struct bfin_rtc *rtc = dev_get_drvdata(&pdev->dev); | 438 | struct bfin_rtc *rtc = dev_get_drvdata(&pdev->dev); |
438 | #endif | 439 | |
439 | bfin_rtc_reset(&pdev->dev); | 440 | if (device_may_wakeup(&pdev->dev)) |
440 | #ifdef PM_WAKEUP_SIC_IWR | 441 | enable_irq_wake(IRQ_RTC); |
441 | bfin_write_RTC_SWCNT(10); | 442 | else |
442 | bfin_rtc_int_set(rtc, RTC_ISTAT_STOPWATCH); | 443 | bfin_rtc_int_clear(rtc, -1); |
443 | #endif | 444 | |
444 | return 0; | 445 | return 0; |
445 | } | 446 | } |
446 | 447 | ||
447 | static int bfin_rtc_resume(struct platform_device *pdev) | 448 | static int bfin_rtc_resume(struct platform_device *pdev) |
448 | { | 449 | { |
449 | #ifdef PM_WAKEUP_SIC_IWR | 450 | if (device_may_wakeup(&pdev->dev)) |
450 | struct bfin_rtc *rtc = dev_get_drvdata(&pdev->dev); | 451 | disable_irq_wake(IRQ_RTC); |
451 | bfin_rtc_int_clear(rtc, RTC_ISTAT_STOPWATCH); | 452 | else |
452 | #endif | 453 | bfin_write_RTC_ISTAT(-1); |
454 | |||
453 | return 0; | 455 | return 0; |
454 | } | 456 | } |
457 | #else | ||
458 | # define bfin_rtc_suspend NULL | ||
459 | # define bfin_rtc_resume NULL | ||
455 | #endif | 460 | #endif |
456 | 461 | ||
457 | static struct platform_driver bfin_rtc_driver = { | 462 | static struct platform_driver bfin_rtc_driver = { |
@@ -461,10 +466,8 @@ static struct platform_driver bfin_rtc_driver = { | |||
461 | }, | 466 | }, |
462 | .probe = bfin_rtc_probe, | 467 | .probe = bfin_rtc_probe, |
463 | .remove = __devexit_p(bfin_rtc_remove), | 468 | .remove = __devexit_p(bfin_rtc_remove), |
464 | #ifdef CONFIG_PM | ||
465 | .suspend = bfin_rtc_suspend, | 469 | .suspend = bfin_rtc_suspend, |
466 | .resume = bfin_rtc_resume, | 470 | .resume = bfin_rtc_resume, |
467 | #endif | ||
468 | }; | 471 | }; |
469 | 472 | ||
470 | static int __init bfin_rtc_init(void) | 473 | static int __init bfin_rtc_init(void) |