summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-04-29 16:20:58 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 18:28:39 -0700
commit4dc8eb13c2b99a334ee703061e75ee71d582dd1f (patch)
tree2c651cab09a21a9e92c43634cf3377da6f071a05 /drivers/rtc
parent08348d2f10d2c6c326bb642eb6f46a696c26f31e (diff)
downloadlinux-3.10-4dc8eb13c2b99a334ee703061e75ee71d582dd1f.tar.gz
linux-3.10-4dc8eb13c2b99a334ee703061e75ee71d582dd1f.tar.bz2
linux-3.10-4dc8eb13c2b99a334ee703061e75ee71d582dd1f.zip
rtc: rtc-at91sam9: convert at91_rtc_driver to dev_pm_ops
Instead of using legacy suspend/resume methods, using newer dev_pm_ops structure allows better control over power management. Signed-off-by: Jingoo Han <jg1.han@samsung.com> 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-at91sam9.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index 7b77c27e095..b60a34cb145 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)
rtt_writel(rtc, MR, mr & ~rtc->imr);
}
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
/* AT91SAM9 RTC Power management control */
-static int at91_rtc_suspend(struct platform_device *pdev,
- pm_message_t state)
+static int at91_rtc_suspend(struct device *dev)
{
- struct sam9_rtc *rtc = platform_get_drvdata(pdev);
+ struct sam9_rtc *rtc = dev_get_drvdata(dev);
u32 mr = rtt_readl(rtc, MR);
/*
@@ -420,7 +419,7 @@ static int at91_rtc_suspend(struct platform_device *pdev,
*/
rtc->imr = mr & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
if (rtc->imr) {
- if (device_may_wakeup(&pdev->dev) && (mr & AT91_RTT_ALMIEN)) {
+ if (device_may_wakeup(dev) && (mr & AT91_RTT_ALMIEN)) {
enable_irq_wake(rtc->irq);
/* don't let RTTINC cause wakeups */
if (mr & AT91_RTT_RTTINCIEN)
@@ -432,13 +431,13 @@ static int at91_rtc_suspend(struct platform_device *pdev,
return 0;
}
-static int at91_rtc_resume(struct platform_device *pdev)
+static int at91_rtc_resume(struct device *dev)
{
- struct sam9_rtc *rtc = platform_get_drvdata(pdev);
+ struct sam9_rtc *rtc = dev_get_drvdata(dev);
u32 mr;
if (rtc->imr) {
- if (device_may_wakeup(&pdev->dev))
+ if (device_may_wakeup(dev))
disable_irq_wake(rtc->irq);
mr = rtt_readl(rtc, MR);
rtt_writel(rtc, MR, mr | rtc->imr);
@@ -446,20 +445,18 @@ static int at91_rtc_resume(struct platform_device *pdev)
return 0;
}
-#else
-#define at91_rtc_suspend NULL
-#define at91_rtc_resume NULL
#endif
+static SIMPLE_DEV_PM_OPS(at91_rtc_pm_ops, at91_rtc_suspend, at91_rtc_resume);
+
static struct platform_driver at91_rtc_driver = {
.probe = at91_rtc_probe,
.remove = at91_rtc_remove,
.shutdown = at91_rtc_shutdown,
- .suspend = at91_rtc_suspend,
- .resume = at91_rtc_resume,
.driver = {
.name = "rtc-at91sam9",
.owner = THIS_MODULE,
+ .pm = &at91_rtc_pm_ops,
},
};