aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@st.com>2012-02-24 04:42:37 -0500
committerWim Van Sebroeck <wim@iguana.be>2012-03-27 13:58:45 -0400
commit16ac4abe0d0ea0a8d42d6a2a7de2a4a00bbf5b40 (patch)
tree1b602e1c94f51b83f66a9c77e8fcff66cae5fa8b /drivers/watchdog
parent474ef121008a2992bcc496930166ced89bda23d2 (diff)
watchdog: sp805_wdt: add pm callbacks to support standby/S2R/hibernation
Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/sp805_wdt.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index 3ff9e47bd218..2b0939ab61da 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -25,6 +25,7 @@
25#include <linux/miscdevice.h> 25#include <linux/miscdevice.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
28#include <linux/pm.h>
28#include <linux/slab.h> 29#include <linux/slab.h>
29#include <linux/spinlock.h> 30#include <linux/spinlock.h>
30#include <linux/types.h> 31#include <linux/types.h>
@@ -351,6 +352,37 @@ static int __devexit sp805_wdt_remove(struct amba_device *adev)
351 return 0; 352 return 0;
352} 353}
353 354
355#ifdef CONFIG_PM
356static int sp805_wdt_suspend(struct device *dev)
357{
358 if (test_bit(WDT_BUSY, &wdt->status)) {
359 wdt_disable();
360 clk_disable(wdt->clk);
361 }
362
363 return 0;
364}
365
366static int sp805_wdt_resume(struct device *dev)
367{
368 int ret = 0;
369
370 if (test_bit(WDT_BUSY, &wdt->status)) {
371 ret = clk_enable(wdt->clk);
372 if (ret) {
373 dev_err(dev, "clock enable fail");
374 return ret;
375 }
376 wdt_enable();
377 }
378
379 return ret;
380}
381#endif /* CONFIG_PM */
382
383static SIMPLE_DEV_PM_OPS(sp805_wdt_dev_pm_ops, sp805_wdt_suspend,
384 sp805_wdt_resume);
385
354static struct amba_id sp805_wdt_ids[] = { 386static struct amba_id sp805_wdt_ids[] = {
355 { 387 {
356 .id = 0x00141805, 388 .id = 0x00141805,
@@ -364,6 +396,7 @@ MODULE_DEVICE_TABLE(amba, sp805_wdt_ids);
364static struct amba_driver sp805_wdt_driver = { 396static struct amba_driver sp805_wdt_driver = {
365 .drv = { 397 .drv = {
366 .name = MODULE_NAME, 398 .name = MODULE_NAME,
399 .pm = &sp805_wdt_dev_pm_ops,
367 }, 400 },
368 .id_table = sp805_wdt_ids, 401 .id_table = sp805_wdt_ids,
369 .probe = sp805_wdt_probe, 402 .probe = sp805_wdt_probe,