diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/rtc/rtc-at91sam9.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 7b77c27e0955..b60a34cb145a 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -404,14 +404,13 @@ static void at91_rtc_shutdown(struct platform_device *pdev) | |||
404 | rtt_writel(rtc, MR, mr & ~rtc->imr); | 404 | rtt_writel(rtc, MR, mr & ~rtc->imr); |
405 | } | 405 | } |
406 | 406 | ||
407 | #ifdef CONFIG_PM | 407 | #ifdef CONFIG_PM_SLEEP |
408 | 408 | ||
409 | /* AT91SAM9 RTC Power management control */ | 409 | /* AT91SAM9 RTC Power management control */ |
410 | 410 | ||
411 | static int at91_rtc_suspend(struct platform_device *pdev, | 411 | static int at91_rtc_suspend(struct device *dev) |
412 | pm_message_t state) | ||
413 | { | 412 | { |
414 | struct sam9_rtc *rtc = platform_get_drvdata(pdev); | 413 | struct sam9_rtc *rtc = dev_get_drvdata(dev); |
415 | u32 mr = rtt_readl(rtc, MR); | 414 | u32 mr = rtt_readl(rtc, MR); |
416 | 415 | ||
417 | /* | 416 | /* |
@@ -420,7 +419,7 @@ static int at91_rtc_suspend(struct platform_device *pdev, | |||
420 | */ | 419 | */ |
421 | rtc->imr = mr & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN); | 420 | rtc->imr = mr & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN); |
422 | if (rtc->imr) { | 421 | if (rtc->imr) { |
423 | if (device_may_wakeup(&pdev->dev) && (mr & AT91_RTT_ALMIEN)) { | 422 | if (device_may_wakeup(dev) && (mr & AT91_RTT_ALMIEN)) { |
424 | enable_irq_wake(rtc->irq); | 423 | enable_irq_wake(rtc->irq); |
425 | /* don't let RTTINC cause wakeups */ | 424 | /* don't let RTTINC cause wakeups */ |
426 | if (mr & AT91_RTT_RTTINCIEN) | 425 | if (mr & AT91_RTT_RTTINCIEN) |
@@ -432,13 +431,13 @@ static int at91_rtc_suspend(struct platform_device *pdev, | |||
432 | return 0; | 431 | return 0; |
433 | } | 432 | } |
434 | 433 | ||
435 | static int at91_rtc_resume(struct platform_device *pdev) | 434 | static int at91_rtc_resume(struct device *dev) |
436 | { | 435 | { |
437 | struct sam9_rtc *rtc = platform_get_drvdata(pdev); | 436 | struct sam9_rtc *rtc = dev_get_drvdata(dev); |
438 | u32 mr; | 437 | u32 mr; |
439 | 438 | ||
440 | if (rtc->imr) { | 439 | if (rtc->imr) { |
441 | if (device_may_wakeup(&pdev->dev)) | 440 | if (device_may_wakeup(dev)) |
442 | disable_irq_wake(rtc->irq); | 441 | disable_irq_wake(rtc->irq); |
443 | mr = rtt_readl(rtc, MR); | 442 | mr = rtt_readl(rtc, MR); |
444 | rtt_writel(rtc, MR, mr | rtc->imr); | 443 | rtt_writel(rtc, MR, mr | rtc->imr); |
@@ -446,20 +445,18 @@ static int at91_rtc_resume(struct platform_device *pdev) | |||
446 | 445 | ||
447 | return 0; | 446 | return 0; |
448 | } | 447 | } |
449 | #else | ||
450 | #define at91_rtc_suspend NULL | ||
451 | #define at91_rtc_resume NULL | ||
452 | #endif | 448 | #endif |
453 | 449 | ||
450 | static SIMPLE_DEV_PM_OPS(at91_rtc_pm_ops, at91_rtc_suspend, at91_rtc_resume); | ||
451 | |||
454 | static struct platform_driver at91_rtc_driver = { | 452 | static struct platform_driver at91_rtc_driver = { |
455 | .probe = at91_rtc_probe, | 453 | .probe = at91_rtc_probe, |
456 | .remove = at91_rtc_remove, | 454 | .remove = at91_rtc_remove, |
457 | .shutdown = at91_rtc_shutdown, | 455 | .shutdown = at91_rtc_shutdown, |
458 | .suspend = at91_rtc_suspend, | ||
459 | .resume = at91_rtc_resume, | ||
460 | .driver = { | 456 | .driver = { |
461 | .name = "rtc-at91sam9", | 457 | .name = "rtc-at91sam9", |
462 | .owner = THIS_MODULE, | 458 | .owner = THIS_MODULE, |
459 | .pm = &at91_rtc_pm_ops, | ||
463 | }, | 460 | }, |
464 | }; | 461 | }; |
465 | 462 | ||