diff options
author | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2017-01-30 12:18:48 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2017-02-24 17:00:23 -0500 |
commit | f201353273b6dec71940df01ea6eeb528d907941 (patch) | |
tree | 80cb375e273dad5674b10b426c3335150ee7bce1 | |
parent | 722ce6356ddfdcb75ab9379f426a89691b0234de (diff) |
watchdog: sama5d4: Implement resume hook
When resuming for the deepest state on sama5d2, it is necessary to restore
MR as the registers are lost.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/watchdog/sama5d4_wdt.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c index 3230a842d015..f709962018ac 100644 --- a/drivers/watchdog/sama5d4_wdt.c +++ b/drivers/watchdog/sama5d4_wdt.c | |||
@@ -258,11 +258,28 @@ static const struct of_device_id sama5d4_wdt_of_match[] = { | |||
258 | }; | 258 | }; |
259 | MODULE_DEVICE_TABLE(of, sama5d4_wdt_of_match); | 259 | MODULE_DEVICE_TABLE(of, sama5d4_wdt_of_match); |
260 | 260 | ||
261 | #ifdef CONFIG_PM_SLEEP | ||
262 | static int sama5d4_wdt_resume(struct device *dev) | ||
263 | { | ||
264 | struct sama5d4_wdt *wdt = dev_get_drvdata(dev); | ||
265 | |||
266 | wdt_write(wdt, AT91_WDT_MR, wdt->mr & ~AT91_WDT_WDDIS); | ||
267 | if (wdt->mr & AT91_WDT_WDDIS) | ||
268 | wdt_write(wdt, AT91_WDT_MR, wdt->mr); | ||
269 | |||
270 | return 0; | ||
271 | } | ||
272 | #endif | ||
273 | |||
274 | static SIMPLE_DEV_PM_OPS(sama5d4_wdt_pm_ops, NULL, | ||
275 | sama5d4_wdt_resume); | ||
276 | |||
261 | static struct platform_driver sama5d4_wdt_driver = { | 277 | static struct platform_driver sama5d4_wdt_driver = { |
262 | .probe = sama5d4_wdt_probe, | 278 | .probe = sama5d4_wdt_probe, |
263 | .remove = sama5d4_wdt_remove, | 279 | .remove = sama5d4_wdt_remove, |
264 | .driver = { | 280 | .driver = { |
265 | .name = "sama5d4_wdt", | 281 | .name = "sama5d4_wdt", |
282 | .pm = &sama5d4_wdt_pm_ops, | ||
266 | .of_match_table = sama5d4_wdt_of_match, | 283 | .of_match_table = sama5d4_wdt_of_match, |
267 | } | 284 | } |
268 | }; | 285 | }; |