summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng-Chieh Hsieh <cj.hsieh@realtek.com>2023-10-16 14:51:14 +0800
committerKalle Valo <kvalo@kernel.org>2023-10-19 10:28:49 +0300
commitaecc60e7d3ab3f5cf6189c204efb205b1d541b38 (patch)
tree6f8bd2f2619a4b3d5ed068a6406ef690d318a965
parent5d2f3c3aaaa680e893b22584a75d9ab27b67e2cd (diff)
downloadlwn-aecc60e7d3ab3f5cf6189c204efb205b1d541b38.tar.gz
lwn-aecc60e7d3ab3f5cf6189c204efb205b1d541b38.zip
wifi: rtw89: correct the DCFO tracking flow to improve CFO compensation
DCFO tracking compensate the CFO (carrier frequency offset) by digital hardware that provides fine CFO estimation. Although the avg_cfo which is a coarse information becomes zero, still we need DCFO tracking to compensate the residual CFO. However, the original flow skips the case when avg_cfo is zero, so we fix it to have expected performance. Signed-off-by: Cheng-Chieh Hsieh <cj.hsieh@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20231016065115.751662-5-pkshih@realtek.com
-rw-r--r--drivers/net/wireless/realtek/rtw89/phy.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
index c7d8faa6265c..3b671a314e60 100644
--- a/drivers/net/wireless/realtek/rtw89/phy.c
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
@@ -2634,6 +2634,10 @@ static void rtw89_phy_cfo_crystal_cap_adjust(struct rtw89_dev *rtwdev,
s32 cfo_abs = abs(curr_cfo);
int sign;
+ if (curr_cfo == 0) {
+ rtw89_debug(rtwdev, RTW89_DBG_CFO, "curr_cfo=0\n");
+ return;
+ }
if (!cfo->is_adjust) {
if (cfo_abs > CFO_TRK_ENABLE_TH)
cfo->is_adjust = true;
@@ -2830,10 +2834,6 @@ static void rtw89_phy_cfo_dm(struct rtw89_dev *rtwdev)
new_cfo = rtw89_phy_average_cfo_calc(rtwdev);
else
new_cfo = rtw89_phy_multi_sta_cfo_calc(rtwdev);
- if (new_cfo == 0) {
- rtw89_debug(rtwdev, RTW89_DBG_CFO, "curr_cfo=0\n");
- return;
- }
if (cfo->divergence_lock_en) {
cfo->lock_cnt++;
if (cfo->lock_cnt > CFO_PERIOD_CNT) {