wifi: rtw89: 8852b: update hardware parameters for RFE type 5
authorPing-Ke Shih <pkshih@realtek.com>
Tue, 23 Apr 2024 12:12:47 +0000 (20:12 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Mon, 29 Apr 2024 00:40:39 +0000 (08:40 +0800)
RFE type 5 of 8852B is a type of hardware module, which can use different
external components, so update register settings accordingly.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240423121247.24714-2-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/reg.h
drivers/net/wireless/realtek/rtw89/rtw8852b.c

index 0c0d3c84b17878ce683e76ec8c7cd9d9eb40f74e..01cbd0312102e71b1b43f3e410ee0ae702899d7a 100644 (file)
 
 #define R_AX_SPSANA_ON_CTRL1 0x0224
 
+#define R_AX_SPS_ANA_ON_CTRL2 0x0228
+#define RTL8852B_RFE_05_SPS_ANA 0x4A82
+
 #define R_AX_WLAN_XTAL_SI_CTRL 0x0270
 #define B_AX_WL_XTAL_SI_CMD_POLL BIT(31)
 #define B_AX_BT_XTAL_SI_ERR_FLAG BIT(30)
index 85908c55baa9f69ae1f148cb3727ca3e587ce52d..9b8f1d06512e82d82d86b15cf5f2e1ec7a0d0996 100644 (file)
@@ -390,6 +390,14 @@ static const struct rtw89_btc_fbtc_mreg rtw89_btc_8852b_mon_reg[] = {
 static const u8 rtw89_btc_8852b_wl_rssi_thres[BTC_WL_RSSI_THMAX] = {70, 60, 50, 40};
 static const u8 rtw89_btc_8852b_bt_rssi_thres[BTC_BT_RSSI_THMAX] = {50, 40, 30, 20};
 
+static void rtw8852b_pwr_sps_ana(struct rtw89_dev *rtwdev)
+{
+       struct rtw89_efuse *efuse = &rtwdev->efuse;
+
+       if (efuse->rfe_type == 0x5)
+               rtw89_write16(rtwdev, R_AX_SPS_ANA_ON_CTRL2, RTL8852B_RFE_05_SPS_ANA);
+}
+
 static int rtw8852b_pwr_on_func(struct rtw89_dev *rtwdev)
 {
        u32 val32;
@@ -522,6 +530,10 @@ static int rtw8852b_pwr_off_func(struct rtw89_dev *rtwdev)
        u32 val32;
        u32 ret;
 
+       /* Only do once during probe stage after reading efuse */
+       if (!test_bit(RTW89_FLAG_PROBE_DONE, rtwdev->flags))
+               rtw8852b_pwr_sps_ana(rtwdev);
+
        ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_RFC2RF,
                                      XTAL_SI_RFC2RF);
        if (ret)