Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexandre Belloni and committed by
Guenter Roeck
f2013532 722ce635

+17
+17
drivers/watchdog/sama5d4_wdt.c
··· 258 258 }; 259 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 277 static struct platform_driver sama5d4_wdt_driver = { 262 278 .probe = sama5d4_wdt_probe, 263 279 .remove = sama5d4_wdt_remove, 264 280 .driver = { 265 281 .name = "sama5d4_wdt", 282 + .pm = &sama5d4_wdt_pm_ops, 266 283 .of_match_table = sama5d4_wdt_of_match, 267 284 } 268 285 };