소스 검색

ath9k: Expand the IQ coefficient array

This will be used for storing data for mutiple
IQ calibration runs, for AR955x.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Sujith Manoharan 11 년 전
부모
커밋
4357a81d8a
1개의 변경된 파일21개의 추가작업 그리고 20개의 파일을 삭제
  1. 21 20
      drivers/net/wireless/ath/ath9k/ar9003_calib.c

+ 21 - 20
drivers/net/wireless/ath/ath9k/ar9003_calib.c

@@ -26,8 +26,8 @@
 #define MAXIQCAL        3
 #define MAXIQCAL        3
 
 
 struct coeff {
 struct coeff {
-	int mag_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT];
-	int phs_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT];
+	int mag_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT][MAXIQCAL];
+	int phs_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT][MAXIQCAL];
 	int iqc_coeff[2];
 	int iqc_coeff[2];
 };
 };
 
 
@@ -837,7 +837,8 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah,
 	return true;
 	return true;
 }
 }
 
 
-static void ar9003_hw_detect_outlier(int *mp_coeff, int nmeasurement,
+static void ar9003_hw_detect_outlier(int mp_coeff[][MAXIQCAL],
+				     int nmeasurement,
 				     int max_delta)
 				     int max_delta)
 {
 {
 	int mp_max = -64, max_idx = 0;
 	int mp_max = -64, max_idx = 0;
@@ -846,20 +847,20 @@ static void ar9003_hw_detect_outlier(int *mp_coeff, int nmeasurement,
 
 
 	/* find min/max mismatch across all calibrated gains */
 	/* find min/max mismatch across all calibrated gains */
 	for (i = 0; i < nmeasurement; i++) {
 	for (i = 0; i < nmeasurement; i++) {
-		if (mp_coeff[i] > mp_max) {
-			mp_max = mp_coeff[i];
+		if (mp_coeff[i][0] > mp_max) {
+			mp_max = mp_coeff[i][0];
 			max_idx = i;
 			max_idx = i;
-		} else if (mp_coeff[i] < mp_min) {
-			mp_min = mp_coeff[i];
+		} else if (mp_coeff[i][0] < mp_min) {
+			mp_min = mp_coeff[i][0];
 			min_idx = i;
 			min_idx = i;
 		}
 		}
 	}
 	}
 
 
 	/* find average (exclude max abs value) */
 	/* find average (exclude max abs value) */
 	for (i = 0; i < nmeasurement; i++) {
 	for (i = 0; i < nmeasurement; i++) {
-		if ((abs(mp_coeff[i]) < abs(mp_max)) ||
-		    (abs(mp_coeff[i]) < abs(mp_min))) {
-			mp_avg += mp_coeff[i];
+		if ((abs(mp_coeff[i][0]) < abs(mp_max)) ||
+		    (abs(mp_coeff[i][0]) < abs(mp_min))) {
+			mp_avg += mp_coeff[i][0];
 			mp_count++;
 			mp_count++;
 		}
 		}
 	}
 	}
@@ -871,7 +872,7 @@ static void ar9003_hw_detect_outlier(int *mp_coeff, int nmeasurement,
 	if (mp_count)
 	if (mp_count)
 		mp_avg /= mp_count;
 		mp_avg /= mp_count;
 	else
 	else
-		mp_avg = mp_coeff[nmeasurement - 1];
+		mp_avg = mp_coeff[nmeasurement - 1][0];
 
 
 	/* detect outlier */
 	/* detect outlier */
 	if (abs(mp_max - mp_min) > max_delta) {
 	if (abs(mp_max - mp_min) > max_delta) {
@@ -880,7 +881,7 @@ static void ar9003_hw_detect_outlier(int *mp_coeff, int nmeasurement,
 		else
 		else
 			outlier_idx = min_idx;
 			outlier_idx = min_idx;
 
 
-		mp_coeff[outlier_idx] = mp_avg;
+		mp_coeff[outlier_idx][0] = mp_avg;
 	}
 	}
 }
 }
 
 
@@ -931,8 +932,8 @@ static void ar9003_hw_tx_iq_cal_outlier_detection(struct ath_hw *ah,
 		}
 		}
 
 
 		for (im = 0; im < nmeasurement; im++) {
 		for (im = 0; im < nmeasurement; im++) {
-			magnitude = coeff->mag_coeff[i][im];
-			phase = coeff->phs_coeff[i][im];
+			magnitude = coeff->mag_coeff[i][im][0];
+			phase = coeff->phs_coeff[i][im][0];
 
 
 			coeff->iqc_coeff[0] =
 			coeff->iqc_coeff[0] =
 				(phase & 0x7f) | ((magnitude & 0x7f) << 7);
 				(phase & 0x7f) | ((magnitude & 0x7f) << 7);
@@ -1068,15 +1069,15 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah,
 				goto tx_iqcal_fail;
 				goto tx_iqcal_fail;
 			}
 			}
 
 
-			coeff.phs_coeff[i][im] =
+			coeff.phs_coeff[i][im][iqcal_idx] =
 				coeff.iqc_coeff[0] & 0x7f;
 				coeff.iqc_coeff[0] & 0x7f;
-			coeff.mag_coeff[i][im] =
+			coeff.mag_coeff[i][im][iqcal_idx] =
 				(coeff.iqc_coeff[0] >> 7) & 0x7f;
 				(coeff.iqc_coeff[0] >> 7) & 0x7f;
 
 
-			if (coeff.mag_coeff[i][im] > 63)
-				coeff.mag_coeff[i][im] -= 128;
-			if (coeff.phs_coeff[i][im] > 63)
-				coeff.phs_coeff[i][im] -= 128;
+			if (coeff.mag_coeff[i][im][iqcal_idx] > 63)
+				coeff.mag_coeff[i][im][iqcal_idx] -= 128;
+			if (coeff.phs_coeff[i][im][iqcal_idx] > 63)
+				coeff.phs_coeff[i][im][iqcal_idx] -= 128;
 		}
 		}
 	}
 	}
 	ar9003_hw_tx_iq_cal_outlier_detection(ah, &coeff, is_reusable);
 	ar9003_hw_tx_iq_cal_outlier_detection(ah, &coeff, is_reusable);