diff --git a/components/esp_hw_support/linker.lf b/components/esp_hw_support/linker.lf index 1d227091472..53202c3a0a9 100644 --- a/components/esp_hw_support/linker.lf +++ b/components/esp_hw_support/linker.lf @@ -88,6 +88,18 @@ entries: sleep_modes: esp_sleep_sub_mode_force_disable (noflash) if (SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP = n || SOC_GPIO_NEED_SOFT_ISOLATE_DURING_PD = y): esp_gpio_reserve (noflash) + if SOC_PM_MODEM_RETENTION_BY_REGDMA = y && ESP_PHY_MAC_BB_PD = y: + sleep_retention:sleep_retention_find_link_by_id (noflash) + regdma_link:regdma_find_link_by_id (noflash) + regdma_link:regdma_link_get_next (noflash) + regdma_link:regdma_link_get_next_continuous_wrapper (noflash) + regdma_link:regdma_link_get_next_addr_map_wrapper (noflash) + regdma_link:regdma_link_get_next_write_wait_wrapper (noflash) + regdma_link:regdma_link_get_next_branch_continuous_wrapper (noflash) + regdma_link:regdma_link_get_next_branch_addr_map_wrapper (noflash) + regdma_link:regdma_link_get_next_branch_write_wait_wrapper (noflash) + regdma_link:regdma_link_set_write_wait_content (noflash) + regdma_link:regdma_link_get_instance (noflash) [mapping:hal_gpio_pm] archive: libesp_hal_gpio.a diff --git a/components/esp_hw_support/port/regdma_link.c b/components/esp_hw_support/port/regdma_link.c index 9e6fef5bbfc..1fb365877f1 100644 --- a/components/esp_hw_support/port/regdma_link.c +++ b/components/esp_hw_support/port/regdma_link.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -318,43 +318,43 @@ void * regdma_link_init(const regdma_link_config_t *config, bool branch, int mod return link; } -static void * regdma_link_get_next_continuous_wrapper(void *link) +__attribute__((used, noinline)) static void * regdma_link_get_next_continuous_wrapper(void *link) { regdma_link_continuous_t *continuous = __containerof(link, regdma_link_continuous_t, head); return (void *)(continuous->body.next); } -static void * regdma_link_get_next_addr_map_wrapper(void *link) +__attribute__((used, noinline)) static void * regdma_link_get_next_addr_map_wrapper(void *link) { regdma_link_addr_map_t *addr_map = __containerof(link, regdma_link_addr_map_t, head); return (void *)(addr_map->body.next); } -static void * regdma_link_get_next_write_wait_wrapper(void *link) +__attribute__((used, noinline)) static void * regdma_link_get_next_write_wait_wrapper(void *link) { regdma_link_write_wait_t *write_wait = __containerof(link, regdma_link_write_wait_t, head); return (void *)(write_wait->body.next); } -static regdma_entry_buf_t * regdma_link_get_next_branch_continuous_wrapper(void *link) +__attribute__((used, noinline)) static regdma_entry_buf_t * regdma_link_get_next_branch_continuous_wrapper(void *link) { regdma_link_branch_continuous_t *branch_continuous = __containerof(link, regdma_link_branch_continuous_t, head); return &branch_continuous->body.next; } -static regdma_entry_buf_t * regdma_link_get_next_branch_addr_map_wrapper(void *link) +__attribute__((used, noinline)) static regdma_entry_buf_t * regdma_link_get_next_branch_addr_map_wrapper(void *link) { regdma_link_branch_addr_map_t *branch_addr_map = __containerof(link, regdma_link_branch_addr_map_t, head); return &branch_addr_map->body.next; } -static regdma_entry_buf_t * regdma_link_get_next_branch_write_wait_wrapper(void *link) +__attribute__((used, noinline)) static regdma_entry_buf_t * regdma_link_get_next_branch_write_wait_wrapper(void *link) { regdma_link_branch_write_wait_t *branch_write_wait = __containerof(link, regdma_link_branch_write_wait_t, head); return &branch_write_wait->body.next; } -static void * regdma_link_get_next(void *link, int entry) +__attribute__((used, noinline)) static void * regdma_link_get_next(void *link, int entry) { if (link) { regdma_link_head_t head = REGDMA_LINK_HEAD(link); @@ -407,7 +407,7 @@ void * regdma_link_recursive(void *link, int entry, void (*hook)(void *, int, in return regdma_link_recursive_impl(link, entry, 0, hook); } -static void * regdma_link_get_instance(void *link) +__attribute__((used, noinline)) static void * regdma_link_get_instance(void *link) { void * container_memaddr[] = { (void *)__containerof(link, regdma_link_continuous_t, head), diff --git a/components/esp_wifi/esp32c6/esp_adapter.c b/components/esp_wifi/esp32c6/esp_adapter.c index b5b805458cd..3b1af40aa1a 100644 --- a/components/esp_wifi/esp32c6/esp_adapter.c +++ b/components/esp_wifi/esp32c6/esp_adapter.c @@ -568,12 +568,12 @@ static void esp_phy_disable_wrapper(void) } #if SOC_PM_MODEM_RETENTION_BY_REGDMA -static void regdma_link_set_write_wait_content_wrapper(void *addr, uint32_t value, uint32_t mask) +static void IRAM_ATTR regdma_link_set_write_wait_content_wrapper(void *addr, uint32_t value, uint32_t mask) { regdma_link_set_write_wait_content(addr, value, mask); } -static void *sleep_retention_find_link_by_id_wrapper(int id) +static void *IRAM_ATTR sleep_retention_find_link_by_id_wrapper(int id) { return sleep_retention_find_link_by_id(id); } diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 925459f52b3..22aa232ea26 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 925459f52b3309c635516e48ba666ef0857cb58c +Subproject commit 22aa232ea261008d95a1d2a70743f44cd9ea3000 diff --git a/examples/wifi/power_save/pytest_wifi_power_save.py b/examples/wifi/power_save/pytest_wifi_power_save.py index 04c030a15d5..0e811d8511f 100644 --- a/examples/wifi/power_save/pytest_wifi_power_save.py +++ b/examples/wifi/power_save/pytest_wifi_power_save.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 import logging @@ -64,6 +64,19 @@ def test_wifi_power_save_pd_top(dut: Dut) -> None: _run_test(dut) +@pytest.mark.wifi_ap +@pytest.mark.parametrize( + 'config', + [ + 'pd_modem', + ], + indirect=True, +) +@idf_parametrize('target', ['esp32c6', 'esp32c5', 'esp32c61'], indirect=['target']) +def test_wifi_power_save_pd_modem(dut: Dut) -> None: + _run_test(dut) + + @pytest.mark.wifi_ap @pytest.mark.xtal_26mhz @pytest.mark.parametrize( diff --git a/examples/wifi/power_save/sdkconfig.ci.c2_xtal26m b/examples/wifi/power_save/sdkconfig.ci.c2_xtal26m index 065020b06fb..68a9d5efcdf 100644 --- a/examples/wifi/power_save/sdkconfig.ci.c2_xtal26m +++ b/examples/wifi/power_save/sdkconfig.ci.c2_xtal26m @@ -1,3 +1,4 @@ CONFIG_IDF_TARGET="esp32c2" CONFIG_XTAL_FREQ_26=y CONFIG_EXAMPLE_GET_AP_INFO_FROM_STDIN=y +CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y diff --git a/examples/wifi/power_save/sdkconfig.ci.esp32c2_rev2_xtal26m b/examples/wifi/power_save/sdkconfig.ci.esp32c2_rev2_xtal26m index a302168187a..296928320fd 100644 --- a/examples/wifi/power_save/sdkconfig.ci.esp32c2_rev2_xtal26m +++ b/examples/wifi/power_save/sdkconfig.ci.esp32c2_rev2_xtal26m @@ -2,3 +2,4 @@ CONFIG_IDF_TARGET="esp32c2" CONFIG_XTAL_FREQ_26=y CONFIG_EXAMPLE_GET_AP_INFO_FROM_STDIN=y CONFIG_ESP32C2_REV_MIN_200=y +CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y diff --git a/examples/wifi/power_save/sdkconfig.ci.esp32c3_rev1 b/examples/wifi/power_save/sdkconfig.ci.esp32c3_rev1 index 6b253290433..05ef4a47428 100644 --- a/examples/wifi/power_save/sdkconfig.ci.esp32c3_rev1 +++ b/examples/wifi/power_save/sdkconfig.ci.esp32c3_rev1 @@ -1,3 +1,4 @@ CONFIG_IDF_TARGET="esp32c3" CONFIG_ESP32C3_REV_MIN_101=y CONFIG_EXAMPLE_GET_AP_INFO_FROM_STDIN=y +CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y diff --git a/examples/wifi/power_save/sdkconfig.ci.pd_modem b/examples/wifi/power_save/sdkconfig.ci.pd_modem new file mode 100644 index 00000000000..604a4ddeb80 --- /dev/null +++ b/examples/wifi/power_save/sdkconfig.ci.pd_modem @@ -0,0 +1,4 @@ +CONFIG_EXAMPLE_GET_AP_INFO_FROM_STDIN=y +CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y +CONFIG_ESP_PHY_MAC_BB_PD=y +CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP=y diff --git a/examples/wifi/power_save/sdkconfig.ci.pd_top b/examples/wifi/power_save/sdkconfig.ci.pd_top index c758a33bcd3..4948d7b497b 100644 --- a/examples/wifi/power_save/sdkconfig.ci.pd_top +++ b/examples/wifi/power_save/sdkconfig.ci.pd_top @@ -2,3 +2,4 @@ CONFIG_EXAMPLE_GET_AP_INFO_FROM_STDIN=y CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP=y CONFIG_ESP_PHY_MAC_BB_PD=y CONFIG_ESP_MODEM_CLOCK_ENABLE_CHECKING=y +CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y