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>
This commit is contained in:
parent
4ba50df685
commit
faa9fa8e44
1 changed files with 36 additions and 0 deletions
|
@ -795,10 +795,46 @@ static int __devexit sh_rtc_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sh_rtc_set_irq_wake(struct device *dev, int enabled)
|
||||||
|
{
|
||||||
|
struct platform_device *pdev = to_platform_device(dev);
|
||||||
|
struct sh_rtc *rtc = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
set_irq_wake(rtc->periodic_irq, enabled);
|
||||||
|
if (rtc->carry_irq > 0) {
|
||||||
|
set_irq_wake(rtc->carry_irq, enabled);
|
||||||
|
set_irq_wake(rtc->alarm_irq, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sh_rtc_suspend(struct device *dev)
|
||||||
|
{
|
||||||
|
if (device_may_wakeup(dev))
|
||||||
|
sh_rtc_set_irq_wake(dev, 1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sh_rtc_resume(struct device *dev)
|
||||||
|
{
|
||||||
|
if (device_may_wakeup(dev))
|
||||||
|
sh_rtc_set_irq_wake(dev, 0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct dev_pm_ops sh_rtc_dev_pm_ops = {
|
||||||
|
.suspend = sh_rtc_suspend,
|
||||||
|
.resume = sh_rtc_resume,
|
||||||
|
};
|
||||||
|
|
||||||
static struct platform_driver sh_rtc_platform_driver = {
|
static struct platform_driver sh_rtc_platform_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = DRV_NAME,
|
.name = DRV_NAME,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
.pm = &sh_rtc_dev_pm_ops,
|
||||||
},
|
},
|
||||||
.probe = sh_rtc_probe,
|
.probe = sh_rtc_probe,
|
||||||
.remove = __devexit_p(sh_rtc_remove),
|
.remove = __devexit_p(sh_rtc_remove),
|
||||||
|
|
Loading…
Reference in a new issue