]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: rtw88: 8821a: Regularly ask for BT info updates
authorBitterblue Smith <rtl8821cerfe2@gmail.com>
Wed, 23 Oct 2024 14:14:45 +0000 (17:14 +0300)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 29 Oct 2024 04:02:39 +0000 (12:02 +0800)
The RTL8821AU firmware sends C2H_BT_INFO by itself when bluetooth
headphones are connected, but not when they are disconnected. This leads
to the coexistence code still using the A2DP algorithm long after the
headphones are disconnected, which means the wifi speeds are much lower
than they should be. Work around this by asking for updates every two
seconds if the chip is RTL8821AU.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/358acdd2-6aae-46c1-9c66-fcce4e700b96@gmail.com
drivers/net/wireless/realtek/rtw88/coex.c
drivers/net/wireless/realtek/rtw88/coex.h
drivers/net/wireless/realtek/rtw88/main.c

index 8f2b472589db30b3eee0369a330c9239deb0657d..c929db1e53ca630e9611e9232face45e8e44eab3 100644 (file)
@@ -446,7 +446,7 @@ static void rtw_coex_check_rfk(struct rtw_dev *rtwdev)
        }
 }
 
-static void rtw_coex_query_bt_info(struct rtw_dev *rtwdev)
+void rtw_coex_query_bt_info(struct rtw_dev *rtwdev)
 {
        struct rtw_coex *coex = &rtwdev->coex;
        struct rtw_coex_stat *coex_stat = &coex->stat;
index 57cf29da9ea4e34e777e98ca3f6f52885b173991..c398be8391f7b083e087e7f0aa45026a1c81d299 100644 (file)
@@ -384,6 +384,7 @@ u32 rtw_coex_read_indirect_reg(struct rtw_dev *rtwdev, u16 addr);
 void rtw_coex_write_indirect_reg(struct rtw_dev *rtwdev, u16 addr,
                                 u32 mask, u32 val);
 void rtw_coex_write_scbd(struct rtw_dev *rtwdev, u16 bitpos, bool set);
+void rtw_coex_query_bt_info(struct rtw_dev *rtwdev);
 
 void rtw_coex_bt_relink_work(struct work_struct *work);
 void rtw_coex_bt_reenable_work(struct work_struct *work);
@@ -419,4 +420,14 @@ static inline bool rtw_coex_disabled(struct rtw_dev *rtwdev)
        return coex_stat->bt_disabled;
 }
 
+static inline void rtw_coex_active_query_bt_info(struct rtw_dev *rtwdev)
+{
+       /* The RTL8821AU firmware doesn't send C2H_BT_INFO by itself
+        * when bluetooth headphones are disconnected, so we have to
+        * ask for it regularly.
+        */
+       if (rtwdev->chip->id == RTW_CHIP_TYPE_8821A && rtwdev->efuse.btcoex)
+               rtw_coex_query_bt_info(rtwdev);
+}
+
 #endif
index 65d20ad02667a3767cb3430ecc3cc7edae53b24d..e91530ed05a0778c9c972895364f3ae7792cc182 100644 (file)
@@ -274,6 +274,7 @@ static void rtw_watch_dog_work(struct work_struct *work)
        rtw_leave_lps(rtwdev);
        rtw_coex_wl_status_check(rtwdev);
        rtw_coex_query_bt_hid_list(rtwdev);
+       rtw_coex_active_query_bt_info(rtwdev);
 
        rtw_phy_dynamic_mechanism(rtwdev);