diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2007-11-12 17:49:58 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-26 10:07:51 -0500 |
commit | 6bc54e69921a64e8f813de658aef645c960a2904 (patch) | |
tree | 9a818601d506c11d38e8106a094facca5f4800b8 /drivers/rtc | |
parent | 4ae7806f8b4bf9a1e74c82f3bd4e91d59bd3d697 (diff) |
[ARM] pxa/sa1100: replace wakeup support
Replace wakeup support using the alarm via the SA1100 RTC driver on
SA1100 and PXA platforms. This allows RTC alarm wakeup to be enabled
via sysfs using the conventional attributes.
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-sa1100.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index 6f1e9a9804bc..2eb38520f0c8 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c | |||
@@ -337,6 +337,8 @@ static int sa1100_rtc_probe(struct platform_device *pdev) | |||
337 | if (IS_ERR(rtc)) | 337 | if (IS_ERR(rtc)) |
338 | return PTR_ERR(rtc); | 338 | return PTR_ERR(rtc); |
339 | 339 | ||
340 | device_init_wakeup(&pdev->dev, 1); | ||
341 | |||
340 | platform_set_drvdata(pdev, rtc); | 342 | platform_set_drvdata(pdev, rtc); |
341 | 343 | ||
342 | return 0; | 344 | return 0; |
@@ -352,9 +354,38 @@ static int sa1100_rtc_remove(struct platform_device *pdev) | |||
352 | return 0; | 354 | return 0; |
353 | } | 355 | } |
354 | 356 | ||
357 | #ifdef CONFIG_PM | ||
358 | static int sa1100_rtc_suspend(struct platform_device *pdev, pm_message_t state) | ||
359 | { | ||
360 | if (pdev->dev.power.power_state.event != state.event) { | ||
361 | if (state.event == PM_EVENT_SUSPEND && | ||
362 | device_may_wakeup(&pdev->dev)) | ||
363 | enable_irq_wake(IRQ_RTCAlrm); | ||
364 | |||
365 | pdev->dev.power.power_state = state; | ||
366 | } | ||
367 | return 0; | ||
368 | } | ||
369 | |||
370 | static int sa1100_rtc_resume(struct platform_device *pdev) | ||
371 | { | ||
372 | if (pdev->dev.power.power_state.event != PM_EVENT_ON) { | ||
373 | if (device_may_wakeup(&pdev->dev)) | ||
374 | disable_irq_wake(IRQ_RTCAlrm); | ||
375 | pdev->dev.power.power_state = PMSG_ON; | ||
376 | } | ||
377 | return 0; | ||
378 | } | ||
379 | #else | ||
380 | #define sa1100_rtc_suspend NULL | ||
381 | #define sa1100_rtc_resume NULL | ||
382 | #endif | ||
383 | |||
355 | static struct platform_driver sa1100_rtc_driver = { | 384 | static struct platform_driver sa1100_rtc_driver = { |
356 | .probe = sa1100_rtc_probe, | 385 | .probe = sa1100_rtc_probe, |
357 | .remove = sa1100_rtc_remove, | 386 | .remove = sa1100_rtc_remove, |
387 | .suspend = sa1100_rtc_suspend, | ||
388 | .resume = sa1100_rtc_resume, | ||
358 | .driver = { | 389 | .driver = { |
359 | .name = "sa1100-rtc", | 390 | .name = "sa1100-rtc", |
360 | }, | 391 | }, |