diff --git a/components/esp_hw_support/include/esp_private/sleep_retention.h b/components/esp_hw_support/include/esp_private/sleep_retention.h index 2efbbcc7dd..adb493cffb 100644 --- a/components/esp_hw_support/include/esp_private/sleep_retention.h +++ b/components/esp_hw_support/include/esp_private/sleep_retention.h @@ -71,6 +71,18 @@ void * sleep_retention_find_link_by_id(int id); */ void sleep_retention_entries_get(sleep_retention_entries_t *entries); +/** + * @brief Get all created modules that require sleep retention + * + * This is an unprotected interface for getting a bitmap of all modules that + * require sleep retention. + * + * It can only be called by the sleep procedure. + * + * @return the bitmap of all modules requiring sleep retention + */ +uint32_t sleep_retention_get_created_modules(void); + #if SOC_PM_RETENTION_HAS_CLOCK_BUG /** * @brief Software trigger REGDMA to do extra linked list retention @@ -81,18 +93,6 @@ void sleep_retention_entries_get(sleep_retention_entries_t *entries); void sleep_retention_do_extra_retention(bool backup_or_restore); #endif -/** - * @brief Get all registered modules that require sleep retention - * - * This is an unprotected interface for getting a bitmap of all modules that - * require sleep retention. - * - * It can only be called by the sleep procedure. - * - * @return the bitmap of all modules requiring sleep retention - */ -uint32_t sleep_retention_get_modules(void); - #if SOC_PM_RETENTION_SW_TRIGGER_REGDMA /** * @brief Software trigger REGDMA to do system linked list retention diff --git a/components/esp_hw_support/sleep_clock.c b/components/esp_hw_support/sleep_clock.c index 433bbc96e2..b1dcad6620 100644 --- a/components/esp_hw_support/sleep_clock.c +++ b/components/esp_hw_support/sleep_clock.c @@ -8,14 +8,14 @@ bool clock_domain_pd_allowed(void) { - const uint32_t modules = sleep_retention_get_modules(); + const uint32_t created_modules = sleep_retention_get_created_modules(); const uint32_t mask = (const uint32_t) ( SLEEP_RETENTION_MODULE_CLOCK_SYSTEM #if CONFIG_MAC_BB_PD || CONFIG_BT_LE_SLEEP_ENABLE || CONFIG_IEEE802154_SLEEP_ENABLE | SLEEP_RETENTION_MODULE_CLOCK_MODEM #endif ); - return ((modules & mask) == mask); + return ((created_modules & mask) == mask); } #if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP || CONFIG_MAC_BB_PD || CONFIG_BT_LE_SLEEP_ENABLE || CONFIG_IEEE802154_SLEEP_ENABLE diff --git a/components/esp_hw_support/sleep_modem.c b/components/esp_hw_support/sleep_modem.c index e8480e2cff..d8d894978b 100644 --- a/components/esp_hw_support/sleep_modem.c +++ b/components/esp_hw_support/sleep_modem.c @@ -286,21 +286,21 @@ bool modem_domain_pd_allowed(void) { #if SOC_PM_MODEM_RETENTION_BY_REGDMA bool modem_domain_pd_allowed = false; - const uint32_t modules = sleep_retention_get_modules(); + const uint32_t created_modules = sleep_retention_get_created_modules(); #if SOC_WIFI_SUPPORTED const uint32_t mask_wifi = (const uint32_t) (SLEEP_RETENTION_MODULE_WIFI_MAC | SLEEP_RETENTION_MODULE_WIFI_BB); - modem_domain_pd_allowed |= ((modules & mask_wifi) == mask_wifi); + modem_domain_pd_allowed |= ((created_modules & mask_wifi) == mask_wifi); #endif #if SOC_BT_SUPPORTED const uint32_t mask_ble = (const uint32_t) (SLEEP_RETENTION_MODULE_BLE_MAC | SLEEP_RETENTION_MODULE_BT_BB); - modem_domain_pd_allowed |= ((modules & mask_ble) == mask_ble); + modem_domain_pd_allowed |= ((created_modules & mask_ble) == mask_ble); #endif #if SOC_IEEE802154_SUPPORTED const uint32_t mask_154 = (const uint32_t) (SLEEP_RETENTION_MODULE_802154_MAC | SLEEP_RETENTION_MODULE_BT_BB); - modem_domain_pd_allowed |= ((modules & mask_154) == mask_154); + modem_domain_pd_allowed |= ((created_modules & mask_154) == mask_154); #endif return modem_domain_pd_allowed; #else diff --git a/components/esp_hw_support/sleep_retention.c b/components/esp_hw_support/sleep_retention.c index fddcf2e6e2..21da032aad 100644 --- a/components/esp_hw_support/sleep_retention.c +++ b/components/esp_hw_support/sleep_retention.c @@ -493,7 +493,7 @@ void sleep_retention_entries_get(sleep_retention_entries_t *entries) _lock_release_recursive(&s_retention.lock); } -uint32_t IRAM_ATTR sleep_retention_get_modules(void) +uint32_t IRAM_ATTR sleep_retention_get_created_modules(void) { return s_retention.created_modules; } diff --git a/components/esp_hw_support/sleep_system_peripheral.c b/components/esp_hw_support/sleep_system_peripheral.c index bf07578136..823d919fe2 100644 --- a/components/esp_hw_support/sleep_system_peripheral.c +++ b/components/esp_hw_support/sleep_system_peripheral.c @@ -145,27 +145,26 @@ error: bool peripheral_domain_pd_allowed(void) { - const uint32_t modules = sleep_retention_get_modules(); - uint32_t mask = 0; + const uint32_t created_modules = sleep_retention_get_created_modules(); + uint32_t mask = (uint32_t) ( + SLEEP_RETENTION_MODULE_INTR_MATRIX | \ + SLEEP_RETENTION_MODULE_HP_SYSTEM | \ + SLEEP_RETENTION_MODULE_UART0 | \ + SLEEP_RETENTION_MODULE_TG0 | \ + SLEEP_RETENTION_MODULE_IOMUX | \ + SLEEP_RETENTION_MODULE_SPIMEM | \ + SLEEP_RETENTION_MODULE_SYSTIMER); - mask |= SLEEP_RETENTION_MODULE_INTR_MATRIX; - mask |= SLEEP_RETENTION_MODULE_HP_SYSTEM; #if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE mask |= SLEEP_RETENTION_MODULE_L2_CACHE; #endif #if SOC_APM_SUPPORTED mask |= SLEEP_RETENTION_MODULE_TEE_APM; #endif - mask |= SLEEP_RETENTION_MODULE_UART0; - mask |= SLEEP_RETENTION_MODULE_TG0; - mask |= SLEEP_RETENTION_MODULE_IOMUX; - mask |= SLEEP_RETENTION_MODULE_SPIMEM; - mask |= SLEEP_RETENTION_MODULE_SYSTIMER; #if SOC_PAU_IN_TOP_DOMAIN mask |= SLEEP_RETENTION_MODULE_REGDMA_SYSTEM; #endif - - return ((modules & mask) == mask); + return ((created_modules & mask) == mask); } #if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP