aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-at91rm9200.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-at91rm9200.c')
-rw-r--r--drivers/rtc/rtc-at91rm9200.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index b5bf93706913..bc8bbca9a2e2 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -289,7 +289,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
289 AT91_RTC_CALEV); 289 AT91_RTC_CALEV);
290 290
291 ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, 291 ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt,
292 IRQF_DISABLED | IRQF_SHARED, 292 IRQF_SHARED,
293 "at91_rtc", pdev); 293 "at91_rtc", pdev);
294 if (ret) { 294 if (ret) {
295 printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n", 295 printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n",
@@ -340,7 +340,7 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
340 340
341static u32 at91_rtc_imr; 341static u32 at91_rtc_imr;
342 342
343static int at91_rtc_suspend(struct platform_device *pdev, pm_message_t state) 343static int at91_rtc_suspend(struct device *dev)
344{ 344{
345 /* this IRQ is shared with DBGU and other hardware which isn't 345 /* this IRQ is shared with DBGU and other hardware which isn't
346 * necessarily doing PM like we are... 346 * necessarily doing PM like we are...
@@ -348,7 +348,7 @@ static int at91_rtc_suspend(struct platform_device *pdev, pm_message_t state)
348 at91_rtc_imr = at91_sys_read(AT91_RTC_IMR) 348 at91_rtc_imr = at91_sys_read(AT91_RTC_IMR)
349 & (AT91_RTC_ALARM|AT91_RTC_SECEV); 349 & (AT91_RTC_ALARM|AT91_RTC_SECEV);
350 if (at91_rtc_imr) { 350 if (at91_rtc_imr) {
351 if (device_may_wakeup(&pdev->dev)) 351 if (device_may_wakeup(dev))
352 enable_irq_wake(AT91_ID_SYS); 352 enable_irq_wake(AT91_ID_SYS);
353 else 353 else
354 at91_sys_write(AT91_RTC_IDR, at91_rtc_imr); 354 at91_sys_write(AT91_RTC_IDR, at91_rtc_imr);
@@ -356,28 +356,34 @@ static int at91_rtc_suspend(struct platform_device *pdev, pm_message_t state)
356 return 0; 356 return 0;
357} 357}
358 358
359static int at91_rtc_resume(struct platform_device *pdev) 359static int at91_rtc_resume(struct device *dev)
360{ 360{
361 if (at91_rtc_imr) { 361 if (at91_rtc_imr) {
362 if (device_may_wakeup(&pdev->dev)) 362 if (device_may_wakeup(dev))
363 disable_irq_wake(AT91_ID_SYS); 363 disable_irq_wake(AT91_ID_SYS);
364 else 364 else
365 at91_sys_write(AT91_RTC_IER, at91_rtc_imr); 365 at91_sys_write(AT91_RTC_IER, at91_rtc_imr);
366 } 366 }
367 return 0; 367 return 0;
368} 368}
369
370static const struct dev_pm_ops at91_rtc_pm = {
371 .suspend = at91_rtc_suspend,
372 .resume = at91_rtc_resume,
373};
374
375#define at91_rtc_pm_ptr &at91_rtc_pm
376
369#else 377#else
370#define at91_rtc_suspend NULL 378#define at91_rtc_pm_ptr NULL
371#define at91_rtc_resume NULL
372#endif 379#endif
373 380
374static struct platform_driver at91_rtc_driver = { 381static struct platform_driver at91_rtc_driver = {
375 .remove = __exit_p(at91_rtc_remove), 382 .remove = __exit_p(at91_rtc_remove),
376 .suspend = at91_rtc_suspend,
377 .resume = at91_rtc_resume,
378 .driver = { 383 .driver = {
379 .name = "at91_rtc", 384 .name = "at91_rtc",
380 .owner = THIS_MODULE, 385 .owner = THIS_MODULE,
386 .pm = at91_rtc_pm_ptr,
381 }, 387 },
382}; 388};
383 389