aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/rtc-at91.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-at91.c b/drivers/rtc/rtc-at91.c
index 3cf3529888c7..c0714da44920 100644
--- a/drivers/rtc/rtc-at91.c
+++ b/drivers/rtc/rtc-at91.c
@@ -307,6 +307,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
307 return PTR_ERR(rtc); 307 return PTR_ERR(rtc);
308 } 308 }
309 platform_set_drvdata(pdev, rtc); 309 platform_set_drvdata(pdev, rtc);
310 device_init_wakeup(&pdev->dev, 1);
310 311
311 printk(KERN_INFO "AT91 Real Time Clock driver.\n"); 312 printk(KERN_INFO "AT91 Real Time Clock driver.\n");
312 return 0; 313 return 0;
@@ -327,6 +328,7 @@ static int __devexit at91_rtc_remove(struct platform_device *pdev)
327 328
328 rtc_device_unregister(rtc); 329 rtc_device_unregister(rtc);
329 platform_set_drvdata(pdev, NULL); 330 platform_set_drvdata(pdev, NULL);
331 device_init_wakeup(&pdev->dev, 0);
330 332
331 return 0; 333 return 0;
332} 334}
@@ -336,6 +338,7 @@ static int __devexit at91_rtc_remove(struct platform_device *pdev)
336/* AT91RM9200 RTC Power management control */ 338/* AT91RM9200 RTC Power management control */
337 339
338static struct timespec at91_rtc_delta; 340static struct timespec at91_rtc_delta;
341static u32 at91_rtc_imr;
339 342
340static int at91_rtc_suspend(struct platform_device *pdev, pm_message_t state) 343static int at91_rtc_suspend(struct platform_device *pdev, pm_message_t state)
341{ 344{
@@ -349,6 +352,18 @@ static int at91_rtc_suspend(struct platform_device *pdev, pm_message_t state)
349 rtc_tm_to_time(&tm, &time.tv_sec); 352 rtc_tm_to_time(&tm, &time.tv_sec);
350 save_time_delta(&at91_rtc_delta, &time); 353 save_time_delta(&at91_rtc_delta, &time);
351 354
355 /* this IRQ is shared with DBGU and other hardware which isn't
356 * necessarily doing PM like we are...
357 */
358 at91_rtc_imr = at91_sys_read(AT91_RTC_IMR)
359 & (AT91_RTC_ALARM|AT91_RTC_SECEV);
360 if (at91_rtc_imr) {
361 if (device_may_wakeup(&pdev->dev))
362 enable_irq_wake(AT91_ID_SYS);
363 else
364 at91_sys_write(AT91_RTC_IDR, at91_rtc_imr);
365 }
366
352 pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __FUNCTION__, 367 pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __FUNCTION__,
353 1900 + tm.tm_year, tm.tm_mon, tm.tm_mday, 368 1900 + tm.tm_year, tm.tm_mon, tm.tm_mday,
354 tm.tm_hour, tm.tm_min, tm.tm_sec); 369 tm.tm_hour, tm.tm_min, tm.tm_sec);
@@ -367,6 +382,13 @@ static int at91_rtc_resume(struct platform_device *pdev)
367 rtc_tm_to_time(&tm, &time.tv_sec); 382 rtc_tm_to_time(&tm, &time.tv_sec);
368 restore_time_delta(&at91_rtc_delta, &time); 383 restore_time_delta(&at91_rtc_delta, &time);
369 384
385 if (at91_rtc_imr) {
386 if (device_may_wakeup(&pdev->dev))
387 disable_irq_wake(AT91_ID_SYS);
388 else
389 at91_sys_write(AT91_RTC_IER, at91_rtc_imr);
390 }
391
370 pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __FUNCTION__, 392 pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __FUNCTION__,
371 1900 + tm.tm_year, tm.tm_mon, tm.tm_mday, 393 1900 + tm.tm_year, tm.tm_mon, tm.tm_mday,
372 tm.tm_hour, tm.tm_min, tm.tm_sec); 394 tm.tm_hour, tm.tm_min, tm.tm_sec);