Skip to contentSkip to conversation

rtw88: reduce polling time of IQ calibration

PATCH In review Ping-Ke Shih 2 participants 2 messages Dec 3, 2020 – Dec 7, 2020 Realtek wireless driver (rtw88)

lore
Share & tools
lore

Ping-Ke Shih

author maintainer
#0 lore raw

PATCH 1/1 rtw88: reduce polling time of IQ calibration

From: Chin-Yen Lee <[email protected]>

When 8822CE is associating with AP, driver will poll status bit of IQ calibration to confirm the IQ calibration is done, and then move on the association process. Current polling time for IQ calibration is 6 seconds.

But occasionally driver fails in polling the status bit because the status bit is not set after IQ calibration is done. When it happends, association process will be serieously delayed up to 6 seconds. To avoid it, we reduce polling time to 300ms, in which the IQ calibration can be done.

---
 drivers/net/wireless/realtek/rtw88/rtw8822c.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/net/wireless/realtek/rtw88/rtw8822c.c +8 -9
index 7dd3ccb73793..7661d8d494c9 100644
@@ -2108,22 +2108,21 @@ static void rtw8822c_false_alarm_statistics(struct rtw_dev *rtwdev)
 
 static void rtw8822c_do_iqk(struct rtw_dev *rtwdev)
 {
+#define IQK_DONE_8822C 0xaa
+
 	struct rtw_iqk_para para = {0};
 	u8 iqk_chk;
-	int counter;
+	int ret;
 
 	para.clear = 1;
 	rtw_fw_do_iqk(rtwdev, &para);
 
-	for (counter = 0; counter < 300; counter++) {
-		iqk_chk = rtw_read8(rtwdev, REG_RPT_CIP);
-		if (iqk_chk == 0xaa)
-			break;
-		msleep(20);
-	}
-	rtw_write8(rtwdev, REG_IQKSTAT, 0x0);
+	ret = read_poll_timeout(rtw_read8, iqk_chk, iqk_chk == IQK_DONE_8822C,
+				20000, 300000, false, rtwdev, REG_RPT_CIP);
+	if (ret)
+		rtw_warn(rtwdev, "failed to poll iqk status bit\n");
 
-	rtw_dbg(rtwdev, RTW_DBG_RFK, "iqk counter=%d\n", counter);
+	rtw_write8(rtwdev, REG_IQKSTAT, 0x0);
 }
 
 /* for coex */
Signature · 1 line
2.21.0
#1 lore raw
Quoted 23 lines · Ping-Ke Shih

From: Chin-Yen Lee <[email protected]>

When 8822CE is associating with AP, driver will poll status bit of IQ calibration to confirm the IQ calibration is done, and then move on the association process. Current polling time for IQ calibration is 6 seconds.

But occasionally driver fails in polling the status bit because the status bit is not set after IQ calibration is done. When it happends, association process will be serieously delayed up to 6 seconds. To avoid it, we reduce polling time to 300ms, in which the IQ calibration can be done.

---
 drivers/net/wireless/realtek/rtw88/rtw8822c.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/net/wireless/realtek/rtw88/rtw8822c.c +0 -0
index 7dd3ccb73793..7661d8d494c9 100644

drivers/net/wireless/realtek/rtw88/rtw8822c.c static void rtw8822c_false_alarm_statistics(struct rtw_dev *rtwdev) · line 2115

Quoted 9 lines
drivers/net/wireless/realtek/rtw88/rtw8822c.c +3 -1
@@ -2108,22 +2108,21 @@ static void rtw8822c_false_alarm_statistics(struct rtw_dev *rtwdev)
 
 static void rtw8822c_do_iqk(struct rtw_dev *rtwdev)
 {
+#define IQK_DONE_8822C 0xaa
+
 	struct rtw_iqk_para para = {0};
 	u8 iqk_chk;
-	int counter;
+	int ret;

That is a bit awkward location for a define. The preferred style is to move the define to a beginning of the file or to a .h file.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches