wifi: rtw89: 8852c: set TX to single path TX on path B in 6GHz band
authorYi-Tang Chiu <chiuyitang@realtek.com>
Thu, 8 Sep 2022 05:12:52 +0000 (13:12 +0800)
committerKalle Valo <kvalo@kernel.org>
Mon, 12 Sep 2022 11:52:32 +0000 (14:52 +0300)
With one path TX for 1SS rate, it can transmit higher power in 6GHz band
to yield better performance in high attenuation circumstance.

Signed-off-by: Yi-Tang Chiu <chiuyitang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220908051257.25353-5-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/reg.h
drivers/net/wireless/realtek/rtw89/rtw8852c.c

index 893c172..7c46c30 100644 (file)
 
 #define R_AX_PATH_COM0 0xD800
 #define AX_PATH_COM0_DFVAL 0x00000000
-#define AX_PATH_COM0_PATHA 0x08888880
-#define AX_PATH_COM0_PATHB 0x11111100
+#define AX_PATH_COM0_PATHA 0x08889880
+#define AX_PATH_COM0_PATHB 0x11111900
 #define AX_PATH_COM0_PATHAB 0x19999980
 #define R_AX_PATH_COM1 0xD804
 #define AX_PATH_COM1_DFVAL 0x00000000
-#define AX_PATH_COM1_PATHA 0x11111111
-#define AX_PATH_COM1_PATHB 0x22222222
+#define AX_PATH_COM1_PATHA 0x13111111
+#define AX_PATH_COM1_PATHB 0x23222222
 #define AX_PATH_COM1_PATHAB 0x33333333
 #define R_AX_PATH_COM2 0xD808
 #define AX_PATH_COM2_DFVAL 0x00000000
-#define AX_PATH_COM2_PATHA 0x01209111
-#define AX_PATH_COM2_PATHB 0x01209222
+#define AX_PATH_COM2_PATHA 0x01209313
+#define AX_PATH_COM2_PATHB 0x01209323
 #define AX_PATH_COM2_PATHAB 0x01209333
 #define R_AX_PATH_COM3 0xD80C
 #define AX_PATH_COM3_DFVAL 0x49249249
index 75ba404..2d4c497 100644 (file)
@@ -152,6 +152,8 @@ static const struct rtw89_dig_regs rtw8852c_dig_regs = {
 };
 
 static void rtw8852c_ctrl_btg(struct rtw89_dev *rtwdev, bool btg);
+static void rtw8852c_ctrl_tx_path_tmac(struct rtw89_dev *rtwdev, u8 tx_path,
+                                      enum rtw89_mac_idx mac_idx);
 
 static int rtw8852c_pwr_on_func(struct rtw89_dev *rtwdev)
 {
@@ -1714,11 +1716,13 @@ static void rtw8852c_set_channel_bb(struct rtw89_dev *rtwdev,
                                    const struct rtw89_chan *chan,
                                    enum rtw89_phy_idx phy_idx)
 {
+       struct rtw89_hal *hal = &rtwdev->hal;
        bool cck_en = chan->band_type == RTW89_BAND_2G;
        u8 pri_ch_idx = chan->pri_ch_idx;
        u32 mask, reg;
        u32 ru_alloc_msk[2] = {B_P80_AT_HIGH_FREQ_RU_ALLOC_PHY0,
                               B_P80_AT_HIGH_FREQ_RU_ALLOC_PHY1};
+       u8 ntx_path;
 
        if (chan->band_type == RTW89_BAND_2G)
                rtw8852c_ctrl_sco_cck(rtwdev, chan->channel,
@@ -1796,6 +1800,13 @@ static void rtw8852c_set_channel_bb(struct rtw89_dev *rtwdev,
        else
                rtw89_phy_write32_clr(rtwdev, R_MUIC, B_MUIC_EN);
 
+       if (hal->antenna_tx)
+               ntx_path = hal->antenna_tx;
+       else
+               ntx_path = chan->band_type == RTW89_BAND_6G ? RF_B : RF_AB;
+
+       rtw8852c_ctrl_tx_path_tmac(rtwdev, ntx_path, (enum rtw89_mac_idx)phy_idx);
+
        rtw8852c_bb_reset_all(rtwdev, phy_idx);
 }
 
@@ -2505,7 +2516,6 @@ static void rtw8852c_bb_ctrl_btc_preagc(struct rtw89_dev *rtwdev, bool bt_en)
 static void rtw8852c_bb_cfg_txrx_path(struct rtw89_dev *rtwdev)
 {
        struct rtw89_hal *hal = &rtwdev->hal;
-       u8 ntx_path = hal->antenna_tx ? hal->antenna_tx : RF_AB;
 
        rtw8852c_bb_cfg_rx_path(rtwdev, RF_PATH_AB);
 
@@ -2520,8 +2530,6 @@ static void rtw8852c_bb_cfg_txrx_path(struct rtw89_dev *rtwdev)
                rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHE_MAX_NSS, 1);
                rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHETB_MAX_NSS, 1);
        }
-
-       rtw8852c_ctrl_tx_path_tmac(rtwdev, ntx_path, RTW89_MAC_0);
 }
 
 static u8 rtw8852c_get_thermal(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path)