[PATCH 2/2] watchdog: gpio: add reset-from-wdt support
From: Steffen Trumtrar
Date: Tue Oct 13 2026 - 01:54:59 EST
The reset-from-wdt is a GPIO that signals, that the last reset was
issued by the gpio-wdt.
When this GPIO is provided, read its value and set the watchdog
bootstatus.
Signed-off-by: Steffen Trumtrar <s.trumtrar@xxxxxxxxxxxxxx>
---
drivers/watchdog/gpio_wdt.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
index 1abc7d0b78a62..ff303ae920bba 100644
--- a/drivers/watchdog/gpio_wdt.c
+++ b/drivers/watchdog/gpio_wdt.c
@@ -29,6 +29,7 @@ enum {
struct gpio_wdt_priv {
struct gpio_desc *gpiod;
+ struct gpio_desc *reset_from_wdt;
bool state;
bool always_running;
unsigned int hw_algo;
@@ -135,6 +136,20 @@ static int gpio_wdt_probe(struct platform_device *pdev)
if (IS_ERR(priv->gpiod))
return PTR_ERR(priv->gpiod);
+ priv->reset_from_wdt = devm_gpiod_get_optional(dev, "reset-from-wdt", GPIOD_IN);
+ if (IS_ERR(priv->reset_from_wdt))
+ return dev_err_probe(dev, PTR_ERR(priv->reset_from_wdt),
+ "failed to get reset-from-wdt-gpios.");
+
+ if (priv->reset_from_wdt) {
+ int val = gpiod_get_value_cansleep(priv->reset_from_wdt);
+
+ if (val < 0)
+ return val;
+
+ priv->wdd.bootstatus = val ? WDIOF_CARDRESET : 0;
+ }
+
ret = device_property_read_u32(dev, "hw_margin_ms", &hw_margin);
if (ret)
return ret;
--
2.52.0