fix(wifi): fix modem sleep flag clear failed

This commit is contained in:
sibeibei
2026-05-12 19:22:54 +08:00
committed by BOT
parent 58ae4daa56
commit 86a9823e5e
12 changed files with 147 additions and 15 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -41,6 +41,18 @@ void pau_regdma_trigger_modem_link_backup(void);
* @brief Software trigger regdma to perform modem link restore
*/
void pau_regdma_trigger_modem_link_restore(void);
#if SOC_PM_PAU_REGDMA_MODEM_WIFIMAC_WORKAROUND
/**
* @brief Software trigger REGDMA backup on WiFi MAC SEL link
*/
void pau_regdma_trigger_wifimac_link_backup(void);
/**
* @brief Software trigger REGDMA restore on WiFi MAC SEL link
*/
void pau_regdma_trigger_wifimac_link_restore(void);
#endif
#endif
#if SOC_PM_RETENTION_SW_TRIGGER_REGDMA
@@ -83,8 +83,9 @@ void sleep_modem_mac_bb_power_up_prepare(void);
* @brief The retention action in the modem state of WiFi PHY module
*
* @param restore true for restore the PHY context, false for backup the PHY context
* @param wifimac_link_is_sel true to trigger REGDMA via WiFi MAC link
*/
void sleep_modem_wifi_do_phy_retention(bool restore);
void sleep_modem_wifi_do_phy_retention(bool restore, bool wifimac_link_is_sel);
/**
* @brief Get WiFi modem state
@@ -293,8 +293,10 @@ void sleep_retention_do_system_retention(bool backup_or_restore);
*
* @param backup_or_restore true for backup register context to memory
* or false for restore to register from memory
* @param wifimac_link_is_sel true to use dedicated WiFi MAC link,
* false to use modem entry link
*/
void sleep_retention_do_phy_retention(bool backup_or_restore);
void sleep_retention_do_phy_retention(bool backup_or_restore, bool wifimac_link_is_sel);
#endif /*SOC_PM_SUPPORT_PMU_MODEM_STATE */
#endif // SOC_PAU_SUPPORTED
+15 -1
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -87,6 +87,20 @@ void IRAM_ATTR pau_regdma_trigger_modem_link_restore(void)
pau_hal_start_regdma_modem_link(PAU_instance()->hal, false);
pau_hal_stop_regdma_modem_link(PAU_instance()->hal);
}
#if SOC_PM_PAU_REGDMA_MODEM_WIFIMAC_WORKAROUND
void IRAM_ATTR pau_regdma_trigger_wifimac_link_backup(void)
{
pau_hal_start_regdma_wifimac_link(PAU_instance()->hal, true);
pau_hal_stop_regdma_wifimac_link(PAU_instance()->hal);
}
void IRAM_ATTR pau_regdma_trigger_wifimac_link_restore(void)
{
pau_hal_start_regdma_wifimac_link(PAU_instance()->hal, false);
pau_hal_stop_regdma_wifimac_link(PAU_instance()->hal);
}
#endif
#endif
#if SOC_PM_RETENTION_SW_TRIGGER_REGDMA
+2 -2
View File
@@ -171,10 +171,10 @@ __attribute__((unused)) void sleep_modem_wifi_modem_state_deinit(void)
}
}
void IRAM_ATTR sleep_modem_wifi_do_phy_retention(bool restore)
void IRAM_ATTR sleep_modem_wifi_do_phy_retention(bool restore, bool wifimac_link_is_sel)
{
sleep_modem_state_phy_link_config(s_sleep_modem.wifi.phy_link, 1);
sleep_retention_do_phy_retention(!restore);
sleep_retention_do_phy_retention(!restore, wifimac_link_is_sel);
sleep_modem_state_phy_link_config(s_sleep_modem.wifi.phy_link, 0);
if (!restore) {
s_sleep_modem.wifi.modem_state_phy_done = 1;
+18 -4
View File
@@ -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
*/
@@ -1007,7 +1007,7 @@ void IRAM_ATTR sleep_retention_do_system_retention(bool backup_or_restore)
#endif
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
void IRAM_ATTR sleep_retention_do_phy_retention(bool backup_or_restore)
void IRAM_ATTR sleep_retention_do_phy_retention(bool backup_or_restore, bool wifimac_link_is_sel)
{
/* since the PHY link and other module links are within the sleep-retention entry (4) context,
* add mutex protection to avoid data race.
@@ -1016,9 +1016,23 @@ void IRAM_ATTR sleep_retention_do_phy_retention(bool backup_or_restore)
_lock_acquire_recursive(&s_retention.lock);
#endif
if (backup_or_restore) {
pau_regdma_trigger_modem_link_backup();
#if SOC_PM_PAU_REGDMA_MODEM_WIFIMAC_WORKAROUND
if (wifimac_link_is_sel) {
pau_regdma_trigger_wifimac_link_backup();
} else
#endif
{
pau_regdma_trigger_modem_link_backup();
}
} else {
pau_regdma_trigger_modem_link_restore();
#if SOC_PM_PAU_REGDMA_MODEM_WIFIMAC_WORKAROUND
if (wifimac_link_is_sel) {
pau_regdma_trigger_wifimac_link_restore();
} else
#endif
{
pau_regdma_trigger_modem_link_restore();
}
}
#if SOC_PM_PAU_REGDMA_COMMON_PHY_LINK_ENTRY
_lock_release_recursive(&s_retention.lock);