mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
wifi: rtw89: configure RX antenna if chips can support
If chip->ops->cfg_txrx_path is implemented, a chip can support to configure RX antenna, so accept setting via iw tool. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20251111022452.28093-9-pkshih@realtek.com
This commit is contained in:
parent
d9204e99b6
commit
7465c0a912
|
|
@ -1147,12 +1147,17 @@ int rtw89_ops_set_antenna(struct ieee80211_hw *hw, int radio_idx, u32 tx_ant, u3
|
|||
{
|
||||
struct rtw89_dev *rtwdev = hw->priv;
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
const struct rtw89_chip_info *chip;
|
||||
|
||||
lockdep_assert_wiphy(hw->wiphy);
|
||||
|
||||
chip = rtwdev->chip;
|
||||
|
||||
if (hal->ant_diversity) {
|
||||
if (tx_ant != rx_ant || hweight32(tx_ant) != 1)
|
||||
return -EINVAL;
|
||||
} else if (chip->ops->cfg_txrx_path) {
|
||||
/* With cfg_txrx_path ops, chips can configure rx_ant */
|
||||
} else if (rx_ant != hw->wiphy->available_antennas_rx && rx_ant != hal->antenna_rx) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1747,11 +1747,15 @@ 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;
|
||||
u8 rx_nss = rtwdev->hal.rx_nss;
|
||||
|
||||
if (rx_path != RF_AB)
|
||||
rx_nss = 1;
|
||||
|
||||
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) {
|
||||
if (rx_nss == 1) {
|
||||
rtw89_phy_write32_mask(rtwdev, R_RXHT_MCS_LIMIT, B_RXHT_MCS_LIMIT, 0);
|
||||
rtw89_phy_write32_mask(rtwdev, R_RXVHT_MCS_LIMIT, B_RXVHT_MCS_LIMIT, 0);
|
||||
rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHE_MAX_NSS, 0);
|
||||
|
|
|
|||
|
|
@ -2502,10 +2502,20 @@ static void rtw8852c_ctrl_nbtg_bt_tx(struct rtw89_dev *rtwdev, bool en,
|
|||
static void rtw8852c_bb_cfg_txrx_path(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
u8 nrx_path = RF_PATH_AB;
|
||||
u8 rx_nss = hal->rx_nss;
|
||||
|
||||
rtw8852c_bb_cfg_rx_path(rtwdev, RF_PATH_AB);
|
||||
if (hal->antenna_rx == RF_A)
|
||||
nrx_path = RF_PATH_A;
|
||||
else if (hal->antenna_rx == RF_B)
|
||||
nrx_path = RF_PATH_B;
|
||||
|
||||
if (hal->rx_nss == 1) {
|
||||
if (nrx_path != RF_PATH_AB)
|
||||
rx_nss = 1;
|
||||
|
||||
rtw8852c_bb_cfg_rx_path(rtwdev, nrx_path);
|
||||
|
||||
if (rx_nss == 1) {
|
||||
rtw89_phy_write32_mask(rtwdev, R_RXHT_MCS_LIMIT, B_RXHT_MCS_LIMIT, 0);
|
||||
rtw89_phy_write32_mask(rtwdev, R_RXVHT_MCS_LIMIT, B_RXVHT_MCS_LIMIT, 0);
|
||||
rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHE_MAX_NSS, 0);
|
||||
|
|
|
|||
|
|
@ -2347,19 +2347,29 @@ static void rtw8922a_bb_cfg_txrx_path(struct rtw89_dev *rtwdev)
|
|||
enum rtw89_band band = chan->band_type;
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
u8 ntx_path = RF_PATH_AB;
|
||||
u8 nrx_path = RF_PATH_AB;
|
||||
u32 tx_en0, tx_en1;
|
||||
u8 rx_nss = 2;
|
||||
|
||||
if (hal->antenna_tx == RF_A)
|
||||
ntx_path = RF_PATH_A;
|
||||
else if (hal->antenna_tx == RF_B)
|
||||
ntx_path = RF_PATH_B;
|
||||
|
||||
if (hal->antenna_rx == RF_A)
|
||||
nrx_path = RF_PATH_A;
|
||||
else if (hal->antenna_rx == RF_B)
|
||||
nrx_path = RF_PATH_B;
|
||||
|
||||
if (nrx_path != RF_PATH_AB)
|
||||
rx_nss = 1;
|
||||
|
||||
rtw8922a_hal_reset(rtwdev, RTW89_PHY_0, RTW89_MAC_0, band, &tx_en0, true);
|
||||
if (rtwdev->dbcc_en)
|
||||
rtw8922a_hal_reset(rtwdev, RTW89_PHY_1, RTW89_MAC_1, band,
|
||||
&tx_en1, true);
|
||||
|
||||
rtw8922a_ctrl_trx_path(rtwdev, ntx_path, 2, RF_PATH_AB, 2);
|
||||
rtw8922a_ctrl_trx_path(rtwdev, ntx_path, 2, nrx_path, rx_nss);
|
||||
|
||||
rtw8922a_hal_reset(rtwdev, RTW89_PHY_0, RTW89_MAC_0, band, &tx_en0, false);
|
||||
if (rtwdev->dbcc_en)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user