diff options
author | Paul Mundt <lethal@linux-sh.org> | 2012-05-10 03:08:35 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2012-05-10 03:08:35 -0400 |
commit | 8c013d964ac32c20afe2cdeadf59926d87012b37 (patch) | |
tree | a20f0d26d4c59ed86970a8954e93e36fa55a399c /drivers/watchdog/shwdt.c | |
parent | 9ea6404691a520f734b819cbbd4757b0ea5f99c6 (diff) |
watchdog: shwdt: Preliminary runtime PM support.
This plugs in some trivial runtime PM support in the probe/remove and
start/stop paths.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/watchdog/shwdt.c')
-rw-r--r-- | drivers/watchdog/shwdt.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c index 380ada4e5d66..b11104702d23 100644 --- a/drivers/watchdog/shwdt.c +++ b/drivers/watchdog/shwdt.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
29 | #include <linux/miscdevice.h> | 29 | #include <linux/miscdevice.h> |
30 | #include <linux/watchdog.h> | 30 | #include <linux/watchdog.h> |
31 | #include <linux/pm_runtime.h> | ||
31 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
32 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
33 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
@@ -87,6 +88,8 @@ static int sh_wdt_start(struct watchdog_device *wdt_dev) | |||
87 | unsigned long flags; | 88 | unsigned long flags; |
88 | u8 csr; | 89 | u8 csr; |
89 | 90 | ||
91 | pm_runtime_get_sync(wdt->dev); | ||
92 | |||
90 | spin_lock_irqsave(&wdt->lock, flags); | 93 | spin_lock_irqsave(&wdt->lock, flags); |
91 | 94 | ||
92 | next_heartbeat = jiffies + (heartbeat * HZ); | 95 | next_heartbeat = jiffies + (heartbeat * HZ); |
@@ -137,6 +140,8 @@ static int sh_wdt_stop(struct watchdog_device *wdt_dev) | |||
137 | 140 | ||
138 | spin_unlock_irqrestore(&wdt->lock, flags); | 141 | spin_unlock_irqrestore(&wdt->lock, flags); |
139 | 142 | ||
143 | pm_runtime_put_sync(wdt->dev); | ||
144 | |||
140 | return 0; | 145 | return 0; |
141 | } | 146 | } |
142 | 147 | ||
@@ -283,6 +288,8 @@ static int __devinit sh_wdt_probe(struct platform_device *pdev) | |||
283 | 288 | ||
284 | dev_info(&pdev->dev, "initialized.\n"); | 289 | dev_info(&pdev->dev, "initialized.\n"); |
285 | 290 | ||
291 | pm_runtime_enable(&pdev->dev); | ||
292 | |||
286 | return 0; | 293 | return 0; |
287 | 294 | ||
288 | out_disable: | 295 | out_disable: |
@@ -300,6 +307,7 @@ static int __devexit sh_wdt_remove(struct platform_device *pdev) | |||
300 | 307 | ||
301 | watchdog_unregister_device(&sh_wdt_dev); | 308 | watchdog_unregister_device(&sh_wdt_dev); |
302 | 309 | ||
310 | pm_runtime_disable(&pdev->dev); | ||
303 | clk_disable(wdt->clk); | 311 | clk_disable(wdt->clk); |
304 | clk_put(wdt->clk); | 312 | clk_put(wdt->clk); |
305 | 313 | ||