diff --git a/components/bt/controller/esp32/bt.c b/components/bt/controller/esp32/bt.c index 5bf5d8a318..b50d676d15 100644 --- a/components/bt/controller/esp32/bt.c +++ b/components/bt/controller/esp32/bt.c @@ -1,16 +1,8 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include @@ -488,6 +480,18 @@ static void btdm_slp_tmr_callback(void *arg); #endif /* #ifdef CONFIG_PM_ENABLE */ +static inline void esp_bt_power_domain_on(void) +{ + // Bluetooth module power up + esp_wifi_bt_power_domain_on(); +} + +static inline void esp_bt_power_domain_off(void) +{ + // Bluetooth module power down + esp_wifi_bt_power_domain_off(); +} + static inline void btdm_check_and_init_bb(void) { /* init BT-BB if PHY/RF has been switched off since last BT-BB init */ @@ -1621,6 +1625,8 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) goto error; } + esp_bt_power_domain_on(); + btdm_controller_mem_init(); periph_module_enable(PERIPH_BT_MODULE); @@ -1774,6 +1780,8 @@ esp_err_t esp_bt_controller_deinit(void) btdm_lpcycle_us = 0; btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_NONE); + esp_bt_power_domain_off(); + return ESP_OK; } diff --git a/components/bt/controller/esp32c3/bt.c b/components/bt/controller/esp32c3/bt.c index 8c1b116343..1edf7950f4 100644 --- a/components/bt/controller/esp32c3/bt.c +++ b/components/bt/controller/esp32c3/bt.c @@ -1,16 +1,8 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include @@ -408,7 +400,7 @@ static DRAM_ATTR esp_pm_lock_handle_t s_light_sleep_pm_lock; void IRAM_ATTR btdm_hw_mac_power_down_wrapper(void) { #if CONFIG_MAC_BB_PD - // le module power down + // Bluetooth module power down SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_ISO); SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PD); @@ -419,7 +411,7 @@ void IRAM_ATTR btdm_hw_mac_power_down_wrapper(void) void IRAM_ATTR btdm_hw_mac_power_up_wrapper(void) { #if CONFIG_MAC_BB_PD - // le module power up + // Bluetooth module power up CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PD); CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_ISO); @@ -427,6 +419,22 @@ void IRAM_ATTR btdm_hw_mac_power_up_wrapper(void) #endif } +static inline void esp_bt_power_domain_on(void) +{ + // Bluetooth module power up + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PD); + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_ISO); + esp_wifi_bt_power_domain_on(); +} + +static inline void esp_bt_power_domain_off(void) +{ + // Bluetooth module power down + SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_ISO); + SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PD); + esp_wifi_bt_power_domain_off(); +} + void IRAM_ATTR btdm_backup_dma_copy_wrapper(uint32_t reg, uint32_t mem_addr, uint32_t num, bool to_mem) { #if CONFIG_MAC_BB_PD @@ -956,6 +964,11 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) // overwrite some parameters cfg->magic = ESP_BT_CTRL_CONFIG_MAGIC_VAL; +#if CONFIG_MAC_BB_PD + esp_mac_bb_pd_mem_init(); +#endif + esp_bt_power_domain_on(); + btdm_controller_mem_init(); #if CONFIG_MAC_BB_PD @@ -1223,6 +1236,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; diff --git a/components/bt/controller/esp32s3/bt.c b/components/bt/controller/esp32s3/bt.c index 4190c7b05a..5da5ce0eaf 100644 --- a/components/bt/controller/esp32s3/bt.c +++ b/components/bt/controller/esp32s3/bt.c @@ -1,16 +1,8 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include @@ -407,10 +399,6 @@ static DRAM_ATTR esp_pm_lock_handle_t s_light_sleep_pm_lock; void IRAM_ATTR btdm_hw_mac_power_down_wrapper(void) { #if CONFIG_MAC_BB_PD - // le module power down - SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_ISO); - SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PD); - esp_mac_bb_power_down(); #endif } @@ -418,10 +406,6 @@ void IRAM_ATTR btdm_hw_mac_power_down_wrapper(void) void IRAM_ATTR btdm_hw_mac_power_up_wrapper(void) { #if CONFIG_MAC_BB_PD - // le module power up - CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PD); - CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_ISO); - esp_mac_bb_power_up(); #endif } @@ -433,6 +417,18 @@ void IRAM_ATTR btdm_backup_dma_copy_wrapper(uint32_t reg, uint32_t mem_addr, uin #endif } +static inline void esp_bt_power_domain_on(void) +{ + // Bluetooth module power up + esp_wifi_bt_power_domain_on(); +} + +static inline void esp_bt_power_domain_off(void) +{ + // Bluetooth module power down + esp_wifi_bt_power_domain_off(); +} + static void interrupt_set_wrapper(int32_t cpu_no, int32_t intr_source, int32_t intr_num, int32_t intr_prio) { intr_matrix_set(cpu_no, intr_source, intr_num); @@ -936,6 +932,11 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) // overwrite some parameters cfg->magic = ESP_BT_CTRL_CONFIG_MAGIC_VAL; +#if CONFIG_MAC_BB_PD + esp_mac_bb_pd_mem_init(); +#endif + esp_bt_power_domain_on(); + btdm_controller_mem_init(); #if CONFIG_MAC_BB_PD @@ -1143,6 +1144,8 @@ 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; diff --git a/components/bt/include/esp32/include/esp_bt.h b/components/bt/include/esp32/include/esp_bt.h index 7c8f2ea744..65b08ab687 100644 --- a/components/bt/include/esp32/include/esp_bt.h +++ b/components/bt/include/esp32/include/esp_bt.h @@ -1,16 +1,8 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_BT_H__ #define __ESP_BT_H__ @@ -530,6 +522,16 @@ esp_err_t esp_bt_sleep_disable(void); */ esp_err_t esp_ble_scan_dupilcate_list_flush(void); +/** + * @brief bt Wi-Fi power domain power on + */ +void esp_wifi_bt_power_domain_on(void); + +/** + * @brief bt Wi-Fi power domain power off + */ +void esp_wifi_bt_power_domain_off(void); + #ifdef __cplusplus } #endif diff --git a/components/bt/include/esp32c3/include/esp_bt.h b/components/bt/include/esp32c3/include/esp_bt.h index 8860d75ff6..0e13ee90fa 100644 --- a/components/bt/include/esp32c3/include/esp_bt.h +++ b/components/bt/include/esp32c3/include/esp_bt.h @@ -1,16 +1,8 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_BT_H__ #define __ESP_BT_H__ @@ -527,6 +519,16 @@ void esp_bt_controller_wakeup_request(void); */ int esp_bt_h4tl_eif_io_event_notify(int event); +/** + * @brief bt Wi-Fi power domain power on + */ +void esp_wifi_bt_power_domain_on(void); + +/** + * @brief bt Wi-Fi power domain power off + */ +void esp_wifi_bt_power_domain_off(void); + #ifdef __cplusplus } #endif diff --git a/components/bt/include/esp32s3/include/esp_bt.h b/components/bt/include/esp32s3/include/esp_bt.h index 3bda8248f0..df9a4a2b79 100644 --- a/components/bt/include/esp32s3/include/esp_bt.h +++ b/components/bt/include/esp32s3/include/esp_bt.h @@ -1,16 +1,8 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_BT_H__ #define __ESP_BT_H__ @@ -526,6 +518,16 @@ void esp_bt_controller_wakeup_request(void); */ int esp_bt_h4tl_eif_io_event_notify(int event); +/** + * @brief bt Wi-Fi power domain power on + */ +void esp_wifi_bt_power_domain_on(void); + +/** + * @brief bt Wi-Fi power domain power off + */ +void esp_wifi_bt_power_domain_off(void); + #ifdef __cplusplus } #endif diff --git a/components/esp_hw_support/port/esp32/rtc_init.c b/components/esp_hw_support/port/esp32/rtc_init.c index 0ebd6e2f05..e66a493b3d 100644 --- a/components/esp_hw_support/port/esp32/rtc_init.c +++ b/components/esp_hw_support/port/esp32/rtc_init.c @@ -88,6 +88,9 @@ void rtc_init(rtc_config_t cfg) CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_UNHOLD); CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_NOISO); } + /* force power down wifi and bt power domain */ + SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_ISO); + SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD); REG_WRITE(RTC_CNTL_INT_ENA_REG, 0); REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX); diff --git a/components/esp_hw_support/port/esp32c3/rtc_init.c b/components/esp_hw_support/port/esp32c3/rtc_init.c index e0431196b2..388399f107 100644 --- a/components/esp_hw_support/port/esp32c3/rtc_init.c +++ b/components/esp_hw_support/port/esp32c3/rtc_init.c @@ -143,6 +143,13 @@ void rtc_init(rtc_config_t cfg) CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_UNHOLD); CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_NOISO); } + /* force power down wifi and bt power domain */ + SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_ISO); + SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD); + /* force power down bt power domain */ + SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_BT_FORCE_ISO); + SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_BT_FORCE_PD); + REG_WRITE(RTC_CNTL_INT_ENA_REG, 0); REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX); } diff --git a/components/esp_hw_support/port/esp32s2/rtc_init.c b/components/esp_hw_support/port/esp32s2/rtc_init.c index 369a372cba..7932a89aa0 100644 --- a/components/esp_hw_support/port/esp32s2/rtc_init.c +++ b/components/esp_hw_support/port/esp32s2/rtc_init.c @@ -145,6 +145,9 @@ void rtc_init(rtc_config_t cfg) CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_UNHOLD); CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_NOISO); } + /* force power down wifi and bt power domain */ + SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_ISO); + SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD); #if !CONFIG_IDF_ENV_FPGA if (cfg.cali_ocode) { diff --git a/components/esp_hw_support/port/esp32s3/rtc_init.c b/components/esp_hw_support/port/esp32s3/rtc_init.c index 2a80ca3e3d..9067843c40 100644 --- a/components/esp_hw_support/port/esp32s3/rtc_init.c +++ b/components/esp_hw_support/port/esp32s3/rtc_init.c @@ -192,6 +192,9 @@ void rtc_init(rtc_config_t cfg) CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_UNHOLD); CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_NOISO); } + /* force power down wifi and bt power domain */ + SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_ISO); + SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD); REG_WRITE(RTC_CNTL_INT_ENA_REG, 0); REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX); diff --git a/components/esp_phy/linker.lf b/components/esp_phy/linker.lf index 53125053d8..a5a355da2e 100644 --- a/components/esp_phy/linker.lf +++ b/components/esp_phy/linker.lf @@ -25,3 +25,4 @@ entries: if ESP_WIFI_SLP_IRAM_OPT =y: phy_init:esp_phy_enable (noflash) phy_init:esp_phy_disable (noflash) + phy_init:esp_wifi_bt_power_domain_off (noflash) diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c index cac6bc9ebf..041ed18155 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -28,11 +28,10 @@ #include "esp_rom_crc.h" #include "esp_rom_sys.h" -#if CONFIG_IDF_TARGET_ESP32C3 #include "soc/rtc_cntl_reg.h" +#if CONFIG_IDF_TARGET_ESP32C3 #include "soc/syscon_reg.h" #elif CONFIG_IDF_TARGET_ESP32S3 -#include "soc/rtc_cntl_reg.h" #include "soc/syscon_reg.h" #endif @@ -44,6 +43,11 @@ static const char* TAG = "phy_init"; static _lock_t s_phy_access_lock; +static DRAM_ATTR struct { + int count; /* power on count of wifi and bt power domain */ + _lock_t lock; +} s_wifi_bt_pd_controller = { .count = 0 }; + /* Indicate PHY is calibrated or not */ static bool s_is_phy_calibrated = false; @@ -273,6 +277,30 @@ void esp_phy_disable(void) _lock_release(&s_phy_access_lock); } +void IRAM_ATTR esp_wifi_bt_power_domain_on(void) +{ + _lock_acquire(&s_wifi_bt_pd_controller.lock); + if (s_wifi_bt_pd_controller.count++ == 0) { + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD); +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 + SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST); + CLEAR_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST); +#endif + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_ISO); + } + _lock_release(&s_wifi_bt_pd_controller.lock); +} + +void esp_wifi_bt_power_domain_off(void) +{ + _lock_acquire(&s_wifi_bt_pd_controller.lock); + if (--s_wifi_bt_pd_controller.count == 0) { + SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_ISO); + SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD); + } + _lock_release(&s_wifi_bt_pd_controller.lock); +} + #if CONFIG_MAC_BB_PD void esp_mac_bb_pd_mem_init(void) { @@ -287,12 +315,12 @@ void esp_mac_bb_pd_mem_init(void) IRAM_ATTR void esp_mac_bb_power_up(void) { - if (s_mac_bb_pd_mem != NULL && (!s_mac_bb_pu)) { + if (s_mac_bb_pd_mem == NULL) { + return; + } + esp_wifi_bt_power_domain_on(); + if (!s_mac_bb_pu) { esp_phy_common_clock_enable(); - CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD); - SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST); - CLEAR_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST); - CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_ISO); phy_freq_mem_backup(false, s_mac_bb_pd_mem); esp_phy_common_clock_disable(); s_mac_bb_pu = true; @@ -301,14 +329,16 @@ IRAM_ATTR void esp_mac_bb_power_up(void) IRAM_ATTR void esp_mac_bb_power_down(void) { - if (s_mac_bb_pd_mem != NULL && s_mac_bb_pu) { + if (s_mac_bb_pd_mem == NULL) { + return; + } + if (s_mac_bb_pu) { esp_phy_common_clock_enable(); phy_freq_mem_backup(true, s_mac_bb_pd_mem); - SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_ISO); - SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PD); esp_phy_common_clock_disable(); s_mac_bb_pu = false; } + esp_wifi_bt_power_domain_off(); } #endif @@ -905,3 +935,6 @@ esp_err_t esp_phy_update_country_info(const char *country) #endif return ESP_OK; } + +void esp_wifi_power_domain_on(void) __attribute__((alias("esp_wifi_bt_power_domain_on"))); +void esp_wifi_power_domain_off(void) __attribute__((alias("esp_wifi_bt_power_domain_off"))); diff --git a/components/esp_wifi/include/esp_private/wifi.h b/components/esp_wifi/include/esp_private/wifi.h index 428cc7d918..957f68791b 100644 --- a/components/esp_wifi/include/esp_private/wifi.h +++ b/components/esp_wifi/include/esp_private/wifi.h @@ -1,16 +1,8 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ /* * All the APIs declared here are internal only APIs, it can only be used by @@ -505,6 +497,16 @@ bool esp_wifi_internal_is_tsf_active(void); void esp_wifi_internal_update_light_sleep_wake_ahead_time(uint32_t); #endif +/** + * @brief Wifi power domain power on + */ +void esp_wifi_power_domain_on(void); + +/** + * @brief Wifi power domain power off + */ +void esp_wifi_power_domain_off(void); + #if CONFIG_MAC_BB_PD /** * @brief Enable or disable powering down MAC and baseband when Wi-Fi is sleeping. diff --git a/components/esp_wifi/src/wifi_init.c b/components/esp_wifi/src/wifi_init.c index f8ec7fbcca..40273d86bf 100644 --- a/components/esp_wifi/src/wifi_init.c +++ b/components/esp_wifi/src/wifi_init.c @@ -125,6 +125,7 @@ esp_err_t esp_wifi_deinit(void) esp_unregister_mac_bb_pd_callback(pm_mac_sleep); esp_unregister_mac_bb_pu_callback(pm_mac_wakeup); #endif + esp_wifi_power_domain_off(); return err; } @@ -169,6 +170,7 @@ static void esp_wifi_config_info(void) esp_err_t esp_wifi_init(const wifi_init_config_t *config) { + esp_wifi_power_domain_on(); #ifdef CONFIG_PM_ENABLE if (s_wifi_modem_sleep_lock == NULL) { esp_err_t err = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "wifi", diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 1280cb7471..7e9f50b5cd 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -70,11 +70,8 @@ components/bt/common/osi/mutex.c components/bt/common/osi/osi.c components/bt/common/osi/semaphore.c components/bt/common/osi/thread.c -components/bt/controller/esp32/bt.c components/bt/controller/esp32/hli_api.c components/bt/controller/esp32/hli_api.h -components/bt/controller/esp32c3/bt.c -components/bt/controller/esp32s3/bt.c components/bt/esp_ble_mesh/api/core/esp_ble_mesh_ble_api.c components/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c components/bt/esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c @@ -702,9 +699,6 @@ components/bt/host/nimble/port/include/console/console.h components/bt/host/nimble/port/include/esp_nimble_cfg.h components/bt/host/nimble/port/include/esp_nimble_mem.h components/bt/host/nimble/port/src/esp_nimble_mem.c -components/bt/include/esp32/include/esp_bt.h -components/bt/include/esp32c3/include/esp_bt.h -components/bt/include/esp32s3/include/esp_bt.h components/bt/test/test_bt_common.c components/bt/test/test_smp.c components/cbor/port/include/cbor.h @@ -1205,7 +1199,6 @@ components/esp_wifi/include/esp_mesh_internal.h components/esp_wifi/include/esp_now.h components/esp_wifi/include/esp_private/esp_wifi_private.h components/esp_wifi/include/esp_private/esp_wifi_types_private.h -components/esp_wifi/include/esp_private/wifi.h components/esp_wifi/include/esp_private/wifi_os_adapter.h components/esp_wifi/include/esp_private/wifi_types.h components/esp_wifi/include/esp_smartconfig.h