Skip to contentSkip to conversation

ath9k: Fix IQ calibration

PATCH New Sujith Manoharan 2 participants 3 messages Jan 14, 2014 – Jan 20, 2014 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath9k: Fix IQ calibration

From: Sujith Manoharan <[email protected]>

This patch fixes a bug in the TX IQ calibration post processing routine because of which the driver disables TX IQ correction even though the calibration results are valid. This fix is applicable for all chips in the AR9003 family.

---
 drivers/net/wireless/ath/ath9k/ar9003_calib.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_calib.c +15 -2
index 8c145cd..4eb35aa 100644
@@ -655,8 +655,8 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah,
 	if (i2_m_q2_a0_d1 > 0x800)
 		i2_m_q2_a0_d1 = -((0xfff - i2_m_q2_a0_d1) + 1);
 
-	if (i2_p_q2_a0_d1 > 0x800)
-		i2_p_q2_a0_d1 = -((0xfff - i2_p_q2_a0_d1) + 1);
+	if (i2_p_q2_a0_d1 > 0x1000)
+		i2_p_q2_a0_d1 = -((0x1fff - i2_p_q2_a0_d1) + 1);
 
 	if (iq_corr_a0_d1 > 0x800)
 		iq_corr_a0_d1 = -((0xfff - iq_corr_a0_d1) + 1);
@@ -700,6 +700,19 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah,
 		return false;
 	}
 
+	if ((i2_p_q2_a0_d0 < 1024) || (i2_p_q2_a0_d0 > 2047) ||
+            (i2_p_q2_a1_d0 < 0) || (i2_p_q2_a1_d1 < 0) ||
+            (i2_p_q2_a0_d0 <= i2_m_q2_a0_d0) ||
+            (i2_p_q2_a0_d0 <= iq_corr_a0_d0) ||
+            (i2_p_q2_a0_d1 <= i2_m_q2_a0_d1) ||
+            (i2_p_q2_a0_d1 <= iq_corr_a0_d1) ||
+            (i2_p_q2_a1_d0 <= i2_m_q2_a1_d0) ||
+            (i2_p_q2_a1_d0 <= iq_corr_a1_d0) ||
+            (i2_p_q2_a1_d1 <= i2_m_q2_a1_d1) ||
+            (i2_p_q2_a1_d1 <= iq_corr_a1_d1)) {
+		return false;
+	}
+
 	mag_a0_d0 = (i2_m_q2_a0_d0 * res_scale) / i2_p_q2_a0_d0;
 	phs_a0_d0 = (iq_corr_a0_d0 * res_scale) / i2_p_q2_a0_d0;
 
Signature · 1 line
1.8.5.2
#1 lore raw

PATCH 1/1 ath9k: Fix IQ calibration

Hello,

drivers/net/wireless/ath/ath9k/ar9003_calib.c static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah, · line 659

Quoted 2 lines · Sujith Manoharan
drivers/net/wireless/ath/ath9k/ar9003_calib.c +2 -0
+	if (i2_p_q2_a0_d1 > 0x1000)
+		i2_p_q2_a0_d1 = -((0x1fff - i2_p_q2_a0_d1) + 1);

While the 'i2_p_q2_a0_d1 = (iq_res[2] & 0xfff)' the condition 'i2_p_q2_a0_d1 > 0x1000' is always false.

Regards,
Alex.

#2 lore raw

PATCH 1/1 ath9k: Fix IQ calibration

Quoted 2 lines · Alex Hacker

While the 'i2_p_q2_a0_d1 = (iq_res[2] & 0xfff)' the condition 'i2_p_q2_a0_d1 > 0x1000' is always false.

You are correct. I'll check with the systems engineers if something else is missing. Thanks !

Sujith