You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
159 lines
5.0 KiB
159 lines
5.0 KiB
From df14c12867748fd17be146dd3d4c8376bbf5812b Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
|
Date: Wed, 24 May 2023 15:00:24 +0200
|
|
Subject: [PATCH 020/142] wifi: rtw89: make generic functions to convert
|
|
subband gain index
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Bugzilla: https://bugzilla.redhat.com/2207499
|
|
|
|
commit 6e5125bcbaf810520969c121c7f12f20b8f3987d
|
|
Author: Ping-Ke Shih <pkshih@realtek.com>
|
|
Date: Wed Oct 5 16:32:11 2022 +0800
|
|
|
|
wifi: rtw89: make generic functions to convert subband gain index
|
|
|
|
The gain tables use different domain index, so we need to convert the index
|
|
from subband of chandef. Since these conversion functions can share with
|
|
8852b, make generic functions for further use.
|
|
|
|
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
|
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
|
Link: https://lore.kernel.org/r/20221005083212.45683-6-pkshih@realtek.com
|
|
|
|
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
|
---
|
|
drivers/net/wireless/realtek/rtw89/phy.h | 44 +++++++++++++++++++++++++
|
|
drivers/net/wireless/realtek/rtw89/rtw8852c.c | 46 ++-------------------------
|
|
2 files changed, 46 insertions(+), 44 deletions(-)
|
|
|
|
diff --git a/drivers/net/wireless/realtek/rtw89/phy.h b/drivers/net/wireless/realtek/rtw89/phy.h
|
|
index 030a7c904a28d..1129d462bfbdb 100644
|
|
--- a/drivers/net/wireless/realtek/rtw89/phy.h
|
|
+++ b/drivers/net/wireless/realtek/rtw89/phy.h
|
|
@@ -374,6 +374,50 @@ static inline u32 rtw89_phy_read32_mask(struct rtw89_dev *rtwdev,
|
|
return rtw89_read32_mask(rtwdev, addr | RTW89_PHY_ADDR_OFFSET, mask);
|
|
}
|
|
|
|
+static inline
|
|
+enum rtw89_gain_offset rtw89_subband_to_gain_offset_band_of_ofdm(enum rtw89_subband subband)
|
|
+{
|
|
+ switch (subband) {
|
|
+ default:
|
|
+ case RTW89_CH_2G:
|
|
+ return RTW89_GAIN_OFFSET_2G_OFDM;
|
|
+ case RTW89_CH_5G_BAND_1:
|
|
+ return RTW89_GAIN_OFFSET_5G_LOW;
|
|
+ case RTW89_CH_5G_BAND_3:
|
|
+ return RTW89_GAIN_OFFSET_5G_MID;
|
|
+ case RTW89_CH_5G_BAND_4:
|
|
+ return RTW89_GAIN_OFFSET_5G_HIGH;
|
|
+ }
|
|
+}
|
|
+
|
|
+static inline
|
|
+enum rtw89_phy_bb_gain_band rtw89_subband_to_bb_gain_band(enum rtw89_subband subband)
|
|
+{
|
|
+ switch (subband) {
|
|
+ default:
|
|
+ case RTW89_CH_2G:
|
|
+ return RTW89_BB_GAIN_BAND_2G;
|
|
+ case RTW89_CH_5G_BAND_1:
|
|
+ return RTW89_BB_GAIN_BAND_5G_L;
|
|
+ case RTW89_CH_5G_BAND_3:
|
|
+ return RTW89_BB_GAIN_BAND_5G_M;
|
|
+ case RTW89_CH_5G_BAND_4:
|
|
+ return RTW89_BB_GAIN_BAND_5G_H;
|
|
+ case RTW89_CH_6G_BAND_IDX0:
|
|
+ case RTW89_CH_6G_BAND_IDX1:
|
|
+ return RTW89_BB_GAIN_BAND_6G_L;
|
|
+ case RTW89_CH_6G_BAND_IDX2:
|
|
+ case RTW89_CH_6G_BAND_IDX3:
|
|
+ return RTW89_BB_GAIN_BAND_6G_M;
|
|
+ case RTW89_CH_6G_BAND_IDX4:
|
|
+ case RTW89_CH_6G_BAND_IDX5:
|
|
+ return RTW89_BB_GAIN_BAND_6G_H;
|
|
+ case RTW89_CH_6G_BAND_IDX6:
|
|
+ case RTW89_CH_6G_BAND_IDX7:
|
|
+ return RTW89_BB_GAIN_BAND_6G_UH;
|
|
+ }
|
|
+}
|
|
+
|
|
enum rtw89_rfk_flag {
|
|
RTW89_RFK_F_WRF = 0,
|
|
RTW89_RFK_F_WM = 1,
|
|
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
|
index 00f564be29e8d..f6bcac8268166 100644
|
|
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
|
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
|
|
@@ -788,40 +788,12 @@ static const struct rtw8852c_bb_gain_op1db bb_gain_op1db_a = {
|
|
.mask_tia0_lna6 = 0xff000000,
|
|
};
|
|
|
|
-static enum rtw89_phy_bb_gain_band
|
|
-rtw8852c_mapping_gain_band(enum rtw89_subband subband)
|
|
-{
|
|
- switch (subband) {
|
|
- default:
|
|
- case RTW89_CH_2G:
|
|
- return RTW89_BB_GAIN_BAND_2G;
|
|
- case RTW89_CH_5G_BAND_1:
|
|
- return RTW89_BB_GAIN_BAND_5G_L;
|
|
- case RTW89_CH_5G_BAND_3:
|
|
- return RTW89_BB_GAIN_BAND_5G_M;
|
|
- case RTW89_CH_5G_BAND_4:
|
|
- return RTW89_BB_GAIN_BAND_5G_H;
|
|
- case RTW89_CH_6G_BAND_IDX0:
|
|
- case RTW89_CH_6G_BAND_IDX1:
|
|
- return RTW89_BB_GAIN_BAND_6G_L;
|
|
- case RTW89_CH_6G_BAND_IDX2:
|
|
- case RTW89_CH_6G_BAND_IDX3:
|
|
- return RTW89_BB_GAIN_BAND_6G_M;
|
|
- case RTW89_CH_6G_BAND_IDX4:
|
|
- case RTW89_CH_6G_BAND_IDX5:
|
|
- return RTW89_BB_GAIN_BAND_6G_H;
|
|
- case RTW89_CH_6G_BAND_IDX6:
|
|
- case RTW89_CH_6G_BAND_IDX7:
|
|
- return RTW89_BB_GAIN_BAND_6G_UH;
|
|
- }
|
|
-}
|
|
-
|
|
static void rtw8852c_set_gain_error(struct rtw89_dev *rtwdev,
|
|
enum rtw89_subband subband,
|
|
enum rtw89_rf_path path)
|
|
{
|
|
const struct rtw89_phy_bb_gain_info *gain = &rtwdev->bb_gain;
|
|
- u8 gain_band = rtw8852c_mapping_gain_band(subband);
|
|
+ u8 gain_band = rtw89_subband_to_bb_gain_band(subband);
|
|
s32 val;
|
|
u32 reg;
|
|
u32 mask;
|
|
@@ -979,21 +951,7 @@ static void rtw8852c_set_gain_offset(struct rtw89_dev *rtwdev,
|
|
rtw89_phy_write32_mask(rtwdev, R_RPL_OFST, B_RPL_OFST_MASK, tmp & 0x7f);
|
|
}
|
|
|
|
- switch (chan->subband_type) {
|
|
- default:
|
|
- case RTW89_CH_2G:
|
|
- gain_band = RTW89_GAIN_OFFSET_2G_OFDM;
|
|
- break;
|
|
- case RTW89_CH_5G_BAND_1:
|
|
- gain_band = RTW89_GAIN_OFFSET_5G_LOW;
|
|
- break;
|
|
- case RTW89_CH_5G_BAND_3:
|
|
- gain_band = RTW89_GAIN_OFFSET_5G_MID;
|
|
- break;
|
|
- case RTW89_CH_5G_BAND_4:
|
|
- gain_band = RTW89_GAIN_OFFSET_5G_HIGH;
|
|
- break;
|
|
- }
|
|
+ gain_band = rtw89_subband_to_gain_offset_band_of_ofdm(chan->subband_type);
|
|
|
|
offset_q0 = -efuse_gain->offset[path][gain_band];
|
|
offset_base_q4 = efuse_gain->offset_base[phy_idx];
|
|
--
|
|
2.13.6
|
|
|