mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 11:33:28 +02:00
wifi: rtw89: phy: add firmware element of digital TX power compensation
Define and set compensation value to corresponding frequency bands. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20260117044157.2392958-6-pkshih@realtek.com
This commit is contained in:
parent
bcd23ebfef
commit
4809013c08
|
|
@ -60,6 +60,28 @@ static enum rtw89_subband rtw89_get_subband_type(enum rtw89_band band,
|
|||
}
|
||||
}
|
||||
|
||||
static enum rtw89_tx_comp_band rtw89_get_tx_comp_band(enum rtw89_band band,
|
||||
u8 center_chan)
|
||||
{
|
||||
switch (band) {
|
||||
default:
|
||||
case RTW89_BAND_2G:
|
||||
return RTW89_TX_COMP_BAND_2GHZ;
|
||||
case RTW89_BAND_5G:
|
||||
if (center_chan < 149)
|
||||
return RTW89_TX_COMP_BAND_5GHZ_L;
|
||||
else
|
||||
return RTW89_TX_COMP_BAND_5GHZ_H;
|
||||
case RTW89_BAND_6G:
|
||||
if (center_chan < 65)
|
||||
return RTW89_TX_COMP_BAND_5GHZ_H;
|
||||
else if (center_chan < 193)
|
||||
return RTW89_TX_COMP_BAND_6GHZ_M;
|
||||
else
|
||||
return RTW89_TX_COMP_BAND_6GHZ_UH;
|
||||
}
|
||||
}
|
||||
|
||||
static enum rtw89_sc_offset rtw89_get_primary_chan_idx(enum rtw89_bandwidth bw,
|
||||
u32 center_freq,
|
||||
u32 primary_freq)
|
||||
|
|
@ -123,6 +145,7 @@ void rtw89_chan_create(struct rtw89_chan *chan, u8 center_chan, u8 primary_chan,
|
|||
|
||||
chan->freq = center_freq;
|
||||
chan->subband_type = rtw89_get_subband_type(band, center_chan);
|
||||
chan->tx_comp_band = rtw89_get_tx_comp_band(band, center_chan);
|
||||
chan->pri_ch_idx = rtw89_get_primary_chan_idx(bandwidth, center_freq,
|
||||
primary_freq);
|
||||
chan->pri_sb_idx = rtw89_get_primary_sb_idx(center_chan, primary_chan,
|
||||
|
|
|
|||
|
|
@ -115,6 +115,16 @@ enum rtw89_subband {
|
|||
RTW89_SUBBAND_2GHZ_5GHZ_NR = RTW89_CH_5G_BAND_4 + 1,
|
||||
};
|
||||
|
||||
enum rtw89_tx_comp_band {
|
||||
RTW89_TX_COMP_BAND_2GHZ,
|
||||
RTW89_TX_COMP_BAND_5GHZ_L,
|
||||
RTW89_TX_COMP_BAND_5GHZ_H,
|
||||
RTW89_TX_COMP_BAND_6GHZ_M,
|
||||
RTW89_TX_COMP_BAND_6GHZ_UH,
|
||||
|
||||
RTW89_TX_COMP_BAND_NR,
|
||||
};
|
||||
|
||||
enum rtw89_gain_offset {
|
||||
RTW89_GAIN_OFFSET_2G_CCK,
|
||||
RTW89_GAIN_OFFSET_2G_OFDM,
|
||||
|
|
@ -991,6 +1001,7 @@ struct rtw89_chan {
|
|||
*/
|
||||
u32 freq;
|
||||
enum rtw89_subband subband_type;
|
||||
enum rtw89_tx_comp_band tx_comp_band;
|
||||
enum rtw89_sc_offset pri_ch_idx;
|
||||
u8 pri_sb_idx;
|
||||
};
|
||||
|
|
@ -4831,6 +4842,7 @@ struct rtw89_fw_elm_info {
|
|||
const struct rtw89_regd_data *regd;
|
||||
const struct rtw89_fw_element_hdr *afe;
|
||||
const struct rtw89_fw_element_hdr *diag_mac;
|
||||
const struct rtw89_fw_element_hdr *tx_comp;
|
||||
};
|
||||
|
||||
enum rtw89_fw_mss_dev_type {
|
||||
|
|
|
|||
|
|
@ -1382,6 +1382,26 @@ int rtw89_recognize_diag_mac_from_elm(struct rtw89_dev *rtwdev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
int rtw89_build_tx_comp_from_elm(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_fw_element_hdr *elm,
|
||||
const union rtw89_fw_element_arg arg)
|
||||
{
|
||||
struct rtw89_fw_elm_info *elm_info = &rtwdev->fw.elm_info;
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
u16 aid;
|
||||
|
||||
aid = le16_to_cpu(elm->aid);
|
||||
if (aid && aid != hal->aid)
|
||||
return 1; /* ignore if aid not matched */
|
||||
else if (elm_info->tx_comp)
|
||||
return 1; /* ignore if an element is existing */
|
||||
|
||||
elm_info->tx_comp = elm;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct rtw89_fw_element_handler __fw_element_handlers[] = {
|
||||
[RTW89_FW_ELEMENT_ID_BBMCU0] = {__rtw89_fw_recognize_from_elm,
|
||||
{ .fw_type = RTW89_FW_BBMCU0 }, NULL},
|
||||
|
|
@ -1473,6 +1493,9 @@ static const struct rtw89_fw_element_handler __fw_element_handlers[] = {
|
|||
[RTW89_FW_ELEMENT_ID_DIAG_MAC] = {
|
||||
rtw89_recognize_diag_mac_from_elm, {}, NULL,
|
||||
},
|
||||
[RTW89_FW_ELEMENT_ID_TX_COMP] = {
|
||||
rtw89_build_tx_comp_from_elm, {}, NULL,
|
||||
},
|
||||
};
|
||||
|
||||
int rtw89_fw_recognize_elements(struct rtw89_dev *rtwdev)
|
||||
|
|
|
|||
|
|
@ -4262,6 +4262,7 @@ enum rtw89_fw_element_id {
|
|||
RTW89_FW_ELEMENT_ID_TXPWR_DA_LMT_RU_6GHZ = 26,
|
||||
RTW89_FW_ELEMENT_ID_AFE_PWR_SEQ = 27,
|
||||
RTW89_FW_ELEMENT_ID_DIAG_MAC = 28,
|
||||
RTW89_FW_ELEMENT_ID_TX_COMP = 29,
|
||||
|
||||
RTW89_FW_ELEMENT_ID_NUM,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user