Home Home > GIT Browse > SLE12-SP3
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYadan Fan <ydfan@suse.com>2018-07-11 18:24:01 +0800
committerYadan Fan <ydfan@suse.com>2018-07-11 18:24:12 +0800
commit9619a0f1c7f17e6c8458f79155819213049033db (patch)
treed7628864424b106d29f098d94ed3e39c45170dc6
parent09be79b7200f24d6526fb3772aa001b75cb46351 (diff)
watchdog: da9063: Fix timeout handling during probe
(bsc#1100843). suse-commit: 524eed187aa499c72d8737e27171951ffec33c11
-rw-r--r--drivers/watchdog/da9063_wdt.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c
index 3f1517681705..2b2326586258 100644
--- a/drivers/watchdog/da9063_wdt.c
+++ b/drivers/watchdog/da9063_wdt.c
@@ -54,6 +54,18 @@ static unsigned int da9063_wdt_timeout_to_sel(unsigned int secs)
return DA9063_TWDSCALE_MAX;
}
+/*
+ * Return 0 if watchdog is disabled, else non zero.
+ */
+static unsigned int da9063_wdt_is_running(struct da9063 *da9063)
+{
+ unsigned int val;
+
+ regmap_read(da9063->regmap, DA9063_REG_CONTROL_D, &val);
+
+ return val & DA9063_TWDSCALE_MASK;
+}
+
static int da9063_wdt_disable_timer(struct da9063 *da9063)
{
return regmap_update_bits(da9063->regmap, DA9063_REG_CONTROL_D,
@@ -239,6 +251,15 @@ static int da9063_wdt_remove(struct platform_device *pdev)
watchdog_unregister_device(&wdt->wdtdev);
+ /* Change the timeout to the default value if the watchdog is running */
+ if (da9063_wdt_is_running(da9063)) {
+ unsigned int timeout;
+
+ timeout = da9063_wdt_timeout_to_sel(DA9063_WDG_TIMEOUT);
+ _da9063_wdt_set_timeout(da9063, timeout);
+ set_bit(WDOG_HW_RUNNING, &wdd->status);
+ }
+
return 0;
}