Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <ku920601@realtek.com>
Subject: [PATCH rtw-next 10/15] wifi: rtw89: coex: store BT TX power per device and per RF band
Date: Sun, 4 Oct 2026 11:45:15 +0800	[thread overview]
Message-ID: <20261004034520.33695-11-pkshih@realtek.com> (raw)
In-Reply-To: <20261004034520.33695-1-pkshih@realtek.com>

From: Ching-Te Ku <ku920601@realtek.com>

A BT TX power report identifies which BT device came from, in bit 7
of its second byte, whether it describes that device's 2.4 GHz
or 5/6 GHz link. The handler ignored both and always wrote the first
BT device's 2.4 GHz link info.

On a chip with two BT devices or with 5/6 GHz BT support, the reported
power therefore never reached the second device or the 5/6 GHz link.
The TDD/FDD switch threshold reads exactly those fields when the WL
link is not on 2.4 GHz or when it scores the second BT, so on those
paths it kept comparing against the reset default instead of what BT
actually transmits at.

Select the device from the report's own index and the link from its
band bit, the same way the other BT mailbox reports already do.

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 | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
index ebc4b1b415c8..c25bc9e619ce 100644
--- a/drivers/net/wireless/realtek/rtw89/coex.c
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
@@ -8542,14 +8542,23 @@ static void _update_bt_bistdma_info(struct rtw89_dev *rtwdev, u8 bid,
 }
 
 #define BTC_BTINFO_PWR_LEN 5
-static void _update_bt_txpwr_info(struct rtw89_dev *rtwdev, u8 *buf, u32 len)
+static void _update_bt_txpwr_info(struct rtw89_dev *rtwdev, u8 bid, u8 *buf,
+				  u32 len)
 {
-	struct rtw89_btc_bt_info *bt = &rtwdev->btc.cx.bt0;
-	struct rtw89_btc_bt_link_info *b = &bt->link_info;
+	struct rtw89_btc_cx *cx = &rtwdev->btc.cx;
+	struct rtw89_btc_bt_link_info *b;
+	struct rtw89_btc_bt_info *bt;
 
 	if (len != BTC_BTINFO_PWR_LEN)
 		return;
 
+	bt = bid == BTC_BT_1ST ? &cx->bt0 : &cx->bt1;
+
+	if ((buf[BTC_BTINFO_L1] & BIT(7)) && bt->band_56G_support)
+		b = &bt->link_info_56g;
+	else
+		b = &bt->link_info;
+
 	if (!memcmp(bt->txpwr_info, buf, sizeof(bt->txpwr_info))) {
 		rtw89_debug(rtwdev, RTW89_DBG_BTC,
 			    "[BTC], %s return by info duplicate!\n", __func__);
@@ -10594,7 +10603,7 @@ void rtw89_btc_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,
 		break;
 	case BTF_EVNT_BT_QUERY_TXPWR:
 		bt->bcnt[BTC_BCNT_TXPWR_UPDATE]++;
-		_update_bt_txpwr_info(rtwdev, buf, len);
+		_update_bt_txpwr_info(rtwdev, bid, buf, len);
 	}
 }
 
-- 
2.25.1


  parent reply	other threads:[~2026-10-04  3:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-04  3:45 [PATCH rtw-next 00/15] wifi: rtw89: coex: update BT-coexistence along changes of newer firmware Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 01/15] wifi: rtw89: coex: fix RF band check in _set_rf_trx_para() and its propagation Ping-Ke Shih
2026-10-07  4:19   ` Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 02/15] wifi: rtw89: coex: track per-HW-band WL role fields with arrays Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 03/15] wifi: rtw89: coex: show per-HW-band MLO state in WL status dump Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 04/15] wifi: rtw89: coex: add outsrc-set-info v7 for BT SPDT state Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 05/15] wifi: rtw89: coex: compute WL/BT cross-talk interference maps Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 06/15] wifi: rtw89: coex: add 1SS MIMO-PS decision for dual-BT CIS Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 07/15] wifi: rtw89: coex: add firmware 0.35.119.3 support for RTL8922A/D Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 08/15] wifi: rtw89: coex: raise default BT TX power to 10 dBm Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 09/15] wifi: rtw89: coex: bind the RF band in use while WL is doing RFK Ping-Ke Shih
2026-10-04  3:45 ` Ping-Ke Shih [this message]
2026-10-04  3:45 ` [PATCH rtw-next 11/15] wifi: rtw89: coex: set the WL/BT antenna map on shared-antenna chips Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 12/15] wifi: rtw89: coex: use the right switch-type enum on RTL8922D Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 13/15] wifi: rtw89: phy: Implement API to control BTG to turn on/off BT TX/RX Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 14/15] wifi: rtw89: coex: turn BT TX/RX on and off through the BTG control Ping-Ke Shih
2026-10-04  3:45 ` [PATCH rtw-next 15/15] wifi: rtw89: coex: set rf_combination in _update_wl_mlo_info() 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=20261004034520.33695-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