[PATCH 1/2] watchdog: imx2_wdt: Allow to continue in low power mode

Nandor Han posted 2 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH 1/2] watchdog: imx2_wdt: Allow to continue in low power mode
Posted by Nandor Han 1 month, 1 week ago
By default, the driver suspends the watchdog in low power modes (STOP
and DOZE). In some situations this is not desired.

Add the possibility to configure the continuation of the watchdog timer
in the above mentioned low power modes.

Note:
Please be advised that the difference between the variable name and the
device tree option has been intentionally selected to uphold the
prevailing driver functionality. This ensures that the watchdog remains
suspended by default in low power mode, while also facilitating a clear
and intelligible device tree option name.

Signed-off-by: Nandor Han <nandor.han@gehealthcare.com>
---
 drivers/watchdog/imx2_wdt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 4b3a192ee3e8..6e837cfc3c5a 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -71,6 +71,7 @@ struct imx2_wdt_device {
 	struct watchdog_device wdog;
 	const struct imx2_wdt_data *data;
 	bool ext_reset;
+	bool wdt_suspend_in_low_power;
 	bool clk_is_on;
 	bool no_ping;
 	bool sleep_wait;
@@ -135,7 +136,8 @@ static inline void imx2_wdt_setup(struct watchdog_device *wdog)
 	regmap_read(wdev->regmap, IMX2_WDT_WCR, &val);
 
 	/* Suspend timer in low power mode, write once-only */
-	val |= IMX2_WDT_WCR_WDZST;
+	if (wdev->wdt_suspend_in_low_power)
+		val |= IMX2_WDT_WCR_WDZST;
 	/* Suspend timer in low power WAIT mode, write once-only */
 	if (wdev->sleep_wait)
 		val |= IMX2_WDT_WCR_WDW;
@@ -326,6 +328,9 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
 	wdev->ext_reset = of_property_read_bool(dev->of_node,
 						"fsl,ext-reset-output");
 
+	wdev->wdt_suspend_in_low_power = !of_property_read_bool(dev->of_node,
+						"fsl,wdt-continue-in-low-power");
+
 	if (of_property_read_bool(dev->of_node, "fsl,suspend-in-wait")) {
 		if (!wdev->data->wdw_supported) {
 			dev_err(dev, "suspend-in-wait not supported\n");
-- 
2.39.5
Re: [PATCH 1/2] watchdog: imx2_wdt: Allow to continue in low power mode
Posted by Guenter Roeck 1 month, 1 week ago
On Mon, Dec 29, 2025 at 04:49:59PM +0200, Nandor Han wrote:
> By default, the driver suspends the watchdog in low power modes (STOP
> and DOZE). In some situations this is not desired.

Following up on Krzysztof's comment to the devicetree patch:
Assuming the watchdog is in low power mode while the system is
suspended, it is all but impossible to imagine what those situations
might be. A reset by watchdog after the system is suspended simply
does not make sense. A system which must not go into suspend mode
must not be permitted to go into suspend mode to start with, or in
other words suspend mode must not be enabled to start with on such
systems.

Guenter
Re: [PATCH 1/2] watchdog: imx2_wdt: Allow to continue in low power mode
Posted by Krzysztof Kozlowski 1 month, 1 week ago
On Mon, Dec 29, 2025 at 04:49:59PM +0200, Nandor Han wrote:
> By default, the driver suspends the watchdog in low power modes (STOP
> and DOZE). In some situations this is not desired.
> 
> Add the possibility to configure the continuation of the watchdog timer
> in the above mentioned low power modes.
> 
> Note:
> Please be advised that the difference between the variable name and the
> device tree option has been intentionally selected to uphold the
> prevailing driver functionality. This ensures that the watchdog remains
> suspended by default in low power mode, while also facilitating a clear
> and intelligible device tree option name.
>

Please organize the patch documenting the compatible (DT bindings)
before the patch using that compatible.
See also: https://elixir.bootlin.com/linux/v6.14-rc6/source/Documentation/devicetree/bindings/submitting-patches.rst#L46

Best regards,
Krzysztof
[PATCH v2 0/2] watchdog: imx2_wdt: Allow to run in low power mode
Posted by Nandor Han 4 weeks ago
Description
-----------
Add the possibility for the user to allow the configuration of watchdog
in low power mode.

Testing
-------
It was verified on a i.MX7D based system that once enabled the watchdog
will reset the device when the system enter in low power mode.


Changes in V2:
-------------
- Order the dt-bindings commit before using it.
- Small documentation update.


Nandor Han (2):
  dt-bindings: watchdog: fsl-imx: document continue in low power mode
  watchdog: imx2_wdt: Allow to continue in low power mode

 .../devicetree/bindings/watchdog/fsl-imx-wdt.yaml          | 6 ++++++
 drivers/watchdog/imx2_wdt.c                                | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

-- 
2.39.5
Re: [PATCH 1/2] watchdog: imx2_wdt: Allow to continue in low power mode
Posted by Nandor Han 1 month ago
On 12/30/25 14:35, Krzysztof Kozlowski wrote:
> CAUTION: This email originated from outside of GE HealthCare. Only open links or attachments if you trust the sender. Report suspicious emails using Outlook’s “Report” button.
>
> On Mon, Dec 29, 2025 at 04:49:59PM +0200, Nandor Han wrote:
>> By default, the driver suspends the watchdog in low power modes (STOP
>> and DOZE). In some situations this is not desired.
>>
>> Add the possibility to configure the continuation of the watchdog timer
>> in the above mentioned low power modes.
>>
>> Note:
>> Please be advised that the difference between the variable name and the
>> device tree option has been intentionally selected to uphold the
>> prevailing driver functionality. This ensures that the watchdog remains
>> suspended by default in low power mode, while also facilitating a clear
>> and intelligible device tree option name.
>>
> Please organize the patch documenting the compatible (DT bindings)
> before the patch using that compatible.
> See also: https://elixir.bootlin.com/linux/v6.14-rc6/source/Documentation/devicetree/bindings/submitting-patches.rst#L46
>
> Best regards,
> Krzysztof

Thanks Krzysztof for the suggestion, I will take a look over the doc.

Regards,
Nandor


[PATCH v2 1/2] dt-bindings: watchdog: fsl-imx: document continue in low power mode
Posted by Nandor Han 4 weeks ago
Property "fsl,wdt-continue-in-low-power" allows the watchdog to continue
running in low power modes (STOP and DOZE). By default, the watchdog is
suspended in these modes. This property provides the option to keep the
watchdog active during low power states when needed.

Signed-off-by: Nandor Han <nandor.han@gehealthcare.com>
---
 Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
index 34951783a633..bf35d02d113f 100644
--- a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
+++ b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
@@ -64,6 +64,12 @@ properties:
       If present, the watchdog device is suspended in WAIT mode
       (Suspend-to-Idle). Only supported on certain devices.
 
+  fsl,wdt-continue-in-low-power:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: |
+      If present, the watchdog device continues to run in low power modes
+      (STOP and DOZE).
+
 required:
   - compatible
   - interrupts
-- 
2.39.5
Re: [PATCH v2 1/2] dt-bindings: watchdog: fsl-imx: document continue in low power mode
Posted by Krzysztof Kozlowski 4 weeks ago
On 12/01/2026 14:08, Nandor Han wrote:
> Property "fsl,wdt-continue-in-low-power" allows the watchdog to continue
> running in low power modes (STOP and DOZE). By default, the watchdog is
> suspended in these modes. This property provides the option to keep the
> watchdog active during low power states when needed.
> 
> Signed-off-by: Nandor Han <nandor.han@gehealthcare.com>

Do not attach (thread) your patchsets to some other threads (unrelated
or older versions). This buries them deep in the mailbox and might
interfere with applying entire sets. See also:
https://elixir.bootlin.com/linux/v6.16-rc2/source/Documentation/process/submitting-patches.rst#L830

> ---
>  Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
> index 34951783a633..bf35d02d113f 100644
> --- a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
> +++ b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
> @@ -64,6 +64,12 @@ properties:
>        If present, the watchdog device is suspended in WAIT mode
>        (Suspend-to-Idle). Only supported on certain devices.
>  
> +  fsl,wdt-continue-in-low-power:
> +    $ref: /schemas/types.yaml#/definitions/flag
> +    description: |

Do not need '|' unless you need to preserve formatting.


> +      If present, the watchdog device continues to run in low power modes
> +      (STOP and DOZE).

Not much improved. My questions how this petting is suppose to work
remain unanswered.

Again, system load is really not relevant whether watchdog works or not
in low power mode.


Best regards,
Krzysztof
Re: [PATCH v2 1/2] dt-bindings: watchdog: fsl-imx: document continue in low power mode
Posted by Nandor Han 3 weeks, 5 days ago
On 1/12/26 15:55, Krzysztof Kozlowski wrote:
> CAUTION: This email originated from outside of GE HealthCare. Only open links or attachments if you trust the sender. Report suspicious emails using Outlook’s “Report” button.
>
> On 12/01/2026 14:08, Nandor Han wrote:
>> Property "fsl,wdt-continue-in-low-power" allows the watchdog to continue
>> running in low power modes (STOP and DOZE). By default, the watchdog is
>> suspended in these modes. This property provides the option to keep the
>> watchdog active during low power states when needed.
>>
>> Signed-off-by: Nandor Han <nandor.han@gehealthcare.com>
> Do not attach (thread) your patchsets to some other threads (unrelated
> or older versions). This buries them deep in the mailbox and might
> interfere with applying entire sets. See also:
> https://elixir.bootlin.com/linux/v6.16-rc2/source/Documentation/process/submitting-patches.rst#L830

Apologies, will not do that on the next version.


<snip>

>> +  fsl,wdt-continue-in-low-power:
>> +    $ref: /schemas/types.yaml#/definitions/flag
>> +    description: |
> Do not need '|' unless you need to preserve formatting.

Thanks, will update.

>> +      If present, the watchdog device continues to run in low power modes
>> +      (STOP and DOZE).
> Not much improved. My questions how this petting is suppose to work
> remain unanswered.
>
> Again, system load is really not relevant whether watchdog works or not
> in low power mode.

Our use case is that we do not allow the CPU (i.MX7) to enter low-power modes.

To enforce this, we explicitly enable the watchdog during low-power states so that if the system enters such a mode for any reason, the watchdog will reset the CPU.
Since in STOP and DOZE modes the CPU is halted and systemd can no longer service the watchdog, the watchdog will eventually trigger a reset.

Regards,
Nandor

Re: [PATCH v2 1/2] dt-bindings: watchdog: fsl-imx: document continue in low power mode
Posted by Krzysztof Kozlowski 3 weeks, 5 days ago
On 14/01/2026 14:22, Nandor Han wrote:
> 
> On 1/12/26 15:55, Krzysztof Kozlowski wrote:
>> CAUTION: This email originated from outside of GE HealthCare. Only open links or attachments if you trust the sender. Report suspicious emails using Outlook’s “Report” button.
>>
>> On 12/01/2026 14:08, Nandor Han wrote:
>>> Property "fsl,wdt-continue-in-low-power" allows the watchdog to continue
>>> running in low power modes (STOP and DOZE). By default, the watchdog is
>>> suspended in these modes. This property provides the option to keep the
>>> watchdog active during low power states when needed.
>>>
>>> Signed-off-by: Nandor Han <nandor.han@gehealthcare.com>
>> Do not attach (thread) your patchsets to some other threads (unrelated
>> or older versions). This buries them deep in the mailbox and might
>> interfere with applying entire sets. See also:
>> https://elixir.bootlin.com/linux/v6.16-rc2/source/Documentation/process/submitting-patches.rst#L830
> 
> Apologies, will not do that on the next version.
> 
> 
> <snip>
> 
>>> +  fsl,wdt-continue-in-low-power:
>>> +    $ref: /schemas/types.yaml#/definitions/flag
>>> +    description: |
>> Do not need '|' unless you need to preserve formatting.
> 
> Thanks, will update.
> 
>>> +      If present, the watchdog device continues to run in low power modes
>>> +      (STOP and DOZE).
>> Not much improved. My questions how this petting is suppose to work
>> remain unanswered.
>>
>> Again, system load is really not relevant whether watchdog works or not
>> in low power mode.
> 
> Our use case is that we do not allow the CPU (i.MX7) to enter low-power modes.

That's very close to OS policy... or some sort of runtime choice.

> 
> To enforce this, we explicitly enable the watchdog during low-power states so that if the system enters such a mode for any reason, the watchdog will reset the CPU.

So finally this is explained. You actually want to trigger the bite by
lack of petting.

You can as well set the bit moment you put the system to suspend. You do
not need DT flag for this.

I unfortunately do not see how this could be anything else than OS
policy, so it is not suitable for DT. Maybe some rephrasing could help
and that's what I would expect usually, but I already raised objections
and then you sent v2 with the same ignoring these objections (really,
never do that), so I doubt that discussing will change anything and you
need very specific answer: no.

> Since in STOP and DOZE modes the CPU is halted and systemd can no longer service the watchdog, the watchdog will eventually trigger a reset.



Best regards,
Krzysztof
[PATCH v2 2/2] watchdog: imx2_wdt: Allow to continue in low power mode
Posted by Nandor Han 4 weeks ago
By default, the driver suspends the watchdog in low power modes (STOP
and DOZE). In some situations this is not desired.

Add the possibility to configure the continuation of the watchdog timer
in the above mentioned low power modes.

Note:
Please be advised that the difference between the variable name and the
device tree option has been intentionally selected to uphold the
prevailing driver functionality. This ensures that the watchdog remains
suspended by default in low power mode, while also facilitating a clear
and intelligible device tree option name.

Signed-off-by: Nandor Han <nandor.han@gehealthcare.com>
---
 drivers/watchdog/imx2_wdt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 4b3a192ee3e8..6e837cfc3c5a 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -71,6 +71,7 @@ struct imx2_wdt_device {
 	struct watchdog_device wdog;
 	const struct imx2_wdt_data *data;
 	bool ext_reset;
+	bool wdt_suspend_in_low_power;
 	bool clk_is_on;
 	bool no_ping;
 	bool sleep_wait;
@@ -135,7 +136,8 @@ static inline void imx2_wdt_setup(struct watchdog_device *wdog)
 	regmap_read(wdev->regmap, IMX2_WDT_WCR, &val);
 
 	/* Suspend timer in low power mode, write once-only */
-	val |= IMX2_WDT_WCR_WDZST;
+	if (wdev->wdt_suspend_in_low_power)
+		val |= IMX2_WDT_WCR_WDZST;
 	/* Suspend timer in low power WAIT mode, write once-only */
 	if (wdev->sleep_wait)
 		val |= IMX2_WDT_WCR_WDW;
@@ -326,6 +328,9 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
 	wdev->ext_reset = of_property_read_bool(dev->of_node,
 						"fsl,ext-reset-output");
 
+	wdev->wdt_suspend_in_low_power = !of_property_read_bool(dev->of_node,
+						"fsl,wdt-continue-in-low-power");
+
 	if (of_property_read_bool(dev->of_node, "fsl,suspend-in-wait")) {
 		if (!wdev->data->wdw_supported) {
 			dev_err(dev, "suspend-in-wait not supported\n");
-- 
2.39.5