Commit 4055ee81 authored by Biju Das's avatar Biju Das Committed by Wim Van Sebroeck

watchdog: rzg2l_wdt: Add set_timeout callback

This patch adds support for set_timeout callback.

Once WDT is started, the WDT cycle setting register(WDTSET) can be updated
only after issuing a module reset. Otherwise, it will ignore the writes
and will hold the previous value. This patch updates the WDTSET register
if it is active.
Signed-off-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220225175320.11041-8-biju.das.jz@bp.renesas.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent f43e6ddb
...@@ -115,6 +115,25 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev) ...@@ -115,6 +115,25 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev)
return 0; return 0;
} }
static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int timeout)
{
struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
wdev->timeout = timeout;
/*
* If the watchdog is active, reset the module for updating the WDTSET
* register so that it is updated with new timeout values.
*/
if (watchdog_active(wdev)) {
pm_runtime_put(wdev->parent);
reset_control_reset(priv->rstc);
rzg2l_wdt_start(wdev);
}
return 0;
}
static int rzg2l_wdt_restart(struct watchdog_device *wdev, static int rzg2l_wdt_restart(struct watchdog_device *wdev,
unsigned long action, void *data) unsigned long action, void *data)
{ {
...@@ -151,6 +170,7 @@ static const struct watchdog_ops rzg2l_wdt_ops = { ...@@ -151,6 +170,7 @@ static const struct watchdog_ops rzg2l_wdt_ops = {
.start = rzg2l_wdt_start, .start = rzg2l_wdt_start,
.stop = rzg2l_wdt_stop, .stop = rzg2l_wdt_stop,
.ping = rzg2l_wdt_ping, .ping = rzg2l_wdt_ping,
.set_timeout = rzg2l_wdt_set_timeout,
.restart = rzg2l_wdt_restart, .restart = rzg2l_wdt_restart,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment