Home Home > GIT Browse
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
commitd97057f72e8b7f7db286e45736dd90fa8036d6d0 (patch)
tree2233eefbe72047c6a7f7733c80210bf8bc55ed63
parent928db1f56a4306b025b2a674b6a30a130103017f (diff)
watchdog: da9063: Fix updating timeout value (bsc#1100843).
-rw-r--r--patches.fixes/watchdog-da9063-Fix-updating-timeout-value.patch61
-rw-r--r--series.conf1
2 files changed, 62 insertions, 0 deletions
diff --git a/patches.fixes/watchdog-da9063-Fix-updating-timeout-value.patch b/patches.fixes/watchdog-da9063-Fix-updating-timeout-value.patch
new file mode 100644
index 0000000000..cfa9b28069
--- /dev/null
+++ b/patches.fixes/watchdog-da9063-Fix-updating-timeout-value.patch
@@ -0,0 +1,61 @@
+From 198e3f2ad3f9c30928ccb090803b05ae3fd0003d Mon Sep 17 00:00:00 2001
+From: Marco Felsch <m.felsch@pengutronix.de>
+Date: Mon, 28 May 2018 08:45:45 +0200
+Subject: [PATCH] watchdog: da9063: Fix updating timeout value
+Patch-mainline: v4.18-rc1
+Git-commit: 44ee54aabfdb3b35866ed909bde3ab01e9679385
+References: bsc#1100843
+
+The DA9063 watchdog has only one register field to store the timeout value
+and to enable the watchdog. The watchdog gets enabled if the value is
+not zero. There is no issue if the watchdog is already running but it
+leads into problems if the watchdog is disabled.
+
+If the watchdog is disabled and only the timeout value should be prepared
+the watchdog gets enabled too. Add a check to get the current watchdog
+state and update the watchdog timeout value on hw-side only if the
+watchdog is already active.
+
+Fixes: 5e9c16e37608 ("watchdog: Add DA9063 PMIC watchdog driver.")
+Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
+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>
+Acked-by: Yadan Fan <ydfan@suse.com>
+---
+ drivers/watchdog/da9063_wdt.c | 17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c
+index e531c1c6a3f4..3f1517681705 100644
+--- a/drivers/watchdog/da9063_wdt.c
++++ b/drivers/watchdog/da9063_wdt.c
+@@ -130,10 +130,23 @@ static int da9063_wdt_set_timeout(struct watchdog_device *wdd,
+ {
+ struct da9063_watchdog *wdt = watchdog_get_drvdata(wdd);
+ unsigned int selector;
+- int ret;
++ int ret = 0;
+
+ selector = da9063_wdt_timeout_to_sel(timeout);
+- ret = _da9063_wdt_set_timeout(wdt->da9063, selector);
++
++ /*
++ * There are two cases when a set_timeout() will be called:
++ * 1. The watchdog is off and someone wants to set the timeout for the
++ * further use.
++ * 2. The watchdog is already running and a new timeout value should be
++ * set.
++ *
++ * The watchdog can't store a timeout value not equal zero without
++ * enabling the watchdog, so the timeout must be buffered by the driver.
++ */
++ if (watchdog_active(wdd))
++ ret = _da9063_wdt_set_timeout(da9063, selector);
++
+ if (ret)
+ dev_err(wdt->da9063->dev, "Failed to set watchdog timeout (err = %d)\n",
+ ret);
+--
+2.17.1
+
diff --git a/series.conf b/series.conf
index 9785bc0a67..45d0b57f78 100644
--- a/series.conf
+++ b/series.conf
@@ -23888,6 +23888,7 @@
# watchdog da9063
patches.fixes/watchdog-da9063-Fix-setting-changing-timeout.patch
+ patches.fixes/watchdog-da9063-Fix-updating-timeout-value.patch
########################################################
# You'd better have a good reason for adding a patch