Skip to content

Commit 172591b

Browse files
saschahauerKalle Valo
authored andcommitted
wifi: rtw88: call rtw8821c_switch_rf_set() according to chip variant
We have to call rtw8821c_switch_rf_set() with SWITCH_TO_WLG or SWITCH_TO_BTG according to the chip variant as denoted in rfe_option. The information which argument to use for which variant has been taken from the vendor driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230417140358.2240429-5-s.hauer@pengutronix.de
1 parent 97c75e1 commit 172591b

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

drivers/net/wireless/realtek/rtw88/main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,6 +1902,7 @@ struct rtw_hal {
19021902
u8 oem_id;
19031903
u8 pkg_type;
19041904
struct rtw_phy_cond phy_cond;
1905+
bool rfe_btg;
19051906

19061907
u8 ps_mode;
19071908
u8 current_channel;

drivers/net/wireless/realtek/rtw88/rtw8821c.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ static int rtw8821c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
7373

7474
hal->pkg_type = map->rfe_option & BIT(5) ? 1 : 0;
7575

76+
switch (efuse->rfe_option) {
77+
case 0x2:
78+
case 0x4:
79+
case 0x7:
80+
case 0xa:
81+
case 0xc:
82+
case 0xf:
83+
hal->rfe_btg = true;
84+
break;
85+
}
86+
7687
for (i = 0; i < 4; i++)
7788
efuse->txpwr_idx_table[i] = map->txpwr_idx_table[i];
7889

@@ -298,6 +309,7 @@ static void rtw8821c_switch_rf_set(struct rtw_dev *rtwdev, u8 rf_set)
298309

299310
static void rtw8821c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)
300311
{
312+
struct rtw_hal *hal = &rtwdev->hal;
301313
u32 rf_reg18;
302314

303315
rf_reg18 = rtw_read_rf(rtwdev, RF_PATH_A, 0x18, RFREG_MASK);
@@ -329,11 +341,10 @@ static void rtw8821c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)
329341
}
330342

331343
if (channel <= 14) {
332-
if (rtwdev->efuse.rfe_option == 0)
333-
rtw8821c_switch_rf_set(rtwdev, SWITCH_TO_WLG);
334-
else if (rtwdev->efuse.rfe_option == 2 ||
335-
rtwdev->efuse.rfe_option == 4)
344+
if (hal->rfe_btg)
336345
rtw8821c_switch_rf_set(rtwdev, SWITCH_TO_BTG);
346+
else
347+
rtw8821c_switch_rf_set(rtwdev, SWITCH_TO_WLG);
337348
rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTDBG, BIT(6), 0x1);
338349
rtw_write_rf(rtwdev, RF_PATH_A, 0x64, 0xf, 0xf);
339350
} else {

0 commit comments

Comments
 (0)