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 <aricciardi@baylibre.com>
This commit is contained in:
Adrien Ricciardi 2025-03-01 18:38:36 +01:00 committed by Benjamin Cabé
parent 36e830f446
commit 6ca9bffe48
2 changed files with 15 additions and 1 deletions

View File

@ -58,6 +58,16 @@ config TASK_WDT_HW_FALLBACK_DELAY
kernel timer. This is especially important if the hardware watchdog
is clocked by an inaccurate low-speed RC oscillator.
config TASK_WDT_HW_FALLBACK_PAUSE_IN_SLEEP
bool "Pause the hardware watchdog in system sleep"
depends on TASK_WDT_HW_FALLBACK
help
Configure the hardware watchdog to automatically pause when the
system reaches a sleep power state. When the system is resumed, the
watchdog is also automatically resumed.
Note that this feature is supported only by a subset of hardware
watchdogs.
config TASK_WDT_SHELL
bool "Task watchdog shell utilities"
depends on SHELL

View File

@ -179,7 +179,11 @@ int task_wdt_add(uint32_t reload_period, task_wdt_callback_t callback,
if (!hw_wdt_started && hw_wdt_dev) {
/* also start fallback hw wdt */
wdt_setup(hw_wdt_dev,
WDT_OPT_PAUSE_HALTED_BY_DBG);
WDT_OPT_PAUSE_HALTED_BY_DBG
#ifdef CONFIG_TASK_WDT_HW_FALLBACK_PAUSE_IN_SLEEP
| WDT_OPT_PAUSE_IN_SLEEP
#endif
);
hw_wdt_started = true;
}
#endif