Skip to contentSkip to conversation

wifi: rtw89: coex: fine tune free-run policy and update debug counters

PATCH In review Ping-Ke Shih 2 participants 6 messages Apr 12, 2023 – Apr 17, 2023 Realtek wireless driver (rtw89)

lore
Share & tools
lore

Ping-Ke Shih

author maintainer
#0 lore raw

cover wifi: rtw89: coex: fine tune free-run policy and update debug counters

Main update related to 8851B is patch 4/4 that sends more information to firmware via H2C command, which converts to suggested format as well. Other patches are to update things found during developing BT-coexistence mechanism for 8851B.

Ching-Te Ku (3):
wifi: rtw89: coex: Enable Wi-Fi RX gain control for free run solution
wifi: rtw89: coex: Add path control register to monitor list
wifi: rtw89: coex: Update function to get BT RSSI and hardware counter

Ping-Ke Shih (1):
wifi: rtw89: coex: send more hardware module info to firmware for

    8851B
 drivers/net/wireless/realtek/rtw89/core.h     |   5 +-
 drivers/net/wireless/realtek/rtw89/fw.c       |  64 +++++-----
 drivers/net/wireless/realtek/rtw89/fw.h       | 113 ++++++------------
 drivers/net/wireless/realtek/rtw89/rtw8852a.c |   3 +-
 drivers/net/wireless/realtek/rtw89/rtw8852b.c |  11 +-
 drivers/net/wireless/realtek/rtw89/rtw8852c.c |  10 +-
 6 files changed, 91 insertions(+), 115 deletions(-)
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH 1/4 wifi: rtw89: coex: Enable Wi-Fi RX gain control for free run solution

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

When Wi-Fi & Bluetooth are both busy at the same time, Wi-Fi need to enable RX gain to protect Wi-Fi RX RF ability. Without this configure the interference from Bluetooth will bring a big impact to Wi-Fi RX.

---
 drivers/net/wireless/realtek/rtw89/rtw8852b.c | 4 ++--
 drivers/net/wireless/realtek/rtw89/rtw8852c.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw89/rtw8852b.c +2 -2
index bae80984cfd51..ed12f72301be7 100644
@@ -323,7 +323,7 @@ static const struct rtw89_btc_rf_trx_para rtw89_btc_8852b_rf_ul[] = {
 	{255, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
 	{255, 0, 0, 7}, /* 3- >reserved for shared-antenna */
 	{255, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
-	{255, 0, 0, 7}, /* the below id is for non-shared-antenna free-run */
+	{255, 1, 0, 7}, /* the below id is for non-shared-antenna free-run */
 	{6, 1, 0, 7},
 	{13, 1, 0, 7},
 	{13, 1, 0, 7}
@@ -335,7 +335,7 @@ static const struct rtw89_btc_rf_trx_para rtw89_btc_8852b_rf_dl[] = {
 	{255, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
 	{255, 0, 0, 7}, /* 3- >reserved for shared-antenna */
 	{255, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
-	{255, 0, 0, 7}, /* the below id is for non-shared-antenna free-run */
+	{255, 1, 0, 7}, /* the below id is for non-shared-antenna free-run */
 	{255, 1, 0, 7},
 	{255, 1, 0, 7},
 	{255, 1, 0, 7}
drivers/net/wireless/realtek/rtw89/rtw8852c.c +2 -2
index ba728fca91881..78d618dd714c0 100644
@@ -2536,7 +2536,7 @@ static const struct rtw89_btc_rf_trx_para rtw89_btc_8852c_rf_ul[] = {
 	{255, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
 	{255, 0, 0, 7}, /* 3- >reserved for shared-antenna */
 	{255, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
-	{255, 0, 0, 7}, /* the below id is for non-shared-antenna free-run */
+	{255, 1, 0, 7}, /* the below id is for non-shared-antenna free-run */
 	{6, 1, 0, 7},
 	{13, 1, 0, 7},
 	{13, 1, 0, 7}
@@ -2548,7 +2548,7 @@ static const struct rtw89_btc_rf_trx_para rtw89_btc_8852c_rf_dl[] = {
 	{255, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
 	{255, 0, 0, 7}, /* 3- >reserved for shared-antenna */
 	{255, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
-	{255, 0, 0, 7}, /* the below id is for non-shared-antenna free-run */
+	{255, 1, 0, 7}, /* the below id is for non-shared-antenna free-run */
 	{255, 1, 0, 7},
 	{255, 1, 0, 7},
 	{255, 1, 0, 7}
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 1/4] wifi: rtw89: coex: Enable Wi-Fi RX gain control for free run solution

Quoted 8 lines · Ping-Ke Shih

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

When Wi-Fi & Bluetooth are both busy at the same time, Wi-Fi need to enable RX gain to protect Wi-Fi RX RF ability. Without this configure the interference from Bluetooth will bring a big impact to Wi-Fi RX.

4 patches applied to wireless-next.git, thanks.

36ef71db559f wifi: rtw89: coex: Enable Wi-Fi RX gain control for free run solution 9fde30562840 wifi: rtw89: coex: Add path control register to monitor list 2380a220316f wifi: rtw89: coex: Update function to get BT RSSI and hardware counter c0fea064b264 wifi: rtw89: coex: send more hardware module info to firmware for 8851B

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
author maintainer
#3 lore raw

PATCH 2/4 wifi: rtw89: coex: Add path control register to monitor list

In reply to Ping-Ke Shih

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

Chips use similar hardware for path control, but could different path/antenna configuration. Add these register to monitor, if there are wrong settings, these register can help to debug.

---
 drivers/net/wireless/realtek/rtw89/rtw8852b.c | 4 +++-
 drivers/net/wireless/realtek/rtw89/rtw8852c.c | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/rtw8852b.c +3 -1
index ed12f72301be7..a7f69d105fbbc 100644
@@ -355,7 +355,9 @@ static const struct rtw89_btc_fbtc_mreg rtw89_btc_8852b_mon_reg[] = {
 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xd200),
 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xd220),
 	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x980),
-	RTW89_DEF_FBTC_MREG(REG_BT_MODEM, 4, 0x178),
+	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x4738),
+	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x4688),
+	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x4694),
 };
 
 static const u8 rtw89_btc_8852b_wl_rssi_thres[BTC_WL_RSSI_THMAX] = {70, 60, 50, 40};
drivers/net/wireless/realtek/rtw89/rtw8852c.c +3 -0
index 78d618dd714c0..1db1298ca9863 100644
@@ -2570,6 +2570,9 @@ static const struct rtw89_btc_fbtc_mreg rtw89_btc_8852c_mon_reg[] = {
 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xd200),
 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xd220),
 	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x980),
+	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x4aa4),
+	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x4778),
+	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x476c),
 };
 
 static
Signature · 1 line
2.25.1
author maintainer
#4 lore raw

PATCH 3/4 wifi: rtw89: coex: Update function to get BT RSSI and hardware counter

In reply to Ping-Ke Shih

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

Correct Bluetooth RSSI count method. The 6dB is the gap between hardware packet sampled value and real RSSI value.

---
 drivers/net/wireless/realtek/rtw89/rtw8852a.c | 3 ++-
 drivers/net/wireless/realtek/rtw89/rtw8852b.c | 3 ++-
 drivers/net/wireless/realtek/rtw89/rtw8852c.c | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/rtw8852a.c +2 -1
index 46907748778bd..a0c02ff39e750 100644
@@ -1827,7 +1827,8 @@ rtw8852a_btc_set_wl_txpwr_ctrl(struct rtw89_dev *rtwdev, u32 txpwr_val)
 static
 s8 rtw8852a_btc_get_bt_rssi(struct rtw89_dev *rtwdev, s8 val)
 {
-	return clamp_t(s8, val, -100, 0) + 100;
+	/* +6 for compensate offset */
+	return clamp_t(s8, val + 6, -100, 0) + 100;
 }
 
 static struct rtw89_btc_rf_trx_para rtw89_btc_8852a_rf_ul[] = {
drivers/net/wireless/realtek/rtw89/rtw8852b.c +2 -1
index a7f69d105fbbc..4cbe4c277a73f 100644
@@ -2269,7 +2269,8 @@ do {								\
 static
 s8 rtw8852b_btc_get_bt_rssi(struct rtw89_dev *rtwdev, s8 val)
 {
-	return clamp_t(s8, val, -100, 0) + 100;
+	/* +6 for compensate offset */
+	return clamp_t(s8, val + 6, -100, 0) + 100;
 }
 
 static
drivers/net/wireless/realtek/rtw89/rtw8852c.c +2 -1
index 1db1298ca9863..4b66ed0cb3bbe 100644
@@ -2527,7 +2527,8 @@ do {								\
 static
 s8 rtw8852c_btc_get_bt_rssi(struct rtw89_dev *rtwdev, s8 val)
 {
-	return clamp_t(s8, val, -100, 0) + 100;
+	/* +6 for compensate offset */
+	return clamp_t(s8, val + 6, -100, 0) + 100;
 }
 
 static const struct rtw89_btc_rf_trx_para rtw89_btc_8852c_rf_ul[] = {
Signature · 1 line
2.25.1
author maintainer
#5 lore raw

PATCH 4/4 wifi: rtw89: coex: send more hardware module info to firmware for 8851B

In reply to Ping-Ke Shih

8851B has various hardware module types, so BT coexistence in firmware needs these information to make decision. Add them to make 8851B work well.

---
 drivers/net/wireless/realtek/rtw89/core.h |   5 +-
 drivers/net/wireless/realtek/rtw89/fw.c   |  64 ++++++------
 drivers/net/wireless/realtek/rtw89/fw.h   | 113 +++++++---------------
 3 files changed, 75 insertions(+), 107 deletions(-)
drivers/net/wireless/realtek/rtw89/core.h +4 -1
index 40fb18b613d90..dc57ea5877513 100644
@@ -957,6 +957,8 @@ struct rtw89_btc_ant_info {
 
 	u8 single_pos: 1;/* Single antenna at S0 or S1 */
 	u8 diversity: 1;
+	u8 btg_pos: 2;
+	u8 stream_cnt: 4;
 };
 
 enum rtw89_tfc_dir {
@@ -1413,8 +1415,9 @@ struct rtw89_btc_module {
 	u8 bt_solo: 1;
 	u8 bt_pos: 1;
 	u8 switch_type: 1;
+	u8 wa_type: 3;
 
-	u8 rsvd;
+	u8 kt_ver_adie;
 };
 
 #define RTW89_BTC_DM_MAXSTEP 30
drivers/net/wireless/realtek/rtw89/fw.c +35 -29

87 lines not on this page · raw message

drivers/net/wireless/realtek/rtw89/fw.h +36 -77

121 lines not on this page · raw message

Signature · 1 line
2.25.1