From: Bruno Randolf <br1@einfach.org>
To: linville@tuxdriver.com
Cc: ath5k-devel@lists.ath5k.org, linux-wireless@vger.kernel.org
Subject: [PATCH 11/13] ath5k: read eeprom IQ calibration values correctly for G mode
Date: Tue, 09 Mar 2010 16:56:10 +0900 [thread overview]
Message-ID: <20100309075610.30616.82140.stgit@void> (raw)
In-Reply-To: <20100309075124.30616.40896.stgit@void>
we read the IQ correction values (i_cal and q_cal) for G mode from a wrong
location (the same shifts as for A mode is applied which is incorrect). use
correct locations, matching the docs and HAL sources.
also we should write IQ correction only when we have that information in the
EEPROM, starting from version 4. also write it in the same way as we do in the
periodic recalibration (enable last), just to be sure.
Signed-off-by: Bruno Randolf <br1@einfach.org>
---
drivers/net/wireless/ath/ath5k/eeprom.c | 4 ++--
drivers/net/wireless/ath/ath5k/reset.c | 15 +++++++++------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
index 6a3f4da..10b5226 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
@@ -429,8 +429,8 @@ static int ath5k_eeprom_read_modes(struct ath5k_hw *ah, u32 *offset,
ee->ee_margin_tx_rx[mode] = (val >> 8) & 0x3f;
AR5K_EEPROM_READ(o++, val);
- ee->ee_i_cal[mode] = (val >> 8) & 0x3f;
- ee->ee_q_cal[mode] = (val >> 3) & 0x1f;
+ ee->ee_i_cal[mode] = (val >> 5) & 0x3f;
+ ee->ee_q_cal[mode] = val & 0x1f;
if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_2) {
AR5K_EEPROM_READ(o++, val);
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index 6d9a1e8..e9e69dc 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -851,12 +851,15 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1,
AR5K_INIT_CYCRSSI_THR1);
- /* I/Q correction
- * TODO: Per channel i/q infos ? */
- AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ,
- AR5K_PHY_IQ_CORR_ENABLE |
- (ee->ee_i_cal[ee_mode] << AR5K_PHY_IQ_CORR_Q_I_COFF_S) |
- ee->ee_q_cal[ee_mode]);
+ /* I/Q correction (set enable bit last to match HAL sources) */
+ /* TODO: Per channel i/q infos ? */
+ if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0) {
+ AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_Q_I_COFF,
+ ee->ee_i_cal[ee_mode]);
+ AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_Q_Q_COFF,
+ ee->ee_q_cal[ee_mode]);
+ AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_ENABLE);
+ }
/* Heavy clipping -disable for now */
if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_1)
next prev parent reply other threads:[~2010-03-09 7:56 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-09 7:55 [PATCH 00/13] all my ath5k patches Bruno Randolf
2010-03-09 7:55 ` [PATCH 01/13] ath5k: add antenna statistics and debugfs file for antenna settings Bruno Randolf
2010-03-09 12:15 ` Nick Kossifidis
2010-03-09 7:55 ` [PATCH 02/13] ath5k: use fixed antenna for tx descriptors Bruno Randolf
2010-03-09 12:16 ` Nick Kossifidis
2010-03-09 7:55 ` [PATCH 03/13] ath5k: preserve antenna settings Bruno Randolf
2010-03-09 12:16 ` Nick Kossifidis
2010-03-09 7:55 ` [PATCH 04/13] ath5k: fix TSF reset Bruno Randolf
2010-03-09 12:17 ` Nick Kossifidis
2010-03-09 7:55 ` [PATCH 05/13] ath5k: remove double opmode definition Bruno Randolf
2010-03-09 12:17 ` Nick Kossifidis
2010-03-09 7:55 ` [PATCH 06/13] ath5k: remove ah_magic Bruno Randolf
2010-03-09 12:18 ` Nick Kossifidis
2010-03-09 7:55 ` [PATCH 07/13] ath5k: remove ah_mac_revision Bruno Randolf
2010-03-09 12:18 ` Nick Kossifidis
2010-03-09 7:55 ` [PATCH 08/13] ath5k: remove ah_gpio_npins Bruno Randolf
2010-03-09 12:19 ` Nick Kossifidis
2010-03-09 7:56 ` [PATCH 09/13] ath5k: add debugfs file frameerrors Bruno Randolf
2010-03-09 12:21 ` Nick Kossifidis
2010-03-09 7:56 ` [PATCH 10/13] ath5k: fix I/Q calibration (for real) Bruno Randolf
2010-03-09 12:22 ` Nick Kossifidis
2010-03-09 7:56 ` Bruno Randolf [this message]
2010-03-09 12:22 ` [PATCH 11/13] ath5k: read eeprom IQ calibration values correctly for G mode Nick Kossifidis
2010-03-09 7:56 ` [PATCH 12/13] ath5k: IQ calibration for AR5211 is slightly different Bruno Randolf
2010-03-09 12:23 ` Nick Kossifidis
2010-03-09 7:56 ` [PATCH 13/13] ath5k: Minor EEPROM documentation updates Bruno Randolf
2010-03-09 14:33 ` [PATCH 00/13] all my ath5k patches John W. Linville
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=20100309075610.30616.82140.stgit@void \
--to=br1@einfach.org \
--cc=ath5k-devel@lists.ath5k.org \
--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;
as well as URLs for NNTP newsgroup(s).