From a2790756b00530825d2cbeecdd82fdf63424e45e Mon Sep 17 00:00:00 2001 From: Li Shuai Date: Mon, 8 Nov 2021 20:52:03 +0800 Subject: [PATCH] fix the wifi scan fail issue caused by the power off the wifi power domain --- components/esp_phy/include/phy.h | 7 +++++++ components/esp_phy/lib | 2 +- components/esp_wifi/src/wifi_init.c | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/components/esp_phy/include/phy.h b/components/esp_phy/include/phy.h index 1d0690f356..e6aa21db50 100644 --- a/components/esp_phy/include/phy.h +++ b/components/esp_phy/include/phy.h @@ -68,6 +68,13 @@ void phy_close_rf(void); void phy_xpd_tsens(void); #endif +#if CONFIG_IDF_TARGET_ESP32C3 +/** + * @brief Update internal state of PHY when wifi deinit powers off the wifi power domain. + */ +void phy_init_flag(void); +#endif + /** * @brief Store and load PHY digital registers. * diff --git a/components/esp_phy/lib b/components/esp_phy/lib index 7586abbf59..fe7dc9599b 160000 --- a/components/esp_phy/lib +++ b/components/esp_phy/lib @@ -1 +1 @@ -Subproject commit 7586abbf591ab63d609d7afeb377559deabec808 +Subproject commit fe7dc9599bd318518eccc165d9e751114e28e7d2 diff --git a/components/esp_wifi/src/wifi_init.c b/components/esp_wifi/src/wifi_init.c index 40273d86bf..3a66d30ea3 100644 --- a/components/esp_wifi/src/wifi_init.c +++ b/components/esp_wifi/src/wifi_init.c @@ -19,6 +19,7 @@ #include "driver/adc2_wifi_private.h" #include "esp_coexist_internal.h" #include "esp_phy_init.h" +#include "phy.h" #if (CONFIG_ESP32_WIFI_RX_BA_WIN > CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM) #error "WiFi configuration check: WARNING, WIFI_RX_BA_WIN should not be larger than WIFI_DYNAMIC_RX_BUFFER_NUM!" @@ -124,6 +125,9 @@ esp_err_t esp_wifi_deinit(void) #if CONFIG_MAC_BB_PD esp_unregister_mac_bb_pd_callback(pm_mac_sleep); esp_unregister_mac_bb_pu_callback(pm_mac_wakeup); +#endif +#if CONFIG_IDF_TARGET_ESP32C3 + phy_init_flag(); #endif esp_wifi_power_domain_off(); return err;