From: Sujith Manoharan <c_man...@qca.qualcomm.com>

Incorrect values are programmed in the registers
containing the IQ correction coefficients by the IQ-CAL
post-processing code. Fix this.

Signed-off-by: Sujith Manoharan <c_man...@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/ar9003_calib.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c 
b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 9210beb..6d4cb00 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -891,6 +891,7 @@ static void ar9003_hw_tx_iq_cal_outlier_detection(struct 
ath_hw *ah,
                                                  bool is_reusable)
 {
        int i, im, nmeasurement;
+       int magnitude, phase;
        u32 tx_corr_coeff[MAX_MEASUREMENT][AR9300_MAX_CHAINS];
        struct ath9k_hw_cal_data *caldata = ah->caldata;
 
@@ -932,9 +933,11 @@ static void ar9003_hw_tx_iq_cal_outlier_detection(struct 
ath_hw *ah,
                }
 
                for (im = 0; im < nmeasurement; im++) {
+                       magnitude = coeff->mag_coeff[i][im];
+                       phase = coeff->phs_coeff[i][im];
 
-                       coeff->iqc_coeff[0] = (coeff->mag_coeff[i][im] & 0x7f) |
-                               ((coeff->phs_coeff[i][im] & 0x7f) << 7);
+                       coeff->iqc_coeff[0] =
+                               (phase & 0x7f) | ((magnitude & 0x7f) << 7);
 
                        if ((im % 2) == 0)
                                REG_RMW_FIELD(ah, tx_corr_coeff[im][i],
@@ -1065,8 +1068,9 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw 
*ah, bool is_reusable)
                                goto tx_iqcal_fail;
                        }
 
-                       coeff.mag_coeff[i][im] = coeff.iqc_coeff[0] & 0x7f;
                        coeff.phs_coeff[i][im] =
+                               coeff.iqc_coeff[0] & 0x7f;
+                       coeff.mag_coeff[i][im] =
                                (coeff.iqc_coeff[0] >> 7) & 0x7f;
 
                        if (coeff.mag_coeff[i][im] > 63)
-- 
1.8.5.3

_______________________________________________
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel

Reply via email to