From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <ku920601@realtek.com>
Subject: [PATCH rtw-next 10/14] wifi: rtw89: coex: Add BTC report version 8 support for BT sub-reports
Date: Fri, 24 Jul 2026 21:56:36 +0800 [thread overview]
Message-ID: <20260724135640.3195044-11-pkshih@realtek.com> (raw)
In-Reply-To: <20260724135640.3195044-1-pkshih@realtek.com>
From: Ching-Te Ku <ku920601@realtek.com>
RTL8922A (FW >= 0.35.111) and RTL8922D (FW >= 0.35.94) set fcxbtver,
fcxbtscan and fcxbtafh to 8, but the handler in _chk_btc_report only
had branches for version 1 and 7. When version 8 arrived pfinfo was
left NULL and pcinfo->req_len was left at zero, so the length check at
validation stage rejected the report and bt->ver_info.fw was never
written, causing BT_FW:0x0 in the BTC dump.
BT-scan and BT-afh version 8 hit the goto err path for the same reason,
making all BT sub-reports silently broken on these chips.
The structural change in version 8 is that the previously reserved
second byte in each struct is now bt_id (0 = BT0, 1 = BT1), allowing
firmware to send separate reports for each Bluetooth device. All three
structs are otherwise layout-compatible with version 7.
Add rtw89_btc_fbtc_btver_v8, rtw89_btc_fbtc_btscan_v8 and
rtw89_btc_fbtc_btafh_v8 structs with the bt_id field, extend the
corresponding unions, add version 8 branches to _chk_btc_report, and
update _update_bt_report to route each report to BT0 or BT1 according
to BT ID.
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 | 52 ++++++++++++++++++++++-
drivers/net/wireless/realtek/rtw89/core.h | 34 +++++++++++++++
2 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
index 5aa06ef430c8..96bb68f09a01 100644
--- a/drivers/net/wireless/realtek/rtw89/coex.c
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
@@ -1529,7 +1529,14 @@ static void _update_bt_report(struct rtw89_dev *rtwdev, u8 rpt_type, u8 *pfinfo)
switch (rpt_type) {
case BTC_RPT_TYPE_BT_VER:
- if (ver->fcxbtver == 7) {
+ if (ver->fcxbtver == 8) {
+ pver->v8 = *(struct rtw89_btc_fbtc_btver_v8 *)pfinfo;
+ bt = pver->v8.bt_id ? &btc->cx.bt1 : &btc->cx.bt0;
+ bt->ver_info.fw = le32_to_cpu(pver->v8.fw_ver);
+ bt->ver_info.fw_coex = le32_get_bits(pver->v8.coex_ver,
+ GENMASK(7, 0));
+ bt->feature = le32_to_cpu(pver->v8.feature);
+ } else if (ver->fcxbtver == 7) {
pver->v7 = *(struct rtw89_btc_fbtc_btver_v7 *)pfinfo;
bt->ver_info.fw = le32_to_cpu(pver->v7.fw_ver);
bt->ver_info.fw_coex = le32_get_bits(pver->v7.coex_ver,
@@ -1570,6 +1577,19 @@ static void _update_bt_report(struct rtw89_dev *rtwdev, u8 rpt_type, u8 *pfinfo)
pscan_v7->para[i].intvl == 0)
scan_update = false;
}
+ } else if (ver->fcxbtscan == 8) {
+ struct rtw89_btc_fbtc_btscan_v8 *pscan_v8 =
+ (struct rtw89_btc_fbtc_btscan_v8 *)pfinfo;
+ struct rtw89_btc_bt_info *tbt =
+ pscan_v8->bt_id ? &btc->cx.bt1 : &btc->cx.bt0;
+
+ for (i = 0; i < CXSCAN_MAX; i++) {
+ tbt->scan_info_v2[i] = pscan_v8->para[i];
+ if ((pscan_v8->type & BIT(i)) &&
+ pscan_v8->para[i].win == 0 &&
+ pscan_v8->para[i].intvl == 0)
+ scan_update = false;
+ }
}
if (scan_update)
bt->scan_info_update = 1;
@@ -1597,6 +1617,22 @@ static void _update_bt_report(struct rtw89_dev *rtwdev, u8 rpt_type, u8 *pfinfo)
memcpy(&bt_linfo->afh_map_le[0], pafh_v7->afh_le_a, 4);
memcpy(&bt_linfo->afh_map_le[4], pafh_v7->afh_le_b, 1);
}
+ } else if (ver->fcxbtafh == 8) {
+ struct rtw89_btc_fbtc_btafh_v8 *pafh_v8 =
+ (struct rtw89_btc_fbtc_btafh_v8 *)pfinfo;
+ struct rtw89_btc_bt_info *tbt =
+ pafh_v8->bt_id ? &btc->cx.bt1 : &btc->cx.bt0;
+ struct rtw89_btc_bt_link_info *tbt_linfo = &tbt->link_info;
+
+ if (pafh_v8->map_type & RPT_BT_AFH_SEQ_LEGACY) {
+ memcpy(&tbt_linfo->afh_map[0], pafh_v8->afh_l, 4);
+ memcpy(&tbt_linfo->afh_map[4], pafh_v8->afh_m, 4);
+ memcpy(&tbt_linfo->afh_map[8], pafh_v8->afh_h, 2);
+ }
+ if (pafh_v8->map_type & RPT_BT_AFH_SEQ_LE) {
+ memcpy(&tbt_linfo->afh_map_le[0], pafh_v8->afh_le_a, 4);
+ memcpy(&tbt_linfo->afh_map_le[4], pafh_v8->afh_le_b, 1);
+ }
} else if (ver->fcxbtafh == 1) {
pafh_v1 = (struct rtw89_btc_fbtc_btafh *)pfinfo;
memcpy(&bt_linfo->afh_map[0], pafh_v1->afh_l, 4);
@@ -1882,6 +1918,12 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
pfinfo = &pfwinfo->rpt_fbtc_btver.finfo.v7;
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btver.finfo.v7);
fwsubver->fcxbtver = pfwinfo->rpt_fbtc_btver.finfo.v7.fver;
+ } else if (ver->fcxbtver == 8) {
+ pfinfo = &pfwinfo->rpt_fbtc_btver.finfo.v8;
+ pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btver.finfo.v8);
+ fwsubver->fcxbtver = pfwinfo->rpt_fbtc_btver.finfo.v8.fver;
+ } else {
+ goto err;
}
pcinfo->req_fver = ver->fcxbtver;
break;
@@ -1899,6 +1941,10 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
pfinfo = &pfwinfo->rpt_fbtc_btscan.finfo.v7;
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btscan.finfo.v7);
fwsubver->fcxbtscan = pfwinfo->rpt_fbtc_btscan.finfo.v7.fver;
+ } else if (ver->fcxbtscan == 8) {
+ pfinfo = &pfwinfo->rpt_fbtc_btscan.finfo.v8;
+ pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btscan.finfo.v8);
+ fwsubver->fcxbtscan = pfwinfo->rpt_fbtc_btscan.finfo.v8.fver;
} else {
goto err;
}
@@ -1918,6 +1964,10 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
pfinfo = &pfwinfo->rpt_fbtc_btafh.finfo.v7;
pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btafh.finfo.v7);
fwsubver->fcxbtafh = pfwinfo->rpt_fbtc_btafh.finfo.v7.fver;
+ } else if (ver->fcxbtafh == 8) {
+ pfinfo = &pfwinfo->rpt_fbtc_btafh.finfo.v8;
+ pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_btafh.finfo.v8);
+ fwsubver->fcxbtafh = pfwinfo->rpt_fbtc_btafh.finfo.v8.fver;
} else {
goto err;
}
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index ba3a9b0d4aa2..aaed155ea423 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -2647,10 +2647,19 @@ struct rtw89_btc_fbtc_btscan_v7 {
struct rtw89_btc_bt_scan_info_v2 para[CXSCAN_MAX];
} __packed;
+struct rtw89_btc_fbtc_btscan_v8 {
+ u8 fver; /* btc_ver::fcxbtscan */
+ u8 type;
+ u8 bt_id; /* 0:BT0, 1:BT1 */
+ u8 rsvd1;
+ struct rtw89_btc_bt_scan_info_v2 para[CXSCAN_MAX];
+} __packed;
+
union rtw89_btc_fbtc_btscan {
struct rtw89_btc_fbtc_btscan_v1 v1;
struct rtw89_btc_fbtc_btscan_v2 v2;
struct rtw89_btc_fbtc_btscan_v7 v7;
+ struct rtw89_btc_fbtc_btscan_v8 v8;
};
struct rtw89_btc_bt_info {
@@ -3683,9 +3692,21 @@ struct rtw89_btc_fbtc_btver_v7 {
__le32 feature;
} __packed;
+struct rtw89_btc_fbtc_btver_v8 {
+ u8 fver;
+ u8 bt_id; /* 0:BT0, 1:BT1 */
+ u8 rsvd1;
+ u8 rsvd2;
+
+ __le32 coex_ver; /*bit[15:8]->shared, bit[7:0]->non-shared */
+ __le32 fw_ver;
+ __le32 feature;
+} __packed;
+
union rtw89_btc_fbtc_btver {
struct rtw89_btc_fbtc_btver_v1 v1;
struct rtw89_btc_fbtc_btver_v7 v7;
+ struct rtw89_btc_fbtc_btver_v8 v8;
} __packed;
struct rtw89_btc_fbtc_btafh {
@@ -3721,6 +3742,18 @@ struct rtw89_btc_fbtc_btafh_v7 {
u8 afh_le_b[4];
} __packed;
+struct rtw89_btc_fbtc_btafh_v8 {
+ u8 fver;
+ u8 map_type;
+ u8 bt_id; /* 0:BT0, 1:BT1 */
+ u8 rsvd1;
+ u8 afh_l[4]; /*bit0:2402, bit1:2403.... bit31:2433 */
+ u8 afh_m[4]; /*bit0:2434, bit1:2435.... bit31:2465 */
+ u8 afh_h[4]; /*bit0:2466, bit1:2467.....bit14:2480 */
+ u8 afh_le_a[4];
+ u8 afh_le_b[4];
+} __packed;
+
struct rtw89_btc_fbtc_btdevinfo {
u8 fver; /* btc_ver::fcxbtdevinfo */
u8 rsvd;
@@ -4194,6 +4227,7 @@ union rtw89_btc_fbtc_btafh_info {
struct rtw89_btc_fbtc_btafh v1;
struct rtw89_btc_fbtc_btafh_v2 v2;
struct rtw89_btc_fbtc_btafh_v7 v7;
+ struct rtw89_btc_fbtc_btafh_v8 v8;
};
struct rtw89_btc_report_ctrl_state {
--
2.25.1
next prev parent reply other threads:[~2026-07-24 13:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 13:56 [PATCH rtw-next 00/14] wifi: rtw89: coex: add more command / event formats for coming RTL8922D Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 01/14] wifi: rtw89: coex: Add chip initial info version 11 for RTL8922A/D Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 02/14] wifi: rtw89: coex: Add Wi-Fi MLO info version 2 H2C command Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 03/14] wifi: rtw89: coex: Add firmware 0.35.111.X support for RTL8922A/D Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 04/14] wifi: rtw89: coex: Rearrange _ntfy_role_info info Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 05/14] wifi: rtw89: coex: Separate _ntfy_role_info into two function Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 06/14] wifi: rtw89: coex: Decrease Wi-Fi special packet protect time Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 07/14] wifi: rtw89: coex: complete GPIO debug configuration handler Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 08/14] wifi: rtw89: coex: Refine RF calibration notify flow Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 09/14] wifi: rtw89: coex: Fix log dump format with proper newline Ping-Ke Shih
2026-07-24 13:56 ` Ping-Ke Shih [this message]
2026-07-24 13:56 ` [PATCH rtw-next 11/14] wifi: rtw89: coex: Add dual Bluetooth debug info dump Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 12/14] wifi: rtw89: coex: Fix TDMA v8 handling to unblock BTC report parsing Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 13/14] wifi: rtw89: coex: Fix H2C command redundant send & version fall through Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 14/14] wifi: rtw89: coex: Handle Bluetooth LE-Audio related coexistence feature 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=20260724135640.3195044-11-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