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

Configure Feed

Select the types of activity you want to include in your feed.

watchdog: rzg2l_wdt: Add suspend/resume support

The RZ/G3S supports deep sleep states where power to most of the IP blocks
is cut off. To ensure proper working of the watchdog when resuming from
such states, the suspend function is stopping the watchdog and the resume
function is starting it. There is no need to configure the watchdog
in case the watchdog was stopped prior to starting suspend.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240531065723.1085423-9-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Claudiu Beznea and committed by
Wim Van Sebroeck
0aad7c44 d8997ed7

+26
+26
drivers/watchdog/rzg2l_wdt.c
··· 286 286 priv->wdev.timeout = WDT_DEFAULT_TIMEOUT; 287 287 288 288 watchdog_set_drvdata(&priv->wdev, priv); 289 + dev_set_drvdata(dev, priv); 289 290 ret = devm_add_action_or_reset(&pdev->dev, rzg2l_wdt_pm_disable, &priv->wdev); 290 291 if (ret) 291 292 return ret; ··· 308 307 }; 309 308 MODULE_DEVICE_TABLE(of, rzg2l_wdt_ids); 310 309 310 + static int rzg2l_wdt_suspend_late(struct device *dev) 311 + { 312 + struct rzg2l_wdt_priv *priv = dev_get_drvdata(dev); 313 + 314 + if (!watchdog_active(&priv->wdev)) 315 + return 0; 316 + 317 + return rzg2l_wdt_stop(&priv->wdev); 318 + } 319 + 320 + static int rzg2l_wdt_resume_early(struct device *dev) 321 + { 322 + struct rzg2l_wdt_priv *priv = dev_get_drvdata(dev); 323 + 324 + if (!watchdog_active(&priv->wdev)) 325 + return 0; 326 + 327 + return rzg2l_wdt_start(&priv->wdev); 328 + } 329 + 330 + static const struct dev_pm_ops rzg2l_wdt_pm_ops = { 331 + LATE_SYSTEM_SLEEP_PM_OPS(rzg2l_wdt_suspend_late, rzg2l_wdt_resume_early) 332 + }; 333 + 311 334 static struct platform_driver rzg2l_wdt_driver = { 312 335 .driver = { 313 336 .name = "rzg2l_wdt", 314 337 .of_match_table = rzg2l_wdt_ids, 338 + .pm = &rzg2l_wdt_pm_ops, 315 339 }, 316 340 .probe = rzg2l_wdt_probe, 317 341 };