aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-at91.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-10-02 08:45:08 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-10-02 08:45:08 -0400
commit59458f40e25915a355d8b1d701425fe9f4f9ea23 (patch)
treef1c9a2934df686e36d75f759ab7313b6f0e0e5f9 /drivers/rtc/rtc-at91.c
parent825f9075d74028d11d7f5932f04e1b5db3022b51 (diff)
parentd834c16516d1ebec4766fc58c059bf01311e6045 (diff)
Merge branch 'master' into gfs2
Diffstat (limited to 'drivers/rtc/rtc-at91.c')
-rw-r--r--drivers/rtc/rtc-at91.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-at91.c b/drivers/rtc/rtc-at91.c
index dfd0ce86f6a0..c0714da44920 100644
--- a/drivers/rtc/rtc-at91.c
+++ b/drivers/rtc/rtc-at91.c
@@ -267,7 +267,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id,
267 return IRQ_NONE; /* not handled */ 267 return IRQ_NONE; /* not handled */
268} 268}
269 269
270static struct rtc_class_ops at91_rtc_ops = { 270static const struct rtc_class_ops at91_rtc_ops = {
271 .ioctl = at91_rtc_ioctl, 271 .ioctl = at91_rtc_ioctl,
272 .read_time = at91_rtc_readtime, 272 .read_time = at91_rtc_readtime,
273 .set_time = at91_rtc_settime, 273 .set_time = at91_rtc_settime,
@@ -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);