wifi: rtw89: coex: update external control length by case

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>
Link: https://patch.msgid.link/20260712030506.43438-11-pkshih@realtek.com
This commit is contained in:
Ching-Te Ku
2026-07-12 11:05:05 +08:00
committed by Ping-Ke Shih
parent 578f9b4827
commit aed0d7771d
3 changed files with 80 additions and 5 deletions

View File

@@ -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);

View File

@@ -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:

View File

@@ -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);