mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
fix(esp_hw_support): enable THREAD_SAFE_CLAIM with PM_EN to fix auto lslp always be rejected
This commit is contained in:
@@ -1502,7 +1502,16 @@ static SLEEP_FN_ATTR esp_err_t sleep_smp_cpu_sleep_prepare(void)
|
||||
// which naturally avoids cache livelock, so the 20ms livelock workaround timeout is not needed.
|
||||
esp_int_wdt_livelock_workaround(false);
|
||||
#endif
|
||||
#if CONFIG_FREERTOS_PORT_THREAD_SAFE_CLAIM
|
||||
esp_err_t ipc_isr_err = ESP_OK;
|
||||
esp_ipc_isr_stall_other_cpu();
|
||||
#else
|
||||
/* Dual-core PM_ENABLE selects THREAD_SAFE_CLAIM, so auto light sleep always takes
|
||||
* the blocking path above. This safe-stall fallback is for non-PM callers of
|
||||
* esp_light_sleep_start(): reject and let the upper layer decide whether to retry.
|
||||
*/
|
||||
esp_err_t ipc_isr_err = esp_ipc_isr_stall_other_cpu_safe();
|
||||
#endif
|
||||
if (ipc_isr_err == ESP_OK) {
|
||||
#if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && SOC_PM_CPU_RETENTION_BY_SW
|
||||
// Run CPU retention in the context of the other safely stalled CPU.
|
||||
|
||||
@@ -15,6 +15,9 @@ menu "Power Management"
|
||||
bool "Support for power management"
|
||||
# SMP FreeRTOS currently does not support power management IDF-4997
|
||||
depends on (!FREERTOS_SMP && SOC_PM_SUPPORTED) || __DOXYGEN__
|
||||
# Without FREERTOS_PORT_THREAD_SAFE_CLAIM, dual-core auto light sleep must use a safe stall that often
|
||||
# rejects when the peer is in an ISR/critical section, which significantly increases power consumption..
|
||||
select FREERTOS_PORT_THREAD_SAFE_CLAIM if !FREERTOS_UNICORE
|
||||
default n
|
||||
help
|
||||
If enabled, application is compiled with support for power management.
|
||||
@@ -23,6 +26,10 @@ menu "Power Management"
|
||||
RTOS ticks and timers used for timekeeping.
|
||||
Enable this option if application uses power management APIs.
|
||||
|
||||
On dual-core targets this also enables FREERTOS_PORT_THREAD_SAFE_CLAIM.
|
||||
Without it, automatic light sleep frequently fails to stall the other CPU and
|
||||
is rejected, which can keep idle power much higher than expected.
|
||||
|
||||
config PM_DFS_INIT_AUTO
|
||||
bool "Enable dynamic frequency scaling (DFS) at startup"
|
||||
depends on PM_ENABLE
|
||||
|
||||
Reference in New Issue
Block a user