Linux wireless drivers development
 help / color / mirror / Atom feed
From: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
To: <linville@tuxdriver.com>
Cc: <linux-wireless@vger.kernel.org>,
	Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Subject: [PATCH 03/10] ath9k_hw: fix IQ calibration chain index
Date: Fri, 18 May 2012 19:37:26 +0530	[thread overview]
Message-ID: <1337350053-15491-3-git-send-email-rmanohar@qca.qualcomm.com> (raw)
In-Reply-To: <1337350053-15491-1-git-send-email-rmanohar@qca.qualcomm.com>

The chain index to perform IQ calibration is counted to number of valid
tx chains and then used for indexing chain specific registers. If the
chainmask is set to 0x2 (i.e chain 1 only), still it accesses chain 0
registers for chain 1. So use real chain index instead sequential one.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/ar9003_calib.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index f83a4a2..d7deb8c 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -653,7 +653,6 @@ static void ar9003_hw_detect_outlier(int *mp_coeff, int nmeasurement,
 }
 
 static void ar9003_hw_tx_iqcal_load_avg_2_passes(struct ath_hw *ah,
-						 u8 num_chains,
 						 struct coeff *coeff,
 						 bool is_reusable)
 {
@@ -677,7 +676,9 @@ static void ar9003_hw_tx_iqcal_load_avg_2_passes(struct ath_hw *ah,
 	}
 
 	/* Load the average of 2 passes */
-	for (i = 0; i < num_chains; i++) {
+	for (i = 0; i < AR9300_MAX_CHAINS; i++) {
+		if (!(ah->txchainmask & (1 << i)))
+			continue;
 		nmeasurement = REG_READ_FIELD(ah,
 				AR_PHY_TX_IQCAL_STATUS_B0,
 				AR_PHY_CALIBRATED_GAINS_0);
@@ -767,16 +768,13 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah, bool is_reusable)
 	};
 	struct coeff coeff;
 	s32 iq_res[6];
-	u8 num_chains = 0;
 	int i, im, j;
 	int nmeasurement;
 
 	for (i = 0; i < AR9300_MAX_CHAINS; i++) {
-		if (ah->txchainmask & (1 << i))
-			num_chains++;
-	}
+		if (!(ah->txchainmask & (1 << i)))
+			continue;
 
-	for (i = 0; i < num_chains; i++) {
 		nmeasurement = REG_READ_FIELD(ah,
 				AR_PHY_TX_IQCAL_STATUS_B0,
 				AR_PHY_CALIBRATED_GAINS_0);
@@ -839,8 +837,7 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah, bool is_reusable)
 				coeff.phs_coeff[i][im] -= 128;
 		}
 	}
-	ar9003_hw_tx_iqcal_load_avg_2_passes(ah, num_chains,
-					     &coeff, is_reusable);
+	ar9003_hw_tx_iqcal_load_avg_2_passes(ah, &coeff, is_reusable);
 
 	return;
 
-- 
1.7.10.2


  parent reply	other threads:[~2012-05-18 14:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-18 14:07 [PATCH 01/10] ath9k_hw: update ar9462 initval table to fix rx nfcal Rajkumar Manoharan
2012-05-18 14:07 ` [PATCH 02/10] ath9k: cleanup MCI indentation Rajkumar Manoharan
2012-05-18 14:07 ` Rajkumar Manoharan [this message]
2012-05-18 14:07 ` [PATCH 04/10] ath9k_hw: program BT to control SPDT Rajkumar Manoharan
2012-05-18 14:07 ` [PATCH 05/10] ath9k_hw: add AR9462 initval for Global WLAN, BT settings Rajkumar Manoharan
2012-05-18 15:48   ` Sujith Manoharan
2012-05-18 14:07 ` [PATCH 06/10] ath9k_hw: fix BT RF performance Rajkumar Manoharan
2012-05-18 15:50   ` Sujith Manoharan
2012-05-18 14:07 ` [PATCH 07/10] ath9k: BT coex performance tuning for AR9462 Rajkumar Manoharan
2012-05-18 14:07 ` [PATCH 08/10] ath: do not update cycle counters with sleep mode results Rajkumar Manoharan
2012-05-18 14:07 ` [PATCH 09/10] ath9k: always perform ani calibration at poll interval Rajkumar Manoharan
2012-05-18 14:07 ` [PATCH 10/10] ath9k_hw: fix power state for MCI Rajkumar Manoharan
2012-05-18 15:45 ` [PATCH 01/10] ath9k_hw: update ar9462 initval table to fix rx nfcal 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=1337350053-15491-3-git-send-email-rmanohar@qca.qualcomm.com \
    --to=rmanohar@qca.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /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