From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <ku920601@realtek.com>
Subject: [PATCH rtw-next 1/7] wifi: rtw89: coex: Fix Bluetooth link weight not updated on profile change
Date: Thu, 30 Jul 2026 14:02:14 +0800 [thread overview]
Message-ID: <20260730060220.55844-2-pkshih@realtek.com> (raw)
In-Reply-To: <20260730060220.55844-1-pkshih@realtek.com>
From: Ching-Te Ku <ku920601@realtek.com>
_update_bt_link_cnt() was missing the bt->link_weight[].
Without it, link_weight stays at the initial value of 5
(set on BT re-enable) regardless of the active BT profile.
_set_bind_info() uses link_weight to compute b2g_score/b5g_score, which
determines tdd_bind.rf_band. With a stale weight of 5 (below the active
profile threshold), tdd_bind.rf_band may not reflect the actual RF band,
causing mode_v0 in _run_coex() to remain 0 (BTC_WLINK_NOLINK), which
incorrectly triggers _action_wl_nc() instead of the BT-profile action.
Add the link_weight calculation to _update_bt_link_cnt() using the same
weighting table as Formal (BIS/A2DP-sink: 70, A2DP: 40-60, PAN/active: 30,
no-profile: 5, else: 9) and call _update_bt_link_cnt() from
_update_bt_info() after parsing the profile exist flags, replacing the
open-coded link_cnt increment that omitted le-audio profiles.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw89/coex.c | 30 ++++++++++++++++++-----
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
index 0e42c720819a..fd9ddd55c192 100644
--- a/drivers/net/wireless/realtek/rtw89/coex.c
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
@@ -7973,6 +7973,8 @@ static void _update_bt_link_cnt(struct rtw89_dev *rtwdev,
struct rtw89_btc_bt_hfp_desc *hfp = &b->hfp_desc;
struct rtw89_btc_bt_hid_desc *hid = &b->hid_desc;
struct rtw89_btc_bt_pan_desc *pan = &b->pan_desc;
+ u8 bt_rf_band = b56g ? BTC_BT_B5G : BTC_BT_B2G;
+ u8 val;
b->link_cnt.last = b->link_cnt.now;
b->link_cnt.now = 0;
@@ -7984,6 +7986,27 @@ static void _update_bt_link_cnt(struct rtw89_dev *rtwdev,
b->link_cnt.now += pan->exist;
b->link_cnt.now += leaudio->bis_exist;
b->link_cnt.now += leaudio->cis_exist;
+
+ if (leaudio->bis_exist || a2dp->sink) {
+ val = 70;
+ } else if (a2dp->exist) {
+ val = 40;
+ if (a2dp->vendor_id == 0x4c)
+ val += 10;
+ if (hid->exist)
+ val += 10;
+ } else if (pan->exist || pan->active || a2dp->active ||
+ b->status.map.inq_pag) {
+ val = 30;
+ } else if (b->link_cnt.now == 0) {
+ val = 5;
+ } else {
+ val = 9;
+ }
+ bt->link_weight[bt_rf_band] = val;
+
+ if (b->link_cnt.last != b->link_cnt.now)
+ b->link_cnt.chg = 1;
}
static void _update_bt_leaudio_info(struct rtw89_dev *rtwdev, u8 bid,
@@ -9012,8 +9035,6 @@ static void _update_bt_info(struct rtw89_dev *rtwdev, u8 *buf, u32 len)
"[BTC], %s(): bt_info[2]=0x%02x\n",
__func__, bt->raw_info[2]);
- b->link_cnt.last = b->link_cnt.now;
- b->link_cnt.now = 0;
hid->type = 0;
/* parse raw info low-Byte2 */
@@ -9026,13 +9047,10 @@ static void _update_bt_info(struct rtw89_dev *rtwdev, u8 *buf, u32 len)
bt->bcnt[BTC_BCNT_INQPAG] += !!(bt->inq_pag.now && !bt->inq_pag.last);
hfp->exist = btinfo.lb2.hfp;
- b->link_cnt.now += (u8)hfp->exist;
hid->exist = btinfo.lb2.hid;
- b->link_cnt.now += (u8)hid->exist;
a2dp->exist = btinfo.lb2.a2dp;
- b->link_cnt.now += (u8)a2dp->exist;
pan->exist = btinfo.lb2.pan;
- b->link_cnt.now += (u8)pan->exist;
+ _update_bt_link_cnt(rtwdev, bt, 0);
btc->dm.trx_info.bt_profile = u32_get_bits(btinfo.val, BT_PROFILE_PROTOCOL_MASK);
/* parse raw info low-Byte3 */
--
2.25.1
next prev parent reply other threads:[~2026-07-30 6:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 6:02 [PATCH rtw-next 0/7] wifi: rtw89: 8922d: fix and cleanup coex code and enable RTL8922DE Ping-Ke Shih
2026-07-30 6:02 ` Ping-Ke Shih [this message]
2026-07-30 6:02 ` [PATCH rtw-next 2/7] wifi: rtw89: coex: Fix BT-info parsing for 5/6 GHz band & dual Bluetooth Ping-Ke Shih
2026-07-30 6:02 ` [PATCH rtw-next 3/7] wifi: rtw89: coex: Clear BT link weight when BT is disabled Ping-Ke Shih
2026-07-30 6:02 ` [PATCH rtw-next 4/7] wifi: rtw89: coex: Change Wi-Fi link_mode_v0 translating timing Ping-Ke Shih
2026-07-30 6:02 ` [PATCH rtw-next 5/7] wifi: rtw89: coex: Port _update_bt_ctrl_lps() for BT profile-based LPS control Ping-Ke Shih
2026-07-30 6:02 ` [PATCH rtw-next 6/7] wifi: rtw89: coex: Update Wi-Fi/Bluetooth coexistence version to 9.24.1 Ping-Ke Shih
2026-07-30 6:02 ` [PATCH rtw-next 7/7] wifi: rtw89: 8922d: enable Makefile and Kconfig for RTL8922DE 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=20260730060220.55844-2-pkshih@realtek.com \
--to=pkshih@realtek.com \
--cc=ku920601@realtek.com \
--cc=linux-wireless@vger.kernel.org \
/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