diff options
author | Senthil Balasubramanian <senthilkumar@atheros.com> | 2009-02-12 03:27:03 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:51:46 -0500 |
commit | 8bd1d07f9345750bd4d767e6c1600919672f98ba (patch) | |
tree | 42b201403637888b4c5cde5e1fd096c373d4ca05 /drivers/net/wireless/ath9k/calib.c | |
parent | 81cb7623ad3b408f871fa36b774fc20d8dfccac0 (diff) |
ath9k: Add open loop control support
This patch adds Open Loop Control support for Atheros chipsets that
supports open loop power control.
Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/calib.c')
-rw-r--r-- | drivers/net/wireless/ath9k/calib.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath9k/calib.c b/drivers/net/wireless/ath9k/calib.c index a7ce8c5d48f5..e5abe6564ca7 100644 --- a/drivers/net/wireless/ath9k/calib.c +++ b/drivers/net/wireless/ath9k/calib.c | |||
@@ -718,10 +718,39 @@ s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan) | |||
718 | return nf; | 718 | return nf; |
719 | } | 719 | } |
720 | 720 | ||
721 | static void ath9k_olc_temp_compensation(struct ath_hw *ah) | ||
722 | { | ||
723 | u32 rddata, i; | ||
724 | int delta, currPDADC, regval; | ||
725 | |||
726 | rddata = REG_READ(ah, AR_PHY_TX_PWRCTRL4); | ||
727 | |||
728 | currPDADC = MS(rddata, AR_PHY_TX_PWRCTRL_PD_AVG_OUT); | ||
729 | |||
730 | if (ah->eep_ops->get_eeprom(ah, EEP_DAC_HPWR_5G)) | ||
731 | delta = (currPDADC - ah->initPDADC + 4) / 8; | ||
732 | else | ||
733 | delta = (currPDADC - ah->initPDADC + 5) / 10; | ||
734 | |||
735 | if (delta != ah->PDADCdelta) { | ||
736 | ah->PDADCdelta = delta; | ||
737 | for (i = 1; i < AR9280_TX_GAIN_TABLE_SIZE; i++) { | ||
738 | regval = ah->originalGain[i] - delta; | ||
739 | if (regval < 0) | ||
740 | regval = 0; | ||
741 | |||
742 | REG_RMW_FIELD(ah, AR_PHY_TX_GAIN_TBL1 + i * 4, | ||
743 | AR_PHY_TX_GAIN, regval); | ||
744 | } | ||
745 | } | ||
746 | } | ||
747 | |||
721 | bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, | 748 | bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, |
722 | u8 rxchainmask, bool longcal, | 749 | u8 rxchainmask, bool longcal, |
723 | bool *isCalDone) | 750 | bool *isCalDone) |
724 | { | 751 | { |
752 | #define OLC_FOR_AR9280_20_LATER (AR_SREV_9280_20_OR_LATER(ah) && \ | ||
753 | ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) | ||
725 | struct hal_cal_list *currCal = ah->cal_list_curr; | 754 | struct hal_cal_list *currCal = ah->cal_list_curr; |
726 | 755 | ||
727 | *isCalDone = true; | 756 | *isCalDone = true; |
@@ -742,6 +771,8 @@ bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, | |||
742 | } | 771 | } |
743 | 772 | ||
744 | if (longcal) { | 773 | if (longcal) { |
774 | if (OLC_FOR_AR9280_20_LATER) | ||
775 | ath9k_olc_temp_compensation(ah); | ||
745 | ath9k_hw_getnf(ah, chan); | 776 | ath9k_hw_getnf(ah, chan); |
746 | ath9k_hw_loadnf(ah, ah->curchan); | 777 | ath9k_hw_loadnf(ah, ah->curchan); |
747 | ath9k_hw_start_nfcal(ah); | 778 | ath9k_hw_start_nfcal(ah); |