Commit 74b45618 authored by Zong-Zhe Yang's avatar Zong-Zhe Yang Committed by Kalle Valo

wifi: rtw89: 52c: rfk: refine MCC channel info notification

RF calibration will notify FW to backup the calibration result after it
is done on a channel. For MCC (multi-channel concurrency) flow, when we
at RTW89_ENTITY_MODE_MCC_PREPARE mode, RF calibration should execute on
second channel of MCC, i.e. RTW89_SUB_ENTITY_1, and then, notify FW to
backup the result for the second one.

Originally, the RF calibration flow only fit single channel case. We are
planning to support MCC on RTL8852C, so we refine its RF calibration flow
to fit MCC case.
Signed-off-by: default avatarZong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230908031145.20931-2-pkshih@realtek.com
parent b7bcea9c
...@@ -3220,11 +3220,11 @@ int rtw89_fw_h2c_rf_reg(struct rtw89_dev *rtwdev, ...@@ -3220,11 +3220,11 @@ int rtw89_fw_h2c_rf_reg(struct rtw89_dev *rtwdev,
int rtw89_fw_h2c_rf_ntfy_mcc(struct rtw89_dev *rtwdev) int rtw89_fw_h2c_rf_ntfy_mcc(struct rtw89_dev *rtwdev)
{ {
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
struct rtw89_rfk_mcc_info *rfk_mcc = &rtwdev->rfk_mcc; struct rtw89_rfk_mcc_info *rfk_mcc = &rtwdev->rfk_mcc;
struct rtw89_fw_h2c_rf_get_mccch *mccch; struct rtw89_fw_h2c_rf_get_mccch *mccch;
struct sk_buff *skb; struct sk_buff *skb;
int ret; int ret;
u8 idx;
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, sizeof(*mccch)); skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, sizeof(*mccch));
if (!skb) { if (!skb) {
...@@ -3234,12 +3234,13 @@ int rtw89_fw_h2c_rf_ntfy_mcc(struct rtw89_dev *rtwdev) ...@@ -3234,12 +3234,13 @@ int rtw89_fw_h2c_rf_ntfy_mcc(struct rtw89_dev *rtwdev)
skb_put(skb, sizeof(*mccch)); skb_put(skb, sizeof(*mccch));
mccch = (struct rtw89_fw_h2c_rf_get_mccch *)skb->data; mccch = (struct rtw89_fw_h2c_rf_get_mccch *)skb->data;
idx = rfk_mcc->table_idx;
mccch->ch_0 = cpu_to_le32(rfk_mcc->ch[0]); mccch->ch_0 = cpu_to_le32(rfk_mcc->ch[0]);
mccch->ch_1 = cpu_to_le32(rfk_mcc->ch[1]); mccch->ch_1 = cpu_to_le32(rfk_mcc->ch[1]);
mccch->band_0 = cpu_to_le32(rfk_mcc->band[0]); mccch->band_0 = cpu_to_le32(rfk_mcc->band[0]);
mccch->band_1 = cpu_to_le32(rfk_mcc->band[1]); mccch->band_1 = cpu_to_le32(rfk_mcc->band[1]);
mccch->current_channel = cpu_to_le32(chan->channel); mccch->current_channel = cpu_to_le32(rfk_mcc->ch[idx]);
mccch->current_band_type = cpu_to_le32(chan->band_type); mccch->current_band_type = cpu_to_le32(rfk_mcc->band[idx]);
rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C, rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
H2C_CAT_OUTSRC, H2C_CL_OUTSRC_RF_FW_NOTIFY, H2C_CAT_OUTSRC, H2C_CL_OUTSRC_RF_FW_NOTIFY,
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Copyright(c) 2019-2022 Realtek Corporation /* Copyright(c) 2019-2022 Realtek Corporation
*/ */
#include "chan.h"
#include "coex.h" #include "coex.h"
#include "debug.h" #include "debug.h"
#include "phy.h" #include "phy.h"
...@@ -4068,21 +4069,53 @@ void rtw8852c_set_channel_rf(struct rtw89_dev *rtwdev, ...@@ -4068,21 +4069,53 @@ void rtw8852c_set_channel_rf(struct rtw89_dev *rtwdev,
void rtw8852c_mcc_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx) void rtw8852c_mcc_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
{ {
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
struct rtw89_rfk_mcc_info *rfk_mcc = &rtwdev->rfk_mcc; struct rtw89_rfk_mcc_info *rfk_mcc = &rtwdev->rfk_mcc;
u8 idx = rfk_mcc->table_idx; DECLARE_BITMAP(map, RTW89_IQK_CHS_NR) = {};
int i; const struct rtw89_chan *chan;
enum rtw89_entity_mode mode;
u8 chan_idx;
u8 idx;
u8 i;
for (i = 0; i < RTW89_IQK_CHS_NR; i++) { mode = rtw89_get_entity_mode(rtwdev);
if (rfk_mcc->ch[idx] == 0) switch (mode) {
break; case RTW89_ENTITY_MODE_MCC_PREPARE:
if (++idx >= RTW89_IQK_CHS_NR) chan_idx = RTW89_SUB_ENTITY_1;
idx = 0; break;
default:
chan_idx = RTW89_SUB_ENTITY_0;
break;
}
for (i = 0; i <= chan_idx; i++) {
chan = rtw89_chan_get(rtwdev, i);
for (idx = 0; idx < RTW89_IQK_CHS_NR; idx++) {
if (rfk_mcc->ch[idx] == chan->channel &&
rfk_mcc->band[idx] == chan->band_type) {
if (i != chan_idx) {
set_bit(idx, map);
break;
}
goto bottom;
}
}
}
idx = find_first_zero_bit(map, RTW89_IQK_CHS_NR);
if (idx == RTW89_IQK_CHS_NR) {
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"%s: no empty rfk table; force replace the first\n",
__func__);
idx = 0;
} }
rfk_mcc->table_idx = idx;
rfk_mcc->ch[idx] = chan->channel; rfk_mcc->ch[idx] = chan->channel;
rfk_mcc->band[idx] = chan->band_type; rfk_mcc->band[idx] = chan->band_type;
bottom:
rfk_mcc->table_idx = idx;
} }
void rtw8852c_rck(struct rtw89_dev *rtwdev) void rtw8852c_rck(struct rtw89_dev *rtwdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment