From 3ae110b30cd7e6ca3b274889f97ca7ec424132d0 Mon Sep 17 00:00:00 2001 From: baohongde Date: Mon, 6 Jan 2020 20:22:04 +0800 Subject: [PATCH] components/bt: Fix A2DP stuck when BLE's interval is too small 1. Fix the cumulative time switch from BLE to classic BT 2. Enhance classic BT performance while enable calssic BT and BLE at the same time --- components/bt/Kconfig | 14 ++++++++++++++ components/bt/controller/lib | 2 +- components/bt/include/esp_bt.h | 10 +++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/components/bt/Kconfig b/components/bt/Kconfig index 04f891b6b..2261333b8 100644 --- a/components/bt/Kconfig +++ b/components/bt/Kconfig @@ -77,6 +77,20 @@ menu "Bluetooth" default 1 if BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM default 0 + config BTDM_CTRL_AUTO_LATENCY + bool "Auto latency" + depends on BTDM_CTRL_MODE_BTDM + default n + help + BLE auto latency, used to enhance classic BT performance + while classic BT and BLE are enabled at the same time. + + config BTDM_CTRL_AUTO_LATENCY_EFF + bool + default BTDM_CTRL_AUTO_LATENCY if BTDM_CTRL_MODE_BTDM + default n + + config BTDM_CTRL_BLE_MAX_CONN_EFF int default BTDM_CTRL_BLE_MAX_CONN if BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM diff --git a/components/bt/controller/lib b/components/bt/controller/lib index 5a2416f8b..0a707c811 160000 --- a/components/bt/controller/lib +++ b/components/bt/controller/lib @@ -1 +1 @@ -Subproject commit 5a2416f8b8729a44c9396747631246432b109f0d +Subproject commit 0a707c811ee824c9777b8712d2edf979fa8d2a2e diff --git a/components/bt/include/esp_bt.h b/components/bt/include/esp_bt.h index a650d9846..6435e9547 100644 --- a/components/bt/include/esp_bt.h +++ b/components/bt/include/esp_bt.h @@ -25,7 +25,7 @@ extern "C" { #endif -#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20190506 +#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20200106 /** * @brief Bluetooth mode for controller enable/disable @@ -111,6 +111,12 @@ the adv packet will be discarded until the memory is restored. */ #define BTDM_CONTROLLER_MODE_EFF ESP_BT_MODE_BTDM #endif +#ifdef CONFIG_BTDM_CTRL_AUTO_LATENCY_EFF +#define BTDM_CTRL_AUTO_LATENCY_EFF CONFIG_BTDM_CTRL_AUTO_LATENCY_EFF +#else +#define BTDM_CTRL_AUTO_LATENCY_EFF false +#endif + #define BTDM_CONTROLLER_BLE_MAX_CONN_LIMIT 9 //Maximum BLE connection limitation #define BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_LIMIT 7 //Maximum ACL connection limitation #define BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_LIMIT 3 //Maximum SCO/eSCO connection limitation @@ -133,6 +139,7 @@ the adv packet will be discarded until the memory is restored. */ .ble_max_conn = CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF, \ .bt_max_acl_conn = CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF, \ .bt_sco_datapath = CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF, \ + .auto_latency = BTDM_CTRL_AUTO_LATENCY_EFF, \ .bt_max_sync_conn = CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF, \ .ble_sca = CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF, \ .magic = ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL, \ @@ -165,6 +172,7 @@ typedef struct { uint8_t ble_max_conn; /*!< BLE maximum connection numbers */ uint8_t bt_max_acl_conn; /*!< BR/EDR maximum ACL connection numbers */ uint8_t bt_sco_datapath; /*!< SCO data path, i.e. HCI or PCM module */ + bool auto_latency; /*!< BLE auto latency, used to enhance classic BT performance */ /* * Following parameters can not be configured runtime when call esp_bt_controller_init() * It will be overwrite with a constant value which in menuconfig or from a macro.