Skip to content

Commit 4055ee8

Browse files
bijudasWim Van Sebroeck
authored andcommitted
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: Biju Das <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent f43e6dd commit 4055ee8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/watchdog/rzg2l_wdt.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,25 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev)
115115
return 0;
116116
}
117117

118+
static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int timeout)
119+
{
120+
struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
121+
122+
wdev->timeout = timeout;
123+
124+
/*
125+
* If the watchdog is active, reset the module for updating the WDTSET
126+
* register so that it is updated with new timeout values.
127+
*/
128+
if (watchdog_active(wdev)) {
129+
pm_runtime_put(wdev->parent);
130+
reset_control_reset(priv->rstc);
131+
rzg2l_wdt_start(wdev);
132+
}
133+
134+
return 0;
135+
}
136+
118137
static int rzg2l_wdt_restart(struct watchdog_device *wdev,
119138
unsigned long action, void *data)
120139
{
@@ -151,6 +170,7 @@ static const struct watchdog_ops rzg2l_wdt_ops = {
151170
.start = rzg2l_wdt_start,
152171
.stop = rzg2l_wdt_stop,
153172
.ping = rzg2l_wdt_ping,
173+
.set_timeout = rzg2l_wdt_set_timeout,
154174
.restart = rzg2l_wdt_restart,
155175
};
156176

0 commit comments

Comments
 (0)