From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <ku920601@realtek.com>
Subject: [PATCH rtw-next 10/11] wifi: rtw89: coex: update external control length by case
Date: Sun, 12 Jul 2026 11:05:05 +0800 [thread overview]
Message-ID: <20260712030506.43438-11-pkshih@realtek.com> (raw)
In-Reply-To: <20260712030506.43438-1-pkshih@realtek.com>
From: Ching-Te Ku <ku920601@realtek.com>
Update recommend external control slot length to driver. Some of the
Wi-Fi feature has its time slot requirement can not be simply controlled
by coexistence firmware TDMA timer. For example: Wi-Fi scan/MCC etc.
In the same time, coexistence need to tell driver the recommend Bluetooth
slot length to make sure Bluetooth can still has enough time slot to
traffic.
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 | 70 +++++++++++++++++++++++
drivers/net/wireless/realtek/rtw89/core.c | 11 ++--
drivers/net/wireless/realtek/rtw89/core.h | 4 +-
3 files changed, 80 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
index c2356d6d9811..a6b1aa2cb24e 100644
--- a/drivers/net/wireless/realtek/rtw89/coex.c
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
@@ -526,6 +526,14 @@ enum btc_cx_poicy_main_type {
BTC_CXP_MAIN_MAX
};
+enum btc_bslot_length {
+ BTC_BSLOT_A2DP_HID = 60,
+ BTC_BSLOT_A2DP = 50,
+ BTC_BSLOT_A2DP_2 = 40,
+ BTC_BSLOT_INQ = 30,
+ BTC_BSLOT_IDLE = 20,
+};
+
enum btc_cx_poicy_type {
/* TDMA off + pri: BT > WL */
BTC_CXP_OFF_BT = (BTC_CXP_OFF << 8) | 0,
@@ -5989,6 +5997,67 @@ static void _set_wl_tx_limit(struct rtw89_dev *rtwdev)
&data);
}
+static void _set_phl_bt_slot_req(struct rtw89_dev *rtwdev)
+{
+ struct rtw89_btc *btc = &rtwdev->btc;
+ struct rtw89_btc_cx *cx = &btc->cx;
+ struct rtw89_btc_wl_info *wl = &cx->wl;
+ struct rtw89_btc_dm *dm = &btc->dm;
+ u8 len = 0;
+ u8 i;
+
+ /* don't change bt slot req state during RFK for p2p/mcc case */
+ if (dm->run_reason == BTC_RSN_NTFY_WL_RFK ||
+ wl->status.map.transacting)
+ return;
+
+ /* enable bt-slot req if ext-slot-control */
+ if (dm->tdma_now.type == CXTDMA_OFF &&
+ dm->tdma_now.ext_ctrl == CXECTL_EXT &&
+ dm->tdd_bind.bt_sel != 0) {
+ if (btc->cx.wl.status.val & btc_scanning_map.val)
+ btc->bt_req_en = false;
+ else
+ btc->bt_req_en = true;
+ } else {
+ btc->bt_req_en = false;
+ }
+
+ if (dm->slot_req_more) {
+ len = BTC_BSLOT_A2DP_HID;
+ } else {
+ if (dm->tdd_bind.bt_link_weight >= BTC_BSLOT_A2DP_HID)
+ len = BTC_BSLOT_A2DP_HID;
+ else if (dm->tdd_bind.bt_link_weight <= BTC_BSLOT_IDLE)
+ len = BTC_BSLOT_IDLE;
+ else
+ len = dm->tdd_bind.bt_link_weight;
+ }
+
+ if (dm->tdd_bind.rf_band == BIT(RTW89_BAND_5G))
+ len = 100 - len;
+
+ if (!btc->bt_req_en)
+ len = 0;
+
+ for (i = RTW89_PHY_0; i < RTW89_PHY_NUM; i++) {
+ if (!(dm->tdd_bind.wl_hwb_sel & BIT(i)))
+ continue;
+
+ if (len == btc->bt_req_len[i])
+ continue;
+
+ btc->bt_req_len[i] = len;
+
+ rtw89_core_ntfy_btc_event(rtwdev,
+ RTW89_BTC_HMSG_SET_BT_REQ_SLOT, i);
+
+ rtw89_debug(rtwdev, RTW89_DBG_BTC,
+ "[BTC], %s(): HWB%d bt_req_len = %d\n",
+ __func__, i, btc->bt_req_len[i]);
+ }
+}
+
static void _set_bt_rx_agc(struct rtw89_dev *rtwdev)
{
struct rtw89_btc *btc = &rtwdev->btc;
@@ -6148,6 +6217,7 @@ static void _action_common(struct rtw89_dev *rtwdev)
_set_btg_ctrl(rtwdev);
_set_wl_preagc_ctrl(rtwdev);
_set_wl_tx_limit(rtwdev);
+ _set_phl_bt_slot_req(rtwdev);
_set_bt_afh_info(rtwdev);
_set_bt_rx_agc(rtwdev);
_set_rf_trx_para(rtwdev);
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 0343cd1a0ee1..30a8e337498e 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -6539,15 +6539,18 @@ void rtw89_complete_cond(struct rtw89_wait_info *wait, unsigned int cond,
rtw89_complete_cond_resp(resp, data);
}
-void rtw89_core_ntfy_btc_event(struct rtw89_dev *rtwdev, enum rtw89_btc_hmsg event)
+void rtw89_core_ntfy_btc_event(struct rtw89_dev *rtwdev,
+ enum rtw89_btc_hmsg event,
+ enum rtw89_phy_idx phy_idx)
{
- u16 bt_req_len;
+ u16 bt_slot_req[RTW89_PHY_NUM];
switch (event) {
case RTW89_BTC_HMSG_SET_BT_REQ_SLOT:
- bt_req_len = rtw89_coex_query_bt_req_len(rtwdev, RTW89_PHY_0);
+ bt_slot_req[phy_idx] = rtw89_coex_query_bt_req_len(rtwdev, phy_idx);
rtw89_debug(rtwdev, RTW89_DBG_BTC,
- "coex updates BT req len to %d TU\n", bt_req_len);
+ "coex updates PHY-%d BT req len to %d TU\n",
+ phy_idx, bt_slot_req[phy_idx]);
rtw89_queue_chanctx_change(rtwdev, RTW89_CHANCTX_BT_SLOT_CHANGE);
break;
default:
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index e7e72f742847..c8b5c9ed55be 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -8866,7 +8866,9 @@ int rtw89_reg_6ghz_recalc(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvi
void rtw89_core_update_p2p_ps(struct rtw89_dev *rtwdev,
struct rtw89_vif_link *rtwvif_link,
struct ieee80211_bss_conf *bss_conf);
-void rtw89_core_ntfy_btc_event(struct rtw89_dev *rtwdev, enum rtw89_btc_hmsg event);
+void rtw89_core_ntfy_btc_event(struct rtw89_dev *rtwdev,
+ enum rtw89_btc_hmsg event,
+ enum rtw89_phy_idx phy_idx);
int rtw89_core_mlsr_switch(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
unsigned int link_id);
void rtw89_core_dm_disable_cfg(struct rtw89_dev *rtwdev, u32 new);
--
2.25.1
next prev parent reply other threads:[~2026-07-12 3:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-12 3:04 [PATCH rtw-next 00/11] wifi: rtw89: coex: implement coex for RTL8922D Ping-Ke Shih
2026-07-12 3:04 ` [PATCH rtw-next 01/11] wifi: rtw89: coex: Add Wi-Fi role info version 10 Ping-Ke Shih
2026-07-12 3:04 ` [PATCH rtw-next 02/11] wifi: rtw89: coex: Rearrange coexistence control structure Ping-Ke Shih
2026-07-12 3:04 ` [PATCH rtw-next 03/11] wifi: rtw89: coex: Update driver outsource info to firmware version 6 Ping-Ke Shih
2026-07-12 3:04 ` [PATCH rtw-next 04/11] wifi: rtw89: ceox: Update antenna & grant signal setting Ping-Ke Shih
2026-07-12 3:05 ` [PATCH rtw-next 05/11] wifi: rtw89: coex: Rearrange Bluetooth firmware report entry Ping-Ke Shih
2026-07-12 3:05 ` [PATCH rtw-next 06/11] wifi: rtw89: coex: Refine send firmware command function Ping-Ke Shih
2026-07-12 3:05 ` [PATCH rtw-next 07/11] wifi: rtw89: coex: Refine _reset_btc_var() Ping-Ke Shih
2026-07-12 3:05 ` [PATCH rtw-next 08/11] wifi: rtw89: coex: Correct SET_RFE settings Ping-Ke Shih
2026-07-12 3:05 ` [PATCH rtw-next 09/11] wifi: rtw89: coex: Add firmware report control report v11 Ping-Ke Shih
2026-07-12 3:05 ` Ping-Ke Shih [this message]
2026-07-12 3:05 ` [PATCH rtw-next 11/11] wifi: rtw89: coex: Update coexistence version to 9.24.0 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=20260712030506.43438-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