diff options
author | Vasanthakumar Thiagarajan <vasanth@atheros.com> | 2010-12-15 10:30:52 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-12-16 15:22:31 -0500 |
commit | 7072bf62fb7abe5a91389d6271da520f29c79326 (patch) | |
tree | ff2a33f47596569d2980711f39b2f8178213647c /drivers/net | |
parent | 8698bca6b53d1f6641850b270de9c953078ed1ce (diff) |
ath9k_hw: Disable PAPRD for rates with low Tx power
When the drop in Tx power for a particular mcs rate exceeds
the paprd scale factor, paprd may not work properly. Disable
paprd for any such rates.
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 39 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_paprd.c | 20 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 1 |
3 files changed, 45 insertions, 15 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 9fa5793abd27..0e9ea35f2fb4 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -4751,16 +4751,53 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah, | |||
4751 | { | 4751 | { |
4752 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | 4752 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); |
4753 | struct ath_common *common = ath9k_hw_common(ah); | 4753 | struct ath_common *common = ath9k_hw_common(ah); |
4754 | struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; | ||
4754 | u8 targetPowerValT2[ar9300RateSize]; | 4755 | u8 targetPowerValT2[ar9300RateSize]; |
4755 | unsigned int i = 0; | 4756 | u8 target_power_val_t2_eep[ar9300RateSize]; |
4757 | unsigned int i = 0, paprd_scale_factor = 0; | ||
4758 | u8 pwr_idx, min_pwridx; | ||
4756 | 4759 | ||
4757 | ar9003_hw_set_target_power_eeprom(ah, chan->channel, targetPowerValT2); | 4760 | ar9003_hw_set_target_power_eeprom(ah, chan->channel, targetPowerValT2); |
4761 | |||
4762 | if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) { | ||
4763 | if (IS_CHAN_2GHZ(chan)) | ||
4764 | ah->paprd_ratemask = (IS_CHAN_HT40(chan) ? | ||
4765 | le32_to_cpu(eep->modalHeader2G.papdRateMaskHt40) : | ||
4766 | le32_to_cpu(eep->modalHeader2G.papdRateMaskHt20)) | ||
4767 | & AR9300_PAPRD_RATE_MASK; | ||
4768 | else | ||
4769 | ah->paprd_ratemask = (IS_CHAN_HT40(chan) ? | ||
4770 | le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40) : | ||
4771 | le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20)) | ||
4772 | & AR9300_PAPRD_RATE_MASK; | ||
4773 | |||
4774 | memcpy(target_power_val_t2_eep, targetPowerValT2, | ||
4775 | sizeof(targetPowerValT2)); | ||
4776 | } | ||
4777 | |||
4758 | ar9003_hw_set_power_per_rate_table(ah, chan, | 4778 | ar9003_hw_set_power_per_rate_table(ah, chan, |
4759 | targetPowerValT2, cfgCtl, | 4779 | targetPowerValT2, cfgCtl, |
4760 | twiceAntennaReduction, | 4780 | twiceAntennaReduction, |
4761 | twiceMaxRegulatoryPower, | 4781 | twiceMaxRegulatoryPower, |
4762 | powerLimit); | 4782 | powerLimit); |
4763 | 4783 | ||
4784 | if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) { | ||
4785 | paprd_scale_factor = ar9003_get_paprd_scale_factor(ah, chan); | ||
4786 | min_pwridx = IS_CHAN_HT40(chan) ? ALL_TARGET_HT40_0_8_16 : | ||
4787 | ALL_TARGET_HT20_0_8_16; | ||
4788 | |||
4789 | for (i = 0; i < ar9300RateSize; i++) { | ||
4790 | if ((ah->paprd_ratemask & (1 << i)) && | ||
4791 | (abs(targetPowerValT2[i] - | ||
4792 | target_power_val_t2_eep[i]) > | ||
4793 | paprd_scale_factor)) { | ||
4794 | ah->paprd_ratemask &= ~(1 << i); | ||
4795 | ath_dbg(common, ATH_DBG_EEPROM, | ||
4796 | "paprd disabled for mcs %d\n", i); | ||
4797 | } | ||
4798 | } | ||
4799 | } | ||
4800 | |||
4764 | regulatory->max_power_level = 0; | 4801 | regulatory->max_power_level = 0; |
4765 | for (i = 0; i < ar9300RateSize; i++) { | 4802 | for (i = 0; i < ar9300RateSize; i++) { |
4766 | if (targetPowerValT2[i] > regulatory->max_power_level) | 4803 | if (targetPowerValT2[i] > regulatory->max_power_level) |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c index 4c744793b4b6..26cf31cca3ac 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c | |||
@@ -87,8 +87,6 @@ static int ar9003_get_training_power_5g(struct ath_hw *ah) | |||
87 | static int ar9003_paprd_setup_single_table(struct ath_hw *ah) | 87 | static int ar9003_paprd_setup_single_table(struct ath_hw *ah) |
88 | { | 88 | { |
89 | struct ath_common *common = ath9k_hw_common(ah); | 89 | struct ath_common *common = ath9k_hw_common(ah); |
90 | struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; | ||
91 | struct ar9300_modal_eep_header *hdr; | ||
92 | static const u32 ctrl0[3] = { | 90 | static const u32 ctrl0[3] = { |
93 | AR_PHY_PAPRD_CTRL0_B0, | 91 | AR_PHY_PAPRD_CTRL0_B0, |
94 | AR_PHY_PAPRD_CTRL0_B1, | 92 | AR_PHY_PAPRD_CTRL0_B1, |
@@ -99,18 +97,9 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah) | |||
99 | AR_PHY_PAPRD_CTRL1_B1, | 97 | AR_PHY_PAPRD_CTRL1_B1, |
100 | AR_PHY_PAPRD_CTRL1_B2 | 98 | AR_PHY_PAPRD_CTRL1_B2 |
101 | }; | 99 | }; |
102 | u32 am_mask, ht40_mask; | ||
103 | int training_power; | 100 | int training_power; |
104 | int i; | 101 | int i; |
105 | 102 | ||
106 | if (ah->curchan && IS_CHAN_5GHZ(ah->curchan)) | ||
107 | hdr = &eep->modalHeader5G; | ||
108 | else | ||
109 | hdr = &eep->modalHeader2G; | ||
110 | |||
111 | am_mask = le32_to_cpu(hdr->papdRateMaskHt20) & AR9300_PAPRD_RATE_MASK; | ||
112 | ht40_mask = le32_to_cpu(hdr->papdRateMaskHt40) & AR9300_PAPRD_RATE_MASK; | ||
113 | |||
114 | if (IS_CHAN_2GHZ(ah->curchan)) | 103 | if (IS_CHAN_2GHZ(ah->curchan)) |
115 | training_power = ar9003_get_training_power_2g(ah); | 104 | training_power = ar9003_get_training_power_2g(ah); |
116 | else | 105 | else |
@@ -126,9 +115,12 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah) | |||
126 | "Training power: %d, Target power: %d\n", | 115 | "Training power: %d, Target power: %d\n", |
127 | ah->paprd_training_power, ah->paprd_target_power); | 116 | ah->paprd_training_power, ah->paprd_target_power); |
128 | 117 | ||
129 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2AM, AR_PHY_PAPRD_AM2AM_MASK, am_mask); | 118 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2AM, AR_PHY_PAPRD_AM2AM_MASK, |
130 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2PM, AR_PHY_PAPRD_AM2PM_MASK, am_mask); | 119 | ah->paprd_ratemask); |
131 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_HT40, AR_PHY_PAPRD_HT40_MASK, ht40_mask); | 120 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2PM, AR_PHY_PAPRD_AM2PM_MASK, |
121 | ah->paprd_ratemask); | ||
122 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_HT40, AR_PHY_PAPRD_HT40_MASK, | ||
123 | AR_PHY_PAPRD_HT40_MASK); | ||
132 | 124 | ||
133 | for (i = 0; i < ah->caps.max_txchains; i++) { | 125 | for (i = 0; i < ah->caps.max_txchains; i++) { |
134 | REG_RMW_FIELD(ah, ctrl0[i], | 126 | REG_RMW_FIELD(ah, ctrl0[i], |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index fb64ab841dc1..3a6101ba9837 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -835,6 +835,7 @@ struct ath_hw { | |||
835 | 835 | ||
836 | unsigned int paprd_target_power; | 836 | unsigned int paprd_target_power; |
837 | unsigned int paprd_training_power; | 837 | unsigned int paprd_training_power; |
838 | unsigned int paprd_ratemask; | ||
838 | u32 paprd_gain_table_entries[PAPRD_GAIN_TABLE_ENTRIES]; | 839 | u32 paprd_gain_table_entries[PAPRD_GAIN_TABLE_ENTRIES]; |
839 | u8 paprd_gain_table_index[PAPRD_GAIN_TABLE_ENTRIES]; | 840 | u8 paprd_gain_table_index[PAPRD_GAIN_TABLE_ENTRIES]; |
840 | /* | 841 | /* |