Skip to contentSkip to conversation

wifi: rtw89: coex: improve user experience with TWS Bluetooth devices

PATCH In review Ping-Ke Shih 1 participant 5 messages Feb 5, 2025 – Feb 10, 2025 Realtek wireless driver (rtw89)

lore
Share & tools
lore

Ping-Ke Shih

author maintainer
#0 lore raw

cover wifi: rtw89: coex: improve user experience with TWS Bluetooth devices

To play A2DP smoothly on TWS (True wireless stereo) Bluetooth devices, fine tune BT-coexistence mechanism to fit characteristic of this kind of devices. Then, no lag sound while listening music and using WiFi.

Ching-Te Ku (3):
wifi: rtw89: coex: Assign value over than 0 to avoid firmware timer
hang
wifi: rtw89: coex: To avoid TWS serials A2DP lag, adjust slot
arrangement
wifi: rtw89: coex: Update Wi-Fi/Bluetooth coexistence version to 7.0.3

 drivers/net/wireless/realtek/rtw89/coex.c | 24 ++++++-----------------
 1 file changed, 6 insertions(+), 18 deletions(-)
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH 1/3 wifi: rtw89: coex: Assign value over than 0 to avoid firmware timer hang

From: Ching-Te Ku <[email protected]>

If the slot duration is 0, the firmware timer will trigger timer hang at the timer initializing state in a low rate due to hardware algorithm.

---
 drivers/net/wireless/realtek/rtw89/coex.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/coex.c +3 -3
index 2c0ccf2f8bd9..806a51782467 100644
@@ -89,10 +89,10 @@ static const struct rtw89_btc_fbtc_slot s_def[] = {
 	[CXST_B4]	= __DEF_FBTC_SLOT(50,  0xe5555555, SLOT_MIX),
 	[CXST_LK]	= __DEF_FBTC_SLOT(20,  0xea5a5a5a, SLOT_ISO),
 	[CXST_BLK]	= __DEF_FBTC_SLOT(500, 0x55555555, SLOT_MIX),
-	[CXST_E2G]	= __DEF_FBTC_SLOT(0,   0xea5a5a5a, SLOT_MIX),
-	[CXST_E5G]	= __DEF_FBTC_SLOT(0,   0xffffffff, SLOT_ISO),
+	[CXST_E2G]	= __DEF_FBTC_SLOT(5,   0xea5a5a5a, SLOT_MIX),
+	[CXST_E5G]	= __DEF_FBTC_SLOT(5,   0xffffffff, SLOT_ISO),
 	[CXST_EBT]	= __DEF_FBTC_SLOT(5,   0xe5555555, SLOT_MIX),
-	[CXST_ENULL]	= __DEF_FBTC_SLOT(0,   0xaaaaaaaa, SLOT_ISO),
+	[CXST_ENULL]	= __DEF_FBTC_SLOT(5,   0xaaaaaaaa, SLOT_ISO),
 	[CXST_WLK]	= __DEF_FBTC_SLOT(250, 0xea5a5a5a, SLOT_MIX),
 	[CXST_W1FDD]	= __DEF_FBTC_SLOT(50,  0xffffffff, SLOT_ISO),
 	[CXST_B1FDD]	= __DEF_FBTC_SLOT(50,  0xffffdfff, SLOT_ISO),
Signature · 1 line
2.25.1
author maintainer
#2 lore raw

Re: [PATCH 1/3] wifi: rtw89: coex: Assign value over than 0 to avoid firmware timer hang

Quoted 7 lines · Ping-Ke Shih

From: Ching-Te Ku <[email protected]>

If the slot duration is 0, the firmware timer will trigger timer hang at the timer initializing state in a low rate due to hardware algorithm.

3 patch(es) applied to rtw-next branch of rtw.git, thanks.

2e4c4717b3f6 wifi: rtw89: coex: Assign value over than 0 to avoid firmware timer hang e53aa85e4b8a wifi: rtw89: coex: To avoid TWS serials A2DP lag, adjust slot arrangement f94ba3c640f6 wifi: rtw89: coex: Update Wi-Fi/Bluetooth coexistence version to 7.0.3

---
https://github.com/pkshih/rtw.git

author maintainer
#3 lore raw

PATCH 2/3 wifi: rtw89: coex: To avoid TWS serials A2DP lag, adjust slot arrangement

In reply to Ping-Ke Shih

From: Ching-Te Ku <[email protected]>

The TWS(True wireless stereo) serials Bluetooth audio device need to keep packet traffic not only with DUT, it also need to synchronize packet with its assistant earbud. And all the BR/EDR Bluetooth device need to do page scan to keep re-connect event sensitively between different DUT. These behavior will make TWS Bluetooth device cost more time slot to keep the good audio performance. This patch decrease half of Wi-Fi slot(from 40ms to 20ms) in a single cycle. Make the slot more flexible to prevent audio lag. The single cycle will be shorter, then it will bring some slot protection cost make Wi-Fi throughput decrease about 5%.

---
 drivers/net/wireless/realtek/rtw89/coex.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
drivers/net/wireless/realtek/rtw89/coex.c +2 -14
index 806a51782467..28d29fa17316 100644
@@ -4583,17 +4583,11 @@ static void _action_bt_hid(struct rtw89_dev *rtwdev)
 static void _action_bt_a2dp(struct rtw89_dev *rtwdev)
 {
 	struct rtw89_btc *btc = &rtwdev->btc;
-	struct rtw89_btc_bt_link_info *bt_linfo = &btc->cx.bt.link_info;
-	struct rtw89_btc_bt_a2dp_desc a2dp = bt_linfo->a2dp_desc;
 	struct rtw89_btc_dm *dm = &btc->dm;
 
 	_set_ant(rtwdev, NM_EXEC, BTC_PHY_ALL, BTC_ANT_W2G);
 
-	if (a2dp.vendor_id == 0x4c || dm->leak_ap || bt_linfo->slave_role)
-		dm->slot_dur[CXST_W1] = 20;
-	else
-		dm->slot_dur[CXST_W1] = 40;
-
+	dm->slot_dur[CXST_W1] = 20;
 	dm->slot_dur[CXST_B1] = BTC_B1_MAX;
 
 	switch (btc->cx.state_map) {
@@ -4690,17 +4684,11 @@ static void _action_bt_pan(struct rtw89_dev *rtwdev)
 static void _action_bt_a2dp_hid(struct rtw89_dev *rtwdev)
 {
 	struct rtw89_btc *btc = &rtwdev->btc;
-	struct rtw89_btc_bt_link_info *bt_linfo = &btc->cx.bt.link_info;
-	struct rtw89_btc_bt_a2dp_desc a2dp = bt_linfo->a2dp_desc;
 	struct rtw89_btc_dm *dm = &btc->dm;
 
 	_set_ant(rtwdev, NM_EXEC, BTC_PHY_ALL, BTC_ANT_W2G);
 
-	if (a2dp.vendor_id == 0x4c || dm->leak_ap || bt_linfo->slave_role)
-		dm->slot_dur[CXST_W1] = 20;
-	else
-		dm->slot_dur[CXST_W1] = 40;
-
+	dm->slot_dur[CXST_W1] = 20;
 	dm->slot_dur[CXST_B1] = BTC_B1_MAX;
 
 	switch (btc->cx.state_map) {
Signature · 1 line
2.25.1
author maintainer
#4 lore raw

PATCH 3/3 wifi: rtw89: coex: Update Wi-Fi/Bluetooth coexistence version to 7.0.3

In reply to Ping-Ke Shih

From: Ching-Te Ku <[email protected]>

Refine the TWS Bluetooth related coexistence mechanism.

---
 drivers/net/wireless/realtek/rtw89/coex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/coex.c +1 -1
index 28d29fa17316..858ff0cd1a23 100644
@@ -10,7 +10,7 @@
 #include "ps.h"
 #include "reg.h"
 
-#define RTW89_COEX_VERSION 0x07000213
+#define RTW89_COEX_VERSION 0x07000313
 #define FCXDEF_STEP 50 /* MUST <= FCXMAX_STEP and match with wl fw*/
 #define BTC_E2G_LIMIT_DEF 80
 
Signature · 1 line
2.25.1