diff options
author | Henry Chen <henryc.chen@mediatek.com> | 2015-07-30 22:53:14 +0800 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2015-09-05 13:19:08 +0200 |
commit | d7f9777de884daf5721211bddfd21e7c8c156b17 (patch) | |
tree | f717b6ebb8db04993a20792093c7bb961c81f5f0 /drivers/rtc | |
parent | 3ee2c40b7ac2bf121aaa1176d8ac25b6a26e3a94 (diff) | |
download | linux-d7f9777de884daf5721211bddfd21e7c8c156b17.tar.bz2 |
rtc: mt6397: implement suspend/resume function in rtc-mt6397 driver
Implement the suspend/resume function in order to control rtc's irq_wake flag and handle as wakeup source.
Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
Acked-by: Eddie Huang <eddie.huang@mediatek.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-mt6397.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index eab230be5a54..30c926b36361 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -373,6 +373,31 @@ static int mtk_rtc_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int mt6397_rtc_suspend(struct device *dev) +{ + struct mt6397_rtc *rtc = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + enable_irq_wake(rtc->irq); + + return 0; +} + +static int mt6397_rtc_resume(struct device *dev) +{ + struct mt6397_rtc *rtc = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + disable_irq_wake(rtc->irq); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_rtc_suspend, + mt6397_rtc_resume); + static const struct of_device_id mt6397_rtc_of_match[] = { { .compatible = "mediatek,mt6397-rtc", }, { } @@ -382,6 +407,7 @@ static struct platform_driver mtk_rtc_driver = { .driver = { .name = "mt6397-rtc", .of_match_table = mt6397_rtc_of_match, + .pm = &mt6397_pm_ops, }, .probe = mtk_rtc_probe, .remove = mtk_rtc_remove, |