diff mbox series

[05/20] wifi: rtw88: Allow rtw_chip_info.ltecoex_addr to be NULL

Message ID 6d4194e2-8c8c-4d37-9b44-aada8d1d519f@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Ping-Ke Shih
Headers show
Series wifi: rtw88: Add support for RTL8821AU and RTL8812AU | expand

Commit Message

Bitterblue Smith Aug. 11, 2024, 8:57 p.m. UTC
RTL8821A doesn't have this. Trying to use it results in error messages,
so don't try if ltecoex_addr is NULL.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
 drivers/net/wireless/realtek/rtw88/coex.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Comments

Ping-Ke Shih Aug. 15, 2024, 6:33 a.m. UTC | #1
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> RTL8821A doesn't have this. Trying to use it results in error messages,
> so don't try if ltecoex_addr is NULL.

In short term, it is fine to avoid these messages, but we need BT-coexistence
for RTL8821A if we want better user experience with BT.

> 
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>


Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Bitterblue Smith Aug. 19, 2024, 5:53 p.m. UTC | #2
On 15/08/2024 09:33, Ping-Ke Shih wrote:
> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>> RTL8821A doesn't have this. Trying to use it results in error messages,
>> so don't try if ltecoex_addr is NULL.
> 
> In short term, it is fine to avoid these messages, but we need BT-coexistence
> for RTL8821A if we want better user experience with BT.
> 
>>
>> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> 
> 
> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
> 
> 

I wasn't able to find this LTE stuff in the btc folder:
https://github.com/morrownr/8821au-20210708/tree/main/hal/btc

I did what I could to make the coexistence work, and it does.
I used my Bluetooth headphones for several days, listening to
music and watching videos. There is only a problem with the
wifi speeds with one router.

With ISP's HG6544C router:
Official driver: 3/5 Mbps.
rtw88: a bit more, but not steady at all. Not enough to watch
a 1080p Youtube video.

With my D-Link Eagle R32 router running Openwrt, on the same
channel:
Official driver: 6/10 Mbps.
rtw88: download starts around 30, climbs to 50 / upload is 10
Mbps. I can watch a 1080p Youtube video.

The music doesn't cut out during any speed tests.

I also tested transferring files to and from my phone. I don't
have other types of devices to test.
Ping-Ke Shih Aug. 20, 2024, 1:15 a.m. UTC | #3
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> On 15/08/2024 09:33, Ping-Ke Shih wrote:
> > Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> >> RTL8821A doesn't have this. Trying to use it results in error messages,
> >> so don't try if ltecoex_addr is NULL.
> >
> > In short term, it is fine to avoid these messages, but we need BT-coexistence
> > for RTL8821A if we want better user experience with BT.
> >
> >>
> >> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> >
> >
> > Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
> >
> >
> 
> I wasn't able to find this LTE stuff in the btc folder:
> https://github.com/morrownr/8821au-20210708/tree/main/hal/btc
> 
> I did what I could to make the coexistence work, and it does.
> I used my Bluetooth headphones for several days, listening to
> music and watching videos. There is only a problem with the
> wifi speeds with one router.
> 
> With ISP's HG6544C router:
> Official driver: 3/5 Mbps.
> rtw88: a bit more, but not steady at all. Not enough to watch
> a 1080p Youtube video.
> 
> With my D-Link Eagle R32 router running Openwrt, on the same
> channel:
> Official driver: 6/10 Mbps.
> rtw88: download starts around 30, climbs to 50 / upload is 10
> Mbps. I can watch a 1080p Youtube video.
> 
> The music doesn't cut out during any speed tests.
> 
> I also tested transferring files to and from my phone. I don't
> have other types of devices to test.

Great! With these testing as evidence, we can approve your changes related to
BT-coexistence. Please add them to commit messages.
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index de3332eb7a22..47d32a6f3345 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -950,12 +950,18 @@  static void rtw_coex_coex_ctrl_owner(struct rtw_dev *rtwdev, bool wifi_control)
 
 static void rtw_coex_set_gnt_bt(struct rtw_dev *rtwdev, u8 state)
 {
+	if (!rtwdev->chip->ltecoex_addr)
+		return;
+
 	rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0xc000, state);
 	rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x0c00, state);
 }
 
 static void rtw_coex_set_gnt_wl(struct rtw_dev *rtwdev, u8 state)
 {
+	if (!rtwdev->chip->ltecoex_addr)
+		return;
+
 	rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x3000, state);
 	rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x0300, state);
 }
@@ -3922,7 +3928,7 @@  void rtw_coex_display_coex_info(struct rtw_dev *rtwdev, struct seq_file *m)
 	u8 sys_lte;
 	u16 score_board_WB, score_board_BW;
 	u32 wl_reg_6c0, wl_reg_6c4, wl_reg_6c8, wl_reg_778, wl_reg_6cc;
-	u32 lte_coex, bt_coex;
+	u32 lte_coex = 0, bt_coex = 0;
 	int i;
 
 	score_board_BW = rtw_coex_read_scbd(rtwdev);
@@ -3934,8 +3940,10 @@  void rtw_coex_display_coex_info(struct rtw_dev *rtwdev, struct seq_file *m)
 	wl_reg_778 = rtw_read8(rtwdev, REG_BT_STAT_CTRL);
 
 	sys_lte = rtw_read8(rtwdev, 0x73);
-	lte_coex = rtw_coex_read_indirect_reg(rtwdev, 0x38);
-	bt_coex = rtw_coex_read_indirect_reg(rtwdev, 0x54);
+	if (rtwdev->chip->ltecoex_addr) {
+		lte_coex = rtw_coex_read_indirect_reg(rtwdev, 0x38);
+		bt_coex = rtw_coex_read_indirect_reg(rtwdev, 0x54);
+	}
 
 	if (!coex_stat->wl_under_ips &&
 	    (!coex_stat->wl_under_lps || coex_stat->wl_force_lps_ctrl) &&