diff options
author | Ping-Ke Shih <pkshih@realtek.com> | 2022-04-21 15:09:01 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@kernel.org> | 2022-04-24 14:30:36 +0300 |
commit | 3ecca403d9bf714be570ca2a31569485618c9da0 (patch) | |
tree | a27896b5c70143785d25573e72a2e171ab5d70f9 /drivers/net/wireless/realtek/rtw89/rtw8852c.c | |
parent | af0cac159b1c96633436b71a4a790d77a1d75858 (diff) | |
download | linux-3ecca403d9bf714be570ca2a31569485618c9da0.tar.xz |
rtw89: 8852c: implement chip_ops::get_thermal
Read thermal value, and then we can use EWMA thermal value to do RF
calibrations if the value is changed over a threshold.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220421120903.73715-13-pkshih@realtek.com
Diffstat (limited to 'drivers/net/wireless/realtek/rtw89/rtw8852c.c')
-rw-r--r-- | drivers/net/wireless/realtek/rtw89/rtw8852c.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c index adcc2b597419..daf467eaef66 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c @@ -2327,6 +2327,17 @@ static void rtw8852c_bb_cfg_txrx_path(struct rtw89_dev *rtwdev) rtw8852c_ctrl_tx_path_tmac(rtwdev, RF_PATH_AB, RTW89_MAC_0); } +static u8 rtw8852c_get_thermal(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path) +{ + rtw89_write_rf(rtwdev, rf_path, RR_TM, RR_TM_TRI, 0x1); + rtw89_write_rf(rtwdev, rf_path, RR_TM, RR_TM_TRI, 0x0); + rtw89_write_rf(rtwdev, rf_path, RR_TM, RR_TM_TRI, 0x1); + + fsleep(200); + + return rtw89_read_rf(rtwdev, rf_path, RR_TM, RR_TM_VAL); +} + static void rtw8852c_ctrl_btg(struct rtw89_dev *rtwdev, bool btg) { if (btg) { @@ -2487,6 +2498,7 @@ static const struct rtw89_chip_ops rtw8852c_chip_ops = { .set_txpwr = rtw8852c_set_txpwr, .set_txpwr_ctrl = rtw8852c_set_txpwr_ctrl, .init_txpwr_unit = rtw8852c_init_txpwr_unit, + .get_thermal = rtw8852c_get_thermal, .read_rf = rtw89_phy_read_rf_v1, .write_rf = rtw89_phy_write_rf_v1, .set_txpwr_ul_tb_offset = rtw8852c_set_txpwr_ul_tb_offset, |