linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
To: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Subject: [PATCH v2 14/22] wifi: rtw88: 8821a: Regularly ask for BT info updates
Date: Fri, 11 Oct 2024 23:53:29 +0300	[thread overview]
Message-ID: <99aeae82-64a2-41e7-8755-9b5973d796da@gmail.com> (raw)
In-Reply-To: <d2870a44-9b91-4090-9a25-873eb62997f5@gmail.com>

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>
---
v2:
 - Move the logic to a separate function and add a comment about it.
---
 drivers/net/wireless/realtek/rtw88/coex.c |  2 +-
 drivers/net/wireless/realtek/rtw88/coex.h | 11 +++++++++++
 drivers/net/wireless/realtek/rtw88/main.c |  1 +
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index 8f2b472589db..c929db1e53ca 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -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;
diff --git a/drivers/net/wireless/realtek/rtw88/coex.h b/drivers/net/wireless/realtek/rtw88/coex.h
index 57cf29da9ea4..c398be8391f7 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.h
+++ b/drivers/net/wireless/realtek/rtw88/coex.h
@@ -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
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 65d20ad02667..e91530ed05a0 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -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);
 
-- 
2.46.0


  parent reply	other threads:[~2024-10-11 20:53 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11 20:31 [PATCH v2 00/22] wifi: rtw88: Add support for RTL8821AU and RTL8812AU Bitterblue Smith
2024-10-11 20:44 ` [PATCH v2 01/22] wifi: rtw88: Add some definitions for RTL8821AU/RTL8812AU Bitterblue Smith
2024-10-11 20:45 ` [PATCH v2 02/22] wifi: rtw88: Dump the HW features only for some chips Bitterblue Smith
2024-10-11 20:47 ` [PATCH v2 03/22] wifi: rtw88: Allow different C2H RA report sizes Bitterblue Smith
2024-10-18  6:11   ` Ping-Ke Shih
2024-10-18 16:41     ` Bitterblue Smith
2024-10-11 20:47 ` [PATCH v2 04/22] wifi: rtw88: Extend the init table parsing for RTL8812AU Bitterblue Smith
2024-10-18  6:16   ` Ping-Ke Shih
2024-10-11 20:48 ` [PATCH v2 05/22] wifi: rtw88: Allow rtw_chip_info.ltecoex_addr to be NULL Bitterblue Smith
2024-10-11 20:49 ` [PATCH v2 06/22] wifi: rtw88: Let each driver control the power on/off process Bitterblue Smith
2024-10-11 20:49 ` [PATCH v2 07/22] wifi: rtw88: Enable data rate fallback for older chips Bitterblue Smith
2024-10-18  6:26   ` Ping-Ke Shih
2024-10-18 16:41     ` Bitterblue Smith
2024-10-11 20:50 ` [PATCH v2 08/22] wifi: rtw88: Make txagc_remnant_ofdm an array Bitterblue Smith
2024-10-11 20:50 ` [PATCH v2 09/22] wifi: rtw88: Support TX page sizes bigger than 128 Bitterblue Smith
2024-10-18  6:33   ` Ping-Ke Shih
2024-10-11 20:51 ` [PATCH v2 10/22] wifi: rtw88: Move pwr_track_tbl to struct rtw_rfe_def Bitterblue Smith
2024-10-18  6:41   ` Ping-Ke Shih
2024-10-18 16:41     ` Bitterblue Smith
2024-10-11 20:51 ` [PATCH v2 11/22] wifi: rtw88: usb: Set pkt_info.ls for the reserved page Bitterblue Smith
2024-10-18  6:42   ` Ping-Ke Shih
2024-10-11 20:52 ` [PATCH v2 12/22] wifi: rtw88: Detect beacon loss with chips other than 8822c Bitterblue Smith
2024-10-11 20:52 ` [PATCH v2 13/22] wifi: rtw88: coex: Support chips without a scoreboard Bitterblue Smith
2024-10-11 20:53 ` Bitterblue Smith [this message]
2024-10-11 20:54 ` [PATCH v2 15/22] wifi: rtw88: 8812a: Mitigate beacon loss Bitterblue Smith
2024-10-11 20:54 ` [PATCH v2 16/22] wifi: rtw88: Add rtw8812a_table.{c,h} Bitterblue Smith
2024-10-11 20:55 ` [PATCH v2 17/22] wifi: rtw88: Add rtw8821a_table.{c,h} Bitterblue Smith
2024-10-11 20:56 ` [PATCH v2 18/22] wifi: rtw88: Add rtw88xxa.{c,h} Bitterblue Smith
2024-10-11 20:56 ` [PATCH v2 19/22] wifi: rtw88: Add rtw8821a.{c,h} Bitterblue Smith
2024-10-11 20:57 ` [PATCH v2 20/22] wifi: rtw88: Add rtw8812a.{c,h} Bitterblue Smith
2024-10-11 20:57 ` [PATCH v2 21/22] wifi: rtw88: Add rtw8821au.c and rtw8812au.c Bitterblue Smith
2024-10-18  7:36   ` Ping-Ke Shih
2024-10-18 16:42     ` Bitterblue Smith
2024-10-11 20:59 ` [PATCH v2 22/22] wifi: rtw88: Enable the new RTL8821AU/RTL8812AU drivers Bitterblue Smith
2024-10-18  7:37   ` Ping-Ke Shih

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99aeae82-64a2-41e7-8755-9b5973d796da@gmail.com \
    --to=rtl8821cerfe2@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).