mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
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 <[email protected]> Acked-by: Eddie Huang <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
This commit is contained in:
parent
3ee2c40b7a
commit
d7f9777de8
1 changed files with 26 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue