arch/xtensa/esp32[-|-s3]: Fix exception issue when pm active

Fix exception issue when PM and DEBUG_ASSERTIONS enabled for esp32 and esp32s3.
This error happens due to PM system workflow, when system gets into sleep-modes with
removing PM_NORMAL count, system is raising an exception for not having
enough number of PM_NORMAL state count if DEBUG_ASSERTIONS enabled.

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
This commit is contained in:
Eren Terzioglu
2025-10-13 16:54:07 +02:00
committed by Matteo Golin
parent aa8fb9ae2e
commit 734068890a
2 changed files with 24 additions and 0 deletions

View File

@@ -167,6 +167,18 @@ static void esp32_idlepm(void)
static enum pm_state_e oldstate = PM_NORMAL;
enum pm_state_e newstate;
int ret;
int count;
count = pm_staycount(PM_IDLE_DOMAIN, PM_NORMAL);
if (oldstate != PM_NORMAL && count == 0)
{
pm_stay(PM_IDLE_DOMAIN, PM_NORMAL);
/* Keep working in normal stage */
pm_changestate(PM_IDLE_DOMAIN, PM_NORMAL);
newstate = PM_NORMAL;
}
/* Decide, which power saving level can be obtained */

View File

@@ -90,6 +90,18 @@ static void up_idlepm(void)
static enum pm_state_e oldstate = PM_NORMAL;
enum pm_state_e newstate;
int ret;
int count;
count = pm_staycount(PM_IDLE_DOMAIN, PM_NORMAL);
if (oldstate != PM_NORMAL && count == 0)
{
pm_stay(PM_IDLE_DOMAIN, PM_NORMAL);
/* Keep working in normal stage */
pm_changestate(PM_IDLE_DOMAIN, PM_NORMAL);
newstate = PM_NORMAL;
}
/* Decide, which power saving level can be obtained */