mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(wifi): fix open rf failed issue
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -13,6 +13,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_CAL_DATA_CHECK_FAIL 1
|
||||
#define ESP_MODEM_RF_FLAG_UPDATE_CB_REQUIRED (SOC_PM_MODEM_RF_FLAG_UPDATE_WORKAROUND || CONFIG_ESP_WIFI_MODEM_RF_FLAG_UPDATE_DEBUG)
|
||||
|
||||
typedef enum {
|
||||
PHY_I2C_MST_CMD_TYPE_OFF = 0,
|
||||
@@ -229,6 +230,16 @@ void phy_ant_update(void);
|
||||
void phy_wakeup_from_modem_state_extra_init(void);
|
||||
#endif
|
||||
|
||||
#if SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP && ESP_MODEM_RF_FLAG_UPDATE_CB_REQUIRED
|
||||
/**
|
||||
* @brief Update modem RF flag
|
||||
*
|
||||
* This function is called as a callback during MAC/BB power down operations.
|
||||
* It checks if modem RF is already enabled and clears the RF power state accordingly.
|
||||
*/
|
||||
void esp_phy_modem_rf_flag_update(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -58,6 +58,11 @@
|
||||
extern wifi_mac_time_update_cb_t s_wifi_mac_time_update_cb;
|
||||
#endif
|
||||
|
||||
#if SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
|
||||
extern void pm_mac_modem_clear_rf_power_state(void);
|
||||
extern bool pm_mac_modem_rf_already_enabled(void);
|
||||
#endif
|
||||
|
||||
static const char* TAG = "phy_init";
|
||||
|
||||
static _lock_t s_phy_access_lock;
|
||||
@@ -291,6 +296,18 @@ static inline void phy_digital_regs_load(void)
|
||||
}
|
||||
#endif // SOC_PM_MODEM_RETENTION_BY_BACKUPDMA
|
||||
|
||||
#if SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP && ESP_MODEM_RF_FLAG_UPDATE_CB_REQUIRED
|
||||
void IRAM_ATTR esp_phy_modem_rf_flag_update(void)
|
||||
{
|
||||
if (pm_mac_modem_rf_already_enabled()) {
|
||||
#if CONFIG_ESP_WIFI_MODEM_RF_FLAG_UPDATE_DEBUG
|
||||
assert(0);
|
||||
#endif
|
||||
pm_mac_modem_clear_rf_power_state();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void esp_phy_enable(esp_phy_modem_t modem)
|
||||
{
|
||||
_lock_acquire(&s_phy_access_lock);
|
||||
@@ -308,7 +325,6 @@ void esp_phy_enable(esp_phy_modem_t modem)
|
||||
s_is_phy_calibrated = true;
|
||||
} else {
|
||||
#if SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
|
||||
extern bool pm_mac_modem_rf_already_enabled(void);
|
||||
if (!pm_mac_modem_rf_already_enabled()) {
|
||||
if (sleep_modem_wifi_modem_state_enabled() && sleep_modem_wifi_modem_link_done()) {
|
||||
sleep_modem_wifi_do_phy_retention(true);
|
||||
@@ -375,7 +391,6 @@ void esp_phy_disable(esp_phy_modem_t modem)
|
||||
phy_digital_regs_store();
|
||||
#endif
|
||||
#if SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
|
||||
extern void pm_mac_modem_clear_rf_power_state(void);
|
||||
pm_mac_modem_clear_rf_power_state();
|
||||
if (sleep_modem_wifi_modem_state_enabled()) {
|
||||
sleep_modem_wifi_do_phy_retention(false);
|
||||
|
||||
Reference in New Issue
Block a user