watchdog: da9063: Fix updating timeout value
authorMarco Felsch <m.felsch@pengutronix.de>
Mon, 28 May 2018 06:45:45 +0000 (08:45 +0200)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Wed, 6 Jun 2018 08:45:32 +0000 (10:45 +0200)
commit44ee54aabfdb3b35866ed909bde3ab01e9679385
treecac7808dcca769272769e546da76bdaed678c6b9
parente46bb55dbc94b06f5ee466e2f50723b56781e661
watchdog: da9063: Fix updating timeout value

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>
drivers/watchdog/da9063_wdt.c