提交 16ac4abe 编写于 作者: V Viresh Kumar 提交者: Wim Van Sebroeck

watchdog: sp805_wdt: add pm callbacks to support standby/S2R/hibernation

Signed-off-by: NViresh Kumar <viresh.kumar@st.com>
Signed-off-by: NWim Van Sebroeck <wim@iguana.be>
上级 474ef121
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/pm.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -351,6 +352,37 @@ static int __devexit sp805_wdt_remove(struct amba_device *adev) ...@@ -351,6 +352,37 @@ static int __devexit sp805_wdt_remove(struct amba_device *adev)
return 0; return 0;
} }
#ifdef CONFIG_PM
static int sp805_wdt_suspend(struct device *dev)
{
if (test_bit(WDT_BUSY, &wdt->status)) {
wdt_disable();
clk_disable(wdt->clk);
}
return 0;
}
static int sp805_wdt_resume(struct device *dev)
{
int ret = 0;
if (test_bit(WDT_BUSY, &wdt->status)) {
ret = clk_enable(wdt->clk);
if (ret) {
dev_err(dev, "clock enable fail");
return ret;
}
wdt_enable();
}
return ret;
}
#endif /* CONFIG_PM */
static SIMPLE_DEV_PM_OPS(sp805_wdt_dev_pm_ops, sp805_wdt_suspend,
sp805_wdt_resume);
static struct amba_id sp805_wdt_ids[] = { static struct amba_id sp805_wdt_ids[] = {
{ {
.id = 0x00141805, .id = 0x00141805,
...@@ -364,6 +396,7 @@ MODULE_DEVICE_TABLE(amba, sp805_wdt_ids); ...@@ -364,6 +396,7 @@ MODULE_DEVICE_TABLE(amba, sp805_wdt_ids);
static struct amba_driver sp805_wdt_driver = { static struct amba_driver sp805_wdt_driver = {
.drv = { .drv = {
.name = MODULE_NAME, .name = MODULE_NAME,
.pm = &sp805_wdt_dev_pm_ops,
}, },
.id_table = sp805_wdt_ids, .id_table = sp805_wdt_ids,
.probe = sp805_wdt_probe, .probe = sp805_wdt_probe,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册