Merge branch 'feat/support_s31_bt_sleep_sdk' into 'master'

feat(bt): support classic Bluetooth sleep mode on ESP32-S31

Closes IDF-15186 and IDF-15194

See merge request espressif/esp-idf!48597
This commit is contained in:
Wang Meng Yang
2026-05-20 16:48:18 +08:00
7 changed files with 29 additions and 29 deletions

View File

@@ -33,6 +33,28 @@ config BT_CTRL_SLEEP_ENABLE
help
Enable Bluetooth Controller sleep
choice BT_CTRL_LP_CLK_SRC
prompt "Bluetooth low power clock source"
default BT_CTRL_LP_CLK_SRC_MAIN_XTAL
depends on BT_CTRL_SLEEP_ENABLE
config BT_CTRL_LP_CLK_SRC_MAIN_XTAL
bool "Use main XTAL as RTC clock source"
help
User main XTAL as RTC clock source.
This option is recommended if external 32.768k XTAL is not available.
Using the external 32.768 kHz XTAL will have lower current consumption
in light sleep compared to using the main XTAL.
config BT_CTRL_LP_CLK_SRC_DEFAULT
depends on (RTC_CLK_SRC_EXT_CRYS || !BT_CTRL_BREDR_ENABLE)
bool "Use system RTC slow clock source"
help
Use the same slow clock source as system RTC
Using any clock source other than external 32.768 kHz XTAL supports only
legacy ADV and SCAN due to low clock accuracy.
endchoice
config BT_DUAL_MODE_ARCH
bool
default y

View File

@@ -433,27 +433,6 @@ config BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF
default 1 if BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EN
default 0 if BT_LE_COEX_PHY_CODED_TX_RX_TLIM_DIS
choice BT_LE_LP_CLK_SRC
prompt "BLE low power clock source"
default BT_LE_LP_CLK_SRC_MAIN_XTAL
depends on BT_CTRL_SLEEP_ENABLE
config BT_LE_LP_CLK_SRC_MAIN_XTAL
bool "Use main XTAL as RTC clock source"
help
User main XTAL as RTC clock source.
This option is recommended if external 32.768k XTAL is not available.
Using the external 32.768 kHz XTAL will have lower current consumption
in light sleep compared to using the main XTAL.
config BT_LE_LP_CLK_SRC_DEFAULT
bool "Use system RTC slow clock source"
help
Use the same slow clock source as system RTC
Using any clock source other than external 32.768 kHz XTAL supports only
legacy ADV and SCAN due to low clock accuracy.
endchoice
config BT_LE_USE_ESP_TIMER
bool "Enable Esp Timer for Callout"
depends on !BT_NIMBLE_ENABLED

View File

@@ -112,7 +112,7 @@ static void
btdm_lp_timer_clk_init(esp_btdm_controller_config_t *cfg)
{
if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_INVALID) {
#if CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL
#if CONFIG_BT_CTRL_LP_CLK_SRC_MAIN_XTAL
s_bt_lpclk_src = MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL;
s_bt_lpclk_freq = s_bt_xtal_lpclk_freq;
#else
@@ -141,7 +141,7 @@ btdm_lp_timer_clk_init(esp_btdm_controller_config_t *cfg)
ESP_LOGE(BTDM_LOG_TAG, "Unsupported clock source");
assert(0);
#endif
#endif /* CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL */
#endif /* CONFIG_BT_CTRL_LP_CLK_SRC_MAIN_XTAL */
}
btdm_lp_rtc_slow_clk_select(s_bt_lpclk_src);
@@ -277,7 +277,6 @@ btdm_lp_modem_state_deinit(void)
* Public Function Definitions
***************************************************************************************************
*/
#include "modem/modem_syscon_reg.h"
void
btdm_lp_enable_clock(esp_btdm_controller_config_t *cfg)
{
@@ -319,7 +318,7 @@ btdm_lp_init(void)
rc = btdm_lp_modem_state_init();
assert(rc == 0);
esp_sleep_enable_bt_wakeup();
ESP_LOGW(BTDM_LOG_TAG, "Enable light sleep, the wake up source is BLE timer");
ESP_LOGW(BTDM_LOG_TAG, "Enable light sleep, the wake up source is modem lp timer");
rc = esp_pm_register_inform_out_light_sleep_overhead_callback(r_btdm_sleep_wake_up_overhead_set);
if (rc != ESP_OK) {

View File

@@ -2,7 +2,7 @@ CONFIG_IDF_TARGET="esp32h4"
# Bluetooth Low Power Config
CONFIG_BT_CTRL_SLEEP_ENABLE=y
CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL=y
CONFIG_BT_CTRL_LP_CLK_SRC_MAIN_XTAL=y
#
# Power Management

View File

@@ -2,7 +2,7 @@ CONFIG_IDF_TARGET="esp32s31"
# Bluetooth Low Power Config
CONFIG_BT_CTRL_SLEEP_ENABLE=y
CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL=y
CONFIG_BT_CTRL_LP_CLK_SRC_MAIN_XTAL=y
#
# Power Management

View File

@@ -2,7 +2,7 @@ CONFIG_IDF_TARGET="esp32h4"
# Bluetooth Low Power Config
CONFIG_BT_CTRL_SLEEP_ENABLE=y
CONFIG_BT_LE_LP_CLK_SRC_DEFAULT=y
CONFIG_BT_CTRL_LP_CLK_SRC_DEFAULT=y
#
# Power Management

View File

@@ -2,7 +2,7 @@ CONFIG_IDF_TARGET="esp32s31"
# Bluetooth Low Power Config
CONFIG_BT_CTRL_SLEEP_ENABLE=y
CONFIG_BT_LE_LP_CLK_SRC_DEFAULT=y
CONFIG_BT_CTRL_LP_CLK_SRC_DEFAULT=y
#
# Power Management