mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-11 15:21:16 -05:00
Merge tag 'rtw-next-2024-09-05' of https://github.com/pkshih/rtw
rtw-next patches for v6.12 The rtw89 is continuously adjusting code to support MLO. The major changes are listed below: rtw88: * fix USB not transmitting beacon in AP mode rtw89: * complete BT-coexistence code for RTL8852BT * fix throughput degrade of VHT rate for RTL8851B/8852A/8852B/8852BT * enable WoWLAN net-detect for more one chip, RTL8922A
This commit is contained in:
@@ -2194,7 +2194,6 @@ static void rtw_coex_action_bt_a2dp_pan(struct rtw_dev *rtwdev)
|
||||
struct rtw_coex_stat *coex_stat = &coex->stat;
|
||||
struct rtw_efuse *efuse = &rtwdev->efuse;
|
||||
u8 table_case, tdma_case;
|
||||
bool wl_cpt_test = false, bt_cpt_test = false;
|
||||
|
||||
rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__);
|
||||
|
||||
@@ -2202,29 +2201,16 @@ static void rtw_coex_action_bt_a2dp_pan(struct rtw_dev *rtwdev)
|
||||
rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]);
|
||||
if (efuse->share_ant) {
|
||||
/* Shared-Ant */
|
||||
if (wl_cpt_test) {
|
||||
if (coex_stat->wl_gl_busy) {
|
||||
table_case = 20;
|
||||
tdma_case = 17;
|
||||
} else {
|
||||
table_case = 10;
|
||||
tdma_case = 15;
|
||||
}
|
||||
} else if (bt_cpt_test) {
|
||||
table_case = 26;
|
||||
tdma_case = 26;
|
||||
} else {
|
||||
if (coex_stat->wl_gl_busy &&
|
||||
coex_stat->wl_noisy_level == 0)
|
||||
table_case = 14;
|
||||
else
|
||||
table_case = 10;
|
||||
if (coex_stat->wl_gl_busy &&
|
||||
coex_stat->wl_noisy_level == 0)
|
||||
table_case = 14;
|
||||
else
|
||||
table_case = 10;
|
||||
|
||||
if (coex_stat->wl_gl_busy)
|
||||
tdma_case = 15;
|
||||
else
|
||||
tdma_case = 20;
|
||||
}
|
||||
if (coex_stat->wl_gl_busy)
|
||||
tdma_case = 15;
|
||||
else
|
||||
tdma_case = 20;
|
||||
} else {
|
||||
/* Non-Shared-Ant */
|
||||
table_case = 112;
|
||||
@@ -2235,11 +2221,7 @@ static void rtw_coex_action_bt_a2dp_pan(struct rtw_dev *rtwdev)
|
||||
tdma_case = 120;
|
||||
}
|
||||
|
||||
if (wl_cpt_test)
|
||||
rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[1]);
|
||||
else
|
||||
rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]);
|
||||
|
||||
rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]);
|
||||
rtw_coex_table(rtwdev, false, table_case);
|
||||
rtw_coex_tdma(rtwdev, false, tdma_case);
|
||||
}
|
||||
|
||||
@@ -1468,10 +1468,12 @@ int rtw_fw_write_data_rsvd_page(struct rtw_dev *rtwdev, u16 pg_addr,
|
||||
val |= BIT_ENSWBCN >> 8;
|
||||
rtw_write8(rtwdev, REG_CR + 1, val);
|
||||
|
||||
val = rtw_read8(rtwdev, REG_FWHW_TXQ_CTRL + 2);
|
||||
bckp[1] = val;
|
||||
val &= ~(BIT_EN_BCNQ_DL >> 16);
|
||||
rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 2, val);
|
||||
if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE) {
|
||||
val = rtw_read8(rtwdev, REG_FWHW_TXQ_CTRL + 2);
|
||||
bckp[1] = val;
|
||||
val &= ~(BIT_EN_BCNQ_DL >> 16);
|
||||
rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 2, val);
|
||||
}
|
||||
|
||||
ret = rtw_hci_write_data_rsvd_page(rtwdev, buf, size);
|
||||
if (ret) {
|
||||
@@ -1496,7 +1498,8 @@ int rtw_fw_write_data_rsvd_page(struct rtw_dev *rtwdev, u16 pg_addr,
|
||||
rsvd_pg_head = rtwdev->fifo.rsvd_boundary;
|
||||
rtw_write16(rtwdev, REG_FIFOPAGE_CTRL_2,
|
||||
rsvd_pg_head | BIT_BCN_VALID_V1);
|
||||
rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 2, bckp[1]);
|
||||
if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE)
|
||||
rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 2, bckp[1]);
|
||||
rtw_write8(rtwdev, REG_CR + 1, bckp[0]);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -167,6 +167,12 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw,
|
||||
|
||||
mutex_lock(&rtwdev->mutex);
|
||||
|
||||
rtwvif->mac_id = rtw_acquire_macid(rtwdev);
|
||||
if (rtwvif->mac_id >= RTW_MAX_MAC_ID_NUM) {
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
port = find_first_zero_bit(rtwdev->hw_port, RTW_PORT_NUM);
|
||||
if (port >= RTW_PORT_NUM) {
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
@@ -214,7 +220,8 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw,
|
||||
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
|
||||
rtw_dbg(rtwdev, RTW_DBG_STATE, "start vif %pM on port %d\n", vif->addr, rtwvif->port);
|
||||
rtw_dbg(rtwdev, RTW_DBG_STATE, "start vif %pM mac_id %d on port %d\n",
|
||||
vif->addr, rtwvif->mac_id, rtwvif->port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -225,7 +232,8 @@ static void rtw_ops_remove_interface(struct ieee80211_hw *hw,
|
||||
struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv;
|
||||
u32 config = 0;
|
||||
|
||||
rtw_dbg(rtwdev, RTW_DBG_STATE, "stop vif %pM on port %d\n", vif->addr, rtwvif->port);
|
||||
rtw_dbg(rtwdev, RTW_DBG_STATE, "stop vif %pM mac_id %d on port %d\n",
|
||||
vif->addr, rtwvif->mac_id, rtwvif->port);
|
||||
|
||||
mutex_lock(&rtwdev->mutex);
|
||||
|
||||
@@ -242,6 +250,7 @@ static void rtw_ops_remove_interface(struct ieee80211_hw *hw,
|
||||
config |= PORT_SET_BCN_CTRL;
|
||||
rtw_vif_port_config(rtwdev, rtwvif, config);
|
||||
clear_bit(rtwvif->port, rtwdev->hw_port);
|
||||
rtw_release_macid(rtwdev, rtwvif->mac_id);
|
||||
rtw_recalc_lps(rtwdev, NULL);
|
||||
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
|
||||
@@ -311,17 +311,6 @@ static void rtw_ips_work(struct work_struct *work)
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
}
|
||||
|
||||
static u8 rtw_acquire_macid(struct rtw_dev *rtwdev)
|
||||
{
|
||||
unsigned long mac_id;
|
||||
|
||||
mac_id = find_first_zero_bit(rtwdev->mac_id_map, RTW_MAX_MAC_ID_NUM);
|
||||
if (mac_id < RTW_MAX_MAC_ID_NUM)
|
||||
set_bit(mac_id, rtwdev->mac_id_map);
|
||||
|
||||
return mac_id;
|
||||
}
|
||||
|
||||
static void rtw_sta_rc_work(struct work_struct *work)
|
||||
{
|
||||
struct rtw_sta_info *si = container_of(work, struct rtw_sta_info,
|
||||
@@ -340,12 +329,14 @@ int rtw_sta_add(struct rtw_dev *rtwdev, struct ieee80211_sta *sta,
|
||||
struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv;
|
||||
int i;
|
||||
|
||||
si->mac_id = rtw_acquire_macid(rtwdev);
|
||||
if (si->mac_id >= RTW_MAX_MAC_ID_NUM)
|
||||
return -ENOSPC;
|
||||
if (vif->type == NL80211_IFTYPE_STATION) {
|
||||
si->mac_id = rtwvif->mac_id;
|
||||
} else {
|
||||
si->mac_id = rtw_acquire_macid(rtwdev);
|
||||
if (si->mac_id >= RTW_MAX_MAC_ID_NUM)
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
if (vif->type == NL80211_IFTYPE_STATION && vif->cfg.assoc == 0)
|
||||
rtwvif->mac_id = si->mac_id;
|
||||
si->rtwdev = rtwdev;
|
||||
si->sta = sta;
|
||||
si->vif = vif;
|
||||
@@ -370,11 +361,13 @@ void rtw_sta_remove(struct rtw_dev *rtwdev, struct ieee80211_sta *sta,
|
||||
bool fw_exist)
|
||||
{
|
||||
struct rtw_sta_info *si = (struct rtw_sta_info *)sta->drv_priv;
|
||||
struct ieee80211_vif *vif = si->vif;
|
||||
int i;
|
||||
|
||||
cancel_work_sync(&si->rc_work);
|
||||
|
||||
rtw_release_macid(rtwdev, si->mac_id);
|
||||
if (vif->type != NL80211_IFTYPE_STATION)
|
||||
rtw_release_macid(rtwdev, si->mac_id);
|
||||
if (fw_exist)
|
||||
rtw_fw_media_status_report(rtwdev, si->mac_id, false);
|
||||
|
||||
@@ -614,6 +607,8 @@ static void rtw_reset_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
|
||||
rtw_bf_disassoc(rtwdev, vif, NULL);
|
||||
rtw_vif_assoc_changed(rtwvif, NULL);
|
||||
rtw_txq_cleanup(rtwdev, vif->txq);
|
||||
|
||||
rtw_release_macid(rtwdev, rtwvif->mac_id);
|
||||
}
|
||||
|
||||
void rtw_fw_recovery(struct rtw_dev *rtwdev)
|
||||
@@ -2139,7 +2134,6 @@ int rtw_core_init(struct rtw_dev *rtwdev)
|
||||
rtwdev->sec.total_cam_num = 32;
|
||||
rtwdev->hal.current_channel = 1;
|
||||
rtwdev->dm_info.fix_rate = U8_MAX;
|
||||
set_bit(RTW_BC_MC_MACID, rtwdev->mac_id_map);
|
||||
|
||||
rtw_stats_init(rtwdev);
|
||||
|
||||
|
||||
@@ -742,7 +742,6 @@ struct rtw_txq {
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
#define RTW_BC_MC_MACID 1
|
||||
DECLARE_EWMA(rssi, 10, 16);
|
||||
|
||||
struct rtw_sta_info {
|
||||
@@ -805,7 +804,7 @@ struct rtw_bf_info {
|
||||
struct rtw_vif {
|
||||
enum rtw_net_type net_type;
|
||||
u16 aid;
|
||||
u8 mac_id; /* for STA mode only */
|
||||
u8 mac_id;
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
u8 bssid[ETH_ALEN];
|
||||
u8 port;
|
||||
@@ -2131,6 +2130,17 @@ static inline bool rtw_chip_has_tx_stbc(struct rtw_dev *rtwdev)
|
||||
return rtwdev->chip->tx_stbc;
|
||||
}
|
||||
|
||||
static inline u8 rtw_acquire_macid(struct rtw_dev *rtwdev)
|
||||
{
|
||||
unsigned long mac_id;
|
||||
|
||||
mac_id = find_first_zero_bit(rtwdev->mac_id_map, RTW_MAX_MAC_ID_NUM);
|
||||
if (mac_id < RTW_MAX_MAC_ID_NUM)
|
||||
set_bit(mac_id, rtwdev->mac_id_map);
|
||||
|
||||
return mac_id;
|
||||
}
|
||||
|
||||
static inline void rtw_release_macid(struct rtw_dev *rtwdev, u8 mac_id)
|
||||
{
|
||||
clear_bit(mac_id, rtwdev->mac_id_map);
|
||||
|
||||
@@ -46,7 +46,8 @@ void rtw_tx_fill_tx_desc(struct rtw_tx_pkt_info *pkt_info, struct sk_buff *skb)
|
||||
le32_encode_bits(pkt_info->ls, RTW_TX_DESC_W0_LS) |
|
||||
le32_encode_bits(pkt_info->dis_qselseq, RTW_TX_DESC_W0_DISQSELSEQ);
|
||||
|
||||
tx_desc->w1 = le32_encode_bits(pkt_info->qsel, RTW_TX_DESC_W1_QSEL) |
|
||||
tx_desc->w1 = le32_encode_bits(pkt_info->mac_id, RTW_TX_DESC_W1_MACID) |
|
||||
le32_encode_bits(pkt_info->qsel, RTW_TX_DESC_W1_QSEL) |
|
||||
le32_encode_bits(pkt_info->rate_id, RTW_TX_DESC_W1_RATE_ID) |
|
||||
le32_encode_bits(pkt_info->sec_type, RTW_TX_DESC_W1_SEC_TYPE) |
|
||||
le32_encode_bits(pkt_info->pkt_offset, RTW_TX_DESC_W1_PKT_OFFSET) |
|
||||
@@ -401,14 +402,18 @@ void rtw_tx_pkt_info_update(struct rtw_dev *rtwdev,
|
||||
const struct rtw_chip_info *chip = rtwdev->chip;
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||
struct ieee80211_vif *vif = info->control.vif;
|
||||
struct rtw_sta_info *si;
|
||||
struct ieee80211_vif *vif = NULL;
|
||||
struct rtw_vif *rtwvif;
|
||||
__le16 fc = hdr->frame_control;
|
||||
bool bmc;
|
||||
|
||||
if (sta) {
|
||||
si = (struct rtw_sta_info *)sta->drv_priv;
|
||||
vif = si->vif;
|
||||
pkt_info->mac_id = si->mac_id;
|
||||
} else if (vif) {
|
||||
rtwvif = (struct rtw_vif *)vif->drv_priv;
|
||||
pkt_info->mac_id = rtwvif->mac_id;
|
||||
}
|
||||
|
||||
if (ieee80211_is_mgmt(fc) || ieee80211_is_nullfunc(fc))
|
||||
|
||||
@@ -27,6 +27,7 @@ struct rtw_tx_desc {
|
||||
#define RTW_TX_DESC_W0_BMC BIT(24)
|
||||
#define RTW_TX_DESC_W0_LS BIT(26)
|
||||
#define RTW_TX_DESC_W0_DISQSELSEQ BIT(31)
|
||||
#define RTW_TX_DESC_W1_MACID GENMASK(7, 0)
|
||||
#define RTW_TX_DESC_W1_QSEL GENMASK(12, 8)
|
||||
#define RTW_TX_DESC_W1_RATE_ID GENMASK(20, 16)
|
||||
#define RTW_TX_DESC_W1_SEC_TYPE GENMASK(23, 22)
|
||||
|
||||
@@ -191,7 +191,7 @@ void rtw89_config_roc_chandef(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_chanctx_idx cur;
|
||||
|
||||
if (chandef) {
|
||||
cur = atomic_cmpxchg(&hal->roc_entity_idx,
|
||||
cur = atomic_cmpxchg(&hal->roc_chanctx_idx,
|
||||
RTW89_CHANCTX_IDLE, idx);
|
||||
if (cur != RTW89_CHANCTX_IDLE) {
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TXRX,
|
||||
@@ -201,7 +201,7 @@ void rtw89_config_roc_chandef(struct rtw89_dev *rtwdev,
|
||||
|
||||
hal->roc_chandef = *chandef;
|
||||
} else {
|
||||
cur = atomic_cmpxchg(&hal->roc_entity_idx, idx,
|
||||
cur = atomic_cmpxchg(&hal->roc_chanctx_idx, idx,
|
||||
RTW89_CHANCTX_IDLE);
|
||||
if (cur == idx)
|
||||
return;
|
||||
@@ -230,7 +230,7 @@ void rtw89_entity_init(struct rtw89_dev *rtwdev)
|
||||
hal->entity_pause = false;
|
||||
bitmap_zero(hal->entity_map, NUM_OF_RTW89_CHANCTX);
|
||||
bitmap_zero(hal->changes, NUM_OF_RTW89_CHANCTX_CHANGES);
|
||||
atomic_set(&hal->roc_entity_idx, RTW89_CHANCTX_IDLE);
|
||||
atomic_set(&hal->roc_chanctx_idx, RTW89_CHANCTX_IDLE);
|
||||
rtw89_config_default_chandef(rtwdev);
|
||||
}
|
||||
|
||||
@@ -2395,11 +2395,11 @@ static void rtw89_swap_chanctx(struct rtw89_dev *rtwdev,
|
||||
rtwvif->chanctx_idx = idx1;
|
||||
}
|
||||
|
||||
cur = atomic_read(&hal->roc_entity_idx);
|
||||
cur = atomic_read(&hal->roc_chanctx_idx);
|
||||
if (cur == idx1)
|
||||
atomic_set(&hal->roc_entity_idx, idx2);
|
||||
atomic_set(&hal->roc_chanctx_idx, idx2);
|
||||
else if (cur == idx2)
|
||||
atomic_set(&hal->roc_entity_idx, idx1);
|
||||
atomic_set(&hal->roc_chanctx_idx, idx1);
|
||||
}
|
||||
|
||||
int rtw89_chanctx_ops_add(struct rtw89_dev *rtwdev,
|
||||
|
||||
@@ -129,6 +129,13 @@ static const u32 cxtbl[] = {
|
||||
|
||||
static const struct rtw89_btc_ver rtw89_btc_ver_defs[] = {
|
||||
/* firmware version must be in decreasing order for each chip */
|
||||
{RTL8852BT, RTW89_FW_VER_CODE(0, 29, 90, 0),
|
||||
.fcxbtcrpt = 7, .fcxtdma = 7, .fcxslots = 7, .fcxcysta = 7,
|
||||
.fcxstep = 7, .fcxnullsta = 7, .fcxmreg = 7, .fcxgpiodbg = 7,
|
||||
.fcxbtver = 7, .fcxbtscan = 7, .fcxbtafh = 7, .fcxbtdevinfo = 7,
|
||||
.fwlrole = 7, .frptmap = 3, .fcxctrl = 7, .fcxinit = 7,
|
||||
.fwevntrptl = 1, .drvinfo_type = 1, .info_buf = 1800, .max_role_num = 6,
|
||||
},
|
||||
{RTL8922A, RTW89_FW_VER_CODE(0, 35, 8, 0),
|
||||
.fcxbtcrpt = 8, .fcxtdma = 7, .fcxslots = 7, .fcxcysta = 7,
|
||||
.fcxstep = 7, .fcxnullsta = 7, .fcxmreg = 7, .fcxgpiodbg = 7,
|
||||
@@ -1351,6 +1358,10 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pfinfo = &pfwinfo->rpt_ctrl.finfo.v8;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v8);
|
||||
break;
|
||||
} else if (ver->fcxbtcrpt == 7) {
|
||||
pfinfo = &pfwinfo->rpt_ctrl.finfo.v7;
|
||||
pcinfo->req_len = sizeof(pfwinfo->rpt_ctrl.finfo.v7);
|
||||
break;
|
||||
} else {
|
||||
goto err;
|
||||
}
|
||||
@@ -1655,6 +1666,38 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
|
||||
pfwinfo->event[BTF_EVNT_RPT]);
|
||||
|
||||
dm->error.map.bt_rfk_timeout = bt->rfk_info.map.timeout;
|
||||
} else if (ver->fcxbtcrpt == 7) {
|
||||
prpt->v7 = pfwinfo->rpt_ctrl.finfo.v7;
|
||||
pfwinfo->rpt_en_map = le32_to_cpu(prpt->v7.rpt_info.en);
|
||||
wl->ver_info.fw_coex = le32_to_cpu(prpt->v7.rpt_info.cx_ver);
|
||||
wl->ver_info.fw = le32_to_cpu(prpt->v7.rpt_info.fw_ver);
|
||||
|
||||
for (i = RTW89_PHY_0; i < RTW89_PHY_MAX; i++)
|
||||
memcpy(&dm->gnt.band[i], &prpt->v7.gnt_val[i][0],
|
||||
sizeof(dm->gnt.band[i]));
|
||||
|
||||
btc->cx.cnt_bt[BTC_BCNT_HIPRI_TX] =
|
||||
le16_to_cpu(prpt->v7.bt_cnt[BTC_BCNT_HI_TX_V105]);
|
||||
btc->cx.cnt_bt[BTC_BCNT_HIPRI_RX] =
|
||||
le16_to_cpu(prpt->v7.bt_cnt[BTC_BCNT_HI_RX_V105]);
|
||||
btc->cx.cnt_bt[BTC_BCNT_LOPRI_TX] =
|
||||
le16_to_cpu(prpt->v7.bt_cnt[BTC_BCNT_LO_TX_V105]);
|
||||
btc->cx.cnt_bt[BTC_BCNT_LOPRI_RX] =
|
||||
le16_to_cpu(prpt->v7.bt_cnt[BTC_BCNT_LO_RX_V105]);
|
||||
|
||||
val1 = le16_to_cpu(prpt->v7.bt_cnt[BTC_BCNT_POLLUTED_V105]);
|
||||
if (val1 > btc->cx.cnt_bt[BTC_BCNT_POLUT_NOW])
|
||||
val1 -= btc->cx.cnt_bt[BTC_BCNT_POLUT_NOW]; /* diff */
|
||||
|
||||
btc->cx.cnt_bt[BTC_BCNT_POLUT_DIFF] = val1;
|
||||
btc->cx.cnt_bt[BTC_BCNT_POLUT_NOW] =
|
||||
le16_to_cpu(prpt->v7.bt_cnt[BTC_BCNT_POLLUTED_V105]);
|
||||
|
||||
val1 = pfwinfo->event[BTF_EVNT_RPT];
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_BTCNT_HANG, 0);
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_RPT_HANG, val1);
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_WL_FW_VER_MATCH, 0);
|
||||
_chk_btc_err(rtwdev, BTC_DCNT_BTTX_HANG, 0);
|
||||
} else if (ver->fcxbtcrpt == 8) {
|
||||
prpt->v8 = pfwinfo->rpt_ctrl.finfo.v8;
|
||||
pfwinfo->rpt_en_map = le32_to_cpu(prpt->v8.rpt_info.en);
|
||||
@@ -2397,7 +2440,7 @@ static void rtw89_btc_fw_en_rpt(struct rtw89_dev *rtwdev,
|
||||
if (val == fwinfo->rpt_en_map)
|
||||
return;
|
||||
|
||||
if (btc->ver->fcxbtcrpt == 8) {
|
||||
if (btc->ver->fcxbtcrpt == 7 || btc->ver->fcxbtcrpt == 8) {
|
||||
r.v8.type = SET_REPORT_EN;
|
||||
r.v8.fver = btc->ver->fcxbtcrpt;
|
||||
r.v8.len = sizeof(r.v8.map);
|
||||
@@ -2567,6 +2610,10 @@ static void _fw_set_drv_info(struct rtw89_dev *rtwdev, u8 type)
|
||||
rtw89_fw_h2c_cxdrv_role_v1(rtwdev, type);
|
||||
else if (ver->fwlrole == 2)
|
||||
rtw89_fw_h2c_cxdrv_role_v2(rtwdev, type);
|
||||
else if (ver->fwlrole == 7)
|
||||
rtw89_fw_h2c_cxdrv_role_v7(rtwdev, type);
|
||||
else if (ver->fwlrole == 8)
|
||||
rtw89_fw_h2c_cxdrv_role_v8(rtwdev, type);
|
||||
break;
|
||||
case CXDRVINFO_CTRL:
|
||||
if (ver->drvinfo_type == 1)
|
||||
@@ -2748,7 +2795,7 @@ static void _set_gnt_v1(struct rtw89_dev *rtwdev, u8 phy_map,
|
||||
rtw89_mac_cfg_gnt_v2(rtwdev, &dm->gnt);
|
||||
}
|
||||
|
||||
#define BTC_TDMA_WLROLE_MAX 2
|
||||
#define BTC_TDMA_WLROLE_MAX 3
|
||||
|
||||
static void _set_bt_ignore_wlan_act(struct rtw89_dev *rtwdev, u8 enable)
|
||||
{
|
||||
@@ -2998,10 +3045,12 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)
|
||||
struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info;
|
||||
struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1;
|
||||
struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2;
|
||||
struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7;
|
||||
struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8;
|
||||
struct rtw89_btc_wl_active_role *r;
|
||||
struct rtw89_btc_wl_active_role_v1 *r1;
|
||||
struct rtw89_btc_wl_active_role_v2 *r2;
|
||||
struct rtw89_btc_wl_active_role_v7 *r7;
|
||||
struct rtw89_btc_wl_rlink *rlink;
|
||||
u8 en = 0, i, ch = 0, bw = 0;
|
||||
u8 mode, connect_cnt;
|
||||
@@ -3018,6 +3067,9 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)
|
||||
} else if (ver->fwlrole == 2) {
|
||||
mode = wl_rinfo_v2->link_mode;
|
||||
connect_cnt = wl_rinfo_v2->connect_cnt;
|
||||
} else if (ver->fwlrole == 7) {
|
||||
mode = wl_rinfo_v7->link_mode;
|
||||
connect_cnt = wl_rinfo_v7->connect_cnt;
|
||||
} else if (ver->fwlrole == 8) {
|
||||
mode = wl_rinfo_v8->link_mode;
|
||||
connect_cnt = wl_rinfo_v8->connect_cnt;
|
||||
@@ -3036,6 +3088,7 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)
|
||||
r = &wl_rinfo->active_role[i];
|
||||
r1 = &wl_rinfo_v1->active_role_v1[i];
|
||||
r2 = &wl_rinfo_v2->active_role_v2[i];
|
||||
r7 = &wl_rinfo_v7->active_role[i];
|
||||
rlink = &wl_rinfo_v8->rlink[i][0];
|
||||
|
||||
if (ver->fwlrole == 0 &&
|
||||
@@ -3056,6 +3109,12 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)
|
||||
ch = r2->ch;
|
||||
bw = r2->bw;
|
||||
break;
|
||||
} else if (ver->fwlrole == 7 &&
|
||||
(r7->role == RTW89_WIFI_ROLE_P2P_GO ||
|
||||
r7->role == RTW89_WIFI_ROLE_P2P_CLIENT)) {
|
||||
ch = r7->ch;
|
||||
bw = r7->bw;
|
||||
break;
|
||||
} else if (ver->fwlrole == 8 &&
|
||||
(rlink->role == RTW89_WIFI_ROLE_P2P_GO ||
|
||||
rlink->role == RTW89_WIFI_ROLE_P2P_CLIENT)) {
|
||||
@@ -3071,6 +3130,7 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)
|
||||
r = &wl_rinfo->active_role[i];
|
||||
r1 = &wl_rinfo_v1->active_role_v1[i];
|
||||
r2 = &wl_rinfo_v2->active_role_v2[i];
|
||||
r7 = &wl_rinfo_v7->active_role[i];
|
||||
rlink = &wl_rinfo_v8->rlink[i][0];
|
||||
|
||||
if (ver->fwlrole == 0 &&
|
||||
@@ -3088,6 +3148,11 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)
|
||||
ch = r2->ch;
|
||||
bw = r2->bw;
|
||||
break;
|
||||
} else if (ver->fwlrole == 7 &&
|
||||
r7->connected && r7->band == RTW89_BAND_2G) {
|
||||
ch = r7->ch;
|
||||
bw = r7->bw;
|
||||
break;
|
||||
} else if (ver->fwlrole == 8 &&
|
||||
rlink->connected && rlink->rf_band == RTW89_BAND_2G) {
|
||||
ch = rlink->ch;
|
||||
@@ -3146,6 +3211,7 @@ static bool _check_freerun(struct rtw89_dev *rtwdev)
|
||||
struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info;
|
||||
struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1;
|
||||
struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2;
|
||||
struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7;
|
||||
struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8;
|
||||
struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info;
|
||||
struct rtw89_btc_bt_hid_desc *hid = &bt_linfo->hid_desc;
|
||||
@@ -3164,6 +3230,8 @@ static bool _check_freerun(struct rtw89_dev *rtwdev)
|
||||
connect_cnt = wl_rinfo_v1->connect_cnt;
|
||||
else if (ver->fwlrole == 2)
|
||||
connect_cnt = wl_rinfo_v2->connect_cnt;
|
||||
else if (ver->fwlrole == 7)
|
||||
connect_cnt = wl_rinfo_v7->connect_cnt;
|
||||
else if (ver->fwlrole == 8)
|
||||
connect_cnt = wl_rinfo_v8->connect_cnt;
|
||||
|
||||
@@ -4082,6 +4150,8 @@ static void _set_ant_v0(struct rtw89_dev *rtwdev, bool force_exec,
|
||||
dbcc_chg = wl->role_info_v1.dbcc_chg;
|
||||
else if (btc->ver->fwlrole == 2)
|
||||
dbcc_chg = wl->role_info_v2.dbcc_chg;
|
||||
else if (btc->ver->fwlrole == 7)
|
||||
dbcc_chg = wl->role_info_v7.dbcc_chg;
|
||||
else if (btc->ver->fwlrole == 8)
|
||||
dbcc_chg = wl->role_info_v8.dbcc_chg;
|
||||
|
||||
@@ -4754,6 +4824,7 @@ static void _set_btg_ctrl(struct rtw89_dev *rtwdev)
|
||||
struct rtw89_btc_wl_info *wl = &btc->cx.wl;
|
||||
struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1;
|
||||
struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2;
|
||||
struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7;
|
||||
struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8;
|
||||
struct rtw89_btc_wl_role_info *wl_rinfo_v0 = &wl->role_info;
|
||||
struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info;
|
||||
@@ -4775,6 +4846,8 @@ static void _set_btg_ctrl(struct rtw89_dev *rtwdev)
|
||||
wl_rinfo.link_mode = wl_rinfo_v1->link_mode;
|
||||
else if (ver->fwlrole == 2)
|
||||
wl_rinfo.link_mode = wl_rinfo_v2->link_mode;
|
||||
else if (ver->fwlrole == 7)
|
||||
wl_rinfo.link_mode = wl_rinfo_v7->link_mode;
|
||||
else if (ver->fwlrole == 8)
|
||||
wl_rinfo.link_mode = wl_rinfo_v8->link_mode;
|
||||
else
|
||||
@@ -4790,6 +4863,8 @@ static void _set_btg_ctrl(struct rtw89_dev *rtwdev)
|
||||
wl_rinfo.dbcc_2g_phy = wl_rinfo_v1->dbcc_2g_phy;
|
||||
} else if (ver->fwlrole == 2) {
|
||||
wl_rinfo.dbcc_2g_phy = wl_rinfo_v2->dbcc_2g_phy;
|
||||
} else if (ver->fwlrole == 7) {
|
||||
wl_rinfo.dbcc_2g_phy = wl_rinfo_v7->dbcc_2g_phy;
|
||||
} else if (ver->fwlrole == 8) {
|
||||
wl_rinfo.dbcc_2g_phy = wl_rinfo_v8->dbcc_2g_phy;
|
||||
} else {
|
||||
@@ -4835,37 +4910,56 @@ static void _set_wl_preagc_ctrl(struct rtw89_dev *rtwdev)
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
struct rtw89_btc_bt_link_info *bt_linfo = &btc->cx.bt.link_info;
|
||||
struct rtw89_btc_wl_info *wl = &btc->cx.wl;
|
||||
struct rtw89_btc_wl_role_info_v2 *wl_rinfo = &wl->role_info_v2;
|
||||
struct rtw89_btc_wl_role_info_v2 *rinfo_v2 = &wl->role_info_v2;
|
||||
struct rtw89_btc_wl_role_info_v7 *rinfo_v7 = &wl->role_info_v7;
|
||||
struct rtw89_btc_wl_role_info_v8 *rinfo_v8 = &wl->role_info_v8;
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
const struct rtw89_btc_ver *ver = btc->ver;
|
||||
struct rtw89_btc_bt_info *bt = &btc->cx.bt;
|
||||
struct rtw89_btc_dm *dm = &btc->dm;
|
||||
u8 is_preagc, val;
|
||||
u8 is_preagc, val, link_mode, dbcc_2g_phy;
|
||||
u8 role_ver = rtwdev->btc.ver->fwlrole;
|
||||
bool dbcc_en;
|
||||
|
||||
if (btc->manual_ctrl)
|
||||
return;
|
||||
|
||||
if (wl_rinfo->link_mode == BTC_WLINK_25G_MCC)
|
||||
if (role_ver == 2) {
|
||||
dbcc_en = rinfo_v2->dbcc_en;
|
||||
link_mode = rinfo_v2->link_mode;
|
||||
dbcc_2g_phy = rinfo_v2->dbcc_2g_phy;
|
||||
} else if (role_ver == 7) {
|
||||
dbcc_en = rinfo_v7->dbcc_en;
|
||||
link_mode = rinfo_v7->link_mode;
|
||||
dbcc_2g_phy = rinfo_v7->dbcc_2g_phy;
|
||||
} else if (role_ver == 8) {
|
||||
dbcc_en = rinfo_v8->dbcc_en;
|
||||
link_mode = rinfo_v8->link_mode;
|
||||
dbcc_2g_phy = rinfo_v7->dbcc_2g_phy;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (link_mode == BTC_WLINK_25G_MCC) {
|
||||
is_preagc = BTC_PREAGC_BB_FWCTRL;
|
||||
else if (!(bt->run_patch_code && bt->enable.now))
|
||||
} else if (!(bt->run_patch_code && bt->enable.now)) {
|
||||
is_preagc = BTC_PREAGC_DISABLE;
|
||||
else if (wl_rinfo->link_mode == BTC_WLINK_5G)
|
||||
} else if (link_mode == BTC_WLINK_5G) {
|
||||
is_preagc = BTC_PREAGC_DISABLE;
|
||||
else if (wl_rinfo->link_mode == BTC_WLINK_NOLINK ||
|
||||
btc->cx.bt.link_info.profile_cnt.now == 0)
|
||||
} else if (link_mode == BTC_WLINK_NOLINK ||
|
||||
btc->cx.bt.link_info.profile_cnt.now == 0) {
|
||||
is_preagc = BTC_PREAGC_DISABLE;
|
||||
else if (dm->tdma_now.type != CXTDMA_OFF &&
|
||||
} else if (dm->tdma_now.type != CXTDMA_OFF &&
|
||||
!bt_linfo->hfp_desc.exist &&
|
||||
!bt_linfo->hid_desc.exist &&
|
||||
dm->fddt_train == BTC_FDDT_DISABLE)
|
||||
dm->fddt_train == BTC_FDDT_DISABLE) {
|
||||
is_preagc = BTC_PREAGC_DISABLE;
|
||||
else if (ver->fwlrole == 2 && wl_rinfo->dbcc_en &&
|
||||
wl_rinfo->dbcc_2g_phy != RTW89_PHY_1)
|
||||
} else if (dbcc_en && (dbcc_2g_phy != RTW89_PHY_1)) {
|
||||
is_preagc = BTC_PREAGC_DISABLE;
|
||||
else if (btc->ant_type == BTC_ANT_SHARED)
|
||||
} else if (btc->ant_type == BTC_ANT_SHARED) {
|
||||
is_preagc = BTC_PREAGC_DISABLE;
|
||||
else
|
||||
} else {
|
||||
is_preagc = BTC_PREAGC_ENABLE;
|
||||
}
|
||||
|
||||
if (dm->wl_pre_agc_rb != dm->wl_pre_agc &&
|
||||
dm->wl_pre_agc_rb != BTC_PREAGC_NOTFOUND) {
|
||||
@@ -4968,6 +5062,7 @@ static void _set_wl_tx_limit(struct rtw89_dev *rtwdev)
|
||||
struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info;
|
||||
struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1;
|
||||
struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2;
|
||||
struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7;
|
||||
struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8;
|
||||
struct rtw89_txtime_data data = {.rtwdev = rtwdev};
|
||||
u8 mode, igno_bt, tx_retry;
|
||||
@@ -4984,6 +5079,8 @@ static void _set_wl_tx_limit(struct rtw89_dev *rtwdev)
|
||||
mode = wl_rinfo_v1->link_mode;
|
||||
else if (ver->fwlrole == 2)
|
||||
mode = wl_rinfo_v2->link_mode;
|
||||
else if (ver->fwlrole == 7)
|
||||
mode = wl_rinfo_v7->link_mode;
|
||||
else if (ver->fwlrole == 8)
|
||||
mode = wl_rinfo_v8->link_mode;
|
||||
else
|
||||
@@ -5043,6 +5140,7 @@ static void _set_bt_rx_agc(struct rtw89_dev *rtwdev)
|
||||
struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info;
|
||||
struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1;
|
||||
struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2;
|
||||
struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7;
|
||||
struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8;
|
||||
struct rtw89_btc_bt_info *bt = &btc->cx.bt;
|
||||
bool bt_hi_lna_rx = false;
|
||||
@@ -5054,6 +5152,8 @@ static void _set_bt_rx_agc(struct rtw89_dev *rtwdev)
|
||||
mode = wl_rinfo_v1->link_mode;
|
||||
else if (ver->fwlrole == 2)
|
||||
mode = wl_rinfo_v2->link_mode;
|
||||
else if (ver->fwlrole == 7)
|
||||
mode = wl_rinfo_v7->link_mode;
|
||||
else if (ver->fwlrole == 8)
|
||||
mode = wl_rinfo_v8->link_mode;
|
||||
else
|
||||
@@ -5359,15 +5459,26 @@ static void _action_wl_2g_scc_v2(struct rtw89_dev *rtwdev)
|
||||
struct rtw89_btc_wl_info *wl = &btc->cx.wl;
|
||||
struct rtw89_btc_bt_info *bt = &btc->cx.bt;
|
||||
struct rtw89_btc_dm *dm = &btc->dm;
|
||||
struct rtw89_btc_wl_role_info_v2 *wl_rinfo = &wl->role_info_v2;
|
||||
struct rtw89_btc_wl_role_info_v2 *rinfo_v2 = &wl->role_info_v2;
|
||||
struct rtw89_btc_wl_role_info_v7 *rinfo_v7 = &wl->role_info_v7;
|
||||
u32 dur, mrole_type, mrole_noa_duration;
|
||||
u16 policy_type = BTC_CXP_OFF_BT;
|
||||
u32 dur;
|
||||
|
||||
if (btc->ver->fwlrole == 2) {
|
||||
mrole_type = rinfo_v2->mrole_type;
|
||||
mrole_noa_duration = rinfo_v2->mrole_noa_duration;
|
||||
} else if (btc->ver->fwlrole == 7) {
|
||||
mrole_type = rinfo_v7->mrole_type;
|
||||
mrole_noa_duration = rinfo_v7->mrole_noa_duration;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (btc->ant_type == BTC_ANT_DEDICATED) {
|
||||
policy_type = BTC_CXP_OFF_EQ0;
|
||||
} else {
|
||||
/* shared-antenna */
|
||||
switch (wl_rinfo->mrole_type) {
|
||||
switch (mrole_type) {
|
||||
case BTC_WLMROLE_STA_GC:
|
||||
dm->wl_scc.null_role1 = RTW89_WIFI_ROLE_STATION;
|
||||
dm->wl_scc.null_role2 = RTW89_WIFI_ROLE_P2P_CLIENT;
|
||||
@@ -5385,7 +5496,7 @@ static void _action_wl_2g_scc_v2(struct rtw89_dev *rtwdev)
|
||||
case BTC_WLMROLE_STA_GO_NOA:
|
||||
dm->wl_scc.null_role1 = RTW89_WIFI_ROLE_STATION;
|
||||
dm->wl_scc.null_role2 = RTW89_WIFI_ROLE_NONE;
|
||||
dur = wl_rinfo->mrole_noa_duration;
|
||||
dur = mrole_noa_duration;
|
||||
|
||||
if (wl->status.map._4way) {
|
||||
dm->wl_scc.ebt_null = 0;
|
||||
@@ -5567,6 +5678,14 @@ _update_rssi_state(struct rtw89_dev *rtwdev, u8 pre_state, u8 rssi, u8 thresh)
|
||||
return next_state;
|
||||
}
|
||||
|
||||
static void _wl_req_mac(struct rtw89_dev *rtwdev, u8 mac)
|
||||
{
|
||||
if (mac == RTW89_MAC_0)
|
||||
rtw89_write32_clr(rtwdev, R_AX_BTC_CFG, B_AX_WL_SRC);
|
||||
else
|
||||
rtw89_write32_set(rtwdev, R_AX_BTC_CFG, B_AX_WL_SRC);
|
||||
}
|
||||
|
||||
static
|
||||
void _update_dbcc_band(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
@@ -6065,12 +6184,20 @@ static u8 _chk_dbcc(struct rtw89_dev *rtwdev, struct rtw89_btc_chdef *ch,
|
||||
u8 *phy, u8 *role, u8 *dbcc_2g_phy)
|
||||
{
|
||||
struct rtw89_btc_wl_info *wl = &rtwdev->btc.cx.wl;
|
||||
struct rtw89_btc_wl_role_info_v8 *wl_rinfo = &wl->role_info_v8;
|
||||
struct rtw89_btc_wl_role_info_v7 *rinfo_v7 = &wl->role_info_v7;
|
||||
struct rtw89_btc_wl_role_info_v8 *rinfo_v8 = &wl->role_info_v8;
|
||||
bool is_2g_ch_exist = false, is_multi_role_in_2g_phy = false;
|
||||
u8 j, k, dbcc_2g_cid, dbcc_2g_cid2;
|
||||
u8 j, k, dbcc_2g_cid, dbcc_2g_cid2, connect_cnt;
|
||||
|
||||
if (rtwdev->btc.ver->fwlrole == 7)
|
||||
connect_cnt = rinfo_v7->connect_cnt;
|
||||
else if (rtwdev->btc.ver->fwlrole == 8)
|
||||
connect_cnt = rinfo_v8->connect_cnt;
|
||||
else
|
||||
return BTC_WLINK_NOLINK;
|
||||
|
||||
/* find out the 2G-PHY by connect-id ->ch */
|
||||
for (j = 0; j < wl_rinfo->connect_cnt; j++) {
|
||||
for (j = 0; j < connect_cnt; j++) {
|
||||
if (ch[j].center_ch <= 14) {
|
||||
is_2g_ch_exist = true;
|
||||
break;
|
||||
@@ -6085,11 +6212,11 @@ static u8 _chk_dbcc(struct rtw89_dev *rtwdev, struct rtw89_btc_chdef *ch,
|
||||
*dbcc_2g_phy = phy[dbcc_2g_cid];
|
||||
|
||||
/* connect_cnt <= 2 */
|
||||
if (wl_rinfo->connect_cnt < BTC_TDMA_WLROLE_MAX)
|
||||
if (connect_cnt < BTC_TDMA_WLROLE_MAX)
|
||||
return (_get_role_link_mode((role[dbcc_2g_cid])));
|
||||
|
||||
/* find the other-port in the 2G-PHY, ex: PHY-0:6G, PHY1: mcc/scc */
|
||||
for (k = 0; k < wl_rinfo->connect_cnt; k++) {
|
||||
for (k = 0; k < connect_cnt; k++) {
|
||||
if (k == dbcc_2g_cid)
|
||||
continue;
|
||||
|
||||
@@ -6116,29 +6243,54 @@ static u8 _chk_dbcc(struct rtw89_dev *rtwdev, struct rtw89_btc_chdef *ch,
|
||||
static void _update_role_link_mode(struct rtw89_dev *rtwdev,
|
||||
bool client_joined, u32 noa)
|
||||
{
|
||||
struct rtw89_btc_wl_role_info_v8 *wl_rinfo = &rtwdev->btc.cx.wl.role_info_v8;
|
||||
struct rtw89_btc_wl_role_info_v8 *rinfo_v8 = &rtwdev->btc.cx.wl.role_info_v8;
|
||||
struct rtw89_btc_wl_role_info_v7 *rinfo_v7 = &rtwdev->btc.cx.wl.role_info_v7;
|
||||
u8 role_ver = rtwdev->btc.ver->fwlrole;
|
||||
u32 type = BTC_WLMROLE_NONE, dur = 0;
|
||||
u32 wl_role = wl_rinfo->role_map;
|
||||
u8 link_mode, connect_cnt;
|
||||
u32 wl_role;
|
||||
|
||||
if (role_ver == 7) {
|
||||
wl_role = rinfo_v7->role_map;
|
||||
link_mode = rinfo_v7->link_mode;
|
||||
connect_cnt = rinfo_v7->connect_cnt;
|
||||
} else if (role_ver == 8) {
|
||||
wl_role = rinfo_v8->role_map;
|
||||
link_mode = rinfo_v8->link_mode;
|
||||
connect_cnt = rinfo_v8->connect_cnt;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
/* if no client_joined, don't care P2P-GO/AP role */
|
||||
if (((wl_role & BIT(RTW89_WIFI_ROLE_P2P_GO)) ||
|
||||
(wl_role & BIT(RTW89_WIFI_ROLE_AP))) && !client_joined) {
|
||||
if (wl_rinfo->link_mode == BTC_WLINK_2G_SCC) {
|
||||
wl_rinfo->link_mode = BTC_WLINK_2G_STA;
|
||||
wl_rinfo->connect_cnt--;
|
||||
} else if (wl_rinfo->link_mode == BTC_WLINK_2G_GO ||
|
||||
wl_rinfo->link_mode == BTC_WLINK_2G_AP) {
|
||||
wl_rinfo->link_mode = BTC_WLINK_NOLINK;
|
||||
wl_rinfo->connect_cnt--;
|
||||
if (link_mode == BTC_WLINK_2G_SCC) {
|
||||
if (role_ver == 7) {
|
||||
rinfo_v7->link_mode = BTC_WLINK_2G_STA;
|
||||
rinfo_v7->connect_cnt--;
|
||||
} else if (role_ver == 8) {
|
||||
rinfo_v8->link_mode = BTC_WLINK_2G_STA;
|
||||
rinfo_v8->connect_cnt--;
|
||||
}
|
||||
} else if (link_mode == BTC_WLINK_2G_GO ||
|
||||
link_mode == BTC_WLINK_2G_AP) {
|
||||
if (role_ver == 7) {
|
||||
rinfo_v7->link_mode = BTC_WLINK_NOLINK;
|
||||
rinfo_v7->connect_cnt--;
|
||||
} else if (role_ver == 8) {
|
||||
rinfo_v8->link_mode = BTC_WLINK_NOLINK;
|
||||
rinfo_v8->connect_cnt--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Identify 2-Role type */
|
||||
if (wl_rinfo->connect_cnt >= 2 &&
|
||||
(wl_rinfo->link_mode == BTC_WLINK_2G_SCC ||
|
||||
wl_rinfo->link_mode == BTC_WLINK_2G_MCC ||
|
||||
wl_rinfo->link_mode == BTC_WLINK_25G_MCC ||
|
||||
wl_rinfo->link_mode == BTC_WLINK_5G)) {
|
||||
if (connect_cnt >= 2 &&
|
||||
(link_mode == BTC_WLINK_2G_SCC ||
|
||||
link_mode == BTC_WLINK_2G_MCC ||
|
||||
link_mode == BTC_WLINK_25G_MCC ||
|
||||
link_mode == BTC_WLINK_5G)) {
|
||||
if ((wl_role & BIT(RTW89_WIFI_ROLE_P2P_GO)) ||
|
||||
(wl_role & BIT(RTW89_WIFI_ROLE_AP)))
|
||||
type = noa ? BTC_WLMROLE_STA_GO_NOA : BTC_WLMROLE_STA_GO;
|
||||
@@ -6150,8 +6302,167 @@ static void _update_role_link_mode(struct rtw89_dev *rtwdev,
|
||||
dur = noa;
|
||||
}
|
||||
|
||||
wl_rinfo->mrole_type = type;
|
||||
wl_rinfo->mrole_noa_duration = dur;
|
||||
if (role_ver == 7) {
|
||||
rinfo_v7->mrole_type = type;
|
||||
rinfo_v7->mrole_noa_duration = dur;
|
||||
} else if (role_ver == 8) {
|
||||
rinfo_v8->mrole_type = type;
|
||||
rinfo_v8->mrole_noa_duration = dur;
|
||||
}
|
||||
}
|
||||
|
||||
static void _update_wl_info_v7(struct rtw89_dev *rtwdev, u8 rid)
|
||||
{
|
||||
struct rtw89_btc_chdef cid_ch[RTW89_BE_BTC_WL_MAX_ROLE_NUMBER];
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
struct rtw89_btc_wl_info *wl = &btc->cx.wl;
|
||||
struct rtw89_btc_wl_role_info_v7 *wl_rinfo = &wl->role_info_v7;
|
||||
struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info;
|
||||
struct rtw89_btc_wl_link_info *wl_linfo = wl->link_info;
|
||||
struct rtw89_btc_wl_active_role_v7 *act_role = NULL;
|
||||
u8 i, mode, cnt = 0, cnt_2g = 0, cnt_5g = 0, phy_now = RTW89_PHY_MAX, phy_dbcc;
|
||||
bool b2g = false, b5g = false, client_joined = false, client_inc_2g = false;
|
||||
u8 client_cnt_last[RTW89_BE_BTC_WL_MAX_ROLE_NUMBER] = {};
|
||||
u8 cid_role[RTW89_BE_BTC_WL_MAX_ROLE_NUMBER] = {};
|
||||
u8 cid_phy[RTW89_BE_BTC_WL_MAX_ROLE_NUMBER] = {};
|
||||
u8 mac = RTW89_MAC_0, dbcc_2g_phy = RTW89_PHY_0;
|
||||
u32 noa_duration = 0;
|
||||
|
||||
memset(wl_rinfo, 0, sizeof(*wl_rinfo));
|
||||
|
||||
for (i = 0; i < RTW89_PORT_NUM; i++) {
|
||||
if (!wl_linfo[i].active || wl_linfo[i].phy >= RTW89_PHY_MAX)
|
||||
continue;
|
||||
|
||||
act_role = &wl_rinfo->active_role[i];
|
||||
act_role->role = wl_linfo[i].role;
|
||||
|
||||
/* check if role connect? */
|
||||
if (wl_linfo[i].connected == MLME_NO_LINK) {
|
||||
act_role->connected = 0;
|
||||
continue;
|
||||
} else if (wl_linfo[i].connected == MLME_LINKING) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cnt++;
|
||||
act_role->connected = 1;
|
||||
act_role->pid = wl_linfo[i].pid;
|
||||
act_role->phy = wl_linfo[i].phy;
|
||||
act_role->band = wl_linfo[i].band;
|
||||
act_role->ch = wl_linfo[i].ch;
|
||||
act_role->bw = wl_linfo[i].bw;
|
||||
act_role->noa = wl_linfo[i].noa;
|
||||
act_role->noa_dur = wl_linfo[i].noa_duration;
|
||||
cid_ch[cnt - 1] = wl_linfo[i].chdef;
|
||||
cid_phy[cnt - 1] = wl_linfo[i].phy;
|
||||
cid_role[cnt - 1] = wl_linfo[i].role;
|
||||
wl_rinfo->role_map |= BIT(wl_linfo[i].role);
|
||||
|
||||
if (rid == i)
|
||||
phy_now = act_role->phy;
|
||||
|
||||
if (wl_linfo[i].role == RTW89_WIFI_ROLE_P2P_GO ||
|
||||
wl_linfo[i].role == RTW89_WIFI_ROLE_AP) {
|
||||
if (wl_linfo[i].client_cnt > 1)
|
||||
client_joined = true;
|
||||
if (client_cnt_last[i] < wl_linfo[i].client_cnt &&
|
||||
wl_linfo[i].chdef.band == RTW89_BAND_2G)
|
||||
client_inc_2g = true;
|
||||
act_role->client_cnt = wl_linfo[i].client_cnt;
|
||||
} else {
|
||||
act_role->client_cnt = 0;
|
||||
}
|
||||
|
||||
if (act_role->noa && act_role->noa_dur > 0)
|
||||
noa_duration = act_role->noa_dur;
|
||||
|
||||
if (rtwdev->dbcc_en) {
|
||||
phy_dbcc = wl_linfo[i].phy;
|
||||
wl_dinfo->role[phy_dbcc] |= BIT(wl_linfo[i].role);
|
||||
wl_dinfo->op_band[phy_dbcc] = wl_linfo[i].chdef.band;
|
||||
}
|
||||
|
||||
if (wl_linfo[i].chdef.band != RTW89_BAND_2G) {
|
||||
cnt_5g++;
|
||||
b5g = true;
|
||||
} else {
|
||||
if (((wl_linfo[i].role == RTW89_WIFI_ROLE_P2P_GO ||
|
||||
wl_linfo[i].role == RTW89_WIFI_ROLE_AP) &&
|
||||
client_joined) ||
|
||||
wl_linfo[i].role == RTW89_WIFI_ROLE_P2P_CLIENT)
|
||||
wl_rinfo->p2p_2g = 1;
|
||||
|
||||
if ((wl_linfo[i].mode & BIT(BTC_WL_MODE_11B)) ||
|
||||
(wl_linfo[i].mode & BIT(BTC_WL_MODE_11G)))
|
||||
wl->bg_mode = 1;
|
||||
else if (wl_linfo[i].mode & BIT(BTC_WL_MODE_HE))
|
||||
wl->he_mode = true;
|
||||
|
||||
cnt_2g++;
|
||||
b2g = true;
|
||||
}
|
||||
|
||||
if (act_role->band == RTW89_BAND_5G && act_role->ch >= 100)
|
||||
wl->is_5g_hi_channel = 1;
|
||||
else
|
||||
wl->is_5g_hi_channel = 0;
|
||||
}
|
||||
|
||||
wl_rinfo->connect_cnt = cnt;
|
||||
wl->client_cnt_inc_2g = client_inc_2g;
|
||||
|
||||
if (cnt == 0) {
|
||||
mode = BTC_WLINK_NOLINK;
|
||||
wl_rinfo->role_map = BIT(RTW89_WIFI_ROLE_NONE);
|
||||
} else if (!b2g && b5g) {
|
||||
mode = BTC_WLINK_5G;
|
||||
} else if (wl_rinfo->role_map & BIT(RTW89_WIFI_ROLE_NAN)) {
|
||||
mode = BTC_WLINK_2G_NAN;
|
||||
} else if (cnt > BTC_TDMA_WLROLE_MAX) {
|
||||
mode = BTC_WLINK_OTHER;
|
||||
} else if (rtwdev->dbcc_en) {
|
||||
mode = _chk_dbcc(rtwdev, cid_ch, cid_phy, cid_role, &dbcc_2g_phy);
|
||||
|
||||
/* correct 2G-located PHY band for gnt ctrl */
|
||||
if (dbcc_2g_phy < RTW89_PHY_MAX)
|
||||
wl_dinfo->op_band[dbcc_2g_phy] = RTW89_BAND_2G;
|
||||
} else if (b2g && b5g && cnt == 2) {
|
||||
mode = BTC_WLINK_25G_MCC;
|
||||
} else if (!b5g && cnt == 2) { /* cnt_connect = 2 */
|
||||
if (_chk_role_ch_group(&cid_ch[0], &cid_ch[cnt - 1]))
|
||||
mode = BTC_WLINK_2G_SCC;
|
||||
else
|
||||
mode = BTC_WLINK_2G_MCC;
|
||||
} else if (!b5g && cnt == 1) { /* cnt_connect = 1 */
|
||||
mode = _get_role_link_mode(cid_role[0]);
|
||||
} else {
|
||||
mode = BTC_WLINK_NOLINK;
|
||||
}
|
||||
|
||||
wl_rinfo->link_mode = mode;
|
||||
_update_role_link_mode(rtwdev, client_joined, noa_duration);
|
||||
|
||||
/* todo DBCC related event */
|
||||
rtw89_debug(rtwdev, RTW89_DBG_BTC, "[BTC] wl_info phy_now=%d\n", phy_now);
|
||||
|
||||
if (wl_rinfo->dbcc_en != rtwdev->dbcc_en) {
|
||||
wl_rinfo->dbcc_chg = 1;
|
||||
wl_rinfo->dbcc_en = rtwdev->dbcc_en;
|
||||
btc->cx.cnt_wl[BTC_WCNT_DBCC_CHG]++;
|
||||
}
|
||||
|
||||
if (rtwdev->dbcc_en) {
|
||||
wl_rinfo->dbcc_2g_phy = dbcc_2g_phy;
|
||||
|
||||
if (dbcc_2g_phy == RTW89_PHY_1)
|
||||
mac = RTW89_MAC_1;
|
||||
|
||||
_update_dbcc_band(rtwdev, RTW89_PHY_0);
|
||||
_update_dbcc_band(rtwdev, RTW89_PHY_1);
|
||||
}
|
||||
_wl_req_mac(rtwdev, mac);
|
||||
_fw_set_drv_info(rtwdev, CXDRVINFO_ROLE);
|
||||
}
|
||||
|
||||
static void _update_wl_info_v8(struct rtw89_dev *rtwdev, u8 role_id, u8 rlink_id,
|
||||
@@ -6496,6 +6807,7 @@ void _run_coex(struct rtw89_dev *rtwdev, enum btc_reason_and_action reason)
|
||||
struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info;
|
||||
struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1;
|
||||
struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2;
|
||||
struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7;
|
||||
struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8;
|
||||
u8 mode, igno_bt, always_freerun;
|
||||
|
||||
@@ -6511,6 +6823,8 @@ void _run_coex(struct rtw89_dev *rtwdev, enum btc_reason_and_action reason)
|
||||
mode = wl_rinfo_v1->link_mode;
|
||||
else if (ver->fwlrole == 2)
|
||||
mode = wl_rinfo_v2->link_mode;
|
||||
else if (ver->fwlrole == 7)
|
||||
mode = wl_rinfo_v7->link_mode;
|
||||
else if (ver->fwlrole == 8)
|
||||
mode = wl_rinfo_v8->link_mode;
|
||||
else
|
||||
@@ -6657,7 +6971,7 @@ void _run_coex(struct rtw89_dev *rtwdev, enum btc_reason_and_action reason)
|
||||
_action_wl_2g_scc(rtwdev);
|
||||
else if (ver->fwlrole == 1)
|
||||
_action_wl_2g_scc_v1(rtwdev);
|
||||
else if (ver->fwlrole == 2)
|
||||
else if (ver->fwlrole == 2 || ver->fwlrole == 7)
|
||||
_action_wl_2g_scc_v2(rtwdev);
|
||||
else if (ver->fwlrole == 8)
|
||||
_action_wl_2g_scc_v8(rtwdev);
|
||||
@@ -7250,6 +7564,9 @@ void rtw89_btc_ntfy_role_info(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif
|
||||
} else if (ver->fwlrole == 2) {
|
||||
*wlinfo = r;
|
||||
_update_wl_info_v2(rtwdev);
|
||||
} else if (ver->fwlrole == 7) {
|
||||
*wlinfo = r;
|
||||
_update_wl_info_v7(rtwdev, r.pid);
|
||||
} else if (ver->fwlrole == 8) {
|
||||
wlinfo = &wl->rlink_info[r.pid][rlink_id];
|
||||
*wlinfo = r;
|
||||
@@ -7856,6 +8173,7 @@ static void _show_wl_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info;
|
||||
struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1;
|
||||
struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2;
|
||||
struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7;
|
||||
struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8;
|
||||
u8 mode;
|
||||
|
||||
@@ -7870,6 +8188,8 @@ static void _show_wl_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
mode = wl_rinfo_v1->link_mode;
|
||||
else if (ver->fwlrole == 2)
|
||||
mode = wl_rinfo_v2->link_mode;
|
||||
else if (ver->fwlrole == 7)
|
||||
mode = wl_rinfo_v7->link_mode;
|
||||
else if (ver->fwlrole == 8)
|
||||
mode = wl_rinfo_v8->link_mode;
|
||||
else
|
||||
@@ -10288,6 +10608,108 @@ static void _show_summary_v105(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
cnt[BTC_NCNT_CUSTOMERIZE]);
|
||||
}
|
||||
|
||||
static void _show_summary_v7(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
struct rtw89_btc_btf_fwinfo *pfwinfo = &rtwdev->btc.fwinfo;
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_v7 *prptctrl = NULL;
|
||||
struct rtw89_btc_rpt_cmn_info *pcinfo = NULL;
|
||||
struct rtw89_btc_cx *cx = &rtwdev->btc.cx;
|
||||
struct rtw89_btc_dm *dm = &rtwdev->btc.dm;
|
||||
struct rtw89_btc_wl_info *wl = &cx->wl;
|
||||
u32 *cnt = rtwdev->btc.dm.cnt_notify;
|
||||
u32 cnt_sum = 0;
|
||||
u8 i;
|
||||
|
||||
if (!(dm->coex_info_map & BTC_COEX_INFO_SUMMARY))
|
||||
return;
|
||||
|
||||
seq_printf(m, "%s", "\n\r========== [Statistics] ==========");
|
||||
|
||||
pcinfo = &pfwinfo->rpt_ctrl.cinfo;
|
||||
if (pcinfo->valid && wl->status.map.lps != BTC_LPS_RF_OFF &&
|
||||
!wl->status.map.rf_off) {
|
||||
prptctrl = &pfwinfo->rpt_ctrl.finfo.v7;
|
||||
|
||||
seq_printf(m,
|
||||
"\n\r %-15s : h2c_cnt=%d(fail:%d, fw_recv:%d),"
|
||||
"c2h_cnt=%d(fw_send:%d, len:%d, max:%d), ",
|
||||
"[summary]", pfwinfo->cnt_h2c, pfwinfo->cnt_h2c_fail,
|
||||
le16_to_cpu(prptctrl->rpt_info.cnt_h2c), pfwinfo->cnt_c2h,
|
||||
le16_to_cpu(prptctrl->rpt_info.cnt_c2h),
|
||||
le16_to_cpu(prptctrl->rpt_info.len_c2h),
|
||||
rtwdev->btc.ver->info_buf);
|
||||
|
||||
seq_printf(m, "rpt_cnt=%d(fw_send:%d), rpt_map=0x%x",
|
||||
pfwinfo->event[BTF_EVNT_RPT],
|
||||
le16_to_cpu(prptctrl->rpt_info.cnt),
|
||||
le32_to_cpu(prptctrl->rpt_info.en));
|
||||
|
||||
if (dm->error.map.wl_fw_hang)
|
||||
seq_puts(m, " (WL FW Hang!!)");
|
||||
|
||||
seq_printf(m, "\n\r %-15s : send_ok:%d, send_fail:%d, recv:%d, ",
|
||||
"[mailbox]", le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_ok),
|
||||
le32_to_cpu(prptctrl->bt_mbx_info.cnt_send_fail),
|
||||
le32_to_cpu(prptctrl->bt_mbx_info.cnt_recv));
|
||||
|
||||
seq_printf(m, "A2DP_empty:%d(stop:%d/tx:%d/ack:%d/nack:%d)",
|
||||
le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_empty),
|
||||
le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_flowctrl),
|
||||
le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_tx),
|
||||
le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_ack),
|
||||
le32_to_cpu(prptctrl->bt_mbx_info.a2dp.cnt_nack));
|
||||
|
||||
seq_printf(m,
|
||||
"\n\r %-15s : wl_rfk[req:%d/go:%d/reject:%d/tout:%d/time:%dms]",
|
||||
"[RFK/LPS]", cx->cnt_wl[BTC_WCNT_RFK_REQ],
|
||||
cx->cnt_wl[BTC_WCNT_RFK_GO],
|
||||
cx->cnt_wl[BTC_WCNT_RFK_REJECT],
|
||||
cx->cnt_wl[BTC_WCNT_RFK_TIMEOUT],
|
||||
wl->rfk_info.proc_time);
|
||||
|
||||
seq_printf(m, ", bt_rfk[req:%d]",
|
||||
le16_to_cpu(prptctrl->bt_cnt[BTC_BCNT_RFK_REQ]));
|
||||
|
||||
seq_printf(m, ", AOAC[RF_on:%d/RF_off:%d]",
|
||||
le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_on),
|
||||
le16_to_cpu(prptctrl->rpt_info.cnt_aoac_rf_off));
|
||||
} else {
|
||||
seq_printf(m,
|
||||
"\n\r %-15s : h2c_cnt=%d(fail:%d), c2h_cnt=%d (lps=%d/rf_off=%d)",
|
||||
"[summary]",
|
||||
pfwinfo->cnt_h2c, pfwinfo->cnt_h2c_fail,
|
||||
pfwinfo->cnt_c2h,
|
||||
wl->status.map.lps, wl->status.map.rf_off);
|
||||
}
|
||||
|
||||
for (i = 0; i < BTC_NCNT_NUM; i++)
|
||||
cnt_sum += dm->cnt_notify[i];
|
||||
|
||||
seq_printf(m,
|
||||
"\n\r %-15s : total=%d, show_coex_info=%d, power_on=%d, init_coex=%d, ",
|
||||
"[notify_cnt]",
|
||||
cnt_sum, cnt[BTC_NCNT_SHOW_COEX_INFO],
|
||||
cnt[BTC_NCNT_POWER_ON], cnt[BTC_NCNT_INIT_COEX]);
|
||||
|
||||
seq_printf(m,
|
||||
"power_off=%d, radio_state=%d, role_info=%d, wl_rfk=%d, wl_sta=%d",
|
||||
cnt[BTC_NCNT_POWER_OFF], cnt[BTC_NCNT_RADIO_STATE],
|
||||
cnt[BTC_NCNT_ROLE_INFO], cnt[BTC_NCNT_WL_RFK],
|
||||
cnt[BTC_NCNT_WL_STA]);
|
||||
|
||||
seq_printf(m,
|
||||
"\n\r %-15s : scan_start=%d, scan_finish=%d, switch_band=%d, switch_chbw=%d, special_pkt=%d, ",
|
||||
"[notify_cnt]",
|
||||
cnt[BTC_NCNT_SCAN_START], cnt[BTC_NCNT_SCAN_FINISH],
|
||||
cnt[BTC_NCNT_SWITCH_BAND], cnt[BTC_NCNT_SWITCH_CHBW],
|
||||
cnt[BTC_NCNT_SPECIAL_PACKET]);
|
||||
|
||||
seq_printf(m, "timer=%d, customerize=%d, hub_msg=%d, chg_fw=%d, send_cc=%d",
|
||||
cnt[BTC_NCNT_TIMER], cnt[BTC_NCNT_CUSTOMERIZE],
|
||||
rtwdev->btc.hubmsg_cnt, cnt[BTC_NCNT_RESUME_DL_FW],
|
||||
cnt[BTC_NCNT_COUNTRYCODE]);
|
||||
}
|
||||
|
||||
static void _show_summary_v8(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
{
|
||||
struct rtw89_btc_btf_fwinfo *pfwinfo = &rtwdev->btc.fwinfo;
|
||||
@@ -10440,6 +10862,8 @@ void rtw89_btc_dump_info(struct rtw89_dev *rtwdev, struct seq_file *m)
|
||||
_show_summary_v5(rtwdev, m);
|
||||
else if (ver->fcxbtcrpt == 105)
|
||||
_show_summary_v105(rtwdev, m);
|
||||
else if (ver->fcxbtcrpt == 7)
|
||||
_show_summary_v7(rtwdev, m);
|
||||
else if (ver->fcxbtcrpt == 8)
|
||||
_show_summary_v8(rtwdev, m);
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ void rtw89_core_set_chip_txpwr(struct rtw89_dev *rtwdev)
|
||||
return;
|
||||
}
|
||||
|
||||
roc_idx = atomic_read(&hal->roc_entity_idx);
|
||||
roc_idx = atomic_read(&hal->roc_chanctx_idx);
|
||||
if (roc_idx != RTW89_CHANCTX_IDLE)
|
||||
chanctx_idx = roc_idx;
|
||||
|
||||
@@ -409,7 +409,7 @@ int rtw89_set_channel(struct rtw89_dev *rtwdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
roc_idx = atomic_read(&hal->roc_entity_idx);
|
||||
roc_idx = atomic_read(&hal->roc_chanctx_idx);
|
||||
if (roc_idx != RTW89_CHANCTX_IDLE)
|
||||
chanctx_idx = roc_idx;
|
||||
|
||||
@@ -429,7 +429,7 @@ int rtw89_set_channel(struct rtw89_dev *rtwdev)
|
||||
|
||||
if (!entity_active || chan_rcd->band_changed) {
|
||||
rtw89_btc_ntfy_switch_band(rtwdev, phy_idx, chan->band_type);
|
||||
rtw89_chip_rfk_band_changed(rtwdev, phy_idx);
|
||||
rtw89_chip_rfk_band_changed(rtwdev, phy_idx, chan);
|
||||
}
|
||||
|
||||
rtw89_set_entity_state(rtwdev, true);
|
||||
@@ -1583,11 +1583,27 @@ static u16 rtw89_core_get_phy_status_ie_len(struct rtw89_dev *rtwdev,
|
||||
return ie_len;
|
||||
}
|
||||
|
||||
static void rtw89_core_parse_phy_status_ie01_v2(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_phy_sts_iehdr *iehdr,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu)
|
||||
{
|
||||
const struct rtw89_phy_sts_ie01_v2 *ie;
|
||||
u8 *rpl_fd = phy_ppdu->rpl_fd;
|
||||
|
||||
ie = (const struct rtw89_phy_sts_ie01_v2 *)iehdr;
|
||||
rpl_fd[RF_PATH_A] = le32_get_bits(ie->w8, RTW89_PHY_STS_IE01_V2_W8_RPL_FD_A);
|
||||
rpl_fd[RF_PATH_B] = le32_get_bits(ie->w8, RTW89_PHY_STS_IE01_V2_W8_RPL_FD_B);
|
||||
rpl_fd[RF_PATH_C] = le32_get_bits(ie->w9, RTW89_PHY_STS_IE01_V2_W9_RPL_FD_C);
|
||||
rpl_fd[RF_PATH_D] = le32_get_bits(ie->w9, RTW89_PHY_STS_IE01_V2_W9_RPL_FD_D);
|
||||
|
||||
phy_ppdu->bw_idx = le32_get_bits(ie->w5, RTW89_PHY_STS_IE01_V2_W5_BW_IDX);
|
||||
}
|
||||
|
||||
static void rtw89_core_parse_phy_status_ie01(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_phy_sts_iehdr *iehdr,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu)
|
||||
{
|
||||
const struct rtw89_phy_sts_ie0 *ie = (const struct rtw89_phy_sts_ie0 *)iehdr;
|
||||
const struct rtw89_phy_sts_ie01 *ie = (const struct rtw89_phy_sts_ie01 *)iehdr;
|
||||
s16 cfo;
|
||||
u32 t;
|
||||
|
||||
@@ -1598,12 +1614,17 @@ static void rtw89_core_parse_phy_status_ie01(struct rtw89_dev *rtwdev,
|
||||
phy_ppdu->stbc = le32_get_bits(ie->w2, RTW89_PHY_STS_IE01_W2_STBC);
|
||||
}
|
||||
|
||||
if (!phy_ppdu->hdr_2_en)
|
||||
phy_ppdu->rx_path_en =
|
||||
le32_get_bits(ie->w0, RTW89_PHY_STS_IE01_W0_RX_PATH_EN);
|
||||
|
||||
if (phy_ppdu->rate < RTW89_HW_RATE_OFDM6)
|
||||
return;
|
||||
|
||||
if (!phy_ppdu->to_self)
|
||||
return;
|
||||
|
||||
phy_ppdu->rpl_avg = le32_get_bits(ie->w0, RTW89_PHY_STS_IE01_W0_RSSI_AVG_FD);
|
||||
phy_ppdu->ofdm.avg_snr = le32_get_bits(ie->w2, RTW89_PHY_STS_IE01_W2_AVG_SNR);
|
||||
phy_ppdu->ofdm.evm_max = le32_get_bits(ie->w2, RTW89_PHY_STS_IE01_W2_EVM_MAX);
|
||||
phy_ppdu->ofdm.evm_min = le32_get_bits(ie->w2, RTW89_PHY_STS_IE01_W2_EVM_MIN);
|
||||
@@ -1619,6 +1640,39 @@ static void rtw89_core_parse_phy_status_ie01(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
rtw89_phy_cfo_parse(rtwdev, cfo, phy_ppdu);
|
||||
|
||||
if (rtwdev->chip->chip_gen == RTW89_CHIP_BE)
|
||||
rtw89_core_parse_phy_status_ie01_v2(rtwdev, iehdr, phy_ppdu);
|
||||
}
|
||||
|
||||
static void rtw89_core_parse_phy_status_ie00(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_phy_sts_iehdr *iehdr,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu)
|
||||
{
|
||||
const struct rtw89_phy_sts_ie00 *ie = (const struct rtw89_phy_sts_ie00 *)iehdr;
|
||||
u16 tmp_rpl;
|
||||
|
||||
tmp_rpl = le32_get_bits(ie->w0, RTW89_PHY_STS_IE00_W0_RPL);
|
||||
phy_ppdu->rpl_avg = tmp_rpl >> 1;
|
||||
}
|
||||
|
||||
static void rtw89_core_parse_phy_status_ie00_v2(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_phy_sts_iehdr *iehdr,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu)
|
||||
{
|
||||
const struct rtw89_phy_sts_ie00_v2 *ie;
|
||||
u8 *rpl_path = phy_ppdu->rpl_path;
|
||||
u16 tmp_rpl[RF_PATH_MAX];
|
||||
u8 i;
|
||||
|
||||
ie = (const struct rtw89_phy_sts_ie00_v2 *)iehdr;
|
||||
tmp_rpl[RF_PATH_A] = le32_get_bits(ie->w4, RTW89_PHY_STS_IE00_V2_W4_RPL_TD_A);
|
||||
tmp_rpl[RF_PATH_B] = le32_get_bits(ie->w4, RTW89_PHY_STS_IE00_V2_W4_RPL_TD_B);
|
||||
tmp_rpl[RF_PATH_C] = le32_get_bits(ie->w4, RTW89_PHY_STS_IE00_V2_W4_RPL_TD_C);
|
||||
tmp_rpl[RF_PATH_D] = le32_get_bits(ie->w5, RTW89_PHY_STS_IE00_V2_W5_RPL_TD_D);
|
||||
|
||||
for (i = 0; i < RF_PATH_MAX; i++)
|
||||
rpl_path[i] = tmp_rpl[i] >> 1;
|
||||
}
|
||||
|
||||
static int rtw89_core_process_phy_status_ie(struct rtw89_dev *rtwdev,
|
||||
@@ -1630,6 +1684,11 @@ static int rtw89_core_process_phy_status_ie(struct rtw89_dev *rtwdev,
|
||||
ie = le32_get_bits(iehdr->w0, RTW89_PHY_STS_IEHDR_TYPE);
|
||||
|
||||
switch (ie) {
|
||||
case RTW89_PHYSTS_IE00_CMN_CCK:
|
||||
rtw89_core_parse_phy_status_ie00(rtwdev, iehdr, phy_ppdu);
|
||||
if (rtwdev->chip->chip_gen == RTW89_CHIP_BE)
|
||||
rtw89_core_parse_phy_status_ie00_v2(rtwdev, iehdr, phy_ppdu);
|
||||
break;
|
||||
case RTW89_PHYSTS_IE01_CMN_OFDM:
|
||||
rtw89_core_parse_phy_status_ie01(rtwdev, iehdr, phy_ppdu);
|
||||
break;
|
||||
@@ -1640,6 +1699,13 @@ static int rtw89_core_process_phy_status_ie(struct rtw89_dev *rtwdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rtw89_core_update_phy_ppdu_hdr_v2(struct rtw89_rx_phy_ppdu *phy_ppdu)
|
||||
{
|
||||
const struct rtw89_phy_sts_hdr_v2 *hdr = phy_ppdu->buf + PHY_STS_HDR_LEN;
|
||||
|
||||
phy_ppdu->rx_path_en = le32_get_bits(hdr->w0, RTW89_PHY_STS_HDR_V2_W0_PATH_EN);
|
||||
}
|
||||
|
||||
static void rtw89_core_update_phy_ppdu(struct rtw89_rx_phy_ppdu *phy_ppdu)
|
||||
{
|
||||
const struct rtw89_phy_sts_hdr *hdr = phy_ppdu->buf;
|
||||
@@ -1651,6 +1717,10 @@ static void rtw89_core_update_phy_ppdu(struct rtw89_rx_phy_ppdu *phy_ppdu)
|
||||
rssi[RF_PATH_B] = le32_get_bits(hdr->w1, RTW89_PHY_STS_HDR_W1_RSSI_B);
|
||||
rssi[RF_PATH_C] = le32_get_bits(hdr->w1, RTW89_PHY_STS_HDR_W1_RSSI_C);
|
||||
rssi[RF_PATH_D] = le32_get_bits(hdr->w1, RTW89_PHY_STS_HDR_W1_RSSI_D);
|
||||
|
||||
phy_ppdu->hdr_2_en = le32_get_bits(hdr->w0, RTW89_PHY_STS_HDR_W0_HDR_2_EN);
|
||||
if (phy_ppdu->hdr_2_en)
|
||||
rtw89_core_update_phy_ppdu_hdr_v2(phy_ppdu);
|
||||
}
|
||||
|
||||
static int rtw89_core_rx_process_phy_ppdu(struct rtw89_dev *rtwdev,
|
||||
@@ -1703,6 +1773,7 @@ static int rtw89_core_rx_parse_phy_sts(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
}
|
||||
|
||||
rtw89_chip_convert_rpl_to_rssi(rtwdev, phy_ppdu);
|
||||
rtw89_phy_antdiv_parse(rtwdev, phy_ppdu);
|
||||
|
||||
return 0;
|
||||
@@ -4263,9 +4334,14 @@ void rtw89_core_stop(struct rtw89_dev *rtwdev)
|
||||
u8 rtw89_acquire_mac_id(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
u8 mac_id_num = chip->support_macid_num;
|
||||
u8 mac_id_num;
|
||||
u8 mac_id;
|
||||
|
||||
if (rtwdev->support_mlo)
|
||||
mac_id_num = chip->support_macid_num / chip->support_link_num;
|
||||
else
|
||||
mac_id_num = chip->support_macid_num;
|
||||
|
||||
mac_id = find_first_zero_bit(rtwdev->mac_id_map, mac_id_num);
|
||||
if (mac_id == mac_id_num)
|
||||
return RTW89_MAX_MAC_ID_NUM;
|
||||
@@ -4315,6 +4391,8 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
|
||||
|
||||
rtw89_init_wait(&rtwdev->mcc.wait);
|
||||
rtw89_init_wait(&rtwdev->mac.fw_ofld_wait);
|
||||
rtw89_init_wait(&rtwdev->wow.wait);
|
||||
rtw89_init_wait(&rtwdev->mac.ps_wait);
|
||||
|
||||
INIT_WORK(&rtwdev->c2h_work, rtw89_fw_c2h_work);
|
||||
INIT_WORK(&rtwdev->ips_work, rtw89_ips_work);
|
||||
@@ -4681,6 +4759,9 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)
|
||||
if (chip->chip_gen == RTW89_CHIP_BE)
|
||||
hw->wiphy->flags |= WIPHY_FLAG_DISABLE_WEXT;
|
||||
|
||||
if (rtwdev->support_mlo)
|
||||
hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
|
||||
|
||||
hw->wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
|
||||
|
||||
hw->wiphy->max_scan_ssids = RTW89_SCANOFLD_MAX_SSID;
|
||||
@@ -4767,6 +4848,8 @@ EXPORT_SYMBOL(rtw89_core_register);
|
||||
void rtw89_core_unregister(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
rtw89_core_unregister_hw(rtwdev);
|
||||
|
||||
rtw89_debugfs_deinit(rtwdev);
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_core_unregister);
|
||||
|
||||
@@ -4781,6 +4864,7 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
|
||||
struct ieee80211_ops *ops;
|
||||
u32 driver_data_size;
|
||||
int fw_format = -1;
|
||||
bool support_mlo;
|
||||
bool no_chanctx;
|
||||
|
||||
firmware = rtw89_early_fw_feature_recognize(device, chip, &early_fw, &fw_format);
|
||||
@@ -4809,6 +4893,14 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
|
||||
if (!hw)
|
||||
goto err;
|
||||
|
||||
/* TODO: When driver MLO arch. is done, determine whether to support MLO
|
||||
* according to the following conditions.
|
||||
* 1. run with chanctx_ops
|
||||
* 2. chip->support_link_num != 0
|
||||
* 3. FW feature supports AP_LINK_PS
|
||||
*/
|
||||
support_mlo = false;
|
||||
|
||||
hw->wiphy->iface_combinations = rtw89_iface_combs;
|
||||
|
||||
if (no_chanctx || chip->support_chanctx_num == 1)
|
||||
@@ -4823,9 +4915,12 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
|
||||
rtwdev->chip = chip;
|
||||
rtwdev->fw.req.firmware = firmware;
|
||||
rtwdev->fw.fw_format = fw_format;
|
||||
rtwdev->support_mlo = support_mlo;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_FW, "probe driver %s chanctx\n",
|
||||
rtw89_debug(rtwdev, RTW89_DBG_CHAN, "probe driver %s chanctx\n",
|
||||
no_chanctx ? "without" : "with");
|
||||
rtw89_debug(rtwdev, RTW89_DBG_CHAN, "probe driver %s MLO cap\n",
|
||||
support_mlo ? "with" : "without");
|
||||
|
||||
return rtwdev;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ struct rtw89_efuse_block_cfg;
|
||||
struct rtw89_h2c_rf_tssi;
|
||||
struct rtw89_fw_txpwr_track_cfg;
|
||||
struct rtw89_phy_rfk_log_fmt;
|
||||
struct rtw89_debugfs;
|
||||
|
||||
extern const struct ieee80211_ops rtw89_ops;
|
||||
|
||||
@@ -796,6 +797,11 @@ struct rtw89_rx_phy_ppdu {
|
||||
u8 chan_idx;
|
||||
u8 ie;
|
||||
u16 rate;
|
||||
u8 rpl_avg;
|
||||
u8 rpl_path[RF_PATH_MAX];
|
||||
u8 rpl_fd[RF_PATH_MAX];
|
||||
u8 bw_idx;
|
||||
u8 rx_path_en;
|
||||
struct {
|
||||
bool has;
|
||||
u8 avg_snr;
|
||||
@@ -808,6 +814,7 @@ struct rtw89_rx_phy_ppdu {
|
||||
bool stbc;
|
||||
bool to_self;
|
||||
bool valid;
|
||||
bool hdr_2_en;
|
||||
};
|
||||
|
||||
enum rtw89_mac_idx {
|
||||
@@ -1589,6 +1596,23 @@ struct rtw89_btc_wl_active_role_v2 {
|
||||
u32 noa_duration; /* ms */
|
||||
};
|
||||
|
||||
struct rtw89_btc_wl_active_role_v7 {
|
||||
u8 connected;
|
||||
u8 pid;
|
||||
u8 phy;
|
||||
u8 noa;
|
||||
|
||||
u8 band;
|
||||
u8 client_ps;
|
||||
u8 bw;
|
||||
u8 role;
|
||||
|
||||
u8 ch;
|
||||
u8 noa_dur;
|
||||
u8 client_cnt;
|
||||
u8 rsvd2;
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_wl_role_info_bpos {
|
||||
u16 none: 1;
|
||||
u16 station: 1;
|
||||
@@ -1670,6 +1694,22 @@ struct rtw89_btc_wl_rlink { /* H2C info, struct size must be n*4 bytes */
|
||||
} __packed;
|
||||
|
||||
#define RTW89_BE_BTC_WL_MAX_ROLE_NUMBER 6
|
||||
struct rtw89_btc_wl_role_info_v7 { /* struct size must be n*4 bytes */
|
||||
u8 connect_cnt;
|
||||
u8 link_mode;
|
||||
u8 link_mode_chg;
|
||||
u8 p2p_2g;
|
||||
|
||||
struct rtw89_btc_wl_active_role_v7 active_role[RTW89_BE_BTC_WL_MAX_ROLE_NUMBER];
|
||||
|
||||
u32 role_map;
|
||||
u32 mrole_type; /* btc_wl_mrole_type */
|
||||
u32 mrole_noa_duration; /* ms */
|
||||
u32 dbcc_en;
|
||||
u32 dbcc_chg;
|
||||
u32 dbcc_2g_phy; /* which phy operate in 2G, HW_PHY_0 or HW_PHY_1 */
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_wl_role_info_v8 { /* H2C info, struct size must be n*4 bytes */
|
||||
u8 connect_cnt;
|
||||
u8 link_mode;
|
||||
@@ -1833,6 +1873,7 @@ struct rtw89_btc_wl_info {
|
||||
struct rtw89_btc_wl_role_info role_info;
|
||||
struct rtw89_btc_wl_role_info_v1 role_info_v1;
|
||||
struct rtw89_btc_wl_role_info_v2 role_info_v2;
|
||||
struct rtw89_btc_wl_role_info_v7 role_info_v7;
|
||||
struct rtw89_btc_wl_role_info_v8 role_info_v8;
|
||||
struct rtw89_btc_wl_scan_info scan_info;
|
||||
struct rtw89_btc_wl_dbcc_info dbcc_info;
|
||||
@@ -1850,8 +1891,10 @@ struct rtw89_btc_wl_info {
|
||||
bool is_5g_hi_channel;
|
||||
bool pta_reg_mac_chg;
|
||||
bool bg_mode;
|
||||
bool he_mode;
|
||||
bool scbd_change;
|
||||
bool fw_ver_mismatch;
|
||||
bool client_cnt_inc_2g;
|
||||
u32 scbd;
|
||||
};
|
||||
|
||||
@@ -2202,6 +2245,19 @@ struct rtw89_btc_fbtc_rpt_ctrl_v105 {
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_bt_mailbox bt_mbx_info;
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_v7 {
|
||||
u8 fver;
|
||||
u8 rsvd0;
|
||||
u8 rsvd1;
|
||||
u8 rsvd2;
|
||||
|
||||
u8 gnt_val[RTW89_PHY_MAX][4];
|
||||
__le16 bt_cnt[BTC_BCNT_STA_MAX_V105];
|
||||
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_info_v8 rpt_info;
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_bt_mailbox bt_mbx_info;
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_v8 {
|
||||
u8 fver;
|
||||
u8 rsvd0;
|
||||
@@ -2220,6 +2276,7 @@ union rtw89_btc_fbtc_rpt_ctrl_ver_info {
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_v4 v4;
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_v5 v5;
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_v105 v105;
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_v7 v7;
|
||||
struct rtw89_btc_fbtc_rpt_ctrl_v8 v8;
|
||||
};
|
||||
|
||||
@@ -3544,7 +3601,8 @@ struct rtw89_chip_ops {
|
||||
void (*rfk_init_late)(struct rtw89_dev *rtwdev);
|
||||
void (*rfk_channel)(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
|
||||
void (*rfk_band_changed)(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan);
|
||||
void (*rfk_scan)(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
bool start);
|
||||
void (*rfk_track)(struct rtw89_dev *rtwdev);
|
||||
@@ -3561,11 +3619,15 @@ struct rtw89_chip_ops {
|
||||
void (*query_ppdu)(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu,
|
||||
struct ieee80211_rx_status *status);
|
||||
void (*convert_rpl_to_rssi)(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu);
|
||||
void (*ctrl_nbtg_bt_tx)(struct rtw89_dev *rtwdev, bool en,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
void (*cfg_txrx_path)(struct rtw89_dev *rtwdev);
|
||||
void (*set_txpwr_ul_tb_offset)(struct rtw89_dev *rtwdev,
|
||||
s8 pw_ofst, enum rtw89_mac_idx mac_idx);
|
||||
void (*digital_pwr_comp)(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
int (*pwr_on_func)(struct rtw89_dev *rtwdev);
|
||||
int (*pwr_off_func)(struct rtw89_dev *rtwdev);
|
||||
void (*query_rxdesc)(struct rtw89_dev *rtwdev,
|
||||
@@ -3916,16 +3978,22 @@ struct rtw89_txpwr_conf {
|
||||
const void *data;
|
||||
};
|
||||
|
||||
static inline bool rtw89_txpwr_entcpy(void *entry, const void *cursor, u8 size,
|
||||
const struct rtw89_txpwr_conf *conf)
|
||||
{
|
||||
u8 valid_size = min(size, conf->ent_sz);
|
||||
|
||||
memcpy(entry, cursor, valid_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
#define rtw89_txpwr_conf_valid(conf) (!!(conf)->data)
|
||||
|
||||
#define rtw89_for_each_in_txpwr_conf(entry, cursor, conf) \
|
||||
for (typecheck(const void *, cursor), (cursor) = (conf)->data, \
|
||||
memcpy(&(entry), cursor, \
|
||||
min_t(u8, sizeof(entry), (conf)->ent_sz)); \
|
||||
for (typecheck(const void *, cursor), (cursor) = (conf)->data; \
|
||||
(cursor) < (conf)->data + (conf)->num_ents * (conf)->ent_sz; \
|
||||
(cursor) += (conf)->ent_sz, \
|
||||
memcpy(&(entry), cursor, \
|
||||
min_t(u8, sizeof(entry), (conf)->ent_sz)))
|
||||
(cursor) += (conf)->ent_sz) \
|
||||
if (rtw89_txpwr_entcpy(&(entry), cursor, sizeof(entry), conf))
|
||||
|
||||
struct rtw89_txpwr_byrate_data {
|
||||
struct rtw89_txpwr_conf conf;
|
||||
@@ -4178,6 +4246,7 @@ struct rtw89_chip_info {
|
||||
u8 wde_qempty_mgq_grpsel;
|
||||
u32 rf_base_addr[2];
|
||||
u8 support_macid_num;
|
||||
u8 support_link_num;
|
||||
u8 support_chanctx_num;
|
||||
u8 support_bands;
|
||||
u16 support_bandwidths;
|
||||
@@ -4342,6 +4411,8 @@ struct rtw89_mac_info {
|
||||
|
||||
/* see RTW89_FW_OFLD_WAIT_COND series for wait condition */
|
||||
struct rtw89_wait_info fw_ofld_wait;
|
||||
/* see RTW89_PS_WAIT_COND series for wait condition */
|
||||
struct rtw89_wait_info ps_wait;
|
||||
};
|
||||
|
||||
enum rtw89_fwdl_check_type {
|
||||
@@ -4594,7 +4665,7 @@ struct rtw89_hal {
|
||||
bool ant_diversity_fixed;
|
||||
bool support_cckpd;
|
||||
bool support_igi;
|
||||
atomic_t roc_entity_idx;
|
||||
atomic_t roc_chanctx_idx;
|
||||
|
||||
DECLARE_BITMAP(changes, NUM_OF_RTW89_CHANCTX_CHANGES);
|
||||
DECLARE_BITMAP(entity_map, NUM_OF_RTW89_CHANCTX);
|
||||
@@ -5312,6 +5383,9 @@ struct rtw89_wow_param {
|
||||
u8 ptk_keyidx;
|
||||
u8 akm;
|
||||
|
||||
/* see RTW89_WOW_WAIT_COND series for wait condition */
|
||||
struct rtw89_wait_info wait;
|
||||
|
||||
bool pno_inited;
|
||||
struct list_head pno_pkt_list;
|
||||
struct cfg80211_sched_scan_request *nd_config;
|
||||
@@ -5421,6 +5495,7 @@ struct rtw89_dev {
|
||||
const struct ieee80211_ops *ops;
|
||||
|
||||
bool dbcc_en;
|
||||
bool support_mlo;
|
||||
enum rtw89_mlo_dbcc_mode mlo_dbcc_mode;
|
||||
struct rtw89_hw_scan_info scan_info;
|
||||
const struct rtw89_chip_info *chip;
|
||||
@@ -5527,6 +5602,8 @@ struct rtw89_dev {
|
||||
struct napi_struct napi;
|
||||
int napi_budget_countdown;
|
||||
|
||||
struct rtw89_debugfs *debugfs;
|
||||
|
||||
/* HCI related data, keep last */
|
||||
u8 priv[] __aligned(sizeof(void *));
|
||||
};
|
||||
@@ -6053,7 +6130,7 @@ const struct cfg80211_chan_def *rtw89_chandef_get(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_chanctx_idx idx)
|
||||
{
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
enum rtw89_chanctx_idx roc_idx = atomic_read(&hal->roc_entity_idx);
|
||||
enum rtw89_chanctx_idx roc_idx = atomic_read(&hal->roc_chanctx_idx);
|
||||
|
||||
if (roc_idx == idx)
|
||||
return &hal->roc_chandef;
|
||||
@@ -6172,12 +6249,13 @@ static inline void rtw89_chip_rfk_channel(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static inline void rtw89_chip_rfk_band_changed(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
|
||||
if (chip->ops->rfk_band_changed)
|
||||
chip->ops->rfk_band_changed(rtwdev, phy_idx);
|
||||
chip->ops->rfk_band_changed(rtwdev, phy_idx, chan);
|
||||
}
|
||||
|
||||
static inline void rtw89_chip_rfk_scan(struct rtw89_dev *rtwdev,
|
||||
@@ -6243,6 +6321,15 @@ static inline void rtw89_chip_query_ppdu(struct rtw89_dev *rtwdev,
|
||||
chip->ops->query_ppdu(rtwdev, phy_ppdu, status);
|
||||
}
|
||||
|
||||
static inline void rtw89_chip_convert_rpl_to_rssi(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
|
||||
if (chip->ops->convert_rpl_to_rssi)
|
||||
chip->ops->convert_rpl_to_rssi(rtwdev, phy_ppdu);
|
||||
}
|
||||
|
||||
static inline void rtw89_ctrl_nbtg_bt_tx(struct rtw89_dev *rtwdev, bool en,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
@@ -6274,6 +6361,15 @@ void rtw89_chip_cfg_txpwr_ul_tb_offset(struct rtw89_dev *rtwdev,
|
||||
chip->ops->set_txpwr_ul_tb_offset(rtwdev, 0, rtwvif->mac_idx);
|
||||
}
|
||||
|
||||
static inline void rtw89_chip_digital_pwr_comp(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
|
||||
if (chip->ops->digital_pwr_comp)
|
||||
chip->ops->digital_pwr_comp(rtwdev, phy_idx);
|
||||
}
|
||||
|
||||
static inline void rtw89_load_txpwr_table(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_txpwr_table *tbl)
|
||||
{
|
||||
|
||||
@@ -52,6 +52,27 @@ struct rtw89_debugfs_priv {
|
||||
};
|
||||
};
|
||||
|
||||
struct rtw89_debugfs {
|
||||
struct rtw89_debugfs_priv read_reg;
|
||||
struct rtw89_debugfs_priv write_reg;
|
||||
struct rtw89_debugfs_priv read_rf;
|
||||
struct rtw89_debugfs_priv write_rf;
|
||||
struct rtw89_debugfs_priv rf_reg_dump;
|
||||
struct rtw89_debugfs_priv txpwr_table;
|
||||
struct rtw89_debugfs_priv mac_reg_dump;
|
||||
struct rtw89_debugfs_priv mac_mem_dump;
|
||||
struct rtw89_debugfs_priv mac_dbg_port_dump;
|
||||
struct rtw89_debugfs_priv send_h2c;
|
||||
struct rtw89_debugfs_priv early_h2c;
|
||||
struct rtw89_debugfs_priv fw_crash;
|
||||
struct rtw89_debugfs_priv btc_info;
|
||||
struct rtw89_debugfs_priv btc_manual;
|
||||
struct rtw89_debugfs_priv fw_log_manual;
|
||||
struct rtw89_debugfs_priv phy_info;
|
||||
struct rtw89_debugfs_priv stations;
|
||||
struct rtw89_debugfs_priv disable_dm;
|
||||
};
|
||||
|
||||
static const u16 rtw89_rate_info_bw_to_mhz_map[] = {
|
||||
[RATE_INFO_BW_20] = 20,
|
||||
[RATE_INFO_BW_40] = 40,
|
||||
@@ -3463,9 +3484,9 @@ static ssize_t rtw89_debug_priv_btc_manual_set(struct file *filp,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t rtw89_debug_fw_log_manual_set(struct file *filp,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *loff)
|
||||
static ssize_t rtw89_debug_priv_fw_log_manual_set(struct file *filp,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *loff)
|
||||
{
|
||||
struct rtw89_debugfs_priv *debugfs_priv = filp->private_data;
|
||||
struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;
|
||||
@@ -3854,92 +3875,55 @@ rtw89_debug_priv_disable_dm_set(struct file *filp, const char __user *user_buf,
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_read_reg = {
|
||||
.cb_read = rtw89_debug_priv_read_reg_get,
|
||||
.cb_write = rtw89_debug_priv_read_reg_select,
|
||||
};
|
||||
#define rtw89_debug_priv_get(name) \
|
||||
{ \
|
||||
.cb_read = rtw89_debug_priv_ ##name## _get, \
|
||||
}
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_write_reg = {
|
||||
.cb_write = rtw89_debug_priv_write_reg_set,
|
||||
};
|
||||
#define rtw89_debug_priv_set(name) \
|
||||
{ \
|
||||
.cb_write = rtw89_debug_priv_ ##name## _set, \
|
||||
}
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_read_rf = {
|
||||
.cb_read = rtw89_debug_priv_read_rf_get,
|
||||
.cb_write = rtw89_debug_priv_read_rf_select,
|
||||
};
|
||||
#define rtw89_debug_priv_select_and_get(name) \
|
||||
{ \
|
||||
.cb_write = rtw89_debug_priv_ ##name## _select, \
|
||||
.cb_read = rtw89_debug_priv_ ##name## _get, \
|
||||
}
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_write_rf = {
|
||||
.cb_write = rtw89_debug_priv_write_rf_set,
|
||||
};
|
||||
#define rtw89_debug_priv_set_and_get(name) \
|
||||
{ \
|
||||
.cb_write = rtw89_debug_priv_ ##name## _set, \
|
||||
.cb_read = rtw89_debug_priv_ ##name## _get, \
|
||||
}
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_rf_reg_dump = {
|
||||
.cb_read = rtw89_debug_priv_rf_reg_dump_get,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_txpwr_table = {
|
||||
.cb_read = rtw89_debug_priv_txpwr_table_get,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_mac_reg_dump = {
|
||||
.cb_read = rtw89_debug_priv_mac_reg_dump_get,
|
||||
.cb_write = rtw89_debug_priv_mac_reg_dump_select,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_mac_mem_dump = {
|
||||
.cb_read = rtw89_debug_priv_mac_mem_dump_get,
|
||||
.cb_write = rtw89_debug_priv_mac_mem_dump_select,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_mac_dbg_port_dump = {
|
||||
.cb_read = rtw89_debug_priv_mac_dbg_port_dump_get,
|
||||
.cb_write = rtw89_debug_priv_mac_dbg_port_dump_select,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_send_h2c = {
|
||||
.cb_write = rtw89_debug_priv_send_h2c_set,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_early_h2c = {
|
||||
.cb_read = rtw89_debug_priv_early_h2c_get,
|
||||
.cb_write = rtw89_debug_priv_early_h2c_set,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_fw_crash = {
|
||||
.cb_read = rtw89_debug_priv_fw_crash_get,
|
||||
.cb_write = rtw89_debug_priv_fw_crash_set,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_btc_info = {
|
||||
.cb_read = rtw89_debug_priv_btc_info_get,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_btc_manual = {
|
||||
.cb_write = rtw89_debug_priv_btc_manual_set,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_fw_log_manual = {
|
||||
.cb_write = rtw89_debug_fw_log_manual_set,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_phy_info = {
|
||||
.cb_read = rtw89_debug_priv_phy_info_get,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_stations = {
|
||||
.cb_read = rtw89_debug_priv_stations_get,
|
||||
};
|
||||
|
||||
static struct rtw89_debugfs_priv rtw89_debug_priv_disable_dm = {
|
||||
.cb_read = rtw89_debug_priv_disable_dm_get,
|
||||
.cb_write = rtw89_debug_priv_disable_dm_set,
|
||||
static const struct rtw89_debugfs rtw89_debugfs_templ = {
|
||||
.read_reg = rtw89_debug_priv_select_and_get(read_reg),
|
||||
.write_reg = rtw89_debug_priv_set(write_reg),
|
||||
.read_rf = rtw89_debug_priv_select_and_get(read_rf),
|
||||
.write_rf = rtw89_debug_priv_set(write_rf),
|
||||
.rf_reg_dump = rtw89_debug_priv_get(rf_reg_dump),
|
||||
.txpwr_table = rtw89_debug_priv_get(txpwr_table),
|
||||
.mac_reg_dump = rtw89_debug_priv_select_and_get(mac_reg_dump),
|
||||
.mac_mem_dump = rtw89_debug_priv_select_and_get(mac_mem_dump),
|
||||
.mac_dbg_port_dump = rtw89_debug_priv_select_and_get(mac_dbg_port_dump),
|
||||
.send_h2c = rtw89_debug_priv_set(send_h2c),
|
||||
.early_h2c = rtw89_debug_priv_set_and_get(early_h2c),
|
||||
.fw_crash = rtw89_debug_priv_set_and_get(fw_crash),
|
||||
.btc_info = rtw89_debug_priv_get(btc_info),
|
||||
.btc_manual = rtw89_debug_priv_set(btc_manual),
|
||||
.fw_log_manual = rtw89_debug_priv_set(fw_log_manual),
|
||||
.phy_info = rtw89_debug_priv_get(phy_info),
|
||||
.stations = rtw89_debug_priv_get(stations),
|
||||
.disable_dm = rtw89_debug_priv_set_and_get(disable_dm),
|
||||
};
|
||||
|
||||
#define rtw89_debugfs_add(name, mode, fopname, parent) \
|
||||
do { \
|
||||
rtw89_debug_priv_ ##name.rtwdev = rtwdev; \
|
||||
if (!debugfs_create_file(#name, mode, \
|
||||
parent, &rtw89_debug_priv_ ##name, \
|
||||
&file_ops_ ##fopname)) \
|
||||
struct rtw89_debugfs_priv *priv = &rtwdev->debugfs->name; \
|
||||
priv->rtwdev = rtwdev; \
|
||||
if (IS_ERR(debugfs_create_file(#name, mode, parent, priv, \
|
||||
&file_ops_ ##fopname))) \
|
||||
pr_debug("Unable to initialize debugfs:%s\n", #name); \
|
||||
} while (0)
|
||||
|
||||
@@ -3950,13 +3934,9 @@ static struct rtw89_debugfs_priv rtw89_debug_priv_disable_dm = {
|
||||
#define rtw89_debugfs_add_r(name) \
|
||||
rtw89_debugfs_add(name, S_IFREG | 0444, single_r, debugfs_topdir)
|
||||
|
||||
void rtw89_debugfs_init(struct rtw89_dev *rtwdev)
|
||||
static
|
||||
void rtw89_debugfs_add_sec0(struct rtw89_dev *rtwdev, struct dentry *debugfs_topdir)
|
||||
{
|
||||
struct dentry *debugfs_topdir;
|
||||
|
||||
debugfs_topdir = debugfs_create_dir("rtw89",
|
||||
rtwdev->hw->wiphy->debugfsdir);
|
||||
|
||||
rtw89_debugfs_add_rw(read_reg);
|
||||
rtw89_debugfs_add_w(write_reg);
|
||||
rtw89_debugfs_add_rw(read_rf);
|
||||
@@ -3966,6 +3946,11 @@ void rtw89_debugfs_init(struct rtw89_dev *rtwdev)
|
||||
rtw89_debugfs_add_rw(mac_reg_dump);
|
||||
rtw89_debugfs_add_rw(mac_mem_dump);
|
||||
rtw89_debugfs_add_rw(mac_dbg_port_dump);
|
||||
}
|
||||
|
||||
static
|
||||
void rtw89_debugfs_add_sec1(struct rtw89_dev *rtwdev, struct dentry *debugfs_topdir)
|
||||
{
|
||||
rtw89_debugfs_add_w(send_h2c);
|
||||
rtw89_debugfs_add_rw(early_h2c);
|
||||
rtw89_debugfs_add_rw(fw_crash);
|
||||
@@ -3976,6 +3961,27 @@ void rtw89_debugfs_init(struct rtw89_dev *rtwdev)
|
||||
rtw89_debugfs_add_r(stations);
|
||||
rtw89_debugfs_add_rw(disable_dm);
|
||||
}
|
||||
|
||||
void rtw89_debugfs_init(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct dentry *debugfs_topdir;
|
||||
|
||||
rtwdev->debugfs = kmemdup(&rtw89_debugfs_templ,
|
||||
sizeof(rtw89_debugfs_templ), GFP_KERNEL);
|
||||
if (!rtwdev->debugfs)
|
||||
return;
|
||||
|
||||
debugfs_topdir = debugfs_create_dir("rtw89",
|
||||
rtwdev->hw->wiphy->debugfsdir);
|
||||
|
||||
rtw89_debugfs_add_sec0(rtwdev, debugfs_topdir);
|
||||
rtw89_debugfs_add_sec1(rtwdev, debugfs_topdir);
|
||||
}
|
||||
|
||||
void rtw89_debugfs_deinit(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
kfree(rtwdev->debugfs);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTW89_DEBUGMSG
|
||||
|
||||
@@ -49,8 +49,10 @@ enum rtw89_debug_mac_reg_sel {
|
||||
|
||||
#ifdef CONFIG_RTW89_DEBUGFS
|
||||
void rtw89_debugfs_init(struct rtw89_dev *rtwdev);
|
||||
void rtw89_debugfs_deinit(struct rtw89_dev *rtwdev);
|
||||
#else
|
||||
static inline void rtw89_debugfs_init(struct rtw89_dev *rtwdev) {}
|
||||
static inline void rtw89_debugfs_deinit(struct rtw89_dev *rtwdev) {}
|
||||
#endif
|
||||
|
||||
#define rtw89_info(rtwdev, a...) dev_info((rtwdev)->dev, ##a)
|
||||
|
||||
@@ -4325,6 +4325,52 @@ int rtw89_fw_h2c_cxdrv_role_v2(struct rtw89_dev *rtwdev, u8 type)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw89_fw_h2c_cxdrv_role_v7(struct rtw89_dev *rtwdev, u8 type)
|
||||
{
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
struct rtw89_btc_wl_role_info_v7 *role = &btc->cx.wl.role_info_v7;
|
||||
struct rtw89_h2c_cxrole_v7 *h2c;
|
||||
u32 len = sizeof(*h2c);
|
||||
struct sk_buff *skb;
|
||||
int ret;
|
||||
|
||||
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
|
||||
if (!skb) {
|
||||
rtw89_err(rtwdev, "failed to alloc skb for h2c cxdrv_ctrl\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
skb_put(skb, len);
|
||||
h2c = (struct rtw89_h2c_cxrole_v7 *)skb->data;
|
||||
|
||||
h2c->hdr.type = type;
|
||||
h2c->hdr.ver = btc->ver->fwlrole;
|
||||
h2c->hdr.len = len - H2C_LEN_CXDRVHDR_V7;
|
||||
memcpy(&h2c->_u8, role, sizeof(h2c->_u8));
|
||||
h2c->_u32.role_map = cpu_to_le32(role->role_map);
|
||||
h2c->_u32.mrole_type = cpu_to_le32(role->mrole_type);
|
||||
h2c->_u32.mrole_noa_duration = cpu_to_le32(role->mrole_noa_duration);
|
||||
h2c->_u32.dbcc_en = cpu_to_le32(role->dbcc_en);
|
||||
h2c->_u32.dbcc_chg = cpu_to_le32(role->dbcc_chg);
|
||||
h2c->_u32.dbcc_2g_phy = cpu_to_le32(role->dbcc_2g_phy);
|
||||
|
||||
rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
H2C_CAT_OUTSRC, BTFC_SET,
|
||||
SET_DRV_INFO, 0, 0,
|
||||
len);
|
||||
|
||||
ret = rtw89_h2c_tx(rtwdev, skb, false);
|
||||
if (ret) {
|
||||
rtw89_err(rtwdev, "failed to send h2c\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
dev_kfree_skb_any(skb);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw89_fw_h2c_cxdrv_role_v8(struct rtw89_dev *rtwdev, u8 type)
|
||||
{
|
||||
struct rtw89_btc *btc = &rtwdev->btc;
|
||||
@@ -4343,6 +4389,7 @@ int rtw89_fw_h2c_cxdrv_role_v8(struct rtw89_dev *rtwdev, u8 type)
|
||||
h2c = (struct rtw89_h2c_cxrole_v8 *)skb->data;
|
||||
|
||||
h2c->hdr.type = type;
|
||||
h2c->hdr.ver = btc->ver->fwlrole;
|
||||
h2c->hdr.len = len - H2C_LEN_CXDRVHDR_V7;
|
||||
memcpy(&h2c->_u8, role, sizeof(h2c->_u8));
|
||||
h2c->_u32.role_map = cpu_to_le32(role->role_map);
|
||||
@@ -4423,7 +4470,7 @@ int rtw89_fw_h2c_cxdrv_ctrl_v7(struct rtw89_dev *rtwdev, u8 type)
|
||||
|
||||
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
|
||||
if (!skb) {
|
||||
rtw89_err(rtwdev, "failed to alloc skb for h2c cxdrv_ctrl\n");
|
||||
rtw89_err(rtwdev, "failed to alloc skb for h2c cxdrv_ctrl_v7\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
skb_put(skb, len);
|
||||
@@ -5267,10 +5314,8 @@ int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
int rtw89_fw_h2c_rf_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_tssi_mode tssi_mode)
|
||||
const struct rtw89_chan *chan, enum rtw89_tssi_mode tssi_mode)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
|
||||
RTW89_CHANCTX_0);
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
struct rtw89_h2c_rf_tssi *h2c;
|
||||
u32 len = sizeof(*h2c);
|
||||
@@ -5314,7 +5359,8 @@ int rtw89_fw_h2c_rf_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw89_fw_h2c_rf_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
int rtw89_fw_h2c_rf_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_h2c_rf_iqk *h2c;
|
||||
u32 len = sizeof(*h2c);
|
||||
@@ -5349,10 +5395,9 @@ int rtw89_fw_h2c_rf_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw89_fw_h2c_rf_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
int rtw89_fw_h2c_rf_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
|
||||
RTW89_CHANCTX_0);
|
||||
struct rtw89_h2c_rf_dpk *h2c;
|
||||
u32 len = sizeof(*h2c);
|
||||
struct sk_buff *skb;
|
||||
@@ -5392,10 +5437,9 @@ int rtw89_fw_h2c_rf_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw89_fw_h2c_rf_txgapk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
int rtw89_fw_h2c_rf_txgapk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
|
||||
RTW89_CHANCTX_0);
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
struct rtw89_h2c_rf_txgapk *h2c;
|
||||
u32 len = sizeof(*h2c);
|
||||
@@ -5436,7 +5480,8 @@ int rtw89_fw_h2c_rf_txgapk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw89_fw_h2c_rf_dack(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
int rtw89_fw_h2c_rf_dack(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_h2c_rf_dack *h2c;
|
||||
u32 len = sizeof(*h2c);
|
||||
@@ -5472,10 +5517,9 @@ int rtw89_fw_h2c_rf_dack(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw89_fw_h2c_rf_rxdck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
int rtw89_fw_h2c_rf_rxdck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
|
||||
RTW89_CHANCTX_0);
|
||||
struct rtw89_h2c_rf_rxdck *h2c;
|
||||
u32 len = sizeof(*h2c);
|
||||
struct sk_buff *skb;
|
||||
@@ -7132,10 +7176,10 @@ int rtw89_fw_h2c_wow_gtk_ofld(struct rtw89_dev *rtwdev,
|
||||
int rtw89_fw_h2c_fwips(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
bool enable)
|
||||
{
|
||||
struct rtw89_wait_info *wait = &rtwdev->mac.ps_wait;
|
||||
struct rtw89_h2c_fwips *h2c;
|
||||
u32 len = sizeof(*h2c);
|
||||
struct sk_buff *skb;
|
||||
int ret;
|
||||
|
||||
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
|
||||
if (!skb) {
|
||||
@@ -7154,25 +7198,15 @@ int rtw89_fw_h2c_fwips(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
H2C_FUNC_IPS_CFG, 0, 1,
|
||||
len);
|
||||
|
||||
ret = rtw89_h2c_tx(rtwdev, skb, false);
|
||||
if (ret) {
|
||||
rtw89_err(rtwdev, "failed to send h2c\n");
|
||||
goto fail;
|
||||
}
|
||||
return 0;
|
||||
fail:
|
||||
dev_kfree_skb_any(skb);
|
||||
|
||||
return ret;
|
||||
return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, RTW89_PS_WAIT_COND_IPS_CFG);
|
||||
}
|
||||
|
||||
int rtw89_fw_h2c_wow_request_aoac(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_wait_info *wait = &rtwdev->mac.fw_ofld_wait;
|
||||
struct rtw89_wait_info *wait = &rtwdev->wow.wait;
|
||||
struct rtw89_h2c_wow_aoac *h2c;
|
||||
u32 len = sizeof(*h2c);
|
||||
struct sk_buff *skb;
|
||||
unsigned int cond;
|
||||
|
||||
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
|
||||
if (!skb) {
|
||||
@@ -7191,8 +7225,7 @@ int rtw89_fw_h2c_wow_request_aoac(struct rtw89_dev *rtwdev)
|
||||
H2C_FUNC_AOAC_REPORT_REQ, 1, 0,
|
||||
len);
|
||||
|
||||
cond = RTW89_WOW_WAIT_COND(H2C_FUNC_AOAC_REPORT_REQ);
|
||||
return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, cond);
|
||||
return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, RTW89_WOW_WAIT_COND_AOAC);
|
||||
}
|
||||
|
||||
/* Return < 0, if failures happen during waiting for the condition.
|
||||
|
||||
@@ -2147,6 +2147,30 @@ struct rtw89_h2c_cxctrl_v7 {
|
||||
#define H2C_LEN_CXDRVHDR sizeof(struct rtw89_h2c_cxhdr)
|
||||
#define H2C_LEN_CXDRVHDR_V7 sizeof(struct rtw89_h2c_cxhdr_v7)
|
||||
|
||||
struct rtw89_btc_wl_role_info_v7_u8 {
|
||||
u8 connect_cnt;
|
||||
u8 link_mode;
|
||||
u8 link_mode_chg;
|
||||
u8 p2p_2g;
|
||||
|
||||
struct rtw89_btc_wl_active_role_v7 active_role[RTW89_BE_BTC_WL_MAX_ROLE_NUMBER];
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_wl_role_info_v7_u32 {
|
||||
__le32 role_map;
|
||||
__le32 mrole_type;
|
||||
__le32 mrole_noa_duration;
|
||||
__le32 dbcc_en;
|
||||
__le32 dbcc_chg;
|
||||
__le32 dbcc_2g_phy;
|
||||
} __packed;
|
||||
|
||||
struct rtw89_h2c_cxrole_v7 {
|
||||
struct rtw89_h2c_cxhdr_v7 hdr;
|
||||
struct rtw89_btc_wl_role_info_v7_u8 _u8;
|
||||
struct rtw89_btc_wl_role_info_v7_u32 _u32;
|
||||
} __packed;
|
||||
|
||||
struct rtw89_btc_wl_role_info_v8_u8 {
|
||||
u8 connect_cnt;
|
||||
u8 link_mode;
|
||||
@@ -2168,7 +2192,7 @@ struct rtw89_btc_wl_role_info_v8_u32 {
|
||||
} __packed;
|
||||
|
||||
struct rtw89_h2c_cxrole_v8 {
|
||||
struct rtw89_h2c_cxhdr hdr;
|
||||
struct rtw89_h2c_cxhdr_v7 hdr;
|
||||
struct rtw89_btc_wl_role_info_v8_u8 _u8;
|
||||
struct rtw89_btc_wl_role_info_v8_u32 _u32;
|
||||
} __packed;
|
||||
@@ -3991,14 +4015,27 @@ enum rtw89_wow_h2c_func {
|
||||
NUM_OF_RTW89_WOW_H2C_FUNC,
|
||||
};
|
||||
|
||||
#define RTW89_WOW_WAIT_COND(func) \
|
||||
(NUM_OF_RTW89_WOW_H2C_FUNC + (func))
|
||||
#define RTW89_WOW_WAIT_COND(tag, func) \
|
||||
((tag) * NUM_OF_RTW89_WOW_H2C_FUNC + (func))
|
||||
|
||||
#define RTW89_WOW_WAIT_COND_AOAC \
|
||||
RTW89_WOW_WAIT_COND(0 /* don't care */, H2C_FUNC_AOAC_REPORT_REQ)
|
||||
|
||||
/* CLASS 2 - PS */
|
||||
#define H2C_CL_MAC_PS 0x2
|
||||
#define H2C_FUNC_MAC_LPS_PARM 0x0
|
||||
#define H2C_FUNC_P2P_ACT 0x1
|
||||
#define H2C_FUNC_IPS_CFG 0x3
|
||||
enum rtw89_ps_h2c_func {
|
||||
H2C_FUNC_MAC_LPS_PARM = 0x0,
|
||||
H2C_FUNC_P2P_ACT = 0x1,
|
||||
H2C_FUNC_IPS_CFG = 0x3,
|
||||
|
||||
NUM_OF_RTW89_PS_H2C_FUNC,
|
||||
};
|
||||
|
||||
#define RTW89_PS_WAIT_COND(tag, func) \
|
||||
((tag) * NUM_OF_RTW89_PS_H2C_FUNC + (func))
|
||||
|
||||
#define RTW89_PS_WAIT_COND_IPS_CFG \
|
||||
RTW89_PS_WAIT_COND(0 /* don't care */, H2C_FUNC_IPS_CFG)
|
||||
|
||||
/* CLASS 3 - FW download */
|
||||
#define H2C_CL_MAC_FWDL 0x3
|
||||
@@ -4426,6 +4463,7 @@ int rtw89_fw_h2c_cxdrv_init_v7(struct rtw89_dev *rtwdev, u8 type);
|
||||
int rtw89_fw_h2c_cxdrv_role(struct rtw89_dev *rtwdev, u8 type);
|
||||
int rtw89_fw_h2c_cxdrv_role_v1(struct rtw89_dev *rtwdev, u8 type);
|
||||
int rtw89_fw_h2c_cxdrv_role_v2(struct rtw89_dev *rtwdev, u8 type);
|
||||
int rtw89_fw_h2c_cxdrv_role_v7(struct rtw89_dev *rtwdev, u8 type);
|
||||
int rtw89_fw_h2c_cxdrv_role_v8(struct rtw89_dev *rtwdev, u8 type);
|
||||
int rtw89_fw_h2c_cxdrv_ctrl(struct rtw89_dev *rtwdev, u8 type);
|
||||
int rtw89_fw_h2c_cxdrv_ctrl_v7(struct rtw89_dev *rtwdev, u8 type);
|
||||
@@ -4453,12 +4491,17 @@ int rtw89_fw_h2c_rf_ntfy_mcc(struct rtw89_dev *rtwdev);
|
||||
int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
int rtw89_fw_h2c_rf_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_tssi_mode tssi_mode);
|
||||
int rtw89_fw_h2c_rf_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
int rtw89_fw_h2c_rf_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
int rtw89_fw_h2c_rf_txgapk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
int rtw89_fw_h2c_rf_dack(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
int rtw89_fw_h2c_rf_rxdck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
const struct rtw89_chan *chan, enum rtw89_tssi_mode tssi_mode);
|
||||
int rtw89_fw_h2c_rf_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan);
|
||||
int rtw89_fw_h2c_rf_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan);
|
||||
int rtw89_fw_h2c_rf_txgapk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan);
|
||||
int rtw89_fw_h2c_rf_dack(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan);
|
||||
int rtw89_fw_h2c_rf_rxdck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan);
|
||||
int rtw89_fw_h2c_raw_with_hdr(struct rtw89_dev *rtwdev,
|
||||
u8 h2c_class, u8 h2c_func, u8 *buf, u16 len,
|
||||
bool rack, bool dack);
|
||||
|
||||
@@ -2742,6 +2742,7 @@ bool rtw89_mac_is_qta_dbcc(struct rtw89_dev *rtwdev, enum rtw89_qta_mode mode)
|
||||
|
||||
static int ptcl_init_ax(struct rtw89_dev *rtwdev, u8 mac_idx)
|
||||
{
|
||||
enum rtw89_core_chip_id chip_id = rtwdev->chip->chip_id;
|
||||
u32 val, reg;
|
||||
int ret;
|
||||
|
||||
@@ -2780,6 +2781,12 @@ static int ptcl_init_ax(struct rtw89_dev *rtwdev, u8 mac_idx)
|
||||
B_AX_SPE_RPT_PATH_MASK, FWD_TO_WLCPU);
|
||||
}
|
||||
|
||||
if (chip_id == RTL8852A || rtw89_is_rtl885xb(rtwdev)) {
|
||||
reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_AGG_LEN_VHT_0, mac_idx);
|
||||
rtw89_write32_mask(rtwdev, reg,
|
||||
B_AX_AMPDU_MAX_LEN_VHT_MASK, 0x3FF80);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4880,6 +4887,7 @@ rtw89_mac_c2h_done_ack(struct rtw89_dev *rtwdev, struct sk_buff *skb_c2h, u32 le
|
||||
{
|
||||
/* N.B. This will run in interrupt context. */
|
||||
struct rtw89_wait_info *fw_ofld_wait = &rtwdev->mac.fw_ofld_wait;
|
||||
struct rtw89_wait_info *ps_wait = &rtwdev->mac.ps_wait;
|
||||
const struct rtw89_c2h_done_ack *c2h =
|
||||
(const struct rtw89_c2h_done_ack *)skb_c2h->data;
|
||||
u8 h2c_cat = le32_get_bits(c2h->w2, RTW89_C2H_DONE_ACK_W2_CAT);
|
||||
@@ -4900,6 +4908,18 @@ rtw89_mac_c2h_done_ack(struct rtw89_dev *rtwdev, struct sk_buff *skb_c2h, u32 le
|
||||
switch (h2c_class) {
|
||||
default:
|
||||
return;
|
||||
case H2C_CL_MAC_PS:
|
||||
switch (h2c_func) {
|
||||
default:
|
||||
return;
|
||||
case H2C_FUNC_IPS_CFG:
|
||||
cond = RTW89_PS_WAIT_COND_IPS_CFG;
|
||||
break;
|
||||
}
|
||||
|
||||
data.err = !!h2c_return;
|
||||
rtw89_complete_cond(ps_wait, cond, &data);
|
||||
return;
|
||||
case H2C_CL_MAC_FW_OFLD:
|
||||
switch (h2c_func) {
|
||||
default:
|
||||
@@ -5158,11 +5178,10 @@ rtw89_mac_c2h_wow_aoac_rpt(struct rtw89_dev *rtwdev, struct sk_buff *skb, u32 le
|
||||
{
|
||||
struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
||||
struct rtw89_wow_aoac_report *aoac_rpt = &rtw_wow->aoac_rpt;
|
||||
struct rtw89_wait_info *wait = &rtwdev->mac.fw_ofld_wait;
|
||||
struct rtw89_wait_info *wait = &rtw_wow->wait;
|
||||
const struct rtw89_c2h_wow_aoac_report *c2h =
|
||||
(const struct rtw89_c2h_wow_aoac_report *)skb->data;
|
||||
struct rtw89_completion_data data = {};
|
||||
unsigned int cond;
|
||||
|
||||
aoac_rpt->rpt_ver = c2h->rpt_ver;
|
||||
aoac_rpt->sec_type = c2h->sec_type;
|
||||
@@ -5180,8 +5199,7 @@ rtw89_mac_c2h_wow_aoac_rpt(struct rtw89_dev *rtwdev, struct sk_buff *skb, u32 le
|
||||
aoac_rpt->igtk_ipn = le64_to_cpu(c2h->igtk_ipn);
|
||||
memcpy(aoac_rpt->igtk, c2h->igtk, sizeof(aoac_rpt->igtk));
|
||||
|
||||
cond = RTW89_WOW_WAIT_COND(H2C_FUNC_AOAC_REPORT_REQ);
|
||||
rtw89_complete_cond(wait, cond, &data);
|
||||
rtw89_complete_cond(wait, RTW89_WOW_WAIT_COND_AOAC, &data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -421,7 +421,6 @@ enum rtw89_mac_c2h_mrc_func {
|
||||
|
||||
enum rtw89_mac_c2h_wow_func {
|
||||
RTW89_MAC_C2H_FUNC_AOAC_REPORT,
|
||||
RTW89_MAC_C2H_FUNC_READ_WOW_CAM,
|
||||
|
||||
NUM_OF_RTW89_MAC_C2H_FUNC_WOW,
|
||||
};
|
||||
|
||||
@@ -356,8 +356,8 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev,
|
||||
csi_mode = RTW89_RA_RPT_MODE_HT;
|
||||
ra_mask |= ((u64)sta->deflink.ht_cap.mcs.rx_mask[3] << 48) |
|
||||
((u64)sta->deflink.ht_cap.mcs.rx_mask[2] << 36) |
|
||||
(sta->deflink.ht_cap.mcs.rx_mask[1] << 24) |
|
||||
(sta->deflink.ht_cap.mcs.rx_mask[0] << 12);
|
||||
((u64)sta->deflink.ht_cap.mcs.rx_mask[1] << 24) |
|
||||
((u64)sta->deflink.ht_cap.mcs.rx_mask[0] << 12);
|
||||
high_rate_masks = rtw89_ra_mask_ht_rates;
|
||||
if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
|
||||
stbc_en = 1;
|
||||
@@ -3084,6 +3084,7 @@ EXPORT_SYMBOL(rtw89_phy_rfk_pre_ntfy_and_wait);
|
||||
|
||||
int rtw89_phy_rfk_tssi_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_tssi_mode tssi_mode,
|
||||
unsigned int ms)
|
||||
{
|
||||
@@ -3091,7 +3092,7 @@ int rtw89_phy_rfk_tssi_and_wait(struct rtw89_dev *rtwdev,
|
||||
|
||||
rtw89_phy_rfk_report_prep(rtwdev);
|
||||
|
||||
ret = rtw89_fw_h2c_rf_tssi(rtwdev, phy_idx, tssi_mode);
|
||||
ret = rtw89_fw_h2c_rf_tssi(rtwdev, phy_idx, chan, tssi_mode);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -3101,13 +3102,14 @@ EXPORT_SYMBOL(rtw89_phy_rfk_tssi_and_wait);
|
||||
|
||||
int rtw89_phy_rfk_iqk_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan,
|
||||
unsigned int ms)
|
||||
{
|
||||
int ret;
|
||||
|
||||
rtw89_phy_rfk_report_prep(rtwdev);
|
||||
|
||||
ret = rtw89_fw_h2c_rf_iqk(rtwdev, phy_idx);
|
||||
ret = rtw89_fw_h2c_rf_iqk(rtwdev, phy_idx, chan);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -3117,13 +3119,14 @@ EXPORT_SYMBOL(rtw89_phy_rfk_iqk_and_wait);
|
||||
|
||||
int rtw89_phy_rfk_dpk_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan,
|
||||
unsigned int ms)
|
||||
{
|
||||
int ret;
|
||||
|
||||
rtw89_phy_rfk_report_prep(rtwdev);
|
||||
|
||||
ret = rtw89_fw_h2c_rf_dpk(rtwdev, phy_idx);
|
||||
ret = rtw89_fw_h2c_rf_dpk(rtwdev, phy_idx, chan);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -3133,13 +3136,14 @@ EXPORT_SYMBOL(rtw89_phy_rfk_dpk_and_wait);
|
||||
|
||||
int rtw89_phy_rfk_txgapk_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan,
|
||||
unsigned int ms)
|
||||
{
|
||||
int ret;
|
||||
|
||||
rtw89_phy_rfk_report_prep(rtwdev);
|
||||
|
||||
ret = rtw89_fw_h2c_rf_txgapk(rtwdev, phy_idx);
|
||||
ret = rtw89_fw_h2c_rf_txgapk(rtwdev, phy_idx, chan);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -3149,13 +3153,14 @@ EXPORT_SYMBOL(rtw89_phy_rfk_txgapk_and_wait);
|
||||
|
||||
int rtw89_phy_rfk_dack_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan,
|
||||
unsigned int ms)
|
||||
{
|
||||
int ret;
|
||||
|
||||
rtw89_phy_rfk_report_prep(rtwdev);
|
||||
|
||||
ret = rtw89_fw_h2c_rf_dack(rtwdev, phy_idx);
|
||||
ret = rtw89_fw_h2c_rf_dack(rtwdev, phy_idx, chan);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -3165,13 +3170,14 @@ EXPORT_SYMBOL(rtw89_phy_rfk_dack_and_wait);
|
||||
|
||||
int rtw89_phy_rfk_rxdck_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan,
|
||||
unsigned int ms)
|
||||
{
|
||||
int ret;
|
||||
|
||||
rtw89_phy_rfk_report_prep(rtwdev);
|
||||
|
||||
ret = rtw89_fw_h2c_rf_rxdck(rtwdev, phy_idx);
|
||||
ret = rtw89_fw_h2c_rf_rxdck(rtwdev, phy_idx, chan);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -5395,7 +5401,7 @@ static void rtw89_phy_dig_update_para(struct rtw89_dev *rtwdev)
|
||||
memcpy(dig->igi_rssi_th, igi_rssi_th, sizeof(dig->igi_rssi_th));
|
||||
}
|
||||
|
||||
static const u8 pd_low_th_offset = 20, dynamic_igi_min = 0x20;
|
||||
static const u8 pd_low_th_offset = 16, dynamic_igi_min = 0x20;
|
||||
static const u8 igi_max_performance_mode = 0x5a;
|
||||
static const u8 dynamic_pd_threshold_max;
|
||||
|
||||
@@ -5693,38 +5699,47 @@ void rtw89_phy_dig_reset(struct rtw89_dev *rtwdev)
|
||||
}
|
||||
|
||||
#define IGI_RSSI_MIN 10
|
||||
#define ABS_IGI_MIN 0xc
|
||||
void rtw89_phy_dig(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_dig_info *dig = &rtwdev->dig;
|
||||
bool is_linked = rtwdev->total_sta_assoc > 0;
|
||||
u8 igi_min;
|
||||
|
||||
if (unlikely(dig->bypass_dig)) {
|
||||
dig->bypass_dig = false;
|
||||
return;
|
||||
}
|
||||
|
||||
rtw89_phy_dig_update_rssi_info(rtwdev);
|
||||
|
||||
if (!dig->is_linked_pre && is_linked) {
|
||||
rtw89_debug(rtwdev, RTW89_DBG_DIG, "First connected\n");
|
||||
rtw89_phy_dig_update_para(rtwdev);
|
||||
dig->igi_fa_rssi = dig->igi_rssi;
|
||||
} else if (dig->is_linked_pre && !is_linked) {
|
||||
rtw89_debug(rtwdev, RTW89_DBG_DIG, "First disconnected\n");
|
||||
rtw89_phy_dig_update_para(rtwdev);
|
||||
dig->igi_fa_rssi = dig->igi_rssi;
|
||||
}
|
||||
dig->is_linked_pre = is_linked;
|
||||
|
||||
rtw89_phy_dig_igi_offset_by_env(rtwdev);
|
||||
rtw89_phy_dig_update_rssi_info(rtwdev);
|
||||
|
||||
dig->dyn_igi_min = (dig->igi_rssi > IGI_RSSI_MIN) ?
|
||||
dig->igi_rssi - IGI_RSSI_MIN : 0;
|
||||
dig->dyn_igi_max = dig->dyn_igi_min + IGI_OFFSET_MAX;
|
||||
dig->igi_fa_rssi = dig->dyn_igi_min + dig->fa_rssi_ofst;
|
||||
igi_min = max_t(int, dig->igi_rssi - IGI_RSSI_MIN, 0);
|
||||
dig->dyn_igi_max = min(igi_min + IGI_OFFSET_MAX, igi_max_performance_mode);
|
||||
dig->dyn_igi_min = max(igi_min, ABS_IGI_MIN);
|
||||
|
||||
dig->igi_fa_rssi = clamp(dig->igi_fa_rssi, dig->dyn_igi_min,
|
||||
dig->dyn_igi_max);
|
||||
if (dig->dyn_igi_max >= dig->dyn_igi_min) {
|
||||
dig->igi_fa_rssi += dig->fa_rssi_ofst;
|
||||
dig->igi_fa_rssi = clamp(dig->igi_fa_rssi, dig->dyn_igi_min,
|
||||
dig->dyn_igi_max);
|
||||
} else {
|
||||
dig->igi_fa_rssi = dig->dyn_igi_max;
|
||||
}
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_DIG,
|
||||
"rssi=%03d, dyn(max,min)=(%d,%d), final_rssi=%d\n",
|
||||
"rssi=%03d, dyn_joint(max,min)=(%d,%d), final_rssi=%d\n",
|
||||
dig->igi_rssi, dig->dyn_igi_max, dig->dyn_igi_min,
|
||||
dig->igi_fa_rssi);
|
||||
|
||||
|
||||
@@ -907,22 +907,28 @@ int rtw89_phy_rfk_pre_ntfy_and_wait(struct rtw89_dev *rtwdev,
|
||||
unsigned int ms);
|
||||
int rtw89_phy_rfk_tssi_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_tssi_mode tssi_mode,
|
||||
unsigned int ms);
|
||||
int rtw89_phy_rfk_iqk_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan,
|
||||
unsigned int ms);
|
||||
int rtw89_phy_rfk_dpk_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan,
|
||||
unsigned int ms);
|
||||
int rtw89_phy_rfk_txgapk_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan,
|
||||
unsigned int ms);
|
||||
int rtw89_phy_rfk_dack_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan,
|
||||
unsigned int ms);
|
||||
int rtw89_phy_rfk_rxdck_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan,
|
||||
unsigned int ms);
|
||||
void rtw89_phy_rfk_tssi_fill_fwcmd_efuse_to_de(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy,
|
||||
|
||||
@@ -98,10 +98,10 @@ static void __rtw89_enter_lps(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif
|
||||
rtw89_fw_h2c_lps_ch_info(rtwdev, rtwvif);
|
||||
}
|
||||
|
||||
static void __rtw89_leave_lps(struct rtw89_dev *rtwdev, u8 mac_id)
|
||||
static void __rtw89_leave_lps(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
{
|
||||
struct rtw89_lps_parm lps_param = {
|
||||
.macid = mac_id,
|
||||
.macid = rtwvif->mac_id,
|
||||
.psmode = RTW89_MAC_AX_PS_MODE_ACTIVE,
|
||||
.lastrpwm = RTW89_LAST_RPWM_ACTIVE,
|
||||
};
|
||||
@@ -109,6 +109,7 @@ static void __rtw89_leave_lps(struct rtw89_dev *rtwdev, u8 mac_id)
|
||||
rtw89_fw_h2c_lps_parm(rtwdev, &lps_param);
|
||||
rtw89_fw_leave_lps_check(rtwdev, 0);
|
||||
rtw89_btc_ntfy_radio_state(rtwdev, BTC_RFCTRL_WL_ON);
|
||||
rtw89_chip_digital_pwr_comp(rtwdev, rtwvif->phy_idx);
|
||||
}
|
||||
|
||||
void rtw89_leave_ps_mode(struct rtw89_dev *rtwdev)
|
||||
@@ -137,7 +138,7 @@ static void rtw89_leave_lps_vif(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwv
|
||||
rtwvif->wifi_role != RTW89_WIFI_ROLE_P2P_CLIENT)
|
||||
return;
|
||||
|
||||
__rtw89_leave_lps(rtwdev, rtwvif->mac_id);
|
||||
__rtw89_leave_lps(rtwdev, rtwvif);
|
||||
}
|
||||
|
||||
void rtw89_leave_lps(struct rtw89_dev *rtwdev)
|
||||
|
||||
@@ -2506,6 +2506,10 @@
|
||||
#define B_AX_RTS_TXTIME_TH_MASK GENMASK(15, 8)
|
||||
#define B_AX_RTS_LEN_TH_MASK GENMASK(7, 0)
|
||||
|
||||
#define R_AX_AGG_LEN_VHT_0 0xC618
|
||||
#define R_AX_AGG_LEN_VHT_0_C1 0xE618
|
||||
#define B_AX_AMPDU_MAX_LEN_VHT_MASK GENMASK(19, 0)
|
||||
|
||||
#define S_AX_CTS2S_TH_SEC_256B 1
|
||||
#define R_AX_SIFS_SETTING 0xC624
|
||||
#define R_AX_SIFS_SETTING_C1 0xE624
|
||||
@@ -6044,6 +6048,9 @@
|
||||
#define R_BE_WP_PAGE_INFO1 0xB7AC
|
||||
#define B_BE_WP_AVAL_PG_MASK GENMASK(28, 16)
|
||||
|
||||
#define R_BE_LTPC_T0_PATH0 0xBA28
|
||||
#define R_BE_LTPC_T0_PATH1 0xBB28
|
||||
|
||||
#define R_BE_CMAC_SHARE_FUNC_EN 0x0E000
|
||||
#define B_BE_CMAC_SHARE_CRPRT BIT(31)
|
||||
#define B_BE_CMAC_SHARE_EN BIT(30)
|
||||
|
||||
@@ -1587,29 +1587,31 @@ static void rtw8851b_rfk_init(struct rtw89_dev *rtwdev)
|
||||
rtw8851b_aack(rtwdev);
|
||||
rtw8851b_rck(rtwdev);
|
||||
rtw8851b_dack(rtwdev);
|
||||
rtw8851b_rx_dck(rtwdev, RTW89_PHY_0);
|
||||
rtw8851b_rx_dck(rtwdev, RTW89_PHY_0, RTW89_CHANCTX_0);
|
||||
}
|
||||
|
||||
static void rtw8851b_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
{
|
||||
enum rtw89_chanctx_idx chanctx_idx = rtwvif->chanctx_idx;
|
||||
enum rtw89_phy_idx phy_idx = rtwvif->phy_idx;
|
||||
|
||||
rtw8851b_rx_dck(rtwdev, phy_idx);
|
||||
rtw8851b_iqk(rtwdev, phy_idx);
|
||||
rtw8851b_tssi(rtwdev, phy_idx, true);
|
||||
rtw8851b_dpk(rtwdev, phy_idx);
|
||||
rtw8851b_rx_dck(rtwdev, phy_idx, chanctx_idx);
|
||||
rtw8851b_iqk(rtwdev, phy_idx, chanctx_idx);
|
||||
rtw8851b_tssi(rtwdev, phy_idx, true, chanctx_idx);
|
||||
rtw8851b_dpk(rtwdev, phy_idx, chanctx_idx);
|
||||
}
|
||||
|
||||
static void rtw8851b_rfk_band_changed(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
rtw8851b_tssi_scan(rtwdev, phy_idx);
|
||||
rtw8851b_tssi_scan(rtwdev, phy_idx, chan);
|
||||
}
|
||||
|
||||
static void rtw8851b_rfk_scan(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
bool start)
|
||||
{
|
||||
rtw8851b_wifi_scan_notify(rtwdev, start, rtwvif->phy_idx);
|
||||
rtw8851b_wifi_scan_notify(rtwdev, start, rtwvif->phy_idx, rtwvif->chanctx_idx);
|
||||
}
|
||||
|
||||
static void rtw8851b_rfk_track(struct rtw89_dev *rtwdev)
|
||||
@@ -2385,9 +2387,11 @@ static const struct rtw89_chip_ops rtw8851b_chip_ops = {
|
||||
.get_thermal = rtw8851b_get_thermal,
|
||||
.ctrl_btg_bt_rx = rtw8851b_ctrl_btg_bt_rx,
|
||||
.query_ppdu = rtw8851b_query_ppdu,
|
||||
.convert_rpl_to_rssi = NULL,
|
||||
.ctrl_nbtg_bt_tx = rtw8851b_ctrl_nbtg_bt_tx,
|
||||
.cfg_txrx_path = rtw8851b_bb_cfg_txrx_path,
|
||||
.set_txpwr_ul_tb_offset = rtw8851b_set_txpwr_ul_tb_offset,
|
||||
.digital_pwr_comp = NULL,
|
||||
.pwr_on_func = rtw8851b_pwr_on_func,
|
||||
.pwr_off_func = rtw8851b_pwr_off_func,
|
||||
.query_rxdesc = rtw89_core_query_rxdesc,
|
||||
@@ -2462,6 +2466,7 @@ const struct rtw89_chip_info rtw8851b_chip_info = {
|
||||
.dig_regs = &rtw8851b_dig_regs,
|
||||
.tssi_dbw_table = NULL,
|
||||
.support_macid_num = RTW89_MAX_MAC_ID_NUM,
|
||||
.support_link_num = 0,
|
||||
.support_chanctx_num = 0,
|
||||
.support_rnr = false,
|
||||
.support_bands = BIT(NL80211_BAND_2GHZ) |
|
||||
|
||||
@@ -521,9 +521,10 @@ static void _dac_cal(struct rtw89_dev *rtwdev, bool force)
|
||||
}
|
||||
|
||||
static void _rx_dck_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, bool is_afe)
|
||||
enum rtw89_rf_path path, bool is_afe,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
"[RX_DCK] ==== S%d RX DCK (%s / CH%d / %s / by %s)====\n", path,
|
||||
@@ -574,7 +575,8 @@ static void _set_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_rf_path path, u8 rf
|
||||
_rxbb_ofst_swap(rtwdev, path, rf_mode);
|
||||
}
|
||||
|
||||
static void _rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool is_afe)
|
||||
static void _rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool is_afe,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u32 rf_reg5;
|
||||
u8 path;
|
||||
@@ -584,7 +586,7 @@ static void _rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool is_af
|
||||
0x2, rtwdev->hal.cv);
|
||||
|
||||
for (path = 0; path < RF_PATH_NUM_8851B; path++) {
|
||||
_rx_dck_info(rtwdev, phy, path, is_afe);
|
||||
_rx_dck_info(rtwdev, phy, path, is_afe, chanctx_idx);
|
||||
|
||||
rf_reg5 = rtw89_read_rf(rtwdev, path, RR_RSV1, RFREG_MASK);
|
||||
|
||||
@@ -1481,9 +1483,9 @@ static void _rfk_restore_rf_reg(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static void _iqk_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
u8 path)
|
||||
u8 path, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
u8 idx = 0;
|
||||
|
||||
@@ -1586,10 +1588,11 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
|
||||
}
|
||||
|
||||
static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
enum rtw89_phy_idx phy_idx, u8 path)
|
||||
enum rtw89_phy_idx phy_idx, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, RF_AB, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, RF_AB, chanctx_idx);
|
||||
u32 backup_rf_val[RTW8851B_IQK_SS][BACKUP_RF_REGS_NR];
|
||||
u32 backup_bb_val[BACKUP_BB_REGS_NR];
|
||||
|
||||
@@ -1602,7 +1605,7 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
iqk_info->version = RTW8851B_IQK_VER;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
|
||||
_iqk_get_ch_info(rtwdev, phy_idx, path);
|
||||
_iqk_get_ch_info(rtwdev, phy_idx, path, chanctx_idx);
|
||||
|
||||
_rfk_backup_bb_reg(rtwdev, &backup_bb_val[0]);
|
||||
_rfk_backup_rf_reg(rtwdev, &backup_rf_val[path][0], path);
|
||||
@@ -1618,9 +1621,10 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
BTC_WRFK_ONESHOT_STOP);
|
||||
}
|
||||
|
||||
static void _iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, bool force)
|
||||
static void _iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
bool force, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A, chanctx_idx);
|
||||
}
|
||||
|
||||
static void _dpk_bkup_kip(struct rtw89_dev *rtwdev, const u32 *reg,
|
||||
@@ -1746,9 +1750,9 @@ static void _dpk_init(struct rtw89_dev *rtwdev, enum rtw89_rf_path path)
|
||||
}
|
||||
|
||||
static void _dpk_information(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
|
||||
u8 kidx = dpk->cur_idx[path];
|
||||
@@ -2449,7 +2453,8 @@ static bool _dpk_main(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
enum rtw89_phy_idx phy, u8 kpath)
|
||||
enum rtw89_phy_idx phy, u8 kpath,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
u32 kip_bkup[RF_PATH_NUM_8851B][DPK_KIP_REG_NUM_8851B] = {};
|
||||
@@ -2465,7 +2470,7 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
continue;
|
||||
_dpk_bkup_kip(rtwdev, dpk_kip_reg, kip_bkup, path);
|
||||
_dpk_bkup_rf(rtwdev, dpk_rf_reg, rf_bkup, path);
|
||||
_dpk_information(rtwdev, phy, path);
|
||||
_dpk_information(rtwdev, phy, path, chanctx_idx);
|
||||
_dpk_init(rtwdev, path);
|
||||
|
||||
if (rtwdev->is_tssi_mode[path])
|
||||
@@ -2505,13 +2510,14 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
_dpk_kip_pwr_clk_onoff(rtwdev, false);
|
||||
}
|
||||
|
||||
static void _dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool force)
|
||||
static void _dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool force,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
"[DPK] ****** 8851B DPK Start (Ver: 0x%x, Cv: %d) ******\n",
|
||||
DPK_VER_8851B, rtwdev->hal.cv);
|
||||
|
||||
_dpk_cal_select(rtwdev, force, phy, _kpath(rtwdev, phy));
|
||||
_dpk_cal_select(rtwdev, force, phy, _kpath(rtwdev, phy), chanctx_idx);
|
||||
}
|
||||
|
||||
static void _dpk_track(struct rtw89_dev *rtwdev)
|
||||
@@ -2617,9 +2623,8 @@ static void _rck(struct rtw89_dev *rtwdev, enum rtw89_rf_path path)
|
||||
}
|
||||
|
||||
static void _tssi_set_sys(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
rtw89_rfk_parser(rtwdev, &rtw8851b_tssi_sys_defs_tbl);
|
||||
@@ -2650,7 +2655,7 @@ static void _tssi_set_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _tssi_set_tmeter_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
#define RTW8851B_TSSI_GET_VAL(ptr, idx) \
|
||||
({ \
|
||||
@@ -2664,7 +2669,6 @@ static void _tssi_set_tmeter_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx ph
|
||||
__val; \
|
||||
})
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u8 subband = chan->subband_type;
|
||||
const s8 *thm_up_a = NULL;
|
||||
@@ -2755,9 +2759,8 @@ static void _tssi_set_dac_gain_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx
|
||||
}
|
||||
|
||||
static void _tssi_slope_cal_org(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
rtw89_rfk_parser_by_cond(rtwdev, band == RTW89_BAND_2G,
|
||||
@@ -2766,9 +2769,9 @@ static void _tssi_slope_cal_org(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy
|
||||
}
|
||||
|
||||
static void _tssi_alignment_default(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, bool all)
|
||||
enum rtw89_rf_path path, bool all,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
rtw89_rfk_parser_by_cond(rtwdev, band == RTW89_BAND_2G,
|
||||
@@ -2944,10 +2947,9 @@ static u32 _tssi_get_trim_group(struct rtw89_dev *rtwdev, u8 ch)
|
||||
}
|
||||
|
||||
static s8 _tssi_get_ofdm_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u32 gidx, gidx_1st, gidx_2nd;
|
||||
u8 ch = chan->channel;
|
||||
s8 de_1st;
|
||||
@@ -2980,10 +2982,9 @@ static s8 _tssi_get_ofdm_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static s8 _tssi_get_ofdm_trim_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u32 tgidx, tgidx_1st, tgidx_2nd;
|
||||
u8 ch = chan->channel;
|
||||
s8 tde_1st;
|
||||
@@ -3017,10 +3018,10 @@ static s8 _tssi_get_ofdm_trim_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx ph
|
||||
return val;
|
||||
}
|
||||
|
||||
static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u8 gidx;
|
||||
s8 ofdm_de;
|
||||
@@ -3033,7 +3034,7 @@ static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx p
|
||||
|
||||
for (i = RF_PATH_A; i < RTW8851B_TSSI_PATH_NR; i++) {
|
||||
gidx = _tssi_get_cck_group(rtwdev, ch);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i, chan);
|
||||
val = tssi_info->tssi_cck[i][gidx] + trim_de;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
@@ -3049,8 +3050,8 @@ static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx p
|
||||
rtw89_phy_read32_mask(rtwdev, _tssi_de_cck_long[i],
|
||||
_TSSI_DE_MASK));
|
||||
|
||||
ofdm_de = _tssi_get_ofdm_de(rtwdev, phy, i);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i);
|
||||
ofdm_de = _tssi_get_ofdm_de(rtwdev, phy, i, chan);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i, chan);
|
||||
val = ofdm_de + trim_de;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
@@ -3096,10 +3097,10 @@ static void _tssi_alimentk_dump_result(struct rtw89_dev *rtwdev, enum rtw89_rf_p
|
||||
}
|
||||
|
||||
static void _tssi_alimentk_done(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy, enum rtw89_rf_path path)
|
||||
enum rtw89_phy_idx phy, enum rtw89_rf_path path,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 channel = chan->channel;
|
||||
u8 band;
|
||||
|
||||
@@ -3255,9 +3256,10 @@ void rtw8851b_dack(struct rtw89_dev *rtwdev)
|
||||
_dac_cal(rtwdev, false);
|
||||
}
|
||||
|
||||
void rtw8851b_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8851b_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
u32 tx_en;
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_START);
|
||||
@@ -3265,30 +3267,32 @@ void rtw8851b_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
_wait_rx_mode(rtwdev, _kpath(rtwdev, phy_idx));
|
||||
|
||||
_iqk_init(rtwdev);
|
||||
_iqk(rtwdev, phy_idx, false);
|
||||
_iqk(rtwdev, phy_idx, false, chanctx_idx);
|
||||
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8851b_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8851b_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
u32 tx_en;
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_RXDCK, BTC_WRFK_START);
|
||||
rtw89_chip_stop_sch_tx(rtwdev, phy_idx, &tx_en, RTW89_SCH_TX_SEL_ALL);
|
||||
_wait_rx_mode(rtwdev, _kpath(rtwdev, phy_idx));
|
||||
|
||||
_rx_dck(rtwdev, phy_idx, false);
|
||||
_rx_dck(rtwdev, phy_idx, false, chanctx_idx);
|
||||
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_RXDCK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8851b_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8851b_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
u32 tx_en;
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DPK, BTC_WRFK_START);
|
||||
@@ -3297,7 +3301,7 @@ void rtw8851b_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
|
||||
rtwdev->dpk.is_dpk_enable = true;
|
||||
rtwdev->dpk.is_dpk_reload_en = false;
|
||||
_dpk(rtwdev, phy_idx, false);
|
||||
_dpk(rtwdev, phy_idx, false, chanctx_idx);
|
||||
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DPK, BTC_WRFK_STOP);
|
||||
@@ -3308,9 +3312,11 @@ void rtw8851b_dpk_track(struct rtw89_dev *rtwdev)
|
||||
_dpk_track(rtwdev);
|
||||
}
|
||||
|
||||
void rtw8851b_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool hwtx_en)
|
||||
void rtw8851b_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
bool hwtx_en, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy, RF_A, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy, RF_A, chanctx_idx);
|
||||
u8 i;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI, "[TSSI] %s: phy=%d\n", __func__, phy);
|
||||
@@ -3319,26 +3325,26 @@ void rtw8851b_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool hwtx_e
|
||||
_tssi_disable(rtwdev, phy);
|
||||
|
||||
for (i = RF_PATH_A; i < RF_PATH_NUM_8851B; i++) {
|
||||
_tssi_set_sys(rtwdev, phy, i);
|
||||
_tssi_set_sys(rtwdev, phy, i, chan);
|
||||
_tssi_ini_txpwr_ctrl_bb(rtwdev, phy, i);
|
||||
_tssi_ini_txpwr_ctrl_bb_he_tb(rtwdev, phy, i);
|
||||
_tssi_set_dck(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i, chan);
|
||||
_tssi_set_dac_gain_tbl(rtwdev, phy, i);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i);
|
||||
_tssi_alignment_default(rtwdev, phy, i, true);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i, chan);
|
||||
_tssi_alignment_default(rtwdev, phy, i, true, chan);
|
||||
_tssi_set_tssi_slope(rtwdev, phy, i);
|
||||
}
|
||||
|
||||
_tssi_enable(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy, chan);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_STOP);
|
||||
}
|
||||
|
||||
void rtw8851b_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
void rtw8851b_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 channel = chan->channel;
|
||||
u32 i;
|
||||
|
||||
@@ -3348,20 +3354,21 @@ void rtw8851b_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
_tssi_disable(rtwdev, phy);
|
||||
|
||||
for (i = RF_PATH_A; i < RF_PATH_NUM_8851B; i++) {
|
||||
_tssi_set_sys(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i);
|
||||
_tssi_alignment_default(rtwdev, phy, i, true);
|
||||
_tssi_set_sys(rtwdev, phy, i, chan);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i, chan);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i, chan);
|
||||
_tssi_alignment_default(rtwdev, phy, i, true, chan);
|
||||
}
|
||||
|
||||
_tssi_enable(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy, chan);
|
||||
}
|
||||
|
||||
static void rtw8851b_tssi_default_txagc(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy, bool enable)
|
||||
enum rtw89_phy_idx phy, bool enable,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
u8 channel = chan->channel;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "======> %s ch=%d\n",
|
||||
@@ -3379,7 +3386,7 @@ static void rtw8851b_tssi_default_txagc(struct rtw89_dev *rtwdev,
|
||||
rtw89_phy_write32_mask(rtwdev, R_P0_TSSI_TRK, B_P0_TSSI_OFT_EN, 0x0);
|
||||
rtw89_phy_write32_mask(rtwdev, R_P0_TSSI_TRK, B_P0_TSSI_OFT_EN, 0x1);
|
||||
|
||||
_tssi_alimentk_done(rtwdev, phy, RF_PATH_A);
|
||||
_tssi_alimentk_done(rtwdev, phy, RF_PATH_A, chan);
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
"======>%s 2 SCAN_END Set 0x5818[7:0]=0x%x\n",
|
||||
@@ -3391,12 +3398,13 @@ static void rtw8851b_tssi_default_txagc(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
void rtw8851b_wifi_scan_notify(struct rtw89_dev *rtwdev, bool scan_start,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
if (scan_start)
|
||||
rtw8851b_tssi_default_txagc(rtwdev, phy_idx, true);
|
||||
rtw8851b_tssi_default_txagc(rtwdev, phy_idx, true, chanctx_idx);
|
||||
else
|
||||
rtw8851b_tssi_default_txagc(rtwdev, phy_idx, false);
|
||||
rtw8851b_tssi_default_txagc(rtwdev, phy_idx, false, chanctx_idx);
|
||||
}
|
||||
|
||||
static void _bw_setting(struct rtw89_dev *rtwdev, enum rtw89_rf_path path,
|
||||
|
||||
@@ -12,15 +12,21 @@ void rtw8851b_lck_init(struct rtw89_dev *rtwdev);
|
||||
void rtw8851b_lck_track(struct rtw89_dev *rtwdev);
|
||||
void rtw8851b_rck(struct rtw89_dev *rtwdev);
|
||||
void rtw8851b_dack(struct rtw89_dev *rtwdev);
|
||||
void rtw8851b_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
void rtw8851b_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
void rtw8851b_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8851b_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8851b_dpk_init(struct rtw89_dev *rtwdev);
|
||||
void rtw8851b_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
void rtw8851b_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8851b_dpk_track(struct rtw89_dev *rtwdev);
|
||||
void rtw8851b_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool hwtx_en);
|
||||
void rtw8851b_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
void rtw8851b_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
bool hwtx_en, enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8851b_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan);
|
||||
void rtw8851b_wifi_scan_notify(struct rtw89_dev *rtwdev, bool scan_start,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8851b_set_channel_rf(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
|
||||
@@ -337,6 +337,11 @@ static const struct rtw89_pwr_cfg rtw8852a_pwroff[] = {
|
||||
PWR_INTF_MSK_PCIE,
|
||||
PWR_BASE_MAC,
|
||||
PWR_CMD_WRITE, BIT(0), 0},
|
||||
{0x0092,
|
||||
PWR_CV_MSK_ALL,
|
||||
PWR_INTF_MSK_PCIE,
|
||||
PWR_BASE_MAC,
|
||||
PWR_CMD_WRITE, BIT(4), BIT(4)},
|
||||
{0x0005,
|
||||
PWR_CV_MSK_ALL,
|
||||
PWR_INTF_MSK_PCIE,
|
||||
@@ -1341,24 +1346,26 @@ static void rtw8852a_rfk_init(struct rtw89_dev *rtwdev)
|
||||
rtwdev->is_tssi_mode[RF_PATH_B] = false;
|
||||
|
||||
rtw8852a_rck(rtwdev);
|
||||
rtw8852a_dack(rtwdev);
|
||||
rtw8852a_rx_dck(rtwdev, RTW89_PHY_0, true);
|
||||
rtw8852a_dack(rtwdev, RTW89_CHANCTX_0);
|
||||
rtw8852a_rx_dck(rtwdev, RTW89_PHY_0, true, RTW89_CHANCTX_0);
|
||||
}
|
||||
|
||||
static void rtw8852a_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
{
|
||||
enum rtw89_chanctx_idx chanctx_idx = rtwvif->chanctx_idx;
|
||||
enum rtw89_phy_idx phy_idx = rtwvif->phy_idx;
|
||||
|
||||
rtw8852a_rx_dck(rtwdev, phy_idx, true);
|
||||
rtw8852a_iqk(rtwdev, phy_idx);
|
||||
rtw8852a_tssi(rtwdev, phy_idx);
|
||||
rtw8852a_dpk(rtwdev, phy_idx);
|
||||
rtw8852a_rx_dck(rtwdev, phy_idx, true, chanctx_idx);
|
||||
rtw8852a_iqk(rtwdev, phy_idx, chanctx_idx);
|
||||
rtw8852a_tssi(rtwdev, phy_idx, chanctx_idx);
|
||||
rtw8852a_dpk(rtwdev, phy_idx, chanctx_idx);
|
||||
}
|
||||
|
||||
static void rtw8852a_rfk_band_changed(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
rtw8852a_tssi_scan(rtwdev, phy_idx);
|
||||
rtw8852a_tssi_scan(rtwdev, phy_idx, chan);
|
||||
}
|
||||
|
||||
static void rtw8852a_rfk_scan(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
@@ -1544,10 +1551,8 @@ static void rtw8852a_start_pmac_tx(struct rtw89_dev *rtwdev,
|
||||
|
||||
void rtw8852a_bb_set_pmac_tx(struct rtw89_dev *rtwdev,
|
||||
struct rtw8852a_bb_pmac_info *tx_info,
|
||||
enum rtw89_phy_idx idx)
|
||||
enum rtw89_phy_idx idx, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
|
||||
if (!tx_info->en_pmac_tx) {
|
||||
rtw8852a_stop_pmac_tx(rtwdev, tx_info, idx);
|
||||
rtw89_phy_write32_idx(rtwdev, R_PD_CTRL, B_PD_HIT_DIS, 0, idx);
|
||||
@@ -1569,7 +1574,7 @@ void rtw8852a_bb_set_pmac_tx(struct rtw89_dev *rtwdev,
|
||||
|
||||
void rtw8852a_bb_set_pmac_pkt_tx(struct rtw89_dev *rtwdev, u8 enable,
|
||||
u16 tx_cnt, u16 period, u16 tx_time,
|
||||
enum rtw89_phy_idx idx)
|
||||
enum rtw89_phy_idx idx, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw8852a_bb_pmac_info tx_info = {0};
|
||||
|
||||
@@ -1579,7 +1584,7 @@ void rtw8852a_bb_set_pmac_pkt_tx(struct rtw89_dev *rtwdev, u8 enable,
|
||||
tx_info.tx_cnt = tx_cnt;
|
||||
tx_info.period = period;
|
||||
tx_info.tx_time = tx_time;
|
||||
rtw8852a_bb_set_pmac_tx(rtwdev, &tx_info, idx);
|
||||
rtw8852a_bb_set_pmac_tx(rtwdev, &tx_info, idx, chan);
|
||||
}
|
||||
|
||||
void rtw8852a_bb_set_power(struct rtw89_dev *rtwdev, s16 pwr_dbm,
|
||||
@@ -2108,9 +2113,11 @@ static const struct rtw89_chip_ops rtw8852a_chip_ops = {
|
||||
.get_thermal = rtw8852a_get_thermal,
|
||||
.ctrl_btg_bt_rx = rtw8852a_ctrl_btg_bt_rx,
|
||||
.query_ppdu = rtw8852a_query_ppdu,
|
||||
.convert_rpl_to_rssi = NULL,
|
||||
.ctrl_nbtg_bt_tx = rtw8852a_ctrl_nbtg_bt_tx,
|
||||
.cfg_txrx_path = NULL,
|
||||
.set_txpwr_ul_tb_offset = rtw8852a_set_txpwr_ul_tb_offset,
|
||||
.digital_pwr_comp = NULL,
|
||||
.pwr_on_func = NULL,
|
||||
.pwr_off_func = NULL,
|
||||
.query_rxdesc = rtw89_core_query_rxdesc,
|
||||
@@ -2177,6 +2184,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
|
||||
.dig_regs = &rtw8852a_dig_regs,
|
||||
.tssi_dbw_table = NULL,
|
||||
.support_macid_num = RTW89_MAX_MAC_ID_NUM,
|
||||
.support_link_num = 0,
|
||||
.support_chanctx_num = 1,
|
||||
.support_rnr = false,
|
||||
.support_bands = BIT(NL80211_BAND_2GHZ) |
|
||||
|
||||
@@ -97,10 +97,10 @@ extern const struct rtw89_chip_info rtw8852a_chip_info;
|
||||
void rtw8852a_bb_set_plcp_tx(struct rtw89_dev *rtwdev);
|
||||
void rtw8852a_bb_set_pmac_tx(struct rtw89_dev *rtwdev,
|
||||
struct rtw8852a_bb_pmac_info *tx_info,
|
||||
enum rtw89_phy_idx idx);
|
||||
enum rtw89_phy_idx idx, const struct rtw89_chan *chan);
|
||||
void rtw8852a_bb_set_pmac_pkt_tx(struct rtw89_dev *rtwdev, u8 enable,
|
||||
u16 tx_cnt, u16 period, u16 tx_time,
|
||||
enum rtw89_phy_idx idx);
|
||||
enum rtw89_phy_idx idx, const struct rtw89_chan *chan);
|
||||
void rtw8852a_bb_set_power(struct rtw89_dev *rtwdev, s16 pwr_dbm,
|
||||
enum rtw89_phy_idx idx);
|
||||
void rtw8852a_bb_cfg_tx_path(struct rtw89_dev *rtwdev, u8 tx_path);
|
||||
|
||||
@@ -493,11 +493,12 @@ static void _dack(struct rtw89_dev *rtwdev)
|
||||
_dack_s1(rtwdev);
|
||||
}
|
||||
|
||||
static void _dac_cal(struct rtw89_dev *rtwdev, bool force)
|
||||
static void _dac_cal(struct rtw89_dev *rtwdev, bool force,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_dack_info *dack = &rtwdev->dack;
|
||||
u32 rf0_0, rf1_0;
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, RF_AB, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, RF_AB, chanctx_idx);
|
||||
|
||||
dack->dack_done = false;
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]DACK b\n");
|
||||
@@ -799,12 +800,13 @@ static bool _iqk_check_cal(struct rtw89_dev *rtwdev, u8 path, u8 ktype)
|
||||
}
|
||||
|
||||
static bool _iqk_one_shot(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx, u8 path, u8 ktype)
|
||||
enum rtw89_phy_idx phy_idx, u8 path, u8 ktype,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
bool fail = false;
|
||||
u32 iqk_cmd = 0x0;
|
||||
u8 phy_map = rtw89_btc_path_phymap(rtwdev, phy_idx, path, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_path_phymap(rtwdev, phy_idx, path, chanctx_idx);
|
||||
u32 addr_rfc_ctl = 0x0;
|
||||
|
||||
if (path == RF_PATH_A)
|
||||
@@ -888,7 +890,8 @@ static bool _iqk_one_shot(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static bool _rxk_group_sel(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx, u8 path)
|
||||
enum rtw89_phy_idx phy_idx, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
static const u32 rxgn_a[4] = {0x18C, 0x1A0, 0x28C, 0x2A0};
|
||||
@@ -927,7 +930,7 @@ static bool _rxk_group_sel(struct rtw89_dev *rtwdev,
|
||||
rtw89_phy_write32_mask(rtwdev, R_CFIR_LUT + (path << 8), B_CFIR_LUT_GP, gp);
|
||||
rtw89_phy_write32_mask(rtwdev, R_IOQ_IQK_DPK, B_IOQ_IQK_DPK_EN, 0x1);
|
||||
rtw89_phy_write32_clr(rtwdev, R_NCTL_N1, B_NCTL_N1_CIP);
|
||||
fail = _iqk_one_shot(rtwdev, phy_idx, path, ID_RXK);
|
||||
fail = _iqk_one_shot(rtwdev, phy_idx, path, ID_RXK, chanctx_idx);
|
||||
rtw89_phy_write32_mask(rtwdev, R_IQKINF, BIT(16 + gp + path * 4), fail);
|
||||
}
|
||||
|
||||
@@ -952,7 +955,8 @@ static bool _rxk_group_sel(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static bool _iqk_nbrxk(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx, u8 path)
|
||||
enum rtw89_phy_idx phy_idx, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
u8 group = 0x0;
|
||||
@@ -991,7 +995,7 @@ static bool _iqk_nbrxk(struct rtw89_dev *rtwdev,
|
||||
B_CFIR_LUT_GP, group);
|
||||
rtw89_phy_write32_set(rtwdev, R_IOQ_IQK_DPK, B_IOQ_IQK_DPK_EN);
|
||||
rtw89_phy_write32_clr(rtwdev, R_NCTL_N1, B_NCTL_N1_CIP);
|
||||
fail = _iqk_one_shot(rtwdev, phy_idx, path, ID_NBRXK);
|
||||
fail = _iqk_one_shot(rtwdev, phy_idx, path, ID_NBRXK, chanctx_idx);
|
||||
|
||||
switch (iqk_info->iqk_band[path]) {
|
||||
case RTW89_BAND_2G:
|
||||
@@ -1040,7 +1044,8 @@ static void _iqk_rxclk_setting(struct rtw89_dev *rtwdev, u8 path)
|
||||
}
|
||||
|
||||
static bool _txk_group_sel(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx, u8 path)
|
||||
enum rtw89_phy_idx phy_idx, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
static const u32 a_txgain[4] = {0xE466, 0x646D, 0xE4E2, 0x64ED};
|
||||
static const u32 g_txgain[4] = {0x60e8, 0x60f0, 0x61e8, 0x61ED};
|
||||
@@ -1083,7 +1088,7 @@ static bool _txk_group_sel(struct rtw89_dev *rtwdev,
|
||||
rtw89_phy_write32_mask(rtwdev, R_CFIR_LUT + (path << 8),
|
||||
B_CFIR_LUT_GP, gp);
|
||||
rtw89_phy_write32_clr(rtwdev, R_NCTL_N1, B_NCTL_N1_CIP);
|
||||
fail = _iqk_one_shot(rtwdev, phy_idx, path, ID_TXK);
|
||||
fail = _iqk_one_shot(rtwdev, phy_idx, path, ID_TXK, chanctx_idx);
|
||||
rtw89_phy_write32_mask(rtwdev, R_IQKINF, BIT(8 + gp + path * 4), fail);
|
||||
}
|
||||
|
||||
@@ -1098,7 +1103,8 @@ static bool _txk_group_sel(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static bool _iqk_nbtxk(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx, u8 path)
|
||||
enum rtw89_phy_idx phy_idx, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
u8 group = 0x2;
|
||||
@@ -1131,7 +1137,7 @@ static bool _iqk_nbtxk(struct rtw89_dev *rtwdev,
|
||||
rtw89_phy_write32_mask(rtwdev, R_CFIR_LUT + (path << 8), B_CFIR_LUT_GP, group);
|
||||
rtw89_phy_write32_mask(rtwdev, R_KIP_IQP + (path << 8), MASKDWORD, itqt);
|
||||
rtw89_phy_write32_clr(rtwdev, R_NCTL_N1, B_NCTL_N1_CIP);
|
||||
fail = _iqk_one_shot(rtwdev, phy_idx, path, ID_NBTXK);
|
||||
fail = _iqk_one_shot(rtwdev, phy_idx, path, ID_NBTXK, chanctx_idx);
|
||||
if (!fail) {
|
||||
tmp = rtw89_phy_read32_mask(rtwdev, R_TXIQC + (path << 8), MASKDWORD);
|
||||
iqk_info->nb_txcfir[path] = tmp | 0x2;
|
||||
@@ -1179,7 +1185,8 @@ static bool _lok_finetune_check(struct rtw89_dev *rtwdev, u8 path)
|
||||
}
|
||||
|
||||
static bool _iqk_lok(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx, u8 path)
|
||||
enum rtw89_phy_idx phy_idx, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
u32 rf0 = 0x0;
|
||||
@@ -1210,11 +1217,11 @@ static bool _iqk_lok(struct rtw89_dev *rtwdev,
|
||||
rtw89_phy_write32_set(rtwdev, R_IOQ_IQK_DPK, B_IOQ_IQK_DPK_EN);
|
||||
rtw89_phy_write32_clr(rtwdev, R_NCTL_N1, B_NCTL_N1_CIP);
|
||||
rtw89_phy_write32_mask(rtwdev, R_KIP_IQP + (path << 8), MASKDWORD, itqt);
|
||||
tmp = _iqk_one_shot(rtwdev, phy_idx, path, ID_FLOK_COARSE);
|
||||
tmp = _iqk_one_shot(rtwdev, phy_idx, path, ID_FLOK_COARSE, chanctx_idx);
|
||||
iqk_info->lok_cor_fail[0][path] = tmp;
|
||||
fsleep(10);
|
||||
rtw89_phy_write32_mask(rtwdev, R_KIP_IQP + (path << 8), MASKDWORD, itqt);
|
||||
tmp = _iqk_one_shot(rtwdev, phy_idx, path, ID_FLOK_FINE);
|
||||
tmp = _iqk_one_shot(rtwdev, phy_idx, path, ID_FLOK_FINE, chanctx_idx);
|
||||
iqk_info->lok_fin_fail[0][path] = tmp;
|
||||
fail = _lok_finetune_check(rtwdev, path);
|
||||
return fail;
|
||||
@@ -1321,7 +1328,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
}
|
||||
|
||||
static
|
||||
void _iqk_by_path(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, u8 path)
|
||||
void _iqk_by_path(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
bool lok_is_fail = false;
|
||||
@@ -1333,30 +1341,35 @@ void _iqk_by_path(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, u8 path)
|
||||
for (i = 0; i < 3; i++) {
|
||||
_lok_res_table(rtwdev, path, ibias++);
|
||||
_iqk_txk_setting(rtwdev, path);
|
||||
lok_is_fail = _iqk_lok(rtwdev, phy_idx, path);
|
||||
lok_is_fail = _iqk_lok(rtwdev, phy_idx, path, chanctx_idx);
|
||||
if (!lok_is_fail)
|
||||
break;
|
||||
}
|
||||
if (iqk_info->is_nbiqk)
|
||||
iqk_info->iqk_tx_fail[0][path] = _iqk_nbtxk(rtwdev, phy_idx, path);
|
||||
iqk_info->iqk_tx_fail[0][path] = _iqk_nbtxk(rtwdev, phy_idx, path,
|
||||
chanctx_idx);
|
||||
else
|
||||
iqk_info->iqk_tx_fail[0][path] = _txk_group_sel(rtwdev, phy_idx, path);
|
||||
iqk_info->iqk_tx_fail[0][path] = _txk_group_sel(rtwdev, phy_idx, path,
|
||||
chanctx_idx);
|
||||
|
||||
_iqk_rxclk_setting(rtwdev, path);
|
||||
_iqk_rxk_setting(rtwdev, path);
|
||||
if (iqk_info->is_nbiqk || rtwdev->dbcc_en || iqk_info->iqk_band[path] == RTW89_BAND_2G)
|
||||
iqk_info->iqk_rx_fail[0][path] = _iqk_nbrxk(rtwdev, phy_idx, path);
|
||||
iqk_info->iqk_rx_fail[0][path] = _iqk_nbrxk(rtwdev, phy_idx, path,
|
||||
chanctx_idx);
|
||||
else
|
||||
iqk_info->iqk_rx_fail[0][path] = _rxk_group_sel(rtwdev, phy_idx, path);
|
||||
iqk_info->iqk_rx_fail[0][path] = _rxk_group_sel(rtwdev, phy_idx, path,
|
||||
chanctx_idx);
|
||||
|
||||
_iqk_info_iqk(rtwdev, phy_idx, path);
|
||||
}
|
||||
|
||||
static void _iqk_get_ch_info(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy, u8 path)
|
||||
enum rtw89_phy_idx phy, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
u32 reg_rf18 = 0x0, reg_35c = 0x0;
|
||||
u8 idx = 0;
|
||||
u8 get_empty_table = false;
|
||||
@@ -1413,9 +1426,9 @@ static void _iqk_get_ch_info(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static void _iqk_start_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
u8 path)
|
||||
u8 path, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
_iqk_by_path(rtwdev, phy_idx, path);
|
||||
_iqk_by_path(rtwdev, phy_idx, path, chanctx_idx);
|
||||
}
|
||||
|
||||
static void _iqk_restore(struct rtw89_dev *rtwdev, u8 path)
|
||||
@@ -1513,7 +1526,8 @@ static void _iqk_macbb_setting(struct rtw89_dev *rtwdev,
|
||||
rtw89_rfk_parser(rtwdev, tbl);
|
||||
}
|
||||
|
||||
static void _iqk_dbcc(struct rtw89_dev *rtwdev, u8 path)
|
||||
static void _iqk_dbcc(struct rtw89_dev *rtwdev, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
u8 phy_idx = 0x0;
|
||||
@@ -1525,10 +1539,10 @@ static void _iqk_dbcc(struct rtw89_dev *rtwdev, u8 path)
|
||||
else
|
||||
phy_idx = RTW89_PHY_1;
|
||||
|
||||
_iqk_get_ch_info(rtwdev, phy_idx, path);
|
||||
_iqk_get_ch_info(rtwdev, phy_idx, path, chanctx_idx);
|
||||
_iqk_macbb_setting(rtwdev, phy_idx, path);
|
||||
_iqk_preset(rtwdev, path);
|
||||
_iqk_start_iqk(rtwdev, phy_idx, path);
|
||||
_iqk_start_iqk(rtwdev, phy_idx, path, chanctx_idx);
|
||||
_iqk_restore(rtwdev, path);
|
||||
_iqk_afebb_restore(rtwdev, phy_idx, path);
|
||||
}
|
||||
@@ -1607,12 +1621,13 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
|
||||
}
|
||||
|
||||
static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
enum rtw89_phy_idx phy_idx, u8 path)
|
||||
enum rtw89_phy_idx phy_idx, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
u32 backup_bb_val[BACKUP_BB_REGS_NR];
|
||||
u32 backup_rf_val[RTW8852A_IQK_SS][BACKUP_RF_REGS_NR];
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, RF_AB, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, RF_AB, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);
|
||||
|
||||
@@ -1622,12 +1637,12 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
iqk_info->version = RTW8852A_IQK_VER;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
|
||||
_iqk_get_ch_info(rtwdev, phy_idx, path);
|
||||
_iqk_get_ch_info(rtwdev, phy_idx, path, chanctx_idx);
|
||||
_rfk_backup_bb_reg(rtwdev, &backup_bb_val[0]);
|
||||
_rfk_backup_rf_reg(rtwdev, &backup_rf_val[path][0], path);
|
||||
_iqk_macbb_setting(rtwdev, phy_idx, path);
|
||||
_iqk_preset(rtwdev, path);
|
||||
_iqk_start_iqk(rtwdev, phy_idx, path);
|
||||
_iqk_start_iqk(rtwdev, phy_idx, path, chanctx_idx);
|
||||
_iqk_restore(rtwdev, path);
|
||||
_iqk_afebb_restore(rtwdev, phy_idx, path);
|
||||
_rfk_restore_bb_reg(rtwdev, &backup_bb_val[0]);
|
||||
@@ -1635,18 +1650,19 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_STOP);
|
||||
}
|
||||
|
||||
static void _iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, bool force)
|
||||
static void _iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, bool force,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
switch (_kpath(rtwdev, phy_idx)) {
|
||||
case RF_A:
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A, chanctx_idx);
|
||||
break;
|
||||
case RF_B:
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B, chanctx_idx);
|
||||
break;
|
||||
case RF_AB:
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A, chanctx_idx);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B, chanctx_idx);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1656,9 +1672,10 @@ static void _iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, bool forc
|
||||
#define RXDCK_VER_8852A 0xe
|
||||
|
||||
static void _set_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, bool is_afe)
|
||||
enum rtw89_rf_path path, bool is_afe,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_path_phymap(rtwdev, phy, path, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_path_phymap(rtwdev, phy, path, chanctx_idx);
|
||||
u32 ori_val;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
@@ -1704,7 +1721,7 @@ static void _set_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
bool is_afe)
|
||||
bool is_afe, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 path, kpath, dck_tune;
|
||||
u32 rf_reg5;
|
||||
@@ -1732,7 +1749,7 @@ static void _rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
rtw89_write_rf(rtwdev, path, RR_RSV1, RR_RSV1_RST, 0x0);
|
||||
rtw89_write_rf(rtwdev, path, RR_DCK, RR_DCK_FINE, 0x0);
|
||||
rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_MASK, RR_MOD_V_RX);
|
||||
_set_rx_dck(rtwdev, phy, path, is_afe);
|
||||
_set_rx_dck(rtwdev, phy, path, is_afe, chanctx_idx);
|
||||
rtw89_write_rf(rtwdev, path, RR_DCK, RR_DCK_FINE, dck_tune);
|
||||
rtw89_write_rf(rtwdev, path, RR_RSV1, RFREG_MASK, rf_reg5);
|
||||
|
||||
@@ -1800,9 +1817,10 @@ static void _dpk_reload_kip(struct rtw89_dev *rtwdev, u32 *reg,
|
||||
}
|
||||
|
||||
static u8 _dpk_one_shot(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, enum rtw8852a_dpk_id id)
|
||||
enum rtw89_rf_path path, enum rtw8852a_dpk_id id,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_path_phymap(rtwdev, phy, path, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_path_phymap(rtwdev, phy, path, chanctx_idx);
|
||||
u16 dpk_cmd = 0x0;
|
||||
u32 val;
|
||||
int ret;
|
||||
@@ -1841,18 +1859,19 @@ static u8 _dpk_one_shot(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
|
||||
static void _dpk_rx_dck(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
rtw89_write_rf(rtwdev, path, RR_RXBB2, RR_EN_TIA_IDA, 0x3);
|
||||
_set_rx_dck(rtwdev, phy, path, false);
|
||||
_set_rx_dck(rtwdev, phy, path, false, chanctx_idx);
|
||||
}
|
||||
|
||||
static void _dpk_information(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
u8 kidx = dpk->cur_idx[path];
|
||||
|
||||
dpk->bp[path][kidx].band = chan->band_type;
|
||||
@@ -1967,7 +1986,8 @@ static void _dpk_kip_restore(struct rtw89_dev *rtwdev,
|
||||
|
||||
static void _dpk_lbk_rxiqk(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 cur_rxbb;
|
||||
|
||||
@@ -1997,7 +2017,7 @@ static void _dpk_lbk_rxiqk(struct rtw89_dev *rtwdev,
|
||||
|
||||
rtw89_phy_write32_mask(rtwdev, R_IQK_DIF4, B_IQK_DIF4_RXT, 0x11);
|
||||
|
||||
_dpk_one_shot(rtwdev, phy, path, LBK_RXIQK);
|
||||
_dpk_one_shot(rtwdev, phy, path, LBK_RXIQK, chanctx_idx);
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DPK] S%d LBK RXIQC = 0x%x\n", path,
|
||||
rtw89_phy_read32_mask(rtwdev, R_RXIQC, MASKDWORD));
|
||||
@@ -2186,10 +2206,11 @@ static bool _dpk_sync_check(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static bool _dpk_sync(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u8 kidx)
|
||||
enum rtw89_rf_path path, u8 kidx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
_dpk_tpg_sel(rtwdev, path, kidx);
|
||||
_dpk_one_shot(rtwdev, phy, path, SYNC);
|
||||
_dpk_one_shot(rtwdev, phy, path, SYNC, chanctx_idx);
|
||||
return _dpk_sync_check(rtwdev, path); /*1= fail*/
|
||||
}
|
||||
|
||||
@@ -2242,10 +2263,10 @@ static u8 _dpk_gainloss_read(struct rtw89_dev *rtwdev)
|
||||
|
||||
static void _dpk_gainloss(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy, enum rtw89_rf_path path,
|
||||
u8 kidx)
|
||||
u8 kidx, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
_dpk_table_select(rtwdev, path, kidx, 1);
|
||||
_dpk_one_shot(rtwdev, phy, path, GAIN_LOSS);
|
||||
_dpk_one_shot(rtwdev, phy, path, GAIN_LOSS, chanctx_idx);
|
||||
}
|
||||
|
||||
#define DPK_TXAGC_LOWER 0x2e
|
||||
@@ -2322,7 +2343,7 @@ static u8 _dpk_pas_read(struct rtw89_dev *rtwdev, bool is_check)
|
||||
|
||||
static u8 _dpk_agc(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u8 kidx, u8 init_txagc,
|
||||
bool loss_only)
|
||||
bool loss_only, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
#define DPK_AGC_ADJ_LMT 6
|
||||
#define DPK_DGAIN_UPPER 1922
|
||||
@@ -2330,7 +2351,7 @@ static u8 _dpk_agc(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
#define DPK_RXBB_UPPER 0x1f
|
||||
#define DPK_RXBB_LOWER 0
|
||||
#define DPK_GL_CRIT 7
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
u8 tmp_txagc, tmp_rxbb = 0, tmp_gl_idx = 0;
|
||||
u8 agc_cnt = 0;
|
||||
bool limited_rxbb = false;
|
||||
@@ -2344,7 +2365,7 @@ static u8 _dpk_agc(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
do {
|
||||
switch (step) {
|
||||
case DPK_AGC_STEP_SYNC_DGAIN:
|
||||
if (_dpk_sync(rtwdev, phy, path, kidx)) {
|
||||
if (_dpk_sync(rtwdev, phy, path, kidx, chanctx_idx)) {
|
||||
tmp_txagc = DPK_TXAGC_INVAL;
|
||||
goout = true;
|
||||
break;
|
||||
@@ -2380,7 +2401,8 @@ static u8 _dpk_agc(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
if (chan->band_width < RTW89_CHANNEL_WIDTH_80)
|
||||
_dpk_bypass_rxcfir(rtwdev, path, true);
|
||||
else
|
||||
_dpk_lbk_rxiqk(rtwdev, phy, path);
|
||||
_dpk_lbk_rxiqk(rtwdev, phy, path,
|
||||
chanctx_idx);
|
||||
}
|
||||
if (dgain > DPK_DGAIN_UPPER || dgain < DPK_DGAIN_LOWER)
|
||||
step = DPK_AGC_STEP_SYNC_DGAIN;
|
||||
@@ -2391,7 +2413,7 @@ static u8 _dpk_agc(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
break;
|
||||
|
||||
case DPK_AGC_STEP_GAIN_LOSS_IDX:
|
||||
_dpk_gainloss(rtwdev, phy, path, kidx);
|
||||
_dpk_gainloss(rtwdev, phy, path, kidx, chanctx_idx);
|
||||
tmp_gl_idx = _dpk_gainloss_read(rtwdev);
|
||||
|
||||
if ((tmp_gl_idx == 0 && _dpk_pas_read(rtwdev, true)) ||
|
||||
@@ -2475,11 +2497,12 @@ static void _dpk_set_mdpd_para(struct rtw89_dev *rtwdev, u8 order)
|
||||
}
|
||||
|
||||
static void _dpk_idl_mpa(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u8 kidx, u8 gain)
|
||||
enum rtw89_rf_path path, u8 kidx, u8 gain,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
_dpk_set_mdpd_para(rtwdev, 0x0);
|
||||
_dpk_table_select(rtwdev, path, kidx, 1);
|
||||
_dpk_one_shot(rtwdev, phy, path, MDPK_IDL);
|
||||
_dpk_one_shot(rtwdev, phy, path, MDPK_IDL, chanctx_idx);
|
||||
}
|
||||
|
||||
static void _dpk_fill_result(struct rtw89_dev *rtwdev,
|
||||
@@ -2518,10 +2541,10 @@ static void _dpk_fill_result(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static bool _dpk_reload_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
bool is_reload = false;
|
||||
u8 idx, cur_band, cur_ch;
|
||||
|
||||
@@ -2545,7 +2568,8 @@ static bool _dpk_reload_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static bool _dpk_main(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u8 gain)
|
||||
enum rtw89_rf_path path, u8 gain,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
u8 txagc = 0, kidx = dpk->cur_idx[path];
|
||||
@@ -2558,16 +2582,16 @@ static bool _dpk_main(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
_rf_direct_cntrl(rtwdev, path, false);
|
||||
txagc = _dpk_set_tx_pwr(rtwdev, gain, path);
|
||||
_dpk_rf_setting(rtwdev, gain, path, kidx);
|
||||
_dpk_rx_dck(rtwdev, phy, path);
|
||||
_dpk_rx_dck(rtwdev, phy, path, chanctx_idx);
|
||||
|
||||
_dpk_kip_setting(rtwdev, path, kidx);
|
||||
_dpk_manual_txcfir(rtwdev, path, true);
|
||||
txagc = _dpk_agc(rtwdev, phy, path, kidx, txagc, false);
|
||||
txagc = _dpk_agc(rtwdev, phy, path, kidx, txagc, false, chanctx_idx);
|
||||
if (txagc == DPK_TXAGC_INVAL)
|
||||
is_fail = true;
|
||||
_dpk_get_thermal(rtwdev, kidx, path);
|
||||
|
||||
_dpk_idl_mpa(rtwdev, phy, path, kidx, gain);
|
||||
_dpk_idl_mpa(rtwdev, phy, path, kidx, gain, chanctx_idx);
|
||||
rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_MASK, RR_MOD_V_RX);
|
||||
_dpk_fill_result(rtwdev, path, kidx, gain, txagc);
|
||||
_dpk_manual_txcfir(rtwdev, path, false);
|
||||
@@ -2584,7 +2608,8 @@ static bool _dpk_main(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
enum rtw89_phy_idx phy, u8 kpath)
|
||||
enum rtw89_phy_idx phy, u8 kpath,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
u32 backup_bb_val[BACKUP_BB_REGS_NR];
|
||||
@@ -2599,7 +2624,8 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
if (!(kpath & BIT(path)))
|
||||
continue;
|
||||
|
||||
reloaded[path] = _dpk_reload_check(rtwdev, phy, path);
|
||||
reloaded[path] = _dpk_reload_check(rtwdev, phy, path,
|
||||
chanctx_idx);
|
||||
if (!reloaded[path] && dpk->bp[path][0].ch != 0)
|
||||
dpk->cur_idx[path] = !dpk->cur_idx[path];
|
||||
else
|
||||
@@ -2624,7 +2650,7 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
_dpk_tssi_pause(rtwdev, path, true);
|
||||
_dpk_bkup_kip(rtwdev, kip_reg, kip_bkup, path);
|
||||
_rfk_backup_rf_reg(rtwdev, &backup_rf_val[path][0], path);
|
||||
_dpk_information(rtwdev, phy, path);
|
||||
_dpk_information(rtwdev, phy, path, chanctx_idx);
|
||||
}
|
||||
|
||||
_dpk_bb_afe_setting(rtwdev, phy, path, kpath);
|
||||
@@ -2633,7 +2659,7 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
if (!(kpath & BIT(path)) || reloaded[path])
|
||||
continue;
|
||||
|
||||
is_fail = _dpk_main(rtwdev, phy, path, 1);
|
||||
is_fail = _dpk_main(rtwdev, phy, path, 1, chanctx_idx);
|
||||
_dpk_onoff(rtwdev, path, is_fail);
|
||||
}
|
||||
|
||||
@@ -2652,10 +2678,11 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
}
|
||||
}
|
||||
|
||||
static bool _dpk_bypass_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
static bool _dpk_bypass_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_fem_info *fem = &rtwdev->fem;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
|
||||
if (fem->epa_2g && chan->band_type == RTW89_BAND_2G) {
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
@@ -2682,17 +2709,19 @@ static void _dpk_force_bypass(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
}
|
||||
}
|
||||
|
||||
static void _dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool force)
|
||||
static void _dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
bool force, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
"[DPK] ****** DPK Start (Ver: 0x%x, Cv: %d, RF_para: %d) ******\n",
|
||||
RTW8852A_DPK_VER, rtwdev->hal.cv,
|
||||
RTW8852A_RF_REL_VERSION);
|
||||
|
||||
if (_dpk_bypass_check(rtwdev, phy))
|
||||
if (_dpk_bypass_check(rtwdev, phy, chanctx_idx))
|
||||
_dpk_force_bypass(rtwdev, phy);
|
||||
else
|
||||
_dpk_cal_select(rtwdev, force, phy, _kpath(rtwdev, phy));
|
||||
_dpk_cal_select(rtwdev, force, phy, _kpath(rtwdev, phy),
|
||||
chanctx_idx);
|
||||
}
|
||||
|
||||
static void _dpk_onoff(struct rtw89_dev *rtwdev,
|
||||
@@ -2815,9 +2844,8 @@ static void _dpk_track(struct rtw89_dev *rtwdev)
|
||||
}
|
||||
|
||||
static void _tssi_rf_setting(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
if (band == RTW89_BAND_2G)
|
||||
@@ -2826,9 +2854,9 @@ static void _tssi_rf_setting(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
rtw89_write_rf(rtwdev, path, RR_TXPOW, RR_TXPOW_TXA, 0x1);
|
||||
}
|
||||
|
||||
static void _tssi_set_sys(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
static void _tssi_set_sys(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
rtw89_rfk_parser(rtwdev, &rtw8852a_tssi_sys_defs_tbl);
|
||||
@@ -2838,9 +2866,9 @@ static void _tssi_set_sys(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
}
|
||||
|
||||
static void _tssi_ini_txpwr_ctrl_bb(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
rtw89_rfk_parser_by_cond(rtwdev, path == RF_PATH_A,
|
||||
@@ -2869,7 +2897,7 @@ static void _tssi_set_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _tssi_set_tmeter_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
#define __get_val(ptr, idx) \
|
||||
({ \
|
||||
@@ -2883,7 +2911,6 @@ static void _tssi_set_tmeter_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx ph
|
||||
__val; \
|
||||
})
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u8 subband = chan->subband_type;
|
||||
const s8 *thm_up_a = NULL;
|
||||
@@ -3076,9 +3103,8 @@ static void _tssi_set_txagc_offset_mv_avg(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static void _tssi_pak(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 subband = chan->subband_type;
|
||||
|
||||
switch (subband) {
|
||||
@@ -3252,10 +3278,9 @@ static u32 _tssi_get_trim_group(struct rtw89_dev *rtwdev, u8 ch)
|
||||
}
|
||||
|
||||
static s8 _tssi_get_ofdm_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u32 gidx, gidx_1st, gidx_2nd;
|
||||
s8 de_1st = 0;
|
||||
@@ -3290,10 +3315,9 @@ static s8 _tssi_get_ofdm_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
|
||||
static s8 _tssi_get_ofdm_trim_de(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u32 tgidx, tgidx_1st, tgidx_2nd;
|
||||
s8 tde_1st = 0;
|
||||
@@ -3328,11 +3352,10 @@ static s8 _tssi_get_ofdm_trim_de(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy)
|
||||
enum rtw89_phy_idx phy, const struct rtw89_chan *chan)
|
||||
{
|
||||
#define __DE_MASK 0x003ff000
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
static const u32 r_cck_long[RF_PATH_NUM_8852A] = {0x5858, 0x7858};
|
||||
static const u32 r_cck_short[RF_PATH_NUM_8852A] = {0x5860, 0x7860};
|
||||
static const u32 r_mcs_20m[RF_PATH_NUM_8852A] = {0x5838, 0x7838};
|
||||
@@ -3352,7 +3375,7 @@ static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev,
|
||||
|
||||
for (i = 0; i < RF_PATH_NUM_8852A; i++) {
|
||||
gidx = _tssi_get_cck_group(rtwdev, ch);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i, chan);
|
||||
val = tssi_info->tssi_cck[i][gidx] + trim_de;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
@@ -3368,8 +3391,8 @@ static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev,
|
||||
rtw89_phy_read32_mask(rtwdev, r_cck_long[i],
|
||||
__DE_MASK));
|
||||
|
||||
ofdm_de = _tssi_get_ofdm_de(rtwdev, phy, i);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i);
|
||||
ofdm_de = _tssi_get_ofdm_de(rtwdev, phy, i, chan);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i, chan);
|
||||
val = ofdm_de + trim_de;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
@@ -3458,10 +3481,10 @@ static void _tssi_track(struct rtw89_dev *rtwdev)
|
||||
}
|
||||
}
|
||||
|
||||
static void _tssi_high_power(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
static void _tssi_high_power(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel, ch_tmp;
|
||||
u8 bw = chan->band_width;
|
||||
u8 band = chan->band_type;
|
||||
@@ -3497,24 +3520,25 @@ static void _tssi_high_power(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
}
|
||||
|
||||
static void _tssi_hw_tx(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
u8 path, s16 pwr_dbm, u8 enable)
|
||||
u8 path, s16 pwr_dbm, u8 enable, const struct rtw89_chan *chan)
|
||||
{
|
||||
rtw8852a_bb_set_plcp_tx(rtwdev);
|
||||
rtw8852a_bb_cfg_tx_path(rtwdev, path);
|
||||
rtw8852a_bb_set_power(rtwdev, pwr_dbm, phy);
|
||||
rtw8852a_bb_set_pmac_pkt_tx(rtwdev, enable, 20, 5000, 0, phy);
|
||||
rtw8852a_bb_set_pmac_pkt_tx(rtwdev, enable, 20, 5000, 0, phy, chan);
|
||||
}
|
||||
|
||||
static void _tssi_pre_tx(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
static void _tssi_pre_tx(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
const struct rtw89_chip_info *mac_reg = rtwdev->chip;
|
||||
u8 ch = chan->channel, ch_tmp;
|
||||
u8 bw = chan->band_width;
|
||||
u8 band = chan->band_type;
|
||||
u32 tx_en;
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy, 0, chanctx_idx);
|
||||
s8 power;
|
||||
s16 xdbm;
|
||||
u32 i, tx_counter = 0;
|
||||
@@ -3546,9 +3570,9 @@ static void _tssi_pre_tx(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
_wait_rx_mode(rtwdev, _kpath(rtwdev, phy));
|
||||
tx_counter = rtw89_phy_read32_mask(rtwdev, R_TX_COUNTER, MASKLWORD);
|
||||
|
||||
_tssi_hw_tx(rtwdev, phy, RF_PATH_AB, xdbm, true);
|
||||
_tssi_hw_tx(rtwdev, phy, RF_PATH_AB, xdbm, true, chan);
|
||||
mdelay(15);
|
||||
_tssi_hw_tx(rtwdev, phy, RF_PATH_AB, xdbm, false);
|
||||
_tssi_hw_tx(rtwdev, phy, RF_PATH_AB, xdbm, false, chan);
|
||||
|
||||
tx_counter = rtw89_phy_read32_mask(rtwdev, R_TX_COUNTER, MASKLWORD) -
|
||||
tx_counter;
|
||||
@@ -3600,19 +3624,21 @@ void rtw8852a_rck(struct rtw89_dev *rtwdev)
|
||||
_rck(rtwdev, path);
|
||||
}
|
||||
|
||||
void rtw8852a_dack(struct rtw89_dev *rtwdev)
|
||||
void rtw8852a_dack(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, 0, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DACK, BTC_WRFK_START);
|
||||
_dac_cal(rtwdev, false);
|
||||
_dac_cal(rtwdev, false, chanctx_idx);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DACK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u32 tx_en;
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_START);
|
||||
rtw89_chip_stop_sch_tx(rtwdev, phy_idx, &tx_en, RTW89_SCH_TX_SEL_ALL);
|
||||
@@ -3620,34 +3646,35 @@ void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
|
||||
_iqk_init(rtwdev);
|
||||
if (rtwdev->dbcc_en)
|
||||
_iqk_dbcc(rtwdev, phy_idx);
|
||||
_iqk_dbcc(rtwdev, phy_idx, chanctx_idx);
|
||||
else
|
||||
_iqk(rtwdev, phy_idx, false);
|
||||
_iqk(rtwdev, phy_idx, false, chanctx_idx);
|
||||
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8852a_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
bool is_afe)
|
||||
bool is_afe, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u32 tx_en;
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_RXDCK, BTC_WRFK_START);
|
||||
rtw89_chip_stop_sch_tx(rtwdev, phy_idx, &tx_en, RTW89_SCH_TX_SEL_ALL);
|
||||
_wait_rx_mode(rtwdev, _kpath(rtwdev, phy_idx));
|
||||
|
||||
_rx_dck(rtwdev, phy_idx, is_afe);
|
||||
_rx_dck(rtwdev, phy_idx, is_afe, chanctx_idx);
|
||||
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_RXDCK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8852a_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8852a_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u32 tx_en;
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DPK, BTC_WRFK_START);
|
||||
rtw89_chip_stop_sch_tx(rtwdev, phy_idx, &tx_en, RTW89_SCH_TX_SEL_ALL);
|
||||
@@ -3655,7 +3682,7 @@ void rtw8852a_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
|
||||
rtwdev->dpk.is_dpk_enable = true;
|
||||
rtwdev->dpk.is_dpk_reload_en = false;
|
||||
_dpk(rtwdev, phy_idx, false);
|
||||
_dpk(rtwdev, phy_idx, false, chanctx_idx);
|
||||
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DPK, BTC_WRFK_STOP);
|
||||
@@ -3666,8 +3693,10 @@ void rtw8852a_dpk_track(struct rtw89_dev *rtwdev)
|
||||
_dpk_track(rtwdev);
|
||||
}
|
||||
|
||||
void rtw8852a_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
void rtw8852a_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
u8 i;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI, "[TSSI] %s: phy=%d\n",
|
||||
@@ -3676,26 +3705,27 @@ void rtw8852a_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
_tssi_disable(rtwdev, phy);
|
||||
|
||||
for (i = RF_PATH_A; i < RF_PATH_NUM_8852A; i++) {
|
||||
_tssi_rf_setting(rtwdev, phy, i);
|
||||
_tssi_set_sys(rtwdev, phy);
|
||||
_tssi_ini_txpwr_ctrl_bb(rtwdev, phy, i);
|
||||
_tssi_rf_setting(rtwdev, phy, i, chan);
|
||||
_tssi_set_sys(rtwdev, phy, chan);
|
||||
_tssi_ini_txpwr_ctrl_bb(rtwdev, phy, i, chan);
|
||||
_tssi_ini_txpwr_ctrl_bb_he_tb(rtwdev, phy, i);
|
||||
_tssi_set_dck(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i, chan);
|
||||
_tssi_set_dac_gain_tbl(rtwdev, phy, i);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i);
|
||||
_tssi_set_rf_gap_tbl(rtwdev, phy, i);
|
||||
_tssi_set_slope(rtwdev, phy, i);
|
||||
_tssi_pak(rtwdev, phy, i);
|
||||
_tssi_pak(rtwdev, phy, i, chan);
|
||||
}
|
||||
|
||||
_tssi_enable(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy);
|
||||
_tssi_high_power(rtwdev, phy);
|
||||
_tssi_pre_tx(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy, chan);
|
||||
_tssi_high_power(rtwdev, phy, chan);
|
||||
_tssi_pre_tx(rtwdev, phy, chanctx_idx);
|
||||
}
|
||||
|
||||
void rtw8852a_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
void rtw8852a_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
@@ -3710,14 +3740,14 @@ void rtw8852a_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
_tssi_disable(rtwdev, phy);
|
||||
|
||||
for (i = RF_PATH_A; i < RF_PATH_NUM_8852A; i++) {
|
||||
_tssi_rf_setting(rtwdev, phy, i);
|
||||
_tssi_set_sys(rtwdev, phy);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i);
|
||||
_tssi_pak(rtwdev, phy, i);
|
||||
_tssi_rf_setting(rtwdev, phy, i, chan);
|
||||
_tssi_set_sys(rtwdev, phy, chan);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i, chan);
|
||||
_tssi_pak(rtwdev, phy, i, chan);
|
||||
}
|
||||
|
||||
_tssi_enable(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy, chan);
|
||||
}
|
||||
|
||||
void rtw8852a_tssi_track(struct rtw89_dev *rtwdev)
|
||||
|
||||
@@ -8,14 +8,19 @@
|
||||
#include "core.h"
|
||||
|
||||
void rtw8852a_rck(struct rtw89_dev *rtwdev);
|
||||
void rtw8852a_dack(struct rtw89_dev *rtwdev);
|
||||
void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
void rtw8852a_dack(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852a_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
bool is_afe);
|
||||
void rtw8852a_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
bool is_afe, enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852a_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852a_dpk_track(struct rtw89_dev *rtwdev);
|
||||
void rtw8852a_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
void rtw8852a_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
void rtw8852a_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852a_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan);
|
||||
void rtw8852a_tssi_track(struct rtw89_dev *rtwdev);
|
||||
void rtw8852a_wifi_scan_notify(struct rtw89_dev *rtwdev, bool scan_start,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
|
||||
@@ -558,30 +558,32 @@ static void rtw8852b_rfk_init(struct rtw89_dev *rtwdev)
|
||||
|
||||
rtw8852b_dpk_init(rtwdev);
|
||||
rtw8852b_rck(rtwdev);
|
||||
rtw8852b_dack(rtwdev);
|
||||
rtw8852b_rx_dck(rtwdev, RTW89_PHY_0);
|
||||
rtw8852b_dack(rtwdev, RTW89_CHANCTX_0);
|
||||
rtw8852b_rx_dck(rtwdev, RTW89_PHY_0, RTW89_CHANCTX_0);
|
||||
}
|
||||
|
||||
static void rtw8852b_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
{
|
||||
enum rtw89_chanctx_idx chanctx_idx = rtwvif->chanctx_idx;
|
||||
enum rtw89_phy_idx phy_idx = rtwvif->phy_idx;
|
||||
|
||||
rtw8852b_rx_dck(rtwdev, phy_idx);
|
||||
rtw8852b_iqk(rtwdev, phy_idx);
|
||||
rtw8852b_tssi(rtwdev, phy_idx, true);
|
||||
rtw8852b_dpk(rtwdev, phy_idx);
|
||||
rtw8852b_rx_dck(rtwdev, phy_idx, chanctx_idx);
|
||||
rtw8852b_iqk(rtwdev, phy_idx, chanctx_idx);
|
||||
rtw8852b_tssi(rtwdev, phy_idx, true, chanctx_idx);
|
||||
rtw8852b_dpk(rtwdev, phy_idx, chanctx_idx);
|
||||
}
|
||||
|
||||
static void rtw8852b_rfk_band_changed(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
rtw8852b_tssi_scan(rtwdev, phy_idx);
|
||||
rtw8852b_tssi_scan(rtwdev, phy_idx, chan);
|
||||
}
|
||||
|
||||
static void rtw8852b_rfk_scan(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
bool start)
|
||||
{
|
||||
rtw8852b_wifi_scan_notify(rtwdev, start, rtwvif->phy_idx);
|
||||
rtw8852b_wifi_scan_notify(rtwdev, start, rtwvif->phy_idx, rtwvif->chanctx_idx);
|
||||
}
|
||||
|
||||
static void rtw8852b_rfk_track(struct rtw89_dev *rtwdev)
|
||||
@@ -739,9 +741,11 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
|
||||
.get_thermal = rtw8852bx_get_thermal,
|
||||
.ctrl_btg_bt_rx = rtw8852bx_ctrl_btg_bt_rx,
|
||||
.query_ppdu = rtw8852bx_query_ppdu,
|
||||
.convert_rpl_to_rssi = rtw8852bx_convert_rpl_to_rssi,
|
||||
.ctrl_nbtg_bt_tx = rtw8852bx_ctrl_nbtg_bt_tx,
|
||||
.cfg_txrx_path = rtw8852bx_bb_cfg_txrx_path,
|
||||
.set_txpwr_ul_tb_offset = rtw8852bx_set_txpwr_ul_tb_offset,
|
||||
.digital_pwr_comp = NULL,
|
||||
.pwr_on_func = rtw8852b_pwr_on_func,
|
||||
.pwr_off_func = rtw8852b_pwr_off_func,
|
||||
.query_rxdesc = rtw89_core_query_rxdesc,
|
||||
@@ -817,6 +821,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
|
||||
.dig_regs = &rtw8852b_dig_regs,
|
||||
.tssi_dbw_table = NULL,
|
||||
.support_macid_num = RTW89_MAX_MAC_ID_NUM,
|
||||
.support_link_num = 0,
|
||||
.support_chanctx_num = 0,
|
||||
.support_rnr = false,
|
||||
.support_bands = BIT(NL80211_BAND_2GHZ) |
|
||||
|
||||
@@ -1445,10 +1445,8 @@ static void rtw8852bx_start_pmac_tx(struct rtw89_dev *rtwdev,
|
||||
static
|
||||
void rtw8852bx_bb_set_pmac_tx(struct rtw89_dev *rtwdev,
|
||||
struct rtw8852bx_bb_pmac_info *tx_info,
|
||||
enum rtw89_phy_idx idx)
|
||||
enum rtw89_phy_idx idx, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
|
||||
if (!tx_info->en_pmac_tx) {
|
||||
rtw8852bx_stop_pmac_tx(rtwdev, tx_info, idx);
|
||||
rtw89_phy_write32_idx(rtwdev, R_PD_CTRL, B_PD_HIT_DIS, 0, idx);
|
||||
@@ -1473,7 +1471,7 @@ void rtw8852bx_bb_set_pmac_tx(struct rtw89_dev *rtwdev,
|
||||
static
|
||||
void __rtw8852bx_bb_set_pmac_pkt_tx(struct rtw89_dev *rtwdev, u8 enable,
|
||||
u16 tx_cnt, u16 period, u16 tx_time,
|
||||
enum rtw89_phy_idx idx)
|
||||
enum rtw89_phy_idx idx, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw8852bx_bb_pmac_info tx_info = {0};
|
||||
|
||||
@@ -1484,7 +1482,7 @@ void __rtw8852bx_bb_set_pmac_pkt_tx(struct rtw89_dev *rtwdev, u8 enable,
|
||||
tx_info.period = period;
|
||||
tx_info.tx_time = tx_time;
|
||||
|
||||
rtw8852bx_bb_set_pmac_tx(rtwdev, &tx_info, idx);
|
||||
rtw8852bx_bb_set_pmac_tx(rtwdev, &tx_info, idx, chan);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -1623,9 +1621,9 @@ static void __rtw8852bx_ctrl_btg_bt_rx(struct rtw89_dev *rtwdev, bool en,
|
||||
|
||||
static
|
||||
void __rtw8852bx_bb_ctrl_rx_path(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_rf_path_bit rx_path)
|
||||
enum rtw89_rf_path_bit rx_path,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u32 rst_mask0;
|
||||
u32 rst_mask1;
|
||||
|
||||
@@ -1713,9 +1711,10 @@ static void rtw8852bx_bb_ctrl_rf_mode_rx_path(struct rtw89_dev *rtwdev,
|
||||
static void __rtw8852bx_bb_cfg_txrx_path(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_rf_path_bit rx_path = hal->antenna_rx ? hal->antenna_rx : RF_AB;
|
||||
|
||||
rtw8852bx_bb_ctrl_rx_path(rtwdev, rx_path);
|
||||
rtw8852bx_bb_ctrl_rx_path(rtwdev, rx_path, chan);
|
||||
rtw8852bx_bb_ctrl_rf_mode_rx_path(rtwdev, rx_path);
|
||||
|
||||
if (rtwdev->hal.rx_nss == 1) {
|
||||
@@ -1948,6 +1947,19 @@ static void __rtw8852bx_query_ppdu(struct rtw89_dev *rtwdev,
|
||||
rtw8852bx_fill_freq_with_ppdu(rtwdev, phy_ppdu, status);
|
||||
}
|
||||
|
||||
static void __rtw8852bx_convert_rpl_to_rssi(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu)
|
||||
{
|
||||
u8 delta = phy_ppdu->rpl_avg - phy_ppdu->rssi_avg;
|
||||
u8 *rssi = phy_ppdu->rssi;
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < RF_PATH_NUM_8852BX; i++)
|
||||
rssi[i] += delta;
|
||||
|
||||
phy_ppdu->rssi_avg = phy_ppdu->rpl_avg;
|
||||
}
|
||||
|
||||
static int __rtw8852bx_mac_enable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
enum rtw89_core_chip_id chip_id = rtwdev->chip->chip_id;
|
||||
@@ -2030,6 +2042,7 @@ const struct rtw8852bx_info rtw8852bx_info = {
|
||||
.ctrl_nbtg_bt_tx = __rtw8852bx_ctrl_nbtg_bt_tx,
|
||||
.ctrl_btg_bt_rx = __rtw8852bx_ctrl_btg_bt_rx,
|
||||
.query_ppdu = __rtw8852bx_query_ppdu,
|
||||
.convert_rpl_to_rssi = __rtw8852bx_convert_rpl_to_rssi,
|
||||
.read_efuse = __rtw8852bx_read_efuse,
|
||||
.read_phycap = __rtw8852bx_read_phycap,
|
||||
.power_trim = __rtw8852bx_power_trim,
|
||||
|
||||
@@ -121,13 +121,14 @@ struct rtw8852bx_info {
|
||||
void (*bb_cfg_txrx_path)(struct rtw89_dev *rtwdev);
|
||||
void (*bb_cfg_tx_path)(struct rtw89_dev *rtwdev, u8 tx_path);
|
||||
void (*bb_ctrl_rx_path)(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_rf_path_bit rx_path);
|
||||
enum rtw89_rf_path_bit rx_path,
|
||||
const struct rtw89_chan *chan);
|
||||
void (*bb_set_plcp_tx)(struct rtw89_dev *rtwdev);
|
||||
void (*bb_set_power)(struct rtw89_dev *rtwdev, s16 pwr_dbm,
|
||||
enum rtw89_phy_idx idx);
|
||||
void (*bb_set_pmac_pkt_tx)(struct rtw89_dev *rtwdev, u8 enable,
|
||||
u16 tx_cnt, u16 period, u16 tx_time,
|
||||
enum rtw89_phy_idx idx);
|
||||
enum rtw89_phy_idx idx, const struct rtw89_chan *chan);
|
||||
void (*bb_backup_tssi)(struct rtw89_dev *rtwdev, enum rtw89_phy_idx idx,
|
||||
struct rtw8852bx_bb_tssi_bak *bak);
|
||||
void (*bb_restore_tssi)(struct rtw89_dev *rtwdev, enum rtw89_phy_idx idx,
|
||||
@@ -145,6 +146,8 @@ struct rtw8852bx_info {
|
||||
void (*query_ppdu)(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu,
|
||||
struct ieee80211_rx_status *status);
|
||||
void (*convert_rpl_to_rssi)(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu);
|
||||
int (*read_efuse)(struct rtw89_dev *rtwdev, u8 *log_map,
|
||||
enum rtw89_efuse_block block);
|
||||
int (*read_phycap)(struct rtw89_dev *rtwdev, u8 *phycap_map);
|
||||
@@ -207,9 +210,10 @@ void rtw8852bx_bb_cfg_tx_path(struct rtw89_dev *rtwdev, u8 tx_path)
|
||||
|
||||
static inline
|
||||
void rtw8852bx_bb_ctrl_rx_path(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_rf_path_bit rx_path)
|
||||
enum rtw89_rf_path_bit rx_path,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
rtw8852bx_info.bb_ctrl_rx_path(rtwdev, rx_path);
|
||||
rtw8852bx_info.bb_ctrl_rx_path(rtwdev, rx_path, chan);
|
||||
}
|
||||
|
||||
static inline
|
||||
@@ -228,9 +232,10 @@ void rtw8852bx_bb_set_power(struct rtw89_dev *rtwdev, s16 pwr_dbm,
|
||||
static inline
|
||||
void rtw8852bx_bb_set_pmac_pkt_tx(struct rtw89_dev *rtwdev, u8 enable,
|
||||
u16 tx_cnt, u16 period, u16 tx_time,
|
||||
enum rtw89_phy_idx idx)
|
||||
enum rtw89_phy_idx idx, const struct rtw89_chan *chan)
|
||||
{
|
||||
rtw8852bx_info.bb_set_pmac_pkt_tx(rtwdev, enable, tx_cnt, period, tx_time, idx);
|
||||
rtw8852bx_info.bb_set_pmac_pkt_tx(rtwdev, enable, tx_cnt, period, tx_time, idx,
|
||||
chan);
|
||||
}
|
||||
|
||||
static inline
|
||||
@@ -290,6 +295,13 @@ void rtw8852bx_query_ppdu(struct rtw89_dev *rtwdev,
|
||||
rtw8852bx_info.query_ppdu(rtwdev, phy_ppdu, status);
|
||||
}
|
||||
|
||||
static inline
|
||||
void rtw8852bx_convert_rpl_to_rssi(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu)
|
||||
{
|
||||
rtw8852bx_info.convert_rpl_to_rssi(rtwdev, phy_ppdu);
|
||||
}
|
||||
|
||||
static inline
|
||||
int rtw8852bx_read_efuse(struct rtw89_dev *rtwdev, u8 *log_map,
|
||||
enum rtw89_efuse_block block)
|
||||
|
||||
@@ -1382,9 +1382,10 @@ static void _iqk_by_path(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, u
|
||||
_iqk_info_iqk(rtwdev, phy_idx, path);
|
||||
}
|
||||
|
||||
static void _iqk_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, u8 path)
|
||||
static void _iqk_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
u32 reg_rf18;
|
||||
u32 reg_35c;
|
||||
@@ -1608,12 +1609,13 @@ static void _tmac_tx_pause(struct rtw89_dev *rtwdev, enum rtw89_phy_idx band_idx
|
||||
}
|
||||
|
||||
static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
enum rtw89_phy_idx phy_idx, u8 path)
|
||||
enum rtw89_phy_idx phy_idx, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
u32 backup_bb_val[BACKUP_BB_REGS_NR];
|
||||
u32 backup_rf_val[RTW8852B_IQK_SS][BACKUP_RF_REGS_NR];
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, RF_AB, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, RF_AB, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);
|
||||
|
||||
@@ -1623,7 +1625,7 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
iqk_info->version = RTW8852B_IQK_VER;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
|
||||
_iqk_get_ch_info(rtwdev, phy_idx, path);
|
||||
_iqk_get_ch_info(rtwdev, phy_idx, path, chanctx_idx);
|
||||
|
||||
_rfk_backup_bb_reg(rtwdev, &backup_bb_val[0]);
|
||||
_rfk_backup_rf_reg(rtwdev, &backup_rf_val[path][0], path);
|
||||
@@ -1638,20 +1640,21 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_STOP);
|
||||
}
|
||||
|
||||
static void _iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, bool force)
|
||||
static void _iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, bool force,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 kpath = _kpath(rtwdev, phy_idx);
|
||||
|
||||
switch (kpath) {
|
||||
case RF_A:
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A, chanctx_idx);
|
||||
break;
|
||||
case RF_B:
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B, chanctx_idx);
|
||||
break;
|
||||
case RF_AB:
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A, chanctx_idx);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B, chanctx_idx);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1761,9 +1764,9 @@ static void _dpk_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _dpk_information(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
|
||||
u8 kidx = dpk->cur_idx[path];
|
||||
@@ -1786,9 +1789,10 @@ static void _dpk_information(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
|
||||
static void _dpk_bb_afe_setting(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u8 kpath)
|
||||
enum rtw89_rf_path path, u8 kpath,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
|
||||
rtw89_rfk_parser(rtwdev, &rtw8852b_dpk_afe_defs_tbl);
|
||||
|
||||
@@ -1803,9 +1807,10 @@ static void _dpk_bb_afe_setting(struct rtw89_dev *rtwdev,
|
||||
|
||||
static void _dpk_bb_afe_restore(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u8 kpath)
|
||||
enum rtw89_rf_path path, u8 kpath,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
|
||||
rtw89_rfk_parser(rtwdev, &rtw8852b_dpk_afe_restore_defs_tbl);
|
||||
|
||||
@@ -2217,9 +2222,9 @@ static bool _dpk_pas_read(struct rtw89_dev *rtwdev, bool is_check)
|
||||
|
||||
static u8 _dpk_agc(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u8 kidx, u8 init_txagc,
|
||||
bool loss_only)
|
||||
bool loss_only, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
u8 step = DPK_AGC_STEP_SYNC_DGAIN;
|
||||
u8 tmp_txagc, tmp_rxbb = 0, tmp_gl_idx = 0;
|
||||
u8 goout = 0, agc_cnt = 0, limited_rxbb = 0;
|
||||
@@ -2416,9 +2421,9 @@ static void _dpk_fill_result(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static bool _dpk_reload_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
bool is_reload = false;
|
||||
u8 idx, cur_band, cur_ch;
|
||||
@@ -2443,7 +2448,8 @@ static bool _dpk_reload_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static bool _dpk_main(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u8 gain)
|
||||
enum rtw89_rf_path path, u8 gain,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
u8 txagc = 0x38, kidx = dpk->cur_idx[path];
|
||||
@@ -2464,7 +2470,7 @@ static bool _dpk_main(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
_dpk_kip_set_rxagc(rtwdev, phy, path);
|
||||
_dpk_table_select(rtwdev, path, kidx, gain);
|
||||
|
||||
txagc = _dpk_agc(rtwdev, phy, path, kidx, txagc, false);
|
||||
txagc = _dpk_agc(rtwdev, phy, path, kidx, txagc, false, chanctx_idx);
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DPK] Adjust txagc = 0x%x\n", txagc);
|
||||
|
||||
if (txagc == 0xff) {
|
||||
@@ -2491,7 +2497,8 @@ static bool _dpk_main(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
enum rtw89_phy_idx phy, u8 kpath)
|
||||
enum rtw89_phy_idx phy, u8 kpath,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
static const u32 kip_reg[] = {0x813c, 0x8124, 0x8120};
|
||||
@@ -2503,7 +2510,8 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
|
||||
if (dpk->is_dpk_reload_en) {
|
||||
for (path = 0; path < RTW8852B_DPK_RF_PATH; path++) {
|
||||
reloaded[path] = _dpk_reload_check(rtwdev, phy, path);
|
||||
reloaded[path] = _dpk_reload_check(rtwdev, phy, path,
|
||||
chanctx_idx);
|
||||
if (!reloaded[path] && dpk->bp[path][0].ch)
|
||||
dpk->cur_idx[path] = !dpk->cur_idx[path];
|
||||
else
|
||||
@@ -2519,19 +2527,19 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
for (path = 0; path < RTW8852B_DPK_RF_PATH; path++) {
|
||||
_dpk_bkup_kip(rtwdev, kip_reg, kip_bkup, path);
|
||||
_rfk_backup_rf_reg(rtwdev, &backup_rf_val[path][0], path);
|
||||
_dpk_information(rtwdev, phy, path);
|
||||
_dpk_information(rtwdev, phy, path, chanctx_idx);
|
||||
if (rtwdev->is_tssi_mode[path])
|
||||
_dpk_tssi_pause(rtwdev, path, true);
|
||||
}
|
||||
|
||||
_dpk_bb_afe_setting(rtwdev, phy, path, kpath);
|
||||
_dpk_bb_afe_setting(rtwdev, phy, path, kpath, chanctx_idx);
|
||||
|
||||
for (path = 0; path < RTW8852B_DPK_RF_PATH; path++) {
|
||||
is_fail = _dpk_main(rtwdev, phy, path, 1);
|
||||
is_fail = _dpk_main(rtwdev, phy, path, 1, chanctx_idx);
|
||||
_dpk_onoff(rtwdev, path, is_fail);
|
||||
}
|
||||
|
||||
_dpk_bb_afe_restore(rtwdev, phy, path, kpath);
|
||||
_dpk_bb_afe_restore(rtwdev, phy, path, kpath, chanctx_idx);
|
||||
_rfk_restore_bb_reg(rtwdev, &backup_bb_val[0]);
|
||||
|
||||
for (path = 0; path < RTW8852B_DPK_RF_PATH; path++) {
|
||||
@@ -2543,9 +2551,10 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
}
|
||||
}
|
||||
|
||||
static bool _dpk_bypass_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
static bool _dpk_bypass_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_fem_info *fem = &rtwdev->fem;
|
||||
|
||||
if (fem->epa_2g && chan->band_type == RTW89_BAND_2G) {
|
||||
@@ -2577,17 +2586,18 @@ static void _dpk_force_bypass(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
}
|
||||
}
|
||||
|
||||
static void _dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool force)
|
||||
static void _dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool force,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
"[DPK] ****** DPK Start (Ver: 0x%x, Cv: %d, RF_para: %d) ******\n",
|
||||
RTW8852B_DPK_VER, rtwdev->hal.cv,
|
||||
RTW8852B_RF_REL_VERSION);
|
||||
|
||||
if (_dpk_bypass_check(rtwdev, phy))
|
||||
if (_dpk_bypass_check(rtwdev, phy, chanctx_idx))
|
||||
_dpk_force_bypass(rtwdev, phy);
|
||||
else
|
||||
_dpk_cal_select(rtwdev, force, phy, RF_AB);
|
||||
_dpk_cal_select(rtwdev, force, phy, RF_AB, chanctx_idx);
|
||||
}
|
||||
|
||||
static void _dpk_track(struct rtw89_dev *rtwdev)
|
||||
@@ -2722,9 +2732,8 @@ static void _set_dpd_backoff(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
}
|
||||
|
||||
static void _tssi_rf_setting(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
if (band == RTW89_BAND_2G)
|
||||
@@ -2734,9 +2743,8 @@ static void _tssi_rf_setting(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _tssi_set_sys(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
rtw89_rfk_parser(rtwdev, &rtw8852b_tssi_sys_defs_tbl);
|
||||
@@ -2778,7 +2786,7 @@ static void _tssi_set_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _tssi_set_tmeter_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
#define RTW8852B_TSSI_GET_VAL(ptr, idx) \
|
||||
({ \
|
||||
@@ -2792,7 +2800,6 @@ static void _tssi_set_tmeter_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx ph
|
||||
__val; \
|
||||
})
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u8 subband = chan->subband_type;
|
||||
const s8 *thm_up_a = NULL;
|
||||
@@ -2944,9 +2951,8 @@ static void _tssi_set_dac_gain_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx
|
||||
}
|
||||
|
||||
static void _tssi_slope_cal_org(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
if (path == RF_PATH_A)
|
||||
@@ -2960,9 +2966,9 @@ static void _tssi_slope_cal_org(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy
|
||||
}
|
||||
|
||||
static void _tssi_alignment_default(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, bool all)
|
||||
enum rtw89_rf_path path, bool all,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
const struct rtw89_rfk_tbl *tbl = NULL;
|
||||
u8 ch = chan->channel;
|
||||
@@ -3231,10 +3237,9 @@ static u32 _tssi_get_trim_group(struct rtw89_dev *rtwdev, u8 ch)
|
||||
}
|
||||
|
||||
static s8 _tssi_get_ofdm_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u32 gidx, gidx_1st, gidx_2nd;
|
||||
s8 de_1st;
|
||||
@@ -3267,10 +3272,9 @@ static s8 _tssi_get_ofdm_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static s8 _tssi_get_ofdm_trim_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u32 tgidx, tgidx_1st, tgidx_2nd;
|
||||
s8 tde_1st;
|
||||
@@ -3304,10 +3308,10 @@ static s8 _tssi_get_ofdm_trim_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx ph
|
||||
return val;
|
||||
}
|
||||
|
||||
static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u8 gidx;
|
||||
s8 ofdm_de;
|
||||
@@ -3320,7 +3324,7 @@ static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx p
|
||||
|
||||
for (i = RF_PATH_A; i < RF_PATH_NUM_8852B; i++) {
|
||||
gidx = _tssi_get_cck_group(rtwdev, ch);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i, chan);
|
||||
val = tssi_info->tssi_cck[i][gidx] + trim_de;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
@@ -3336,8 +3340,8 @@ static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx p
|
||||
rtw89_phy_read32_mask(rtwdev, _tssi_de_cck_long[i],
|
||||
_TSSI_DE_MASK));
|
||||
|
||||
ofdm_de = _tssi_get_ofdm_de(rtwdev, phy, i);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i);
|
||||
ofdm_de = _tssi_get_ofdm_de(rtwdev, phy, i, chan);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i, chan);
|
||||
val = ofdm_de + trim_de;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
@@ -3383,10 +3387,10 @@ static void _tssi_alimentk_dump_result(struct rtw89_dev *rtwdev, enum rtw89_rf_p
|
||||
}
|
||||
|
||||
static void _tssi_alimentk_done(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy, enum rtw89_rf_path path)
|
||||
enum rtw89_phy_idx phy, enum rtw89_rf_path path,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 channel = chan->channel;
|
||||
u8 band;
|
||||
|
||||
@@ -3420,7 +3424,7 @@ static void _tssi_alimentk_done(struct rtw89_dev *rtwdev,
|
||||
|
||||
static void _tssi_hw_tx(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u16 cnt, u16 period, s16 pwr_dbm,
|
||||
u8 enable)
|
||||
u8 enable, const struct rtw89_chan *chan)
|
||||
{
|
||||
enum rtw89_rf_path_bit rx_path;
|
||||
|
||||
@@ -3436,11 +3440,11 @@ static void _tssi_hw_tx(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
if (enable) {
|
||||
rtw8852bx_bb_set_plcp_tx(rtwdev);
|
||||
rtw8852bx_bb_cfg_tx_path(rtwdev, path);
|
||||
rtw8852bx_bb_ctrl_rx_path(rtwdev, rx_path);
|
||||
rtw8852bx_bb_ctrl_rx_path(rtwdev, rx_path, chan);
|
||||
rtw8852bx_bb_set_power(rtwdev, pwr_dbm, phy);
|
||||
}
|
||||
|
||||
rtw8852bx_bb_set_pmac_pkt_tx(rtwdev, enable, cnt, period, 20, phy);
|
||||
rtw8852bx_bb_set_pmac_pkt_tx(rtwdev, enable, cnt, period, 20, phy, chan);
|
||||
}
|
||||
|
||||
static void _tssi_backup_bb_registers(struct rtw89_dev *rtwdev,
|
||||
@@ -3494,7 +3498,7 @@ static u8 _tssi_ch_to_idx(struct rtw89_dev *rtwdev, u8 channel)
|
||||
|
||||
static bool _tssi_get_cw_report(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, const s16 *power,
|
||||
u32 *tssi_cw_rpt)
|
||||
u32 *tssi_cw_rpt, const struct rtw89_chan *chan)
|
||||
{
|
||||
u32 tx_counter, tx_counter_tmp;
|
||||
const int retry = 100;
|
||||
@@ -3513,9 +3517,10 @@ static bool _tssi_get_cw_report(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy
|
||||
_tssi_trigger[path], tmp, path);
|
||||
|
||||
if (j == 0)
|
||||
_tssi_hw_tx(rtwdev, phy, path, 100, 5000, power[j], true);
|
||||
_tssi_hw_tx(rtwdev, phy, path, 100, 5000, power[j], true, chan);
|
||||
else
|
||||
_tssi_hw_tx(rtwdev, phy, RF_PATH_ABCD, 100, 5000, power[j], true);
|
||||
_tssi_hw_tx(rtwdev, phy, RF_PATH_ABCD, 100, 5000, power[j], true,
|
||||
chan);
|
||||
|
||||
tx_counter_tmp = rtw89_phy_read32_mask(rtwdev, R_TX_COUNTER, MASKLWORD);
|
||||
tx_counter_tmp -= tx_counter;
|
||||
@@ -3546,14 +3551,14 @@ static bool _tssi_get_cw_report(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy
|
||||
"[TSSI PA K] TSSI finish bit k > %d mp:100ms normal:30us path=%d\n",
|
||||
k, path);
|
||||
|
||||
_tssi_hw_tx(rtwdev, phy, path, 100, 5000, power[j], false);
|
||||
_tssi_hw_tx(rtwdev, phy, path, 100, 5000, power[j], false, chan);
|
||||
return false;
|
||||
}
|
||||
|
||||
tssi_cw_rpt[j] =
|
||||
rtw89_phy_read32_mask(rtwdev, _tssi_cw_rpt_addr[path], B_TSSI_CWRPT);
|
||||
|
||||
_tssi_hw_tx(rtwdev, phy, path, 100, 5000, power[j], false);
|
||||
_tssi_hw_tx(rtwdev, phy, path, 100, 5000, power[j], false, chan);
|
||||
|
||||
tx_counter_tmp = rtw89_phy_read32_mask(rtwdev, R_TX_COUNTER, MASKLWORD);
|
||||
tx_counter_tmp -= tx_counter;
|
||||
@@ -3567,14 +3572,13 @@ static bool _tssi_get_cw_report(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy
|
||||
}
|
||||
|
||||
static void _tssi_alimentk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
static const u32 bb_reg[8] = {0x5820, 0x7820, 0x4978, 0x58e4,
|
||||
0x78e4, 0x49c0, 0x0d18, 0x0d80};
|
||||
static const s16 power_2g[4] = {48, 20, 4, 4};
|
||||
static const s16 power_5g[4] = {48, 20, 4, 4};
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
s32 tssi_alim_offset_1, tssi_alim_offset_2, tssi_alim_offset_3;
|
||||
u32 tssi_cw_rpt[RTW8852B_TSSI_PATH_NR] = {0};
|
||||
u8 channel = chan->channel;
|
||||
@@ -3635,7 +3639,7 @@ static void _tssi_alimentk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
rtw89_phy_write32_mask(rtwdev, R_P0_TSSI_MV_AVG, B_P0_TSSI_MV_AVG, 0x2);
|
||||
rtw89_phy_write32_mask(rtwdev, R_P1_TSSI_MV_AVG, B_P1_TSSI_MV_AVG, 0x2);
|
||||
|
||||
ok = _tssi_get_cw_report(rtwdev, phy, path, power, tssi_cw_rpt);
|
||||
ok = _tssi_get_cw_report(rtwdev, phy, path, power, tssi_cw_rpt, chan);
|
||||
if (!ok)
|
||||
goto out;
|
||||
|
||||
@@ -3755,18 +3759,19 @@ void rtw8852b_rck(struct rtw89_dev *rtwdev)
|
||||
_rck(rtwdev, path);
|
||||
}
|
||||
|
||||
void rtw8852b_dack(struct rtw89_dev *rtwdev)
|
||||
void rtw8852b_dack(struct rtw89_dev *rtwdev, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, 0, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DACK, BTC_WRFK_START);
|
||||
_dac_cal(rtwdev, false);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DACK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8852b_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8852b_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
u32 tx_en;
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_START);
|
||||
@@ -3774,15 +3779,16 @@ void rtw8852b_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
_wait_rx_mode(rtwdev, _kpath(rtwdev, phy_idx));
|
||||
|
||||
_iqk_init(rtwdev);
|
||||
_iqk(rtwdev, phy_idx, false);
|
||||
_iqk(rtwdev, phy_idx, false, chanctx_idx);
|
||||
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8852b_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8852b_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
u32 tx_en;
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_RXDCK, BTC_WRFK_START);
|
||||
@@ -3795,9 +3801,10 @@ void rtw8852b_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_RXDCK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8852b_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8852b_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
u32 tx_en;
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DPK, BTC_WRFK_START);
|
||||
@@ -3806,7 +3813,7 @@ void rtw8852b_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
|
||||
rtwdev->dpk.is_dpk_enable = true;
|
||||
rtwdev->dpk.is_dpk_reload_en = false;
|
||||
_dpk(rtwdev, phy_idx, false);
|
||||
_dpk(rtwdev, phy_idx, false, chanctx_idx);
|
||||
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DPK, BTC_WRFK_STOP);
|
||||
@@ -3817,9 +3824,11 @@ void rtw8852b_dpk_track(struct rtw89_dev *rtwdev)
|
||||
_dpk_track(rtwdev);
|
||||
}
|
||||
|
||||
void rtw8852b_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool hwtx_en)
|
||||
void rtw8852b_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
bool hwtx_en, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy, RF_AB, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy, RF_AB, chanctx_idx);
|
||||
u32 tx_en;
|
||||
u8 i;
|
||||
|
||||
@@ -3829,34 +3838,34 @@ void rtw8852b_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool hwtx_e
|
||||
_tssi_disable(rtwdev, phy);
|
||||
|
||||
for (i = RF_PATH_A; i < RF_PATH_NUM_8852B; i++) {
|
||||
_tssi_rf_setting(rtwdev, phy, i);
|
||||
_tssi_set_sys(rtwdev, phy, i);
|
||||
_tssi_rf_setting(rtwdev, phy, i, chan);
|
||||
_tssi_set_sys(rtwdev, phy, i, chan);
|
||||
_tssi_ini_txpwr_ctrl_bb(rtwdev, phy, i);
|
||||
_tssi_ini_txpwr_ctrl_bb_he_tb(rtwdev, phy, i);
|
||||
_tssi_set_dck(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i, chan);
|
||||
_tssi_set_dac_gain_tbl(rtwdev, phy, i);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i);
|
||||
_tssi_alignment_default(rtwdev, phy, i, true);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i, chan);
|
||||
_tssi_alignment_default(rtwdev, phy, i, true, chan);
|
||||
_tssi_set_tssi_slope(rtwdev, phy, i);
|
||||
|
||||
rtw89_chip_stop_sch_tx(rtwdev, phy, &tx_en, RTW89_SCH_TX_SEL_ALL);
|
||||
_tmac_tx_pause(rtwdev, phy, true);
|
||||
if (hwtx_en)
|
||||
_tssi_alimentk(rtwdev, phy, i);
|
||||
_tssi_alimentk(rtwdev, phy, i, chan);
|
||||
_tmac_tx_pause(rtwdev, phy, false);
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy, tx_en);
|
||||
}
|
||||
|
||||
_tssi_enable(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy, chan);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_STOP);
|
||||
}
|
||||
|
||||
void rtw8852b_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
void rtw8852b_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
u8 channel = chan->channel;
|
||||
u8 band;
|
||||
@@ -3879,24 +3888,25 @@ void rtw8852b_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
_tssi_disable(rtwdev, phy);
|
||||
|
||||
for (i = RF_PATH_A; i < RTW8852B_TSSI_PATH_NR; i++) {
|
||||
_tssi_rf_setting(rtwdev, phy, i);
|
||||
_tssi_set_sys(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i);
|
||||
_tssi_rf_setting(rtwdev, phy, i, chan);
|
||||
_tssi_set_sys(rtwdev, phy, i, chan);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i, chan);
|
||||
|
||||
if (tssi_info->alignment_done[i][band])
|
||||
_tssi_alimentk_done(rtwdev, phy, i);
|
||||
_tssi_alimentk_done(rtwdev, phy, i, chan);
|
||||
else
|
||||
_tssi_alignment_default(rtwdev, phy, i, true);
|
||||
_tssi_alignment_default(rtwdev, phy, i, true, chan);
|
||||
}
|
||||
|
||||
_tssi_enable(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy, chan);
|
||||
}
|
||||
|
||||
static void rtw8852b_tssi_default_txagc(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy, bool enable)
|
||||
enum rtw89_phy_idx phy, bool enable,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
u8 channel = chan->channel;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "======> %s ch=%d\n",
|
||||
@@ -3904,7 +3914,7 @@ static void rtw8852b_tssi_default_txagc(struct rtw89_dev *rtwdev,
|
||||
|
||||
if (enable) {
|
||||
if (!rtwdev->is_tssi_mode[RF_PATH_A] && !rtwdev->is_tssi_mode[RF_PATH_B])
|
||||
rtw8852b_tssi(rtwdev, phy, true);
|
||||
rtw8852b_tssi(rtwdev, phy, true, chanctx_idx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3921,8 +3931,8 @@ static void rtw8852b_tssi_default_txagc(struct rtw89_dev *rtwdev,
|
||||
rtw89_phy_write32_mask(rtwdev, R_P1_TSSI_TRK, B_P1_TSSI_OFT_EN, 0x0);
|
||||
rtw89_phy_write32_mask(rtwdev, R_P1_TSSI_TRK, B_P1_TSSI_OFT_EN, 0x1);
|
||||
|
||||
_tssi_alimentk_done(rtwdev, phy, RF_PATH_A);
|
||||
_tssi_alimentk_done(rtwdev, phy, RF_PATH_B);
|
||||
_tssi_alimentk_done(rtwdev, phy, RF_PATH_A, chan);
|
||||
_tssi_alimentk_done(rtwdev, phy, RF_PATH_B, chan);
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
"======>%s 2 SCAN_END Set 0x5818[7:0]=0x%x 0x7818[7:0]=0x%x\n",
|
||||
@@ -3935,12 +3945,13 @@ static void rtw8852b_tssi_default_txagc(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
void rtw8852b_wifi_scan_notify(struct rtw89_dev *rtwdev, bool scan_start,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
if (scan_start)
|
||||
rtw8852b_tssi_default_txagc(rtwdev, phy_idx, true);
|
||||
rtw8852b_tssi_default_txagc(rtwdev, phy_idx, true, chanctx_idx);
|
||||
else
|
||||
rtw8852b_tssi_default_txagc(rtwdev, phy_idx, false);
|
||||
rtw8852b_tssi_default_txagc(rtwdev, phy_idx, false, chanctx_idx);
|
||||
}
|
||||
|
||||
static void _bw_setting(struct rtw89_dev *rtwdev, enum rtw89_rf_path path,
|
||||
|
||||
@@ -8,16 +8,22 @@
|
||||
#include "core.h"
|
||||
|
||||
void rtw8852b_rck(struct rtw89_dev *rtwdev);
|
||||
void rtw8852b_dack(struct rtw89_dev *rtwdev);
|
||||
void rtw8852b_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
void rtw8852b_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
void rtw8852b_dack(struct rtw89_dev *rtwdev, enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852b_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852b_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852b_dpk_init(struct rtw89_dev *rtwdev);
|
||||
void rtw8852b_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
void rtw8852b_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852b_dpk_track(struct rtw89_dev *rtwdev);
|
||||
void rtw8852b_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool hwtx_en);
|
||||
void rtw8852b_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
void rtw8852b_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
bool hwtx_en, enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852b_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan);
|
||||
void rtw8852b_wifi_scan_notify(struct rtw89_dev *rtwdev, bool scan_start,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852b_set_channel_rf(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
|
||||
@@ -480,12 +480,12 @@ static void rtw8852bt_tssi_cont_en(struct rtw89_dev *rtwdev, bool en,
|
||||
}
|
||||
|
||||
static void rtw8852bt_tssi_cont_en_phyidx(struct rtw89_dev *rtwdev, bool en,
|
||||
u8 phy_idx)
|
||||
u8 phy_idx, const struct rtw89_chan *chan)
|
||||
{
|
||||
if (!rtwdev->dbcc_en) {
|
||||
rtw8852bt_tssi_cont_en(rtwdev, en, RF_PATH_A);
|
||||
rtw8852bt_tssi_cont_en(rtwdev, en, RF_PATH_B);
|
||||
rtw8852bt_tssi_scan(rtwdev, phy_idx);
|
||||
rtw8852bt_tssi_scan(rtwdev, phy_idx, chan);
|
||||
} else {
|
||||
if (phy_idx == RTW89_PHY_0)
|
||||
rtw8852bt_tssi_cont_en(rtwdev, en, RF_PATH_A);
|
||||
@@ -511,14 +511,14 @@ static void rtw8852bt_set_channel_help(struct rtw89_dev *rtwdev, bool enter,
|
||||
if (enter) {
|
||||
rtw89_chip_stop_sch_tx(rtwdev, RTW89_MAC_0, &p->tx_en, RTW89_SCH_TX_SEL_ALL);
|
||||
rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, false);
|
||||
rtw8852bt_tssi_cont_en_phyidx(rtwdev, false, RTW89_PHY_0);
|
||||
rtw8852bt_tssi_cont_en_phyidx(rtwdev, false, RTW89_PHY_0, chan);
|
||||
rtw8852bt_adc_en(rtwdev, false);
|
||||
fsleep(40);
|
||||
rtw8852bt_bb_reset_en(rtwdev, chan->band_type, phy_idx, false);
|
||||
} else {
|
||||
rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, true);
|
||||
rtw8852bt_adc_en(rtwdev, true);
|
||||
rtw8852bt_tssi_cont_en_phyidx(rtwdev, true, RTW89_PHY_0);
|
||||
rtw8852bt_tssi_cont_en_phyidx(rtwdev, true, RTW89_PHY_0, chan);
|
||||
rtw8852bt_bb_reset_en(rtwdev, chan->band_type, phy_idx, true);
|
||||
rtw89_chip_resume_sch_tx(rtwdev, RTW89_MAC_0, p->tx_en);
|
||||
}
|
||||
@@ -531,30 +531,32 @@ static void rtw8852bt_rfk_init(struct rtw89_dev *rtwdev)
|
||||
|
||||
rtw8852bt_dpk_init(rtwdev);
|
||||
rtw8852bt_rck(rtwdev);
|
||||
rtw8852bt_dack(rtwdev);
|
||||
rtw8852bt_rx_dck(rtwdev, RTW89_PHY_0);
|
||||
rtw8852bt_dack(rtwdev, RTW89_CHANCTX_0);
|
||||
rtw8852bt_rx_dck(rtwdev, RTW89_PHY_0, RTW89_CHANCTX_0);
|
||||
}
|
||||
|
||||
static void rtw8852bt_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
{
|
||||
enum rtw89_chanctx_idx chanctx_idx = rtwvif->chanctx_idx;
|
||||
enum rtw89_phy_idx phy_idx = rtwvif->phy_idx;
|
||||
|
||||
rtw8852bt_rx_dck(rtwdev, phy_idx);
|
||||
rtw8852bt_iqk(rtwdev, phy_idx);
|
||||
rtw8852bt_tssi(rtwdev, phy_idx, true);
|
||||
rtw8852bt_dpk(rtwdev, phy_idx);
|
||||
rtw8852bt_rx_dck(rtwdev, phy_idx, chanctx_idx);
|
||||
rtw8852bt_iqk(rtwdev, phy_idx, chanctx_idx);
|
||||
rtw8852bt_tssi(rtwdev, phy_idx, true, chanctx_idx);
|
||||
rtw8852bt_dpk(rtwdev, phy_idx, chanctx_idx);
|
||||
}
|
||||
|
||||
static void rtw8852bt_rfk_band_changed(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
rtw8852bt_tssi_scan(rtwdev, phy_idx);
|
||||
rtw8852bt_tssi_scan(rtwdev, phy_idx, chan);
|
||||
}
|
||||
|
||||
static void rtw8852bt_rfk_scan(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
bool start)
|
||||
{
|
||||
rtw8852bt_wifi_scan_notify(rtwdev, start, rtwvif->phy_idx);
|
||||
rtw8852bt_wifi_scan_notify(rtwdev, start, rtwvif->phy_idx, rtwvif->chanctx_idx);
|
||||
}
|
||||
|
||||
static void rtw8852bt_rfk_track(struct rtw89_dev *rtwdev)
|
||||
@@ -673,9 +675,11 @@ static const struct rtw89_chip_ops rtw8852bt_chip_ops = {
|
||||
.get_thermal = rtw8852bx_get_thermal,
|
||||
.ctrl_btg_bt_rx = rtw8852bx_ctrl_btg_bt_rx,
|
||||
.query_ppdu = rtw8852bx_query_ppdu,
|
||||
.convert_rpl_to_rssi = rtw8852bx_convert_rpl_to_rssi,
|
||||
.ctrl_nbtg_bt_tx = rtw8852bx_ctrl_nbtg_bt_tx,
|
||||
.cfg_txrx_path = rtw8852bx_bb_cfg_txrx_path,
|
||||
.set_txpwr_ul_tb_offset = rtw8852bx_set_txpwr_ul_tb_offset,
|
||||
.digital_pwr_comp = NULL,
|
||||
.pwr_on_func = rtw8852bt_pwr_on_func,
|
||||
.pwr_off_func = rtw8852bt_pwr_off_func,
|
||||
.query_rxdesc = rtw89_core_query_rxdesc,
|
||||
@@ -750,6 +754,7 @@ const struct rtw89_chip_info rtw8852bt_chip_info = {
|
||||
.dig_regs = &rtw8852bt_dig_regs,
|
||||
.tssi_dbw_table = NULL,
|
||||
.support_macid_num = RTW89_MAX_MAC_ID_NUM,
|
||||
.support_link_num = 0,
|
||||
.support_chanctx_num = 1,
|
||||
.support_rnr = false,
|
||||
.support_bands = BIT(NL80211_BAND_2GHZ) |
|
||||
|
||||
@@ -1525,9 +1525,10 @@ static void _iqk_by_path(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, u
|
||||
lok_result, txk_result, rxk_result);
|
||||
}
|
||||
|
||||
static void _iqk_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, u8 path)
|
||||
static void _iqk_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
u8 get_empty_table = false;
|
||||
u32 reg_rf18;
|
||||
@@ -1755,12 +1756,13 @@ static void _tmac_tx_pause(struct rtw89_dev *rtwdev, enum rtw89_phy_idx band_idx
|
||||
}
|
||||
|
||||
static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
enum rtw89_phy_idx phy_idx, u8 path)
|
||||
enum rtw89_phy_idx phy_idx, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
u32 backup_bb_val[BACKUP_BB_REGS_NR];
|
||||
u32 backup_rf_val[RTW8852BT_SS][BACKUP_RF_REGS_NR];
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, RF_AB, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, RF_AB, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);
|
||||
|
||||
@@ -1770,7 +1772,7 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
iqk_info->version = RTW8852BT_IQK_VER;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
|
||||
_iqk_get_ch_info(rtwdev, phy_idx, path);
|
||||
_iqk_get_ch_info(rtwdev, phy_idx, path, chanctx_idx);
|
||||
|
||||
_rfk_backup_bb_reg(rtwdev, backup_bb_val);
|
||||
_rfk_backup_rf_reg(rtwdev, backup_rf_val[path], path);
|
||||
@@ -1785,20 +1787,21 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_STOP);
|
||||
}
|
||||
|
||||
static void _iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, bool force)
|
||||
static void _iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, bool force,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 kpath = _kpath(rtwdev, phy_idx);
|
||||
|
||||
switch (kpath) {
|
||||
case RF_A:
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A, chanctx_idx);
|
||||
break;
|
||||
case RF_B:
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B, chanctx_idx);
|
||||
break;
|
||||
case RF_AB:
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A, chanctx_idx);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B, chanctx_idx);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1879,9 +1882,9 @@ static void _dpk_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _dpk_information(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
|
||||
u8 kidx = dpk->cur_idx[path];
|
||||
@@ -2277,9 +2280,9 @@ static bool _dpk_pas_read(struct rtw89_dev *rtwdev, enum rtw89_rf_path path,
|
||||
|
||||
static u8 _dpk_agc(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u8 kidx, u8 init_txagc,
|
||||
bool loss_only)
|
||||
bool loss_only, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
u8 goout = 0, agc_cnt = 0, limited_rxbb = 0, gl_cnt = 0;
|
||||
u8 tmp_txagc, tmp_rxbb, tmp_gl_idx = 0;
|
||||
@@ -2504,9 +2507,9 @@ static void _dpk_fill_result(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static bool _dpk_reload_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
u8 idx, cur_band, cur_ch;
|
||||
bool is_reload = false;
|
||||
@@ -2549,7 +2552,8 @@ void _drf_direct_cntrl(struct rtw89_dev *rtwdev, enum rtw89_rf_path path, bool i
|
||||
}
|
||||
|
||||
static bool _dpk_main(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u8 gain)
|
||||
enum rtw89_rf_path path, u8 gain,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
u8 txagc = 0x38, kidx = dpk->cur_idx[path];
|
||||
@@ -2569,7 +2573,7 @@ static bool _dpk_main(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
_dpk_kip_set_rxagc(rtwdev, phy, path);
|
||||
_dpk_table_select(rtwdev, path, kidx, gain);
|
||||
|
||||
txagc = _dpk_agc(rtwdev, phy, path, kidx, txagc, false);
|
||||
txagc = _dpk_agc(rtwdev, phy, path, kidx, txagc, false, chanctx_idx);
|
||||
|
||||
_rfk_get_thermal(rtwdev, kidx, path);
|
||||
|
||||
@@ -2601,7 +2605,8 @@ static bool _dpk_main(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _dpk_cal_select(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy, u8 kpath)
|
||||
enum rtw89_phy_idx phy, u8 kpath,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
u32 backup_kip_val[BACKUP_KIP_REGS_NR];
|
||||
@@ -2611,7 +2616,7 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev,
|
||||
u8 path;
|
||||
|
||||
for (path = 0; path < DPK_RF_PATH_MAX_8852BT; path++) {
|
||||
reloaded[path] = _dpk_reload_check(rtwdev, phy, path);
|
||||
reloaded[path] = _dpk_reload_check(rtwdev, phy, path, chanctx_idx);
|
||||
if (!reloaded[path] && dpk->bp[path][0].ch != 0)
|
||||
dpk->cur_idx[path] = !dpk->cur_idx[path];
|
||||
else
|
||||
@@ -2623,7 +2628,7 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev,
|
||||
|
||||
for (path = 0; path < DPK_RF_PATH_MAX_8852BT; path++) {
|
||||
_rfk_backup_rf_reg(rtwdev, backup_rf_val[path], path);
|
||||
_dpk_information(rtwdev, phy, path);
|
||||
_dpk_information(rtwdev, phy, path, chanctx_idx);
|
||||
if (rtwdev->is_tssi_mode[path])
|
||||
_dpk_tssi_pause(rtwdev, path, true);
|
||||
}
|
||||
@@ -2631,7 +2636,7 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev,
|
||||
_rfk_bb_afe_setting(rtwdev, phy, path, kpath);
|
||||
|
||||
for (path = 0; path < DPK_RF_PATH_MAX_8852BT; path++)
|
||||
_dpk_main(rtwdev, phy, path, 1);
|
||||
_dpk_main(rtwdev, phy, path, 1, chanctx_idx);
|
||||
|
||||
_rfk_bb_afe_restore(rtwdev, phy, path, kpath);
|
||||
|
||||
@@ -2646,9 +2651,10 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
}
|
||||
|
||||
static bool _dpk_bypass_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
static bool _dpk_bypass_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_fem_info *fem = &rtwdev->fem;
|
||||
|
||||
if (fem->epa_2g && chan->band_type == RTW89_BAND_2G) {
|
||||
@@ -2817,9 +2823,8 @@ static void _tssi_dpk_off(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
}
|
||||
|
||||
static void _tssi_rf_setting(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
if (band == RTW89_BAND_2G)
|
||||
@@ -2829,9 +2834,8 @@ static void _tssi_rf_setting(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _tssi_set_sys(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
rtw89_rfk_parser(rtwdev, &rtw8852bt_tssi_sys_defs_tbl);
|
||||
@@ -2878,7 +2882,7 @@ static void _tssi_set_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static void _tssi_set_tmeter_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
#define RTW8852BT_TSSI_GET_VAL(ptr, idx) \
|
||||
({ \
|
||||
@@ -2893,7 +2897,6 @@ static void _tssi_set_tmeter_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx ph
|
||||
})
|
||||
struct rtw89_fw_txpwr_track_cfg *trk = rtwdev->fw.elm_info.txpwr_trk;
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u8 subband = chan->subband_type;
|
||||
const s8 *thm_up_a = NULL;
|
||||
@@ -3047,9 +3050,8 @@ static void _tssi_set_dac_gain_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx
|
||||
}
|
||||
|
||||
static void _tssi_slope_cal_org(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
if (path == RF_PATH_A)
|
||||
@@ -3063,9 +3065,9 @@ static void _tssi_slope_cal_org(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy
|
||||
}
|
||||
|
||||
static void _tssi_alignment_default(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, bool all)
|
||||
enum rtw89_rf_path path, bool all,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
const struct rtw89_rfk_tbl *tbl = NULL;
|
||||
u8 ch = chan->channel;
|
||||
@@ -3310,10 +3312,9 @@ static u32 _tssi_get_trim_group(struct rtw89_dev *rtwdev, u8 ch)
|
||||
}
|
||||
|
||||
static s8 _tssi_get_ofdm_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u32 gidx, gidx_1st, gidx_2nd;
|
||||
s8 de_1st;
|
||||
@@ -3346,10 +3347,9 @@ static s8 _tssi_get_ofdm_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static s8 _tssi_get_ofdm_trim_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u32 tgidx, tgidx_1st, tgidx_2nd;
|
||||
s8 tde_1st;
|
||||
@@ -3383,10 +3383,10 @@ static s8 _tssi_get_ofdm_trim_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx ph
|
||||
return val;
|
||||
}
|
||||
|
||||
static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u8 gidx;
|
||||
s8 ofdm_de;
|
||||
@@ -3399,7 +3399,7 @@ static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx p
|
||||
|
||||
for (i = RF_PATH_A; i < RF_PATH_NUM_8852BT; i++) {
|
||||
gidx = _tssi_get_cck_group(rtwdev, ch);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i, chan);
|
||||
val = tssi_info->tssi_cck[i][gidx] + trim_de;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
@@ -3415,8 +3415,8 @@ static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx p
|
||||
rtw89_phy_read32_mask(rtwdev, _tssi_de_cck_long[i],
|
||||
_TSSI_DE_MASK));
|
||||
|
||||
ofdm_de = _tssi_get_ofdm_de(rtwdev, phy, i);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i);
|
||||
ofdm_de = _tssi_get_ofdm_de(rtwdev, phy, i, chan);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i, chan);
|
||||
val = ofdm_de + trim_de;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
@@ -3463,10 +3463,10 @@ static void _tssi_alimentk_dump_result(struct rtw89_dev *rtwdev, enum rtw89_rf_p
|
||||
}
|
||||
|
||||
static void _tssi_alimentk_done(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy, enum rtw89_rf_path path)
|
||||
enum rtw89_phy_idx phy, enum rtw89_rf_path path,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 channel = chan->channel;
|
||||
u8 band;
|
||||
|
||||
@@ -3500,7 +3500,7 @@ static void _tssi_alimentk_done(struct rtw89_dev *rtwdev,
|
||||
|
||||
static void _tssi_hw_tx(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, u16 cnt, u16 period, s16 pwr_dbm,
|
||||
u8 enable)
|
||||
u8 enable, const struct rtw89_chan *chan)
|
||||
{
|
||||
enum rtw89_rf_path_bit rx_path;
|
||||
|
||||
@@ -3516,11 +3516,11 @@ static void _tssi_hw_tx(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
if (enable) {
|
||||
rtw8852bx_bb_set_plcp_tx(rtwdev);
|
||||
rtw8852bx_bb_cfg_tx_path(rtwdev, path);
|
||||
rtw8852bx_bb_ctrl_rx_path(rtwdev, rx_path);
|
||||
rtw8852bx_bb_ctrl_rx_path(rtwdev, rx_path, chan);
|
||||
rtw8852bx_bb_set_power(rtwdev, pwr_dbm, phy);
|
||||
}
|
||||
|
||||
rtw8852bx_bb_set_pmac_pkt_tx(rtwdev, enable, cnt, period, 20, phy);
|
||||
rtw8852bx_bb_set_pmac_pkt_tx(rtwdev, enable, cnt, period, 20, phy, chan);
|
||||
}
|
||||
|
||||
static void _tssi_backup_bb_registers(struct rtw89_dev *rtwdev,
|
||||
@@ -3574,7 +3574,7 @@ static u8 _tssi_ch_to_idx(struct rtw89_dev *rtwdev, u8 channel)
|
||||
|
||||
static bool _tssi_get_cw_report(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path, const s16 *power,
|
||||
u32 *tssi_cw_rpt)
|
||||
u32 *tssi_cw_rpt, const struct rtw89_chan *chan)
|
||||
{
|
||||
u32 tx_counter, tx_counter_tmp;
|
||||
const int retry = 100;
|
||||
@@ -3593,9 +3593,11 @@ static bool _tssi_get_cw_report(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy
|
||||
_tssi_trigger[path], tmp, path);
|
||||
|
||||
if (j == 0)
|
||||
_tssi_hw_tx(rtwdev, phy, path, 100, 5000, power[j], true);
|
||||
_tssi_hw_tx(rtwdev, phy, path, 100, 5000, power[j], true,
|
||||
chan);
|
||||
else
|
||||
_tssi_hw_tx(rtwdev, phy, RF_PATH_ABCD, 100, 5000, power[j], true);
|
||||
_tssi_hw_tx(rtwdev, phy, RF_PATH_ABCD, 100, 5000, power[j], true,
|
||||
chan);
|
||||
|
||||
tx_counter_tmp = rtw89_phy_read32_mask(rtwdev, R_TX_COUNTER, MASKLWORD);
|
||||
tx_counter_tmp -= tx_counter;
|
||||
@@ -3626,7 +3628,7 @@ static bool _tssi_get_cw_report(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy
|
||||
"[TSSI PA K] TSSI finish bit k > %d mp:100ms normal:30us path=%d\n",
|
||||
k, path);
|
||||
|
||||
_tssi_hw_tx(rtwdev, phy, path, 100, 5000, power[j], false);
|
||||
_tssi_hw_tx(rtwdev, phy, path, 100, 5000, power[j], false, chan);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3634,7 +3636,7 @@ static bool _tssi_get_cw_report(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy
|
||||
rtw89_phy_read32_mask(rtwdev, _tssi_cw_rpt_addr[path],
|
||||
B_TSSI_CWRPT);
|
||||
|
||||
_tssi_hw_tx(rtwdev, phy, path, 100, 5000, power[j], false);
|
||||
_tssi_hw_tx(rtwdev, phy, path, 100, 5000, power[j], false, chan);
|
||||
|
||||
tx_counter_tmp = rtw89_phy_read32_mask(rtwdev, R_TX_COUNTER, MASKLWORD);
|
||||
tx_counter_tmp -= tx_counter;
|
||||
@@ -3648,14 +3650,13 @@ static bool _tssi_get_cw_report(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy
|
||||
}
|
||||
|
||||
static void _tssi_alimentk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
static const u32 bb_reg[8] = {0x5820, 0x7820, 0x4978, 0x58e4,
|
||||
0x78e4, 0x49c0, 0x0d18, 0x0d80};
|
||||
static const s16 power_2g[4] = {48, 20, 4, -8};
|
||||
static const s16 power_5g[4] = {48, 20, 4, 4};
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
s32 tssi_alim_offset_1, tssi_alim_offset_2, tssi_alim_offset_3;
|
||||
u32 tssi_cw_rpt[RTW8852BT_TSSI_PATH_NR] = {};
|
||||
u8 channel = chan->channel;
|
||||
@@ -3701,7 +3702,7 @@ static void _tssi_alimentk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
rtw89_phy_write32_mask(rtwdev, R_P0_TSSI_MV_AVG, B_P0_TSSI_MV_AVG, 0x2);
|
||||
rtw89_phy_write32_mask(rtwdev, R_P1_TSSI_MV_AVG, B_P1_TSSI_MV_AVG, 0x2);
|
||||
|
||||
ok = _tssi_get_cw_report(rtwdev, phy, path, power, tssi_cw_rpt);
|
||||
ok = _tssi_get_cw_report(rtwdev, phy, path, power, tssi_cw_rpt, chan);
|
||||
if (!ok)
|
||||
goto out;
|
||||
|
||||
@@ -3833,18 +3834,19 @@ void rtw8852bt_rck(struct rtw89_dev *rtwdev)
|
||||
_rck(rtwdev, path);
|
||||
}
|
||||
|
||||
void rtw8852bt_dack(struct rtw89_dev *rtwdev)
|
||||
void rtw8852bt_dack(struct rtw89_dev *rtwdev, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, 0, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DACK, BTC_WRFK_START);
|
||||
_dac_cal(rtwdev, false);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DACK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8852bt_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8852bt_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
u32 tx_en;
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_START);
|
||||
@@ -3852,15 +3854,16 @@ void rtw8852bt_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
_wait_rx_mode(rtwdev, _kpath(rtwdev, phy_idx));
|
||||
|
||||
_iqk_init(rtwdev);
|
||||
_iqk(rtwdev, phy_idx, false);
|
||||
_iqk(rtwdev, phy_idx, false, chanctx_idx);
|
||||
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8852bt_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8852bt_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
u32 tx_en;
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_RXDCK, BTC_WRFK_START);
|
||||
@@ -3873,15 +3876,16 @@ void rtw8852bt_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_RXDCK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8852bt_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8852bt_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
"[DPK] ****** DPK Start (Ver: 0x%x) ******\n", RTW8852BT_DPK_VER);
|
||||
|
||||
if (_dpk_bypass_check(rtwdev, phy_idx))
|
||||
if (_dpk_bypass_check(rtwdev, phy_idx, chanctx_idx))
|
||||
_dpk_force_bypass(rtwdev, phy_idx);
|
||||
else
|
||||
_dpk_cal_select(rtwdev, phy_idx, RF_AB);
|
||||
_dpk_cal_select(rtwdev, phy_idx, RF_AB, chanctx_idx);
|
||||
}
|
||||
|
||||
void rtw8852bt_dpk_track(struct rtw89_dev *rtwdev)
|
||||
@@ -3889,10 +3893,12 @@ void rtw8852bt_dpk_track(struct rtw89_dev *rtwdev)
|
||||
_dpk_track(rtwdev);
|
||||
}
|
||||
|
||||
void rtw8852bt_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool hwtx_en)
|
||||
void rtw8852bt_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
bool hwtx_en, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
static const u32 reg[2] = {R_DPD_CH0A, R_DPD_CH0B};
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy, RF_AB, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy, RF_AB, chanctx_idx);
|
||||
u32 reg_backup[2] = {};
|
||||
u32 tx_en;
|
||||
u8 i;
|
||||
@@ -3905,36 +3911,36 @@ void rtw8852bt_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool hwtx_
|
||||
_tssi_disable(rtwdev, phy);
|
||||
|
||||
for (i = RF_PATH_A; i < RF_PATH_NUM_8852BT; i++) {
|
||||
_tssi_rf_setting(rtwdev, phy, i);
|
||||
_tssi_set_sys(rtwdev, phy, i);
|
||||
_tssi_rf_setting(rtwdev, phy, i, chan);
|
||||
_tssi_set_sys(rtwdev, phy, i, chan);
|
||||
_tssi_ini_txpwr_ctrl_bb(rtwdev, phy, i);
|
||||
_tssi_ini_txpwr_ctrl_bb_he_tb(rtwdev, phy, i);
|
||||
_tssi_set_dck(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i, chan);
|
||||
_tssi_set_dac_gain_tbl(rtwdev, phy, i);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i);
|
||||
_tssi_alignment_default(rtwdev, phy, i, true);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i, chan);
|
||||
_tssi_alignment_default(rtwdev, phy, i, true, chan);
|
||||
_tssi_set_tssi_slope(rtwdev, phy, i);
|
||||
|
||||
rtw89_chip_stop_sch_tx(rtwdev, phy, &tx_en, RTW89_SCH_TX_SEL_ALL);
|
||||
_tmac_tx_pause(rtwdev, phy, true);
|
||||
if (hwtx_en)
|
||||
_tssi_alimentk(rtwdev, phy, i);
|
||||
_tssi_alimentk(rtwdev, phy, i, chan);
|
||||
_tmac_tx_pause(rtwdev, phy, false);
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy, tx_en);
|
||||
}
|
||||
|
||||
_tssi_enable(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy, chan);
|
||||
|
||||
_tssi_reload_bb_registers(rtwdev, phy, reg, reg_backup, 2);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_STOP);
|
||||
}
|
||||
|
||||
void rtw8852bt_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
void rtw8852bt_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
u8 channel = chan->channel;
|
||||
u8 band;
|
||||
@@ -3957,24 +3963,25 @@ void rtw8852bt_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
_tssi_disable(rtwdev, phy);
|
||||
|
||||
for (i = RF_PATH_A; i < RTW8852BT_TSSI_PATH_NR; i++) {
|
||||
_tssi_rf_setting(rtwdev, phy, i);
|
||||
_tssi_set_sys(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i);
|
||||
_tssi_rf_setting(rtwdev, phy, i, chan);
|
||||
_tssi_set_sys(rtwdev, phy, i, chan);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i, chan);
|
||||
|
||||
if (tssi_info->alignment_done[i][band])
|
||||
_tssi_alimentk_done(rtwdev, phy, i);
|
||||
_tssi_alimentk_done(rtwdev, phy, i, chan);
|
||||
else
|
||||
_tssi_alignment_default(rtwdev, phy, i, true);
|
||||
_tssi_alignment_default(rtwdev, phy, i, true, chan);
|
||||
}
|
||||
|
||||
_tssi_enable(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy, chan);
|
||||
}
|
||||
|
||||
static void rtw8852bt_tssi_default_txagc(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy, bool enable)
|
||||
enum rtw89_phy_idx phy, bool enable,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
u8 channel = chan->channel;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "======> %s ch=%d\n",
|
||||
@@ -3996,8 +4003,8 @@ static void rtw8852bt_tssi_default_txagc(struct rtw89_dev *rtwdev,
|
||||
rtw89_phy_write32_mask(rtwdev, R_P1_TSSI_TRK, B_P1_TSSI_OFT_EN, 0x0);
|
||||
rtw89_phy_write32_mask(rtwdev, R_P1_TSSI_TRK, B_P1_TSSI_OFT_EN, 0x1);
|
||||
|
||||
_tssi_alimentk_done(rtwdev, phy, RF_PATH_A);
|
||||
_tssi_alimentk_done(rtwdev, phy, RF_PATH_B);
|
||||
_tssi_alimentk_done(rtwdev, phy, RF_PATH_A, chan);
|
||||
_tssi_alimentk_done(rtwdev, phy, RF_PATH_B, chan);
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
"======>%s 2 SCAN_END Set 0x5818[7:0]=0x%x 0x7818[7:0]=0x%x\n",
|
||||
@@ -4010,12 +4017,13 @@ static void rtw8852bt_tssi_default_txagc(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
void rtw8852bt_wifi_scan_notify(struct rtw89_dev *rtwdev, bool scan_start,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
if (scan_start)
|
||||
rtw8852bt_tssi_default_txagc(rtwdev, phy_idx, true);
|
||||
rtw8852bt_tssi_default_txagc(rtwdev, phy_idx, true, chanctx_idx);
|
||||
else
|
||||
rtw8852bt_tssi_default_txagc(rtwdev, phy_idx, false);
|
||||
rtw8852bt_tssi_default_txagc(rtwdev, phy_idx, false, chanctx_idx);
|
||||
}
|
||||
|
||||
static void _bw_setting(struct rtw89_dev *rtwdev, enum rtw89_rf_path path,
|
||||
|
||||
@@ -8,16 +8,22 @@
|
||||
#include "core.h"
|
||||
|
||||
void rtw8852bt_rck(struct rtw89_dev *rtwdev);
|
||||
void rtw8852bt_dack(struct rtw89_dev *rtwdev);
|
||||
void rtw8852bt_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
void rtw8852bt_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
void rtw8852bt_dack(struct rtw89_dev *rtwdev, enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852bt_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852bt_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852bt_dpk_init(struct rtw89_dev *rtwdev);
|
||||
void rtw8852bt_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
void rtw8852bt_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852bt_dpk_track(struct rtw89_dev *rtwdev);
|
||||
void rtw8852bt_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool hwtx_en);
|
||||
void rtw8852bt_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
void rtw8852bt_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
bool hwtx_en, enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852bt_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan);
|
||||
void rtw8852bt_wifi_scan_notify(struct rtw89_dev *rtwdev, bool scan_start,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852bt_set_channel_rf(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
|
||||
@@ -1817,7 +1817,7 @@ static void rtw8852c_set_channel_help(struct rtw89_dev *rtwdev, bool enter,
|
||||
RTW89_SCH_TX_SEL_ALL);
|
||||
rtw89_mac_cfg_ppdu_status(rtwdev, mac_idx, false);
|
||||
rtw8852c_dfs_en(rtwdev, false);
|
||||
rtw8852c_tssi_cont_en_phyidx(rtwdev, false, phy_idx);
|
||||
rtw8852c_tssi_cont_en_phyidx(rtwdev, false, phy_idx, chan);
|
||||
rtw8852c_adc_en(rtwdev, false);
|
||||
fsleep(40);
|
||||
rtw8852c_bb_reset_en(rtwdev, chan->band_type, phy_idx, false);
|
||||
@@ -1825,7 +1825,7 @@ static void rtw8852c_set_channel_help(struct rtw89_dev *rtwdev, bool enter,
|
||||
rtw89_mac_cfg_ppdu_status(rtwdev, mac_idx, true);
|
||||
rtw8852c_adc_en(rtwdev, true);
|
||||
rtw8852c_dfs_en(rtwdev, true);
|
||||
rtw8852c_tssi_cont_en_phyidx(rtwdev, true, phy_idx);
|
||||
rtw8852c_tssi_cont_en_phyidx(rtwdev, true, phy_idx, chan);
|
||||
rtw8852c_bb_reset_en(rtwdev, chan->band_type, phy_idx, true);
|
||||
rtw89_chip_resume_sch_tx(rtwdev, mac_idx, p->tx_en);
|
||||
}
|
||||
@@ -1842,26 +1842,28 @@ static void rtw8852c_rfk_init(struct rtw89_dev *rtwdev)
|
||||
rtw8852c_dpk_init(rtwdev);
|
||||
|
||||
rtw8852c_rck(rtwdev);
|
||||
rtw8852c_dack(rtwdev);
|
||||
rtw8852c_dack(rtwdev, RTW89_CHANCTX_0);
|
||||
rtw8852c_rx_dck(rtwdev, RTW89_PHY_0, false);
|
||||
}
|
||||
|
||||
static void rtw8852c_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
{
|
||||
enum rtw89_chanctx_idx chanctx_idx = rtwvif->chanctx_idx;
|
||||
enum rtw89_phy_idx phy_idx = rtwvif->phy_idx;
|
||||
|
||||
rtw8852c_mcc_get_ch_info(rtwdev, phy_idx);
|
||||
rtw8852c_rx_dck(rtwdev, phy_idx, false);
|
||||
rtw8852c_iqk(rtwdev, phy_idx);
|
||||
rtw8852c_tssi(rtwdev, phy_idx);
|
||||
rtw8852c_dpk(rtwdev, phy_idx);
|
||||
rtw8852c_iqk(rtwdev, phy_idx, chanctx_idx);
|
||||
rtw8852c_tssi(rtwdev, phy_idx, chanctx_idx);
|
||||
rtw8852c_dpk(rtwdev, phy_idx, chanctx_idx);
|
||||
rtw89_fw_h2c_rf_ntfy_mcc(rtwdev);
|
||||
}
|
||||
|
||||
static void rtw8852c_rfk_band_changed(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
rtw8852c_tssi_scan(rtwdev, phy_idx);
|
||||
rtw8852c_tssi_scan(rtwdev, phy_idx, chan);
|
||||
}
|
||||
|
||||
static void rtw8852c_rfk_scan(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
@@ -2888,9 +2890,11 @@ static const struct rtw89_chip_ops rtw8852c_chip_ops = {
|
||||
.get_thermal = rtw8852c_get_thermal,
|
||||
.ctrl_btg_bt_rx = rtw8852c_ctrl_btg_bt_rx,
|
||||
.query_ppdu = rtw8852c_query_ppdu,
|
||||
.convert_rpl_to_rssi = NULL,
|
||||
.ctrl_nbtg_bt_tx = rtw8852c_ctrl_nbtg_bt_tx,
|
||||
.cfg_txrx_path = rtw8852c_bb_cfg_txrx_path,
|
||||
.set_txpwr_ul_tb_offset = rtw8852c_set_txpwr_ul_tb_offset,
|
||||
.digital_pwr_comp = NULL,
|
||||
.pwr_on_func = rtw8852c_pwr_on_func,
|
||||
.pwr_off_func = rtw8852c_pwr_off_func,
|
||||
.query_rxdesc = rtw89_core_query_rxdesc,
|
||||
@@ -2958,6 +2962,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
|
||||
.dig_regs = &rtw8852c_dig_regs,
|
||||
.tssi_dbw_table = &rtw89_8852c_tssi_dbw_table,
|
||||
.support_macid_num = RTW89_MAX_MAC_ID_NUM,
|
||||
.support_link_num = 0,
|
||||
.support_chanctx_num = 2,
|
||||
.support_rnr = false,
|
||||
.support_bands = BIT(NL80211_BAND_2GHZ) |
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "chan.h"
|
||||
#include "coex.h"
|
||||
#include "debug.h"
|
||||
#include "fw.h"
|
||||
#include "phy.h"
|
||||
#include "reg.h"
|
||||
#include "rtw8852c.h"
|
||||
@@ -584,11 +585,12 @@ static void _drck(struct rtw89_dev *rtwdev)
|
||||
rtw89_phy_read32_mask(rtwdev, R_DRCK, MASKDWORD));
|
||||
}
|
||||
|
||||
static void _dac_cal(struct rtw89_dev *rtwdev, bool force)
|
||||
static void _dac_cal(struct rtw89_dev *rtwdev, bool force,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_dack_info *dack = &rtwdev->dack;
|
||||
u32 rf0_0, rf1_0;
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, RF_AB, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, RF_AB, chanctx_idx);
|
||||
|
||||
dack->dack_done = false;
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DACK]DACK b\n");
|
||||
@@ -1321,9 +1323,10 @@ static void _iqk_by_path(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, u
|
||||
}
|
||||
|
||||
static void _iqk_get_ch_info(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy, u8 path)
|
||||
enum rtw89_phy_idx phy, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]===>%s\n", __func__);
|
||||
@@ -1516,12 +1519,13 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
|
||||
}
|
||||
|
||||
static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
enum rtw89_phy_idx phy_idx, u8 path)
|
||||
enum rtw89_phy_idx phy_idx, u8 path,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
|
||||
u32 backup_bb_val[BACKUP_BB_REGS_NR];
|
||||
u32 backup_rf_val[RTW8852C_IQK_SS][BACKUP_RF_REGS_NR];
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, RF_AB, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, RF_AB, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);
|
||||
|
||||
@@ -1531,7 +1535,7 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
iqk_info->version = RTW8852C_IQK_VER;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
|
||||
_iqk_get_ch_info(rtwdev, phy_idx, path);
|
||||
_iqk_get_ch_info(rtwdev, phy_idx, path, chanctx_idx);
|
||||
_rfk_backup_bb_reg(rtwdev, backup_bb_val);
|
||||
_rfk_backup_rf_reg(rtwdev, backup_rf_val[path], path);
|
||||
_iqk_macbb_setting(rtwdev, phy_idx, path);
|
||||
@@ -1544,18 +1548,19 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_STOP);
|
||||
}
|
||||
|
||||
static void _iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, bool force)
|
||||
static void _iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, bool force,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
switch (_kpath(rtwdev, phy_idx)) {
|
||||
case RF_A:
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A, chanctx_idx);
|
||||
break;
|
||||
case RF_B:
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B, chanctx_idx);
|
||||
break;
|
||||
case RF_AB:
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_A, chanctx_idx);
|
||||
_doiqk(rtwdev, force, phy_idx, RF_PATH_B, chanctx_idx);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1901,9 +1906,9 @@ static u8 _dpk_one_shot(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
|
||||
static void _dpk_information(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
|
||||
u8 kidx = dpk->cur_idx[path];
|
||||
@@ -2495,9 +2500,9 @@ static void _dpk_idl_mpa(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
}
|
||||
|
||||
static bool _dpk_reload_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
bool is_reload = false;
|
||||
u8 idx, cur_band, cur_ch;
|
||||
@@ -2689,7 +2694,8 @@ static void _dpk_drf_direct_cntrl(struct rtw89_dev *rtwdev, u8 path, bool is_byb
|
||||
}
|
||||
|
||||
static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
enum rtw89_phy_idx phy, u8 kpath)
|
||||
enum rtw89_phy_idx phy, u8 kpath,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_dpk_info *dpk = &rtwdev->dpk;
|
||||
static const u32 kip_reg[] = {0x813c, 0x8124, 0x8120, 0xc0c4, 0xc0e8, 0xc0d4, 0xc0d8};
|
||||
@@ -2705,7 +2711,8 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
if (!(kpath & BIT(path)))
|
||||
continue;
|
||||
|
||||
reloaded[path] = _dpk_reload_check(rtwdev, phy, path);
|
||||
reloaded[path] = _dpk_reload_check(rtwdev, phy, path,
|
||||
chanctx_idx);
|
||||
if (!reloaded[path] && dpk->bp[path][0].ch != 0)
|
||||
dpk->cur_idx[path] = !dpk->cur_idx[path];
|
||||
else
|
||||
@@ -2722,7 +2729,7 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
path, dpk->cur_idx[path]);
|
||||
_dpk_bkup_kip(rtwdev, kip_reg, kip_bkup, path);
|
||||
_rfk_backup_rf_reg(rtwdev, backup_rf_val[path], path);
|
||||
_dpk_information(rtwdev, phy, path);
|
||||
_dpk_information(rtwdev, phy, path, chanctx_idx);
|
||||
_dpk_init(rtwdev, path);
|
||||
if (rtwdev->is_tssi_mode[path])
|
||||
_dpk_tssi_pause(rtwdev, path, true);
|
||||
@@ -2755,10 +2762,11 @@ static void _dpk_cal_select(struct rtw89_dev *rtwdev, bool force,
|
||||
_dpk_kip_pwr_clk_onoff(rtwdev, false);
|
||||
}
|
||||
|
||||
static bool _dpk_bypass_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
static bool _dpk_bypass_check(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
struct rtw89_fem_info *fem = &rtwdev->fem;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
u8 band = chan->band_type;
|
||||
|
||||
if (rtwdev->hal.cv == CHIP_CAV && band != RTW89_BAND_2G) {
|
||||
@@ -2790,17 +2798,18 @@ static void _dpk_force_bypass(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
}
|
||||
}
|
||||
|
||||
static void _dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool force)
|
||||
static void _dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool force,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
rtw89_debug(rtwdev, RTW89_DBG_RFK,
|
||||
"[DPK] ****** DPK Start (Ver: 0x%x, Cv: %d, RF_para: %d) ******\n",
|
||||
RTW8852C_DPK_VER, rtwdev->hal.cv,
|
||||
RTW8852C_RF_REL_VERSION);
|
||||
|
||||
if (_dpk_bypass_check(rtwdev, phy))
|
||||
if (_dpk_bypass_check(rtwdev, phy, chanctx_idx))
|
||||
_dpk_force_bypass(rtwdev, phy);
|
||||
else
|
||||
_dpk_cal_select(rtwdev, force, phy, _kpath(rtwdev, phy));
|
||||
_dpk_cal_select(rtwdev, force, phy, _kpath(rtwdev, phy), chanctx_idx);
|
||||
|
||||
if (rtw89_read_rf(rtwdev, RF_PATH_A, RR_DCKC, RR_DCKC_CHK) == 0x1)
|
||||
rtw8852c_rx_dck(rtwdev, phy, false);
|
||||
@@ -2891,9 +2900,8 @@ static void _dpk_track(struct rtw89_dev *rtwdev)
|
||||
}
|
||||
|
||||
static void _tssi_set_sys(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_bandwidth bw = chan->band_width;
|
||||
enum rtw89_band band = chan->band_type;
|
||||
u32 clk = 0x0;
|
||||
@@ -2945,9 +2953,8 @@ static void _tssi_ini_txpwr_ctrl_bb_he_tb(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static void _tssi_set_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
if (path == RF_PATH_A) {
|
||||
@@ -2972,7 +2979,7 @@ static void _tssi_set_bbgain_split(struct rtw89_dev *rtwdev, enum rtw89_phy_idx
|
||||
}
|
||||
|
||||
static void _tssi_set_tmeter_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
#define RTW8852C_TSSI_GET_VAL(ptr, idx) \
|
||||
({ \
|
||||
@@ -2985,8 +2992,8 @@ static void _tssi_set_tmeter_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx ph
|
||||
} \
|
||||
__val; \
|
||||
})
|
||||
struct rtw89_fw_txpwr_track_cfg *trk = rtwdev->fw.elm_info.txpwr_trk;
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u8 subband = chan->subband_type;
|
||||
const s8 *thm_up_a = NULL;
|
||||
@@ -3001,56 +3008,88 @@ static void _tssi_set_tmeter_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx ph
|
||||
switch (subband) {
|
||||
default:
|
||||
case RTW89_CH_2G:
|
||||
thm_up_a = rtw89_8852c_trk_cfg.delta_swingidx_2ga_p;
|
||||
thm_down_a = rtw89_8852c_trk_cfg.delta_swingidx_2ga_n;
|
||||
thm_up_b = rtw89_8852c_trk_cfg.delta_swingidx_2gb_p;
|
||||
thm_down_b = rtw89_8852c_trk_cfg.delta_swingidx_2gb_n;
|
||||
thm_up_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_2GA_P][0] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_2ga_p;
|
||||
thm_down_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_2GA_N][0] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_2ga_n;
|
||||
thm_up_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_2GB_P][0] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_2gb_p;
|
||||
thm_down_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_2GB_N][0] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_2gb_n;
|
||||
break;
|
||||
case RTW89_CH_5G_BAND_1:
|
||||
thm_up_a = rtw89_8852c_trk_cfg.delta_swingidx_5ga_p[0];
|
||||
thm_down_a = rtw89_8852c_trk_cfg.delta_swingidx_5ga_n[0];
|
||||
thm_up_b = rtw89_8852c_trk_cfg.delta_swingidx_5gb_p[0];
|
||||
thm_down_b = rtw89_8852c_trk_cfg.delta_swingidx_5gb_n[0];
|
||||
thm_up_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_5GA_P][0] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_5ga_p[0];
|
||||
thm_down_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_5GA_N][0] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_5ga_n[0];
|
||||
thm_up_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_5GB_P][0] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_5gb_p[0];
|
||||
thm_down_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_5GB_N][0] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_5gb_n[0];
|
||||
break;
|
||||
case RTW89_CH_5G_BAND_3:
|
||||
thm_up_a = rtw89_8852c_trk_cfg.delta_swingidx_5ga_p[1];
|
||||
thm_down_a = rtw89_8852c_trk_cfg.delta_swingidx_5ga_n[1];
|
||||
thm_up_b = rtw89_8852c_trk_cfg.delta_swingidx_5gb_p[1];
|
||||
thm_down_b = rtw89_8852c_trk_cfg.delta_swingidx_5gb_n[1];
|
||||
thm_up_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_5GA_P][1] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_5ga_p[1];
|
||||
thm_down_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_5GA_N][1] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_5ga_n[1];
|
||||
thm_up_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_5GB_P][1] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_5gb_p[1];
|
||||
thm_down_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_5GB_N][1] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_5gb_n[1];
|
||||
break;
|
||||
case RTW89_CH_5G_BAND_4:
|
||||
thm_up_a = rtw89_8852c_trk_cfg.delta_swingidx_5ga_p[2];
|
||||
thm_down_a = rtw89_8852c_trk_cfg.delta_swingidx_5ga_n[2];
|
||||
thm_up_b = rtw89_8852c_trk_cfg.delta_swingidx_5gb_p[2];
|
||||
thm_down_b = rtw89_8852c_trk_cfg.delta_swingidx_5gb_n[2];
|
||||
thm_up_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_5GA_P][2] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_5ga_p[2];
|
||||
thm_down_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_5GA_N][2] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_5ga_n[2];
|
||||
thm_up_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_5GB_P][2] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_5gb_p[2];
|
||||
thm_down_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_5GB_N][2] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_5gb_n[2];
|
||||
break;
|
||||
case RTW89_CH_6G_BAND_IDX0:
|
||||
case RTW89_CH_6G_BAND_IDX1:
|
||||
thm_up_a = rtw89_8852c_trk_cfg.delta_swingidx_6ga_p[0];
|
||||
thm_down_a = rtw89_8852c_trk_cfg.delta_swingidx_6ga_n[0];
|
||||
thm_up_b = rtw89_8852c_trk_cfg.delta_swingidx_6gb_p[0];
|
||||
thm_down_b = rtw89_8852c_trk_cfg.delta_swingidx_6gb_n[0];
|
||||
thm_up_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GA_P][0] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6ga_p[0];
|
||||
thm_down_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GA_N][0] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6ga_n[0];
|
||||
thm_up_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GB_P][0] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6gb_p[0];
|
||||
thm_down_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GB_N][0] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6gb_n[0];
|
||||
break;
|
||||
case RTW89_CH_6G_BAND_IDX2:
|
||||
case RTW89_CH_6G_BAND_IDX3:
|
||||
thm_up_a = rtw89_8852c_trk_cfg.delta_swingidx_6ga_p[1];
|
||||
thm_down_a = rtw89_8852c_trk_cfg.delta_swingidx_6ga_n[1];
|
||||
thm_up_b = rtw89_8852c_trk_cfg.delta_swingidx_6gb_p[1];
|
||||
thm_down_b = rtw89_8852c_trk_cfg.delta_swingidx_6gb_n[1];
|
||||
thm_up_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GA_P][1] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6ga_p[1];
|
||||
thm_down_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GA_N][1] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6ga_n[1];
|
||||
thm_up_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GB_P][1] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6gb_p[1];
|
||||
thm_down_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GB_N][1] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6gb_n[1];
|
||||
break;
|
||||
case RTW89_CH_6G_BAND_IDX4:
|
||||
case RTW89_CH_6G_BAND_IDX5:
|
||||
thm_up_a = rtw89_8852c_trk_cfg.delta_swingidx_6ga_p[2];
|
||||
thm_down_a = rtw89_8852c_trk_cfg.delta_swingidx_6ga_n[2];
|
||||
thm_up_b = rtw89_8852c_trk_cfg.delta_swingidx_6gb_p[2];
|
||||
thm_down_b = rtw89_8852c_trk_cfg.delta_swingidx_6gb_n[2];
|
||||
thm_up_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GA_P][2] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6ga_p[2];
|
||||
thm_down_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GA_N][2] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6ga_n[2];
|
||||
thm_up_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GB_P][2] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6gb_p[2];
|
||||
thm_down_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GB_N][2] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6gb_n[2];
|
||||
break;
|
||||
case RTW89_CH_6G_BAND_IDX6:
|
||||
case RTW89_CH_6G_BAND_IDX7:
|
||||
thm_up_a = rtw89_8852c_trk_cfg.delta_swingidx_6ga_p[3];
|
||||
thm_down_a = rtw89_8852c_trk_cfg.delta_swingidx_6ga_n[3];
|
||||
thm_up_b = rtw89_8852c_trk_cfg.delta_swingidx_6gb_p[3];
|
||||
thm_down_b = rtw89_8852c_trk_cfg.delta_swingidx_6gb_n[3];
|
||||
thm_up_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GA_P][3] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6ga_p[3];
|
||||
thm_down_a = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GA_N][3] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6ga_n[3];
|
||||
thm_up_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GB_P][3] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6gb_p[3];
|
||||
thm_down_b = trk ? trk->delta[RTW89_FW_TXPWR_TRK_TYPE_6GB_N][3] :
|
||||
rtw89_8852c_trk_cfg.delta_swingidx_6gb_n[3];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3158,9 +3197,8 @@ static void _tssi_set_tmeter_tbl(struct rtw89_dev *rtwdev, enum rtw89_phy_idx ph
|
||||
}
|
||||
|
||||
static void _tssi_slope_cal_org(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
|
||||
if (path == RF_PATH_A) {
|
||||
@@ -3175,9 +3213,9 @@ static void _tssi_slope_cal_org(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy
|
||||
}
|
||||
|
||||
static void _tssi_set_aligk_default(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
const struct rtw89_rfk_tbl *tbl;
|
||||
|
||||
@@ -3586,10 +3624,9 @@ static u32 _tssi_get_6g_trim_group(struct rtw89_dev *rtwdev, u8 ch)
|
||||
}
|
||||
|
||||
static s8 _tssi_get_ofdm_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
u8 ch = chan->channel;
|
||||
u32 gidx, gidx_1st, gidx_2nd;
|
||||
@@ -3650,10 +3687,9 @@ static s8 _tssi_get_ofdm_de(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
|
||||
static s8 _tssi_get_ofdm_trim_de(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_band band = chan->band_type;
|
||||
u8 ch = chan->channel;
|
||||
u32 tgidx, tgidx_1st, tgidx_2nd;
|
||||
@@ -3715,10 +3751,9 @@ static s8 _tssi_get_ofdm_trim_de(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy)
|
||||
enum rtw89_phy_idx phy, const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_tssi_info *tssi_info = &rtwdev->tssi;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
u8 ch = chan->channel;
|
||||
u8 gidx;
|
||||
s8 ofdm_de;
|
||||
@@ -3741,7 +3776,7 @@ static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev,
|
||||
|
||||
for (i = path; i < path_max; i++) {
|
||||
gidx = _tssi_get_cck_group(rtwdev, ch);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i, chan);
|
||||
val = tssi_info->tssi_cck[i][gidx] + trim_de;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
@@ -3757,8 +3792,8 @@ static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev,
|
||||
rtw89_phy_read32_mask(rtwdev, _tssi_de_cck_long[i],
|
||||
_TSSI_DE_MASK));
|
||||
|
||||
ofdm_de = _tssi_get_ofdm_de(rtwdev, phy, i);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i);
|
||||
ofdm_de = _tssi_get_ofdm_de(rtwdev, phy, i, chan);
|
||||
trim_de = _tssi_get_ofdm_trim_de(rtwdev, phy, i, chan);
|
||||
val = ofdm_de + trim_de;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI,
|
||||
@@ -3781,7 +3816,7 @@ static void _tssi_set_efuse_to_de(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static void rtw8852c_tssi_cont_en(struct rtw89_dev *rtwdev, bool en,
|
||||
enum rtw89_rf_path path)
|
||||
enum rtw89_rf_path path, const struct rtw89_chan *chan)
|
||||
{
|
||||
static const u32 tssi_trk[2] = {0x5818, 0x7818};
|
||||
static const u32 tssi_en[2] = {0x5820, 0x7820};
|
||||
@@ -3790,25 +3825,26 @@ static void rtw8852c_tssi_cont_en(struct rtw89_dev *rtwdev, bool en,
|
||||
rtw89_phy_write32_mask(rtwdev, tssi_trk[path], BIT(30), 0x0);
|
||||
rtw89_phy_write32_mask(rtwdev, tssi_en[path], BIT(31), 0x0);
|
||||
if (rtwdev->dbcc_en && path == RF_PATH_B)
|
||||
_tssi_set_efuse_to_de(rtwdev, RTW89_PHY_1);
|
||||
_tssi_set_efuse_to_de(rtwdev, RTW89_PHY_1, chan);
|
||||
else
|
||||
_tssi_set_efuse_to_de(rtwdev, RTW89_PHY_0);
|
||||
_tssi_set_efuse_to_de(rtwdev, RTW89_PHY_0, chan);
|
||||
} else {
|
||||
rtw89_phy_write32_mask(rtwdev, tssi_trk[path], BIT(30), 0x1);
|
||||
rtw89_phy_write32_mask(rtwdev, tssi_en[path], BIT(31), 0x1);
|
||||
}
|
||||
}
|
||||
|
||||
void rtw8852c_tssi_cont_en_phyidx(struct rtw89_dev *rtwdev, bool en, u8 phy_idx)
|
||||
void rtw8852c_tssi_cont_en_phyidx(struct rtw89_dev *rtwdev, bool en, u8 phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
if (!rtwdev->dbcc_en) {
|
||||
rtw8852c_tssi_cont_en(rtwdev, en, RF_PATH_A);
|
||||
rtw8852c_tssi_cont_en(rtwdev, en, RF_PATH_B);
|
||||
rtw8852c_tssi_cont_en(rtwdev, en, RF_PATH_A, chan);
|
||||
rtw8852c_tssi_cont_en(rtwdev, en, RF_PATH_B, chan);
|
||||
} else {
|
||||
if (phy_idx == RTW89_PHY_0)
|
||||
rtw8852c_tssi_cont_en(rtwdev, en, RF_PATH_A);
|
||||
rtw8852c_tssi_cont_en(rtwdev, en, RF_PATH_A, chan);
|
||||
else
|
||||
rtw8852c_tssi_cont_en(rtwdev, en, RF_PATH_B);
|
||||
rtw8852c_tssi_cont_en(rtwdev, en, RF_PATH_B, chan);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4112,26 +4148,27 @@ void rtw8852c_rck(struct rtw89_dev *rtwdev)
|
||||
_rck(rtwdev, path);
|
||||
}
|
||||
|
||||
void rtw8852c_dack(struct rtw89_dev *rtwdev)
|
||||
void rtw8852c_dack(struct rtw89_dev *rtwdev, enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, RTW89_PHY_0, 0, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DACK, BTC_WRFK_START);
|
||||
_dac_cal(rtwdev, false);
|
||||
_dac_cal(rtwdev, false, chanctx_idx);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DACK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
void rtw8852c_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8852c_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u32 tx_en;
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_START);
|
||||
rtw89_chip_stop_sch_tx(rtwdev, phy_idx, &tx_en, RTW89_SCH_TX_SEL_ALL);
|
||||
_wait_rx_mode(rtwdev, _kpath(rtwdev, phy_idx));
|
||||
|
||||
_iqk_init(rtwdev);
|
||||
_iqk(rtwdev, phy_idx, false);
|
||||
_iqk(rtwdev, phy_idx, false, chanctx_idx);
|
||||
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_STOP);
|
||||
@@ -4202,10 +4239,11 @@ void rtw8852c_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy, bool is_a
|
||||
|
||||
void rtw8852c_rx_dck_track(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
enum rtw89_chanctx_idx chanctx_idx = RTW89_CHANCTX_0;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
struct rtw89_rx_dck_info *rx_dck = &rtwdev->rx_dck;
|
||||
enum rtw89_phy_idx phy_idx = RTW89_PHY_0;
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
u8 dck_channel;
|
||||
u8 cur_thermal;
|
||||
u32 tx_en;
|
||||
@@ -4259,16 +4297,17 @@ void rtw8852c_dpk_init(struct rtw89_dev *rtwdev)
|
||||
dpk->is_dpk_reload_en = false;
|
||||
}
|
||||
|
||||
void rtw8852c_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
|
||||
void rtw8852c_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
u32 tx_en;
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, 0, chanctx_idx);
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DPK, BTC_WRFK_START);
|
||||
rtw89_chip_stop_sch_tx(rtwdev, phy_idx, &tx_en, RTW89_SCH_TX_SEL_ALL);
|
||||
_wait_rx_mode(rtwdev, _kpath(rtwdev, phy_idx));
|
||||
|
||||
_dpk(rtwdev, phy_idx, false);
|
||||
_dpk(rtwdev, phy_idx, false, chanctx_idx);
|
||||
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_DPK, BTC_WRFK_STOP);
|
||||
@@ -4279,8 +4318,10 @@ void rtw8852c_dpk_track(struct rtw89_dev *rtwdev)
|
||||
_dpk_track(rtwdev);
|
||||
}
|
||||
|
||||
void rtw8852c_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
void rtw8852c_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_chanctx_idx chanctx_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
u32 i, path = RF_PATH_A, path_max = RF_PATH_NUM_8852C;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TSSI, "[TSSI] %s: phy=%d\n", __func__, phy);
|
||||
@@ -4298,23 +4339,24 @@ void rtw8852c_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
_tssi_disable(rtwdev, phy);
|
||||
|
||||
for (i = path; i < path_max; i++) {
|
||||
_tssi_set_sys(rtwdev, phy, i);
|
||||
_tssi_set_sys(rtwdev, phy, i, chan);
|
||||
_tssi_ini_txpwr_ctrl_bb(rtwdev, phy, i);
|
||||
_tssi_ini_txpwr_ctrl_bb_he_tb(rtwdev, phy, i);
|
||||
_tssi_set_dck(rtwdev, phy, i);
|
||||
_tssi_set_dck(rtwdev, phy, i, chan);
|
||||
_tssi_set_bbgain_split(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i);
|
||||
_tssi_set_aligk_default(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i, chan);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i, chan);
|
||||
_tssi_set_aligk_default(rtwdev, phy, i, chan);
|
||||
_tssi_set_slope(rtwdev, phy, i);
|
||||
_tssi_run_slope(rtwdev, phy, i);
|
||||
}
|
||||
|
||||
_tssi_enable(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy, chan);
|
||||
}
|
||||
|
||||
void rtw8852c_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
void rtw8852c_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
u32 i, path = RF_PATH_A, path_max = RF_PATH_NUM_8852C;
|
||||
|
||||
@@ -4339,15 +4381,15 @@ void rtw8852c_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy)
|
||||
_tssi_disable(rtwdev, phy);
|
||||
|
||||
for (i = path; i < path_max; i++) {
|
||||
_tssi_set_sys(rtwdev, phy, i);
|
||||
_tssi_set_dck(rtwdev, phy, i);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i);
|
||||
_tssi_set_aligk_default(rtwdev, phy, i);
|
||||
_tssi_set_sys(rtwdev, phy, i, chan);
|
||||
_tssi_set_dck(rtwdev, phy, i, chan);
|
||||
_tssi_set_tmeter_tbl(rtwdev, phy, i, chan);
|
||||
_tssi_slope_cal_org(rtwdev, phy, i, chan);
|
||||
_tssi_set_aligk_default(rtwdev, phy, i, chan);
|
||||
}
|
||||
|
||||
_tssi_enable(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy);
|
||||
_tssi_set_efuse_to_de(rtwdev, phy, chan);
|
||||
}
|
||||
|
||||
static void rtw8852c_tssi_default_txagc(struct rtw89_dev *rtwdev,
|
||||
@@ -4422,7 +4464,7 @@ void rtw8852c_rfk_chanctx_cb(struct rtw89_dev *rtwdev,
|
||||
dpk->is_dpk_enable = true;
|
||||
for (path = 0; path < RTW8852C_DPK_RF_PATH; path++)
|
||||
_dpk_onoff(rtwdev, path, false);
|
||||
rtw8852c_dpk(rtwdev, RTW89_PHY_0);
|
||||
rtw8852c_dpk(rtwdev, RTW89_PHY_0, RTW89_CHANCTX_0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -9,16 +9,21 @@
|
||||
|
||||
void rtw8852c_mcc_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
void rtw8852c_rck(struct rtw89_dev *rtwdev);
|
||||
void rtw8852c_dack(struct rtw89_dev *rtwdev);
|
||||
void rtw8852c_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
|
||||
void rtw8852c_dack(struct rtw89_dev *rtwdev, enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852c_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852c_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, bool is_afe);
|
||||
void rtw8852c_rx_dck_track(struct rtw89_dev *rtwdev);
|
||||
void rtw8852c_dpk_init(struct rtw89_dev *rtwdev);
|
||||
void rtw8852c_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
void rtw8852c_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852c_dpk_track(struct rtw89_dev *rtwdev);
|
||||
void rtw8852c_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
void rtw8852c_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
|
||||
void rtw8852c_tssi_cont_en_phyidx(struct rtw89_dev *rtwdev, bool en, u8 phy_idx);
|
||||
void rtw8852c_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
enum rtw89_chanctx_idx chanctx_idx);
|
||||
void rtw8852c_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
|
||||
const struct rtw89_chan *chan);
|
||||
void rtw8852c_tssi_cont_en_phyidx(struct rtw89_dev *rtwdev, bool en, u8 phy_idx,
|
||||
const struct rtw89_chan *chan);
|
||||
void rtw8852c_wifi_scan_notify(struct rtw89_dev *rtwdev, bool scan_start,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
void rtw8852c_set_channel_rf(struct rtw89_dev *rtwdev,
|
||||
|
||||
@@ -1689,6 +1689,60 @@ static int rtw8922a_ctrl_rx_path_tmac(struct rtw89_dev *rtwdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define DIGITAL_PWR_COMP_REG_NUM 22
|
||||
static const u32 rtw8922a_digital_pwr_comp_val[][DIGITAL_PWR_COMP_REG_NUM] = {
|
||||
{0x012C0096, 0x044C02BC, 0x00322710, 0x015E0096, 0x03C8028A,
|
||||
0x0BB80708, 0x17701194, 0x02020100, 0x03030303, 0x01000303,
|
||||
0x05030302, 0x06060605, 0x06050300, 0x0A090807, 0x02000B0B,
|
||||
0x09080604, 0x0D0D0C0B, 0x08060400, 0x110F0C0B, 0x05001111,
|
||||
0x0D0C0907, 0x12121210},
|
||||
{0x012C0096, 0x044C02BC, 0x00322710, 0x015E0096, 0x03C8028A,
|
||||
0x0BB80708, 0x17701194, 0x04030201, 0x05050505, 0x01000505,
|
||||
0x07060504, 0x09090908, 0x09070400, 0x0E0D0C0B, 0x03000E0E,
|
||||
0x0D0B0907, 0x1010100F, 0x0B080500, 0x1512100D, 0x05001515,
|
||||
0x100D0B08, 0x15151512},
|
||||
};
|
||||
|
||||
static void rtw8922a_set_digital_pwr_comp(struct rtw89_dev *rtwdev,
|
||||
bool enable, u8 nss,
|
||||
enum rtw89_rf_path path)
|
||||
{
|
||||
static const u32 ltpc_t0[2] = {R_BE_LTPC_T0_PATH0, R_BE_LTPC_T0_PATH1};
|
||||
const u32 *digital_pwr_comp;
|
||||
u32 addr, val;
|
||||
u32 i;
|
||||
|
||||
if (nss == 1)
|
||||
digital_pwr_comp = rtw8922a_digital_pwr_comp_val[0];
|
||||
else
|
||||
digital_pwr_comp = rtw8922a_digital_pwr_comp_val[1];
|
||||
|
||||
addr = ltpc_t0[path];
|
||||
for (i = 0; i < DIGITAL_PWR_COMP_REG_NUM; i++, addr += 4) {
|
||||
val = enable ? digital_pwr_comp[i] : 0;
|
||||
rtw89_phy_write32(rtwdev, addr, val);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtw8922a_digital_pwr_comp(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
bool enable = chan->band_type != RTW89_BAND_2G;
|
||||
u8 path;
|
||||
|
||||
if (rtwdev->mlo_dbcc_mode == MLO_1_PLUS_1_1RF) {
|
||||
if (phy_idx == RTW89_PHY_0)
|
||||
path = RF_PATH_A;
|
||||
else
|
||||
path = RF_PATH_B;
|
||||
rtw8922a_set_digital_pwr_comp(rtwdev, enable, 1, path);
|
||||
} else {
|
||||
rtw8922a_set_digital_pwr_comp(rtwdev, enable, 2, RF_PATH_A);
|
||||
rtw8922a_set_digital_pwr_comp(rtwdev, enable, 2, RF_PATH_B);
|
||||
}
|
||||
}
|
||||
|
||||
static int rtw8922a_ctrl_mlo(struct rtw89_dev *rtwdev, enum rtw89_mlo_dbcc_mode mode)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
@@ -1810,11 +1864,13 @@ static void rtw8922a_pre_set_channel_bb(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
static void rtw8922a_post_set_channel_bb(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_mlo_dbcc_mode mode)
|
||||
enum rtw89_mlo_dbcc_mode mode,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
if (!rtwdev->dbcc_en)
|
||||
return;
|
||||
|
||||
rtw8922a_digital_pwr_comp(rtwdev, phy_idx);
|
||||
rtw8922a_ctrl_mlo(rtwdev, mode);
|
||||
}
|
||||
|
||||
@@ -1921,7 +1977,7 @@ static void rtw8922a_set_channel_help(struct rtw89_dev *rtwdev, bool enter,
|
||||
rtw8922a_hal_reset(rtwdev, phy_idx, mac_idx, chan->band_type, &p->tx_en, enter);
|
||||
|
||||
if (!enter) {
|
||||
rtw8922a_post_set_channel_bb(rtwdev, rtwdev->mlo_dbcc_mode);
|
||||
rtw8922a_post_set_channel_bb(rtwdev, rtwdev->mlo_dbcc_mode, phy_idx);
|
||||
rtw8922a_post_set_channel_rf(rtwdev, phy_idx);
|
||||
}
|
||||
}
|
||||
@@ -1937,10 +1993,12 @@ static void rtw8922a_rfk_init(struct rtw89_dev *rtwdev)
|
||||
|
||||
static void rtw8922a_rfk_init_late(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_CHANCTX_0);
|
||||
|
||||
rtw89_phy_rfk_pre_ntfy_and_wait(rtwdev, RTW89_PHY_0, 5);
|
||||
|
||||
rtw89_phy_rfk_dack_and_wait(rtwdev, RTW89_PHY_0, 58);
|
||||
rtw89_phy_rfk_rxdck_and_wait(rtwdev, RTW89_PHY_0, 32);
|
||||
rtw89_phy_rfk_dack_and_wait(rtwdev, RTW89_PHY_0, chan, 58);
|
||||
rtw89_phy_rfk_rxdck_and_wait(rtwdev, RTW89_PHY_0, chan, 32);
|
||||
}
|
||||
|
||||
static void _wait_rx_mode(struct rtw89_dev *rtwdev, u8 kpath)
|
||||
@@ -1964,8 +2022,10 @@ static void _wait_rx_mode(struct rtw89_dev *rtwdev, u8 kpath)
|
||||
|
||||
static void rtw8922a_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
{
|
||||
enum rtw89_chanctx_idx chanctx_idx = rtwvif->chanctx_idx;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, chanctx_idx);
|
||||
enum rtw89_phy_idx phy_idx = rtwvif->phy_idx;
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, RF_AB, RTW89_CHANCTX_0);
|
||||
u8 phy_map = rtw89_btc_phymap(rtwdev, phy_idx, RF_AB, chanctx_idx);
|
||||
u32 tx_en;
|
||||
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_CHLK, BTC_WRFK_START);
|
||||
@@ -1973,20 +2033,21 @@ static void rtw8922a_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtw
|
||||
_wait_rx_mode(rtwdev, RF_AB);
|
||||
|
||||
rtw89_phy_rfk_pre_ntfy_and_wait(rtwdev, phy_idx, 5);
|
||||
rtw89_phy_rfk_txgapk_and_wait(rtwdev, phy_idx, 54);
|
||||
rtw89_phy_rfk_iqk_and_wait(rtwdev, phy_idx, 84);
|
||||
rtw89_phy_rfk_tssi_and_wait(rtwdev, phy_idx, RTW89_TSSI_NORMAL, 6);
|
||||
rtw89_phy_rfk_dpk_and_wait(rtwdev, phy_idx, 34);
|
||||
rtw89_phy_rfk_rxdck_and_wait(rtwdev, RTW89_PHY_0, 32);
|
||||
rtw89_phy_rfk_txgapk_and_wait(rtwdev, phy_idx, chan, 54);
|
||||
rtw89_phy_rfk_iqk_and_wait(rtwdev, phy_idx, chan, 84);
|
||||
rtw89_phy_rfk_tssi_and_wait(rtwdev, phy_idx, chan, RTW89_TSSI_NORMAL, 6);
|
||||
rtw89_phy_rfk_dpk_and_wait(rtwdev, phy_idx, chan, 34);
|
||||
rtw89_phy_rfk_rxdck_and_wait(rtwdev, RTW89_PHY_0, chan, 32);
|
||||
|
||||
rtw89_chip_resume_sch_tx(rtwdev, phy_idx, tx_en);
|
||||
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_CHLK, BTC_WRFK_STOP);
|
||||
}
|
||||
|
||||
static void rtw8922a_rfk_band_changed(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
enum rtw89_phy_idx phy_idx,
|
||||
const struct rtw89_chan *chan)
|
||||
{
|
||||
rtw89_phy_rfk_tssi_and_wait(rtwdev, phy_idx, RTW89_TSSI_SCAN, 6);
|
||||
rtw89_phy_rfk_tssi_and_wait(rtwdev, phy_idx, chan, RTW89_TSSI_SCAN, 6);
|
||||
}
|
||||
|
||||
static void rtw8922a_rfk_scan(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
@@ -2436,6 +2497,38 @@ static void rtw8922a_query_ppdu(struct rtw89_dev *rtwdev,
|
||||
rtw8922a_fill_freq_with_ppdu(rtwdev, phy_ppdu, status);
|
||||
}
|
||||
|
||||
static void rtw8922a_convert_rpl_to_rssi(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu)
|
||||
{
|
||||
/* Mapping to BW: 5, 10, 20, 40, 80, 160, 80_80 */
|
||||
static const u8 bw_compensate[] = {0, 0, 0, 6, 12, 18, 0};
|
||||
u8 *rssi = phy_ppdu->rssi;
|
||||
u8 compensate = 0;
|
||||
u16 rpl_tmp;
|
||||
u8 i;
|
||||
|
||||
if (phy_ppdu->bw_idx < ARRAY_SIZE(bw_compensate))
|
||||
compensate = bw_compensate[phy_ppdu->bw_idx];
|
||||
|
||||
for (i = 0; i < RF_PATH_NUM_8922A; i++) {
|
||||
if (!(phy_ppdu->rx_path_en & BIT(i))) {
|
||||
rssi[i] = 0;
|
||||
phy_ppdu->rpl_path[i] = 0;
|
||||
phy_ppdu->rpl_fd[i] = 0;
|
||||
}
|
||||
if (phy_ppdu->rate >= RTW89_HW_RATE_OFDM6) {
|
||||
rpl_tmp = phy_ppdu->rpl_fd[i];
|
||||
if (rpl_tmp)
|
||||
rpl_tmp += compensate;
|
||||
|
||||
phy_ppdu->rpl_path[i] = rpl_tmp;
|
||||
}
|
||||
rssi[i] = phy_ppdu->rpl_path[i];
|
||||
}
|
||||
|
||||
phy_ppdu->rssi_avg = phy_ppdu->rpl_avg;
|
||||
}
|
||||
|
||||
static int rtw8922a_mac_enable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
rtw89_write8_set(rtwdev, R_BE_FEN_RST_ENABLE,
|
||||
@@ -2455,10 +2548,12 @@ static int rtw8922a_mac_disable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static const struct wiphy_wowlan_support rtw_wowlan_stub_8922a = {
|
||||
.flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT,
|
||||
.flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT |
|
||||
WIPHY_WOWLAN_NET_DETECT,
|
||||
.n_patterns = RTW89_MAX_PATTERN_NUM,
|
||||
.pattern_max_len = RTW89_MAX_PATTERN_SIZE,
|
||||
.pattern_min_len = 1,
|
||||
.max_nd_match_sets = RTW89_SCANOFLD_MAX_SSID,
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -2491,9 +2586,11 @@ static const struct rtw89_chip_ops rtw8922a_chip_ops = {
|
||||
.get_thermal = rtw8922a_get_thermal,
|
||||
.ctrl_btg_bt_rx = rtw8922a_ctrl_btg_bt_rx,
|
||||
.query_ppdu = rtw8922a_query_ppdu,
|
||||
.convert_rpl_to_rssi = rtw8922a_convert_rpl_to_rssi,
|
||||
.ctrl_nbtg_bt_tx = rtw8922a_ctrl_nbtg_bt_tx,
|
||||
.cfg_txrx_path = rtw8922a_bb_cfg_txrx_path,
|
||||
.set_txpwr_ul_tb_offset = NULL,
|
||||
.digital_pwr_comp = rtw8922a_digital_pwr_comp,
|
||||
.pwr_on_func = rtw8922a_pwr_on_func,
|
||||
.pwr_off_func = rtw8922a_pwr_off_func,
|
||||
.query_rxdesc = rtw89_core_query_rxdesc_v2,
|
||||
@@ -2559,6 +2656,7 @@ const struct rtw89_chip_info rtw8922a_chip_info = {
|
||||
.dig_regs = &rtw8922a_dig_regs,
|
||||
.tssi_dbw_table = NULL,
|
||||
.support_macid_num = 32,
|
||||
.support_link_num = 2,
|
||||
.support_chanctx_num = 2,
|
||||
.support_rnr = true,
|
||||
.support_bands = BIT(NL80211_BAND_2GHZ) |
|
||||
|
||||
@@ -441,6 +441,7 @@ struct rtw89_phy_sts_hdr {
|
||||
} __packed;
|
||||
|
||||
#define RTW89_PHY_STS_HDR_W0_IE_MAP GENMASK(4, 0)
|
||||
#define RTW89_PHY_STS_HDR_W0_HDR_2_EN BIT(5)
|
||||
#define RTW89_PHY_STS_HDR_W0_VALID BIT(7)
|
||||
#define RTW89_PHY_STS_HDR_W0_LEN GENMASK(15, 8)
|
||||
#define RTW89_PHY_STS_HDR_W0_RSSI_AVG GENMASK(31, 24)
|
||||
@@ -449,6 +450,13 @@ struct rtw89_phy_sts_hdr {
|
||||
#define RTW89_PHY_STS_HDR_W1_RSSI_C GENMASK(23, 16)
|
||||
#define RTW89_PHY_STS_HDR_W1_RSSI_D GENMASK(31, 24)
|
||||
|
||||
struct rtw89_phy_sts_hdr_v2 {
|
||||
__le32 w0;
|
||||
__le32 w1;
|
||||
} __packed;
|
||||
|
||||
#define RTW89_PHY_STS_HDR_V2_W0_PATH_EN GENMASK(20, 16)
|
||||
|
||||
struct rtw89_phy_sts_iehdr {
|
||||
__le32 w0;
|
||||
};
|
||||
@@ -552,13 +560,43 @@ struct rtw89_phy_sts_iehdr {
|
||||
#define BE_RXD_HDR_OFFSET_MASK GENMASK(20, 16)
|
||||
#define BE_RXD_WL_HD_IV_LEN_MASK GENMASK(26, 21)
|
||||
|
||||
struct rtw89_phy_sts_ie0 {
|
||||
struct rtw89_phy_sts_ie00 {
|
||||
__le32 w0;
|
||||
__le32 w1;
|
||||
__le32 w2;
|
||||
__le32 w3;
|
||||
} __packed;
|
||||
|
||||
#define RTW89_PHY_STS_IE00_W0_RPL GENMASK(15, 7)
|
||||
|
||||
struct rtw89_phy_sts_ie00_v2 {
|
||||
__le32 w0;
|
||||
__le32 w1;
|
||||
__le32 w2;
|
||||
__le32 w3;
|
||||
__le32 w4;
|
||||
__le32 w5;
|
||||
__le32 w6;
|
||||
__le32 w7;
|
||||
} __packed;
|
||||
|
||||
#define RTW89_PHY_STS_IE00_V2_W4_RPL_TD_A GENMASK(8, 0)
|
||||
#define RTW89_PHY_STS_IE00_V2_W4_RPL_TD_B GENMASK(17, 9)
|
||||
#define RTW89_PHY_STS_IE00_V2_W4_RPL_TD_C GENMASK(26, 18)
|
||||
#define RTW89_PHY_STS_IE00_V2_W5_RPL_TD_D GENMASK(8, 0)
|
||||
|
||||
struct rtw89_phy_sts_ie01 {
|
||||
__le32 w0;
|
||||
__le32 w1;
|
||||
__le32 w2;
|
||||
__le32 w3;
|
||||
__le32 w4;
|
||||
__le32 w5;
|
||||
} __packed;
|
||||
|
||||
#define RTW89_PHY_STS_IE01_W0_CH_IDX GENMASK(23, 16)
|
||||
#define RTW89_PHY_STS_IE01_W0_RSSI_AVG_FD GENMASK(15, 8)
|
||||
#define RTW89_PHY_STS_IE01_W0_RX_PATH_EN GENMASK(31, 28)
|
||||
#define RTW89_PHY_STS_IE01_W1_FD_CFO GENMASK(19, 8)
|
||||
#define RTW89_PHY_STS_IE01_W1_PREMB_CFO GENMASK(31, 20)
|
||||
#define RTW89_PHY_STS_IE01_W2_AVG_SNR GENMASK(5, 0)
|
||||
@@ -567,6 +605,25 @@ struct rtw89_phy_sts_ie0 {
|
||||
#define RTW89_PHY_STS_IE01_W2_LDPC BIT(28)
|
||||
#define RTW89_PHY_STS_IE01_W2_STBC BIT(30)
|
||||
|
||||
struct rtw89_phy_sts_ie01_v2 {
|
||||
__le32 w0;
|
||||
__le32 w1;
|
||||
__le32 w2;
|
||||
__le32 w3;
|
||||
__le32 w4;
|
||||
__le32 w5;
|
||||
__le32 w6;
|
||||
__le32 w7;
|
||||
__le32 w8;
|
||||
__le32 w9;
|
||||
} __packed;
|
||||
|
||||
#define RTW89_PHY_STS_IE01_V2_W5_BW_IDX GENMASK(31, 29)
|
||||
#define RTW89_PHY_STS_IE01_V2_W8_RPL_FD_A GENMASK(11, 4)
|
||||
#define RTW89_PHY_STS_IE01_V2_W8_RPL_FD_B GENMASK(23, 16)
|
||||
#define RTW89_PHY_STS_IE01_V2_W9_RPL_FD_C GENMASK(11, 4)
|
||||
#define RTW89_PHY_STS_IE01_V2_W9_RPL_FD_D GENMASK(23, 16)
|
||||
|
||||
enum rtw89_tx_channel {
|
||||
RTW89_TXCH_ACH0 = 0,
|
||||
RTW89_TXCH_ACH1 = 1,
|
||||
|
||||
@@ -1438,6 +1438,7 @@ static int rtw89_pno_scan_offload(struct rtw89_dev *rtwdev, bool enable)
|
||||
struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
||||
struct ieee80211_vif *wow_vif = rtw_wow->wow_vif;
|
||||
struct rtw89_vif *rtwvif = (struct rtw89_vif *)wow_vif->drv_priv;
|
||||
int interval = rtw_wow->nd_config->scan_plans[0].interval;
|
||||
struct rtw89_scan_option opt = {};
|
||||
int ret;
|
||||
|
||||
@@ -1457,7 +1458,7 @@ static int rtw89_pno_scan_offload(struct rtw89_dev *rtwdev, bool enable)
|
||||
|
||||
opt.enable = enable;
|
||||
opt.repeat = RTW89_SCAN_NORMAL;
|
||||
opt.norm_pd = 10; /* in unit of 100ms */
|
||||
opt.norm_pd = max(interval, 1) * 10; /* in unit of 100ms */
|
||||
opt.delay = max(rtw_wow->nd_config->delay, 1);
|
||||
|
||||
if (rtwdev->chip->chip_gen == RTW89_CHIP_BE) {
|
||||
|
||||
Reference in New Issue
Block a user