Commit 9fab0692 authored by Greta Zhang's avatar Greta Zhang Committed by Wim Van Sebroeck

watchdog: mtk_wdt: add suspend/resume support

add mediatek watchdog driver suspend/resume support
Signed-off-by: default avatarGreta Zhang <greta.zhang@mediatek.com>
Signed-off-by: default avatarRoger Lu <roger.lu@mediatek.com>
Signed-off-by: default avatarEddie Huang <eddie.huang@mediatek.com>
Acked-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 8a340dbb
...@@ -221,17 +221,47 @@ static int mtk_wdt_remove(struct platform_device *pdev) ...@@ -221,17 +221,47 @@ static int mtk_wdt_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP
static int mtk_wdt_suspend(struct device *dev)
{
struct mtk_wdt_dev *mtk_wdt = dev_get_drvdata(dev);
if (watchdog_active(&mtk_wdt->wdt_dev))
mtk_wdt_stop(&mtk_wdt->wdt_dev);
return 0;
}
static int mtk_wdt_resume(struct device *dev)
{
struct mtk_wdt_dev *mtk_wdt = dev_get_drvdata(dev);
if (watchdog_active(&mtk_wdt->wdt_dev)) {
mtk_wdt_start(&mtk_wdt->wdt_dev);
mtk_wdt_ping(&mtk_wdt->wdt_dev);
}
return 0;
}
#endif
static const struct of_device_id mtk_wdt_dt_ids[] = { static const struct of_device_id mtk_wdt_dt_ids[] = {
{ .compatible = "mediatek,mt6589-wdt" }, { .compatible = "mediatek,mt6589-wdt" },
{ /* sentinel */ } { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(of, mtk_wdt_dt_ids); MODULE_DEVICE_TABLE(of, mtk_wdt_dt_ids);
static const struct dev_pm_ops mtk_wdt_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(mtk_wdt_suspend,
mtk_wdt_resume)
};
static struct platform_driver mtk_wdt_driver = { static struct platform_driver mtk_wdt_driver = {
.probe = mtk_wdt_probe, .probe = mtk_wdt_probe,
.remove = mtk_wdt_remove, .remove = mtk_wdt_remove,
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.pm = &mtk_wdt_pm_ops,
.of_match_table = mtk_wdt_dt_ids, .of_match_table = mtk_wdt_dt_ids,
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment