From: Sujith Manoharan <sujith@msujith.org>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH 6/7] ath9k: Expand the IQ coefficient array
Date: Fri, 7 Feb 2014 10:29:54 +0530 [thread overview]
Message-ID: <1391749195-24381-7-git-send-email-sujith@msujith.org> (raw)
In-Reply-To: <1391749195-24381-1-git-send-email-sujith@msujith.org>
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
This will be used for storing data for mutiple
IQ calibration runs, for AR955x.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath9k/ar9003_calib.c | 41 ++++++++++++++-------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 4a02ceb..6f2a994 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -26,8 +26,8 @@
#define MAXIQCAL 3
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];
};
@@ -840,7 +840,8 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah,
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 mp_max = -64, max_idx = 0;
@@ -849,20 +850,20 @@ static void ar9003_hw_detect_outlier(int *mp_coeff, int nmeasurement,
/* find min/max mismatch across all calibrated gains */
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;
- } 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;
}
}
/* find average (exclude max abs value) */
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++;
}
}
@@ -874,7 +875,7 @@ static void ar9003_hw_detect_outlier(int *mp_coeff, int nmeasurement,
if (mp_count)
mp_avg /= mp_count;
else
- mp_avg = mp_coeff[nmeasurement - 1];
+ mp_avg = mp_coeff[nmeasurement - 1][0];
/* detect outlier */
if (abs(mp_max - mp_min) > max_delta) {
@@ -883,7 +884,7 @@ static void ar9003_hw_detect_outlier(int *mp_coeff, int nmeasurement,
else
outlier_idx = min_idx;
- mp_coeff[outlier_idx] = mp_avg;
+ mp_coeff[outlier_idx][0] = mp_avg;
}
}
@@ -934,8 +935,8 @@ 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];
+ magnitude = coeff->mag_coeff[i][im][0];
+ phase = coeff->phs_coeff[i][im][0];
coeff->iqc_coeff[0] =
(phase & 0x7f) | ((magnitude & 0x7f) << 7);
@@ -1071,15 +1072,15 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah,
goto tx_iqcal_fail;
}
- coeff.phs_coeff[i][im] =
+ coeff.phs_coeff[i][im][iqcal_idx] =
coeff.iqc_coeff[0] & 0x7f;
- coeff.mag_coeff[i][im] =
+ coeff.mag_coeff[i][im][iqcal_idx] =
(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);
--
1.8.5.3
next prev parent reply other threads:[~2014-02-07 4:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-07 4:59 [ath9k-devel] [PATCH 0/7] ath9k patches Sujith Manoharan
2014-02-07 4:59 ` [ath9k-devel] [PATCH 1/7] ath9k: Fix IQ cal post processing for SoC Sujith Manoharan
2014-02-07 4:59 ` [ath9k-devel] [PATCH 2/7] ath9k: Check explicitly for IQ calibration Sujith Manoharan
2014-02-07 4:59 ` [ath9k-devel] [PATCH 3/7] ath9k: Rename ar9003_hw_tx_iqcal_load_avg_2_passes Sujith Manoharan
2014-02-07 4:59 ` [ath9k-devel] [PATCH 4/7] ath9k: Fix magnitude/phase calculation Sujith Manoharan
2014-02-07 4:59 ` [ath9k-devel] [PATCH 5/7] ath9k: Modify IQ calibration for AR955x Sujith Manoharan
2014-02-07 4:59 ` Sujith Manoharan [this message]
2014-02-07 4:59 ` [ath9k-devel] [PATCH 7/7] ath9k: Calculate IQ-CAL median Sujith Manoharan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1391749195-24381-7-git-send-email-sujith@msujith.org \
--to=sujith@msujith.org \
--cc=ath9k-devel@lists.ath9k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox