diff options
author | Patryk Duda <pdk@semihalf.com> | 2021-12-20 17:20:20 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-01-13 16:54:09 +0000 |
commit | 0d85638f571a5a0a60de219a11f0e50bdc1ae786 (patch) | |
tree | 5e4cbf8b892097b30eae3a8115d3a3667d5626b3 | |
parent | d52cadca2cbc983b4596538544b12237bf64156d (diff) | |
download | chrome-ec-0d85638f571a5a0a60de219a11f0e50bdc1ae786.tar.gz |
clock-stm32h7: Check if deep sleep time is less than watchdog period
If we go to deep sleep for longer than CONFIG_WATCHDOG_PERIOD_MS, then
watchdog will wake us from sleep which is not what we want. Please note
that there will be no information where watchodg was triggered, because
timers are stopped in stop mode.
BUG=b:200828093
BRANCH=none
TEST=make -j buildall
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Change-Id: Icc9bbf14c7dbfad4cb614efb6f01948b07c6c89a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3347654
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
-rw-r--r-- | chip/stm32/clock-stm32h7.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/chip/stm32/clock-stm32h7.c b/chip/stm32/clock-stm32h7.c index 72f904c4ed..696105b4f1 100644 --- a/chip/stm32/clock-stm32h7.c +++ b/chip/stm32/clock-stm32h7.c @@ -478,6 +478,15 @@ void __idle(void) if (DEEP_SLEEP_ALLOWED && next_delay > LPTIM_PERIOD_US + STOP_MODE_LATENCY) { + /* + * Sleep time MUST be smaller than watchdog period. + * Otherwise watchdog will wake us from deep sleep + * which is not what we want. Please note that this + * assert won't fire if we are already part way through + * the watchdog period. + */ + ASSERT(next_delay < CONFIG_WATCHDOG_PERIOD_MS * MSEC); + /* deep-sleep in STOP mode */ idle_dsleep_cnt++; |