diff --git a/components/esp_hw_support/include/esp_private/sleep_modem.h b/components/esp_hw_support/include/esp_private/sleep_modem.h index 03d7437159a..1e2749ca49e 100644 --- a/components/esp_hw_support/include/esp_private/sleep_modem.h +++ b/components/esp_hw_support/include/esp_private/sleep_modem.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -253,6 +253,13 @@ esp_err_t sleep_phy_link_deinit(void *link_head); * @param flags A bitmap to indicate the PHY link regdma description configuration flag */ void sleep_phy_link_config(void *link_context, uint32_t flags); + +/** + * @brief Function to skip the retention entries involving Wi-Fi registers + * + * @param skip + */ +void sleep_phy_skip_wifi_reg(bool skip); #endif #ifdef __cplusplus diff --git a/components/esp_hw_support/lowpower/port/esp32c6/sleep_phy.c b/components/esp_hw_support/lowpower/port/esp32c6/sleep_phy.c index 69d6b4286eb..afcc0bf3d1d 100644 --- a/components/esp_hw_support/lowpower/port/esp32c6/sleep_phy.c +++ b/components/esp_hw_support/lowpower/port/esp32c6/sleep_phy.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -41,10 +41,17 @@ typedef struct { #define DESC_IDX_I2C_MST_DIS (2) void *regdma_desc[DESC_IDX_I2C_MST_DIS + 1]; } sleep_phy_link_context_t; +static DRAM_ATTR struct{ + void *skip_link[8]; +} s_phy_skip_links; esp_err_t sleep_phy_link_init(void **link_head) { esp_err_t err = ESP_OK; + const int skip_idx_list[] = { + REGDMA_PHY_LINK(0x10), REGDMA_PHY_LINK(0x1c), REGDMA_PHY_LINK(0x1d), REGDMA_PHY_LINK(0x1e), REGDMA_PHY_LINK(0x1f), + REGDMA_PHY_LINK(0x20), REGDMA_PHY_LINK(0x21), REGDMA_PHY_LINK(0x22) + }; #if SOC_PM_PAU_REGDMA_LINK_MODEM static regdma_link_config_t phy_modem_config[] = { @@ -104,10 +111,18 @@ esp_err_t sleep_phy_link_init(void **link_head) phy_modem_config[22].write_wait.value = phy_ana_i2c_master_burst_rf_onoff(false); void *link = NULL; + uint8_t skip_idx = 0; for (int i = ARRAY_SIZE(phy_modem_config) - 1; (err == ESP_OK) && (i >= 0); i--) { void *next = regdma_link_init_safe(&phy_modem_config[i], false, 0, link); if (next) { link = next; + for (int idx = 0; idx < ARRAY_SIZE(skip_idx_list); idx ++) { + if (skip_idx_list[idx] == phy_modem_config[i].id) { + s_phy_skip_links.skip_link[skip_idx] = next; + skip_idx ++; + break; + } + } } else { regdma_link_destroy(link, 0); err = ESP_ERR_NO_MEM; @@ -159,4 +174,10 @@ esp_err_t sleep_phy_link_deinit(void *link_head) return ESP_OK; } +void sleep_phy_skip_wifi_reg(bool skip) +{ + for (int i = 0; i < ARRAY_SIZE(s_phy_skip_links.skip_link); i++) { + regdma_link_set_skip_flag(s_phy_skip_links.skip_link[i], skip, skip); + } +} #endif /* SOC_PM_SUPPORT_PMU_MODEM_STATE */