diff mbox series

[2/6] rtw89: 8852c: set TX antenna path

Message ID 20220513054224.16902-3-pkshih@realtek.com
State Superseded
Headers show
Series rtw89: add missing functions and fix misbehavior found by verification | expand

Commit Message

Ping-Ke Shih May 13, 2022, 5:42 a.m. UTC
To make user space can set TX antenna via iw command. Then, we can diagnose
antenna is connected properly or not, and measure TX power in single path.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/rtw8852c.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
index 77dcdbd86c63a..64840c8d9efe8 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
@@ -2360,19 +2360,19 @@  static void rtw8852c_ctrl_tx_path_tmac(struct rtw89_dev *rtwdev, u8 tx_path,
 		rtw89_write32(rtwdev, reg, 0);
 	}
 
-	if (tx_path == RF_PATH_A) {
+	if (tx_path == RF_A) {
 		path_com[0].data = AX_PATH_COM0_PATHA;
 		path_com[1].data = AX_PATH_COM1_PATHA;
 		path_com[2].data = AX_PATH_COM2_PATHA;
 		path_com[7].data = AX_PATH_COM7_PATHA;
 		path_com[8].data = AX_PATH_COM8_PATHA;
-	} else if (tx_path == RF_PATH_B) {
+	} else if (tx_path == RF_B) {
 		path_com[0].data = AX_PATH_COM0_PATHB;
 		path_com[1].data = AX_PATH_COM1_PATHB;
 		path_com[2].data = AX_PATH_COM2_PATHB;
 		path_com[7].data = AX_PATH_COM7_PATHB;
 		path_com[8].data = AX_PATH_COM8_PATHB;
-	} else if (tx_path == RF_PATH_AB) {
+	} else if (tx_path == RF_AB) {
 		path_com[0].data = AX_PATH_COM0_PATHAB;
 		path_com[1].data = AX_PATH_COM1_PATHAB;
 		path_com[2].data = AX_PATH_COM2_PATHAB;
@@ -2457,6 +2457,7 @@  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);
 
@@ -2472,7 +2473,7 @@  static void rtw8852c_bb_cfg_txrx_path(struct rtw89_dev *rtwdev)
 		rtw89_phy_write32_mask(rtwdev, R_RXHE, B_RXHETB_MAX_NSS, 1);
 	}
 
-	rtw8852c_ctrl_tx_path_tmac(rtwdev, RF_PATH_AB, RTW89_MAC_0);
+	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)