Merge branch 'bugfix/power_down_bluetooth_module_when_deinit_v4.4' into 'release/v4.4'

component/bt: Power down bluetooth module when deinit

See merge request espressif/esp-idf!15717
This commit is contained in:
Jiang Jiang Jian 2021-11-11 08:27:51 +00:00
commit dd5d452428
5 changed files with 21 additions and 3 deletions

View File

@ -37,6 +37,7 @@
#include "esp32c3/rom/rom_layout.h"
#include "esp_timer.h"
#include "esp_sleep.h"
#include "phy.h"
#if CONFIG_BT_ENABLED
@ -1237,6 +1238,11 @@ esp_err_t esp_bt_controller_deinit(void)
esp_unregister_mac_bb_pu_callback(btdm_mac_bb_power_up_cb);
#endif
/* Fix the issue caused by the power off the bt power domain.
* This issue is only on ESP32C3.
*/
phy_init_flag();
esp_bt_power_domain_off();
free(osi_funcs_p);

View File

@ -1144,8 +1144,6 @@ error:
esp_unregister_mac_bb_pu_callback(btdm_mac_bb_power_up_cb);
#endif
esp_bt_power_domain_off();
if (osi_funcs_p != NULL) {
free(osi_funcs_p);
osi_funcs_p = NULL;
@ -1206,6 +1204,9 @@ esp_err_t esp_bt_controller_deinit(void)
esp_unregister_mac_bb_pd_callback(btdm_mac_bb_power_down_cb);
esp_unregister_mac_bb_pu_callback(btdm_mac_bb_power_up_cb);
#endif
esp_bt_power_domain_off();
free(osi_funcs_p);
osi_funcs_p = NULL;

View File

@ -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.
*

@ -1 +1 @@
Subproject commit 7586abbf591ab63d609d7afeb377559deabec808
Subproject commit fe7dc9599bd318518eccc165d9e751114e28e7d2

View File

@ -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;