Skip to content

Commit 6ca9bff

Browse files
RICCIARDI-Adrienkartben
authored andcommitted
task_wdt: Kconfig: Allow to pause the hardware watchdog in sleep
The hardware watchdog optionally used by the Task Watchdog can support being automatically paused when the system enters a sleep power state. Add a Kconfig flag to enable such feature. Signed-off-by: Adrien Ricciardi <[email protected]>
1 parent 36e830f commit 6ca9bff

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

subsys/task_wdt/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ config TASK_WDT_HW_FALLBACK_DELAY
5858
kernel timer. This is especially important if the hardware watchdog
5959
is clocked by an inaccurate low-speed RC oscillator.
6060

61+
config TASK_WDT_HW_FALLBACK_PAUSE_IN_SLEEP
62+
bool "Pause the hardware watchdog in system sleep"
63+
depends on TASK_WDT_HW_FALLBACK
64+
help
65+
Configure the hardware watchdog to automatically pause when the
66+
system reaches a sleep power state. When the system is resumed, the
67+
watchdog is also automatically resumed.
68+
Note that this feature is supported only by a subset of hardware
69+
watchdogs.
70+
6171
config TASK_WDT_SHELL
6272
bool "Task watchdog shell utilities"
6373
depends on SHELL

subsys/task_wdt/task_wdt.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,11 @@ int task_wdt_add(uint32_t reload_period, task_wdt_callback_t callback,
179179
if (!hw_wdt_started && hw_wdt_dev) {
180180
/* also start fallback hw wdt */
181181
wdt_setup(hw_wdt_dev,
182-
WDT_OPT_PAUSE_HALTED_BY_DBG);
182+
WDT_OPT_PAUSE_HALTED_BY_DBG
183+
#ifdef CONFIG_TASK_WDT_HW_FALLBACK_PAUSE_IN_SLEEP
184+
| WDT_OPT_PAUSE_IN_SLEEP
185+
#endif
186+
);
183187
hw_wdt_started = true;
184188
}
185189
#endif

0 commit comments

Comments
 (0)