Skip to contentSkip to conversation

watchdog: da9062: Use pre-configured timeout until userspace takes over

PATCH In review Stefan Riedmueller 3 participants 10 messages Mar 26, 2020 – Apr 1, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 watchdog: da9062: Use pre-configured timeout until userspace takes over

If the watchdog is already running during probe read back its pre-configured timeout (set e.g. by the bootloader) and use it to ping the watchdog until userspace takes over. Otherwise the default timeout set before might not result in a fast enough ping.

---
 drivers/watchdog/da9062_wdt.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/watchdog/da9062_wdt.c +16 -0
index 0ad15d55071c..6d81b1276b87 100644
@@ -35,6 +35,14 @@ struct da9062_watchdog {
 	bool use_sw_pm;
 };
 
+static unsigned int da9062_wdt_read_timeout(struct da9062_watchdog *wdt)
+{
+	int val;
+
+	regmap_read(wdt->hw->regmap, DA9062AA_CONTROL_D, &val);
+	return wdt_timeout[val & DA9062AA_TWDSCALE_MASK];
+}
+
 static unsigned int da9062_wdt_timeout_to_sel(unsigned int secs)
 {
 	unsigned int i;
@@ -184,6 +192,7 @@ static int da9062_wdt_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	int ret;
+	int timeout;
 	struct da9062 *chip;
 	struct da9062_watchdog *wdt;
 
@@ -213,6 +222,13 @@ static int da9062_wdt_probe(struct platform_device *pdev)
 	watchdog_set_drvdata(&wdt->wdtdev, wdt);
 	dev_set_drvdata(dev, &wdt->wdtdev);
 
+	timeout = da9062_wdt_read_timeout(wdt);
+	if (timeout > 0) {
+		wdt->wdtdev.timeout = timeout;
+		set_bit(WDOG_HW_RUNNING, &wdt->wdtdev.status);
+		dev_info(wdt->hw->dev, "watchdog is running (%u s)", timeout);
+	}
+
 	ret = devm_watchdog_register_device(dev, &wdt->wdtdev);
 	if (ret < 0)
 		return ret;
Signature · 1 line
2.23.0
#1 lore raw

PATCH 2/3 watchdog: da9063: Use pre configured timeout when watchdog is running

If the watchdog is already running during probe use its pre-configured timeout instead of a default timeout to make sure the watchdog is pinged in time until userspace takes over.

---
 drivers/watchdog/da9063_wdt.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/watchdog/da9063_wdt.c +18 -11
index 3d65e92a4e3f..34d0c4f03814 100644
@@ -46,15 +46,16 @@ static unsigned int da9063_wdt_timeout_to_sel(unsigned int secs)
 }
 
 /*
- * Return 0 if watchdog is disabled, else non zero.
+ * Read the currently active timeout.
+ * Zero means the watchdog is disabled.
  */
-static unsigned int da9063_wdt_is_running(struct da9063 *da9063)
+static unsigned int da9063_wdt_read_timeout(struct da9063 *da9063)
 {
 	unsigned int val;
 
 	regmap_read(da9063->regmap, DA9063_REG_CONTROL_D, &val);
 
-	return val & DA9063_TWDSCALE_MASK;
+	return wdt_timeout[val & DA9063_TWDSCALE_MASK];
 }
 
 static int da9063_wdt_disable_timer(struct da9063 *da9063)
@@ -191,6 +192,7 @@ static int da9063_wdt_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct da9063 *da9063;
 	struct watchdog_device *wdd;
+	int timeout;
 
 	if (!dev->parent)
 		return -EINVAL;
@@ -214,15 +216,20 @@ static int da9063_wdt_probe(struct platform_device *pdev)
 	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, wdd->timeout);
+	/*
+	 * Use pre-configured timeout if watchdog is already running.
+	 * Otherwise set default timeout, maybe override it with DT value,
+	 * scale it
+	 */
+	timeout = da9063_wdt_read_timeout(da9063);
+	if (timeout) {
+		wdd->timeout = timeout;
 		set_bit(WDOG_HW_RUNNING, &wdd->status);
+		dev_info(da9063->dev, "watchdog is running (%u s)", timeout);
+	} else {
+		wdd->timeout = DA9063_WDG_TIMEOUT;
+		watchdog_init_timeout(wdd, 0, dev);
+		da9063_wdt_set_timeout(wdd, wdd->timeout);
 	}
 
 	return devm_watchdog_register_device(dev, wdd);
Signature · 1 line
2.23.0
#2 lore raw

RE: [PATCH 2/3] watchdog: da9063: Use pre configured timeout when watchdog is running

Quoted 3 lines · Stefan Riedmueller

If the watchdog is already running during probe use its pre-configured timeout instead of a default timeout to make sure the watchdog is pinged in time until userspace takes over.

At least for this driver I don't think there's an issue here with regards to not pinging in time. Calling 'da9063_wdt_update_timeout()', as it currently does in the probe() when the watchdog is already active, actually disables the watchdog before then setting a new timeout value, so by that method we're avoiding a timeout and starting a new timer period.

To my mind the timeout value should come from DT if possible, which I would assume for the most part would match whatever is defined in the bootloader as well, unless I'm mistaken. If that's not available though then I would maybe agree on falling back to a value that was already programmed in the bootloader rather than the driver default which should be the last resort.

Quoted 72 lines
---
 drivers/watchdog/da9063_wdt.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/watchdog/da9063_wdt.c +4 -3
index 3d65e92a4e3f..34d0c4f03814 100644
@@ -46,15 +46,16 @@ static unsigned int da9063_wdt_timeout_to_sel(unsigned
 int secs)
 }
 
 /*
- * Return 0 if watchdog is disabled, else non zero.
+ * Read the currently active timeout.
+ * Zero means the watchdog is disabled.
  */
-static unsigned int da9063_wdt_is_running(struct da9063 *da9063)
+static unsigned int da9063_wdt_read_timeout(struct da9063 *da9063)
 {
 	unsigned int val;
 
 	regmap_read(da9063->regmap, DA9063_REG_CONTROL_D, &val);
 
-	return val & DA9063_TWDSCALE_MASK;
+	return wdt_timeout[val & DA9063_TWDSCALE_MASK];
 }
 

static int da9063_wdt_disable_timer(struct da9063 *da9063)

drivers/watchdog/da9063_wdt.c +1 -0
@@ -191,6 +192,7 @@ static int da9063_wdt_probe(struct platform_device
 *pdev)
 	struct device *dev = &pdev->dev;
 	struct da9063 *da9063;
 	struct watchdog_device *wdd;
+	int timeout;
 
 	if (!dev->parent)
drivers/watchdog/da9063_wdt.c +13 -8
 		return -EINVAL;
@@ -214,15 +216,20 @@ static int da9063_wdt_probe(struct platform_device
 *pdev)
 	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, wdd->timeout);
+	/*
+	 * Use pre-configured timeout if watchdog is already running.
+	 * Otherwise set default timeout, maybe override it with DT value,
+	 * scale it
+	 */
+	timeout = da9063_wdt_read_timeout(da9063);
+	if (timeout) {
+		wdd->timeout = timeout;
 		set_bit(WDOG_HW_RUNNING, &wdd->status);
+		dev_info(da9063->dev, "watchdog is running (%u s)", timeout);
+	} else {
+		wdd->timeout = DA9063_WDG_TIMEOUT;
+		watchdog_init_timeout(wdd, 0, dev);
+		da9063_wdt_set_timeout(wdd, wdd->timeout);
 	}
 

return devm_watchdog_register_device(dev, wdd);
--
2.23.0

maintainer
#3 lore raw

Re: [PATCH 2/3] watchdog: da9063: Use pre configured timeout when watchdog is running

Quoted 12 lines · Adam Thomson
Quoted 3 lines · Stefan Riedmueller

If the watchdog is already running during probe use its pre-configured timeout instead of a default timeout to make sure the watchdog is pinged in time until userspace takes over.

At least for this driver I don't think there's an issue here with regards to not pinging in time. Calling 'da9063_wdt_update_timeout()', as it currently does in the probe() when the watchdog is already active, actually disables the watchdog before then setting a new timeout value, so by that method we're avoiding a timeout and starting a new timer period.

Quoted 6 lines

To my mind the timeout value should come from DT if possible, which I would assume for the most part would match whatever is defined in the bootloader as well, unless I'm mistaken. If that's not available though then I would maybe agree on falling back to a value that was already programmed in the bootloader rather than the driver default which should be the last resort.

Agreed.

Guenter

Quoted 73 lines
Quoted 72 lines
---
 drivers/watchdog/da9063_wdt.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/watchdog/da9063_wdt.c +4 -3
index 3d65e92a4e3f..34d0c4f03814 100644
@@ -46,15 +46,16 @@ static unsigned int da9063_wdt_timeout_to_sel(unsigned
 int secs)
 }
 
 /*
- * Return 0 if watchdog is disabled, else non zero.
+ * Read the currently active timeout.
+ * Zero means the watchdog is disabled.
  */
-static unsigned int da9063_wdt_is_running(struct da9063 *da9063)
+static unsigned int da9063_wdt_read_timeout(struct da9063 *da9063)
 {
 	unsigned int val;
 
 	regmap_read(da9063->regmap, DA9063_REG_CONTROL_D, &val);
 
-	return val & DA9063_TWDSCALE_MASK;
+	return wdt_timeout[val & DA9063_TWDSCALE_MASK];
 }
 

static int da9063_wdt_disable_timer(struct da9063 *da9063)

drivers/watchdog/da9063_wdt.c +1 -0
@@ -191,6 +192,7 @@ static int da9063_wdt_probe(struct platform_device
 *pdev)
 	struct device *dev = &pdev->dev;
 	struct da9063 *da9063;
 	struct watchdog_device *wdd;
+	int timeout;
 
 	if (!dev->parent)
drivers/watchdog/da9063_wdt.c +13 -8
 		return -EINVAL;
@@ -214,15 +216,20 @@ static int da9063_wdt_probe(struct platform_device
 *pdev)
 	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, wdd->timeout);
+	/*
+	 * Use pre-configured timeout if watchdog is already running.
+	 * Otherwise set default timeout, maybe override it with DT value,
+	 * scale it
+	 */
+	timeout = da9063_wdt_read_timeout(da9063);
+	if (timeout) {
+		wdd->timeout = timeout;
 		set_bit(WDOG_HW_RUNNING, &wdd->status);
+		dev_info(da9063->dev, "watchdog is running (%u s)", timeout);
+	} else {
+		wdd->timeout = DA9063_WDG_TIMEOUT;
+		watchdog_init_timeout(wdd, 0, dev);
+		da9063_wdt_set_timeout(wdd, wdd->timeout);
 	}
 

return devm_watchdog_register_device(dev, wdd);
--
2.23.0

#4 lore raw

Re: [PATCH 2/3] watchdog: da9063: Use pre configured timeout when watchdog is running

Hi Guenter, Adam,

Guenter Roeck <[email protected]> wrote on Tue, 31. Mar 20 09:08:

Quoted 13 lines · Adam Thomson
Quoted 12 lines · Stefan Riedmueller
Quoted 4 lines

If the watchdog is already running during probe use its pre-configured timeout instead of a default timeout to make sure the watchdog is pinged in time until userspace takes over.

At least for this driver I don't think there's an issue here with regards to not pinging in time. Calling 'da9063_wdt_update_timeout()', as it currently does in the probe() when the watchdog is already active, actually disables the watchdog before then setting a new timeout value, so by that method we're avoiding a timeout and starting a new timer period.

Quoted 7 lines
Quoted 6 lines

To my mind the timeout value should come from DT if possible, which I would assume for the most part would match whatever is defined in the bootloader as well, unless I'm mistaken. If that's not available though then I would maybe agree on falling back to a value that was already programmed in the bootloader rather than the driver default which should be the last resort.

Agreed.

Thanks for both your feedback. I'll drop the pre-configured timeout part and stick with the default timeout and do the same procedure (init_timeout + update_timeout) for the da9062.

Thanks
Stefan

Quoted 77 lines

Guenter

Quoted 73 lines
Quoted 72 lines
---
 drivers/watchdog/da9063_wdt.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/watchdog/da9063_wdt.c +4 -3
index 3d65e92a4e3f..34d0c4f03814 100644
@@ -46,15 +46,16 @@ static unsigned int da9063_wdt_timeout_to_sel(unsigned
 int secs)
 }
 
 /*
- * Return 0 if watchdog is disabled, else non zero.
+ * Read the currently active timeout.
+ * Zero means the watchdog is disabled.
  */
-static unsigned int da9063_wdt_is_running(struct da9063 *da9063)
+static unsigned int da9063_wdt_read_timeout(struct da9063 *da9063)
 {
 	unsigned int val;
 
 	regmap_read(da9063->regmap, DA9063_REG_CONTROL_D, &val);
 
-	return val & DA9063_TWDSCALE_MASK;
+	return wdt_timeout[val & DA9063_TWDSCALE_MASK];
 }
 

static int da9063_wdt_disable_timer(struct da9063 *da9063)

drivers/watchdog/da9063_wdt.c +1 -0
@@ -191,6 +192,7 @@ static int da9063_wdt_probe(struct platform_device
 *pdev)
 	struct device *dev = &pdev->dev;
 	struct da9063 *da9063;
 	struct watchdog_device *wdd;
+	int timeout;
 
 	if (!dev->parent)
drivers/watchdog/da9063_wdt.c +13 -8
 		return -EINVAL;
@@ -214,15 +216,20 @@ static int da9063_wdt_probe(struct platform_device
 *pdev)
 	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, wdd->timeout);
+	/*
+	 * Use pre-configured timeout if watchdog is already running.
+	 * Otherwise set default timeout, maybe override it with DT value,
+	 * scale it
+	 */
+	timeout = da9063_wdt_read_timeout(da9063);
+	if (timeout) {
+		wdd->timeout = timeout;
 		set_bit(WDOG_HW_RUNNING, &wdd->status);
+		dev_info(da9063->dev, "watchdog is running (%u s)", timeout);
+	} else {
+		wdd->timeout = DA9063_WDG_TIMEOUT;
+		watchdog_init_timeout(wdd, 0, dev);
+		da9063_wdt_set_timeout(wdd, wdd->timeout);
 	}
 

return devm_watchdog_register_device(dev, wdd);
--
2.23.0

#5 lore raw

PATCH 3/3 watchdog: da9062: No need to ping manually before setting timeout

In reply to Stefan Riedmueller

There is actually no need to ping the watchdog before disabling it during timeout change. Disabling the watchdog already takes care of resetting the counter.

This fixes an issue during boot when the userspace watchdog handler takes over and the watchdog is already running. Opening the watchdog in this case leads to the first ping and directly after that without the required heartbeat delay a second ping issued by the set_timeout call. Due to the missing delay this resulted in a reset.

---
 drivers/watchdog/da9062_wdt.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/watchdog/da9062_wdt.c +0 -5
index 6d81b1276b87..c5bd075c8b14 100644
@@ -66,11 +66,6 @@ static int da9062_wdt_update_timeout_register(struct da9062_watchdog *wdt,
 					      unsigned int regval)
 {
 	struct da9062 *chip = wdt->hw;
-	int ret;
-
-	ret = da9062_reset_watchdog_timer(wdt);
-	if (ret)
-		return ret;
 
 	regmap_update_bits(chip->regmap,
 				  DA9062AA_CONTROL_D,
Signature · 1 line
2.23.0
maintainer Reviewed-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] watchdog: da9062: No need to ping manually before setting timeout

Quoted 11 lines · Stefan Riedmueller

There is actually no need to ping the watchdog before disabling it during timeout change. Disabling the watchdog already takes care of resetting the counter.

This fixes an issue during boot when the userspace watchdog handler takes over and the watchdog is already running. Opening the watchdog in this case leads to the first ping and directly after that without the required heartbeat delay a second ping issued by the set_timeout call. Due to the missing delay this resulted in a reset.

Makes sense to me.

Guenter

Quoted 21 lines
---
 drivers/watchdog/da9062_wdt.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/watchdog/da9062_wdt.c +0 -5
index 6d81b1276b87..c5bd075c8b14 100644
@@ -66,11 +66,6 @@ static int da9062_wdt_update_timeout_register(struct da9062_watchdog *wdt,
 					      unsigned int regval)
 {
 	struct da9062 *chip = wdt->hw;
-	int ret;
-
-	ret = da9062_reset_watchdog_timer(wdt);
-	if (ret)
-		return ret;
 
 	regmap_update_bits(chip->regmap,
 				  DA9062AA_CONTROL_D,
Reviewed-by on v1 3/3
#7 lore raw

RE: [PATCH 3/3] watchdog: da9062: No need to ping manually before setting timeout

In reply to Stefan Riedmueller
Quoted 11 lines · Stefan Riedmueller

There is actually no need to ping the watchdog before disabling it during timeout change. Disabling the watchdog already takes care of resetting the counter.

This fixes an issue during boot when the userspace watchdog handler takes over and the watchdog is already running. Opening the watchdog in this case leads to the first ping and directly after that without the required heartbeat delay a second ping issued by the set_timeout call. Due to the missing delay this resulted in a reset.

Thanks for the update:

Quoted 23 lines
---
 drivers/watchdog/da9062_wdt.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/watchdog/da9062_wdt.c +0 -5
index 6d81b1276b87..c5bd075c8b14 100644
@@ -66,11 +66,6 @@ static int da9062_wdt_update_timeout_register(struct
 da9062_watchdog *wdt,
 					      unsigned int regval)
 {
 	struct da9062 *chip = wdt->hw;
-	int ret;
-
-	ret = da9062_reset_watchdog_timer(wdt);
-	if (ret)
-		return ret;
 
 	regmap_update_bits(chip->regmap,

DA9062AA_CONTROL_D,
--
2.23.0

maintainer
#8 lore raw
In reply to Stefan Riedmueller
Quoted 38 lines · Stefan Riedmueller

If the watchdog is already running during probe read back its pre-configured timeout (set e.g. by the bootloader) and use it to ping the watchdog until userspace takes over. Otherwise the default timeout set before might not result in a fast enough ping.

---
 drivers/watchdog/da9062_wdt.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/watchdog/da9062_wdt.c +9 -0
index 0ad15d55071c..6d81b1276b87 100644
@@ -35,6 +35,14 @@ struct da9062_watchdog {
 	bool use_sw_pm;
 };
 
+static unsigned int da9062_wdt_read_timeout(struct da9062_watchdog *wdt)
+{
+	int val;
+
+	regmap_read(wdt->hw->regmap, DA9062AA_CONTROL_D, &val);
+	return wdt_timeout[val & DA9062AA_TWDSCALE_MASK];
+}
+
 static unsigned int da9062_wdt_timeout_to_sel(unsigned int secs)
 {
 	unsigned int i;
@@ -184,6 +192,7 @@ static int da9062_wdt_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	int ret;
+	int timeout;
 	struct da9062 *chip;
 	struct da9062_watchdog *wdt;
 

drivers/watchdog/da9062_wdt.c static int da9062_wdt_probe(struct platform_device *pdev) · line 229

Quoted 8 lines
drivers/watchdog/da9062_wdt.c +5 -0
@@ -213,6 +222,13 @@ static int da9062_wdt_probe(struct platform_device *pdev)
 	watchdog_set_drvdata(&wdt->wdtdev, wdt);
 	dev_set_drvdata(dev, &wdt->wdtdev);
 
+	timeout = da9062_wdt_read_timeout(wdt);
+	if (timeout > 0) {
+		wdt->wdtdev.timeout = timeout;
+		set_bit(WDOG_HW_RUNNING, &wdt->wdtdev.status);
+		dev_info(wdt->hw->dev, "watchdog is running (%u s)", timeout);

The user won't know what "(%u s)" means.e that "%u" reflects the timeout. Also, the newline at the end is missing.

Personally, I think the message is just noise and should be dropped entirely.

Guenter

Quoted 5 lines
drivers/watchdog/da9062_wdt.c +2 -0
+	}
+
 	ret = devm_watchdog_register_device(dev, &wdt->wdtdev);
 	if (ret < 0)
 		return ret;
maintainer
#9 lore raw
In reply to Stefan Riedmueller
Quoted 38 lines · Stefan Riedmueller

If the watchdog is already running during probe read back its pre-configured timeout (set e.g. by the bootloader) and use it to ping the watchdog until userspace takes over. Otherwise the default timeout set before might not result in a fast enough ping.

---
 drivers/watchdog/da9062_wdt.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/watchdog/da9062_wdt.c +9 -0
index 0ad15d55071c..6d81b1276b87 100644
@@ -35,6 +35,14 @@ struct da9062_watchdog {
 	bool use_sw_pm;
 };
 
+static unsigned int da9062_wdt_read_timeout(struct da9062_watchdog *wdt)
+{
+	int val;
+
+	regmap_read(wdt->hw->regmap, DA9062AA_CONTROL_D, &val);
+	return wdt_timeout[val & DA9062AA_TWDSCALE_MASK];
+}
+
 static unsigned int da9062_wdt_timeout_to_sel(unsigned int secs)
 {
 	unsigned int i;
@@ -184,6 +192,7 @@ static int da9062_wdt_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	int ret;
+	int timeout;
 	struct da9062 *chip;
 	struct da9062_watchdog *wdt;
 

drivers/watchdog/da9062_wdt.c static int da9062_wdt_probe(struct platform_device *pdev) · line 230

Quoted 9 lines
drivers/watchdog/da9062_wdt.c +6 -0
@@ -213,6 +222,13 @@ static int da9062_wdt_probe(struct platform_device *pdev)
 	watchdog_set_drvdata(&wdt->wdtdev, wdt);
 	dev_set_drvdata(dev, &wdt->wdtdev);
 
+	timeout = da9062_wdt_read_timeout(wdt);
+	if (timeout > 0) {
+		wdt->wdtdev.timeout = timeout;
+		set_bit(WDOG_HW_RUNNING, &wdt->wdtdev.status);
+		dev_info(wdt->hw->dev, "watchdog is running (%u s)", timeout);
+	}

Oh, and I agree with the comment made for the da9063 driver: This driver should really implement watchdog_init_timeout() and set the default timeout accordingly if specified in dt (or, in other words, follow the da9063 implementation).

Guenter

Quoted 4 lines
drivers/watchdog/da9062_wdt.c +1 -0
+
 	ret = devm_watchdog_register_device(dev, &wdt->wdtdev);
 	if (ret < 0)
 		return ret;