diff options
author | Magnus Damm <damm@igel.co.jp> | 2009-04-01 10:45:17 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-04-01 22:21:17 -0400 |
commit | faa9fa8e448ba4c0a9d61778fd3cda1313bf1533 (patch) | |
tree | fe47f6c4cc9a0a684519212daf8c839e70cd9984 | |
parent | 4ba50df685e85b9d912a290d9614ffbeb4d9f060 (diff) |
rtc: rtc-sh: use set_irq_wake()
Modify the sh_rtc driver to use set_irq_wake() during suspend
and resume. These functions are used to enable the rtc interrupts
in the interrupt controller so the rtc can be used to wakeup the
system from suspend.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | drivers/rtc/rtc-sh.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 4898f7fe8518..9b1ff12bf947 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -795,10 +795,46 @@ static int __devexit sh_rtc_remove(struct platform_device *pdev) | |||
795 | 795 | ||
796 | return 0; | 796 | return 0; |
797 | } | 797 | } |
798 | |||
799 | static void sh_rtc_set_irq_wake(struct device *dev, int enabled) | ||
800 | { | ||
801 | struct platform_device *pdev = to_platform_device(dev); | ||
802 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | ||
803 | |||
804 | set_irq_wake(rtc->periodic_irq, enabled); | ||
805 | if (rtc->carry_irq > 0) { | ||
806 | set_irq_wake(rtc->carry_irq, enabled); | ||
807 | set_irq_wake(rtc->alarm_irq, enabled); | ||
808 | } | ||
809 | |||
810 | } | ||
811 | |||
812 | static int sh_rtc_suspend(struct device *dev) | ||
813 | { | ||
814 | if (device_may_wakeup(dev)) | ||
815 | sh_rtc_set_irq_wake(dev, 1); | ||
816 | |||
817 | return 0; | ||
818 | } | ||
819 | |||
820 | static int sh_rtc_resume(struct device *dev) | ||
821 | { | ||
822 | if (device_may_wakeup(dev)) | ||
823 | sh_rtc_set_irq_wake(dev, 0); | ||
824 | |||
825 | return 0; | ||
826 | } | ||
827 | |||
828 | static struct dev_pm_ops sh_rtc_dev_pm_ops = { | ||
829 | .suspend = sh_rtc_suspend, | ||
830 | .resume = sh_rtc_resume, | ||
831 | }; | ||
832 | |||
798 | static struct platform_driver sh_rtc_platform_driver = { | 833 | static struct platform_driver sh_rtc_platform_driver = { |
799 | .driver = { | 834 | .driver = { |
800 | .name = DRV_NAME, | 835 | .name = DRV_NAME, |
801 | .owner = THIS_MODULE, | 836 | .owner = THIS_MODULE, |
837 | .pm = &sh_rtc_dev_pm_ops, | ||
802 | }, | 838 | }, |
803 | .probe = sh_rtc_probe, | 839 | .probe = sh_rtc_probe, |
804 | .remove = __devexit_p(sh_rtc_remove), | 840 | .remove = __devexit_p(sh_rtc_remove), |