summaryrefslogtreecommitdiff
path: root/drivers/watchdog/da9063_wdt.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2019-04-14 14:09:33 +0300
committerWim Van Sebroeck <wim@linux-watchdog.org>2019-05-05 22:04:57 +0300
commit280ce5c00661a5d92c94dddc05c4a2b5c39252f8 (patch)
tree0828da4ba46dc0ca2eba73ccb9b2ee9d34e56d46 /drivers/watchdog/da9063_wdt.c
parent36ccec3db8975f4b452254da8607371765fce09a (diff)
downloadlinux-280ce5c00661a5d92c94dddc05c4a2b5c39252f8.tar.xz
watchdog: da9063_wdt: parse DT for timeout value, too
And make sure the final obtained value gets properly scaled. Remove two empty lines to group the initialization blocks while we are here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Steve Twiss <stwiss.opensource@diasemi.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Diffstat (limited to 'drivers/watchdog/da9063_wdt.c')
-rw-r--r--drivers/watchdog/da9063_wdt.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c
index 06eb9070203c..3d65e92a4e3f 100644
--- a/drivers/watchdog/da9063_wdt.c
+++ b/drivers/watchdog/da9063_wdt.c
@@ -208,18 +208,20 @@ static int da9063_wdt_probe(struct platform_device *pdev)
wdd->min_timeout = DA9063_WDT_MIN_TIMEOUT;
wdd->max_timeout = DA9063_WDT_MAX_TIMEOUT;
wdd->min_hw_heartbeat_ms = DA9063_RESET_PROTECTION_MS;
- wdd->timeout = DA9063_WDG_TIMEOUT;
wdd->parent = dev;
-
wdd->status = WATCHDOG_NOWAYOUT_INIT_STATUS;
watchdog_set_restart_priority(wdd, 128);
-
watchdog_set_drvdata(wdd, da9063);
+ /* Set default timeout, maybe override it with DT value, scale it */
+ wdd->timeout = DA9063_WDG_TIMEOUT;
+ watchdog_init_timeout(wdd, 0, dev);
+ da9063_wdt_set_timeout(wdd, wdd->timeout);
+
/* Change the timeout to the default value if the watchdog is running */
if (da9063_wdt_is_running(da9063)) {
- da9063_wdt_update_timeout(da9063, DA9063_WDG_TIMEOUT);
+ da9063_wdt_update_timeout(da9063, wdd->timeout);
set_bit(WDOG_HW_RUNNING, &wdd->status);
}