aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMohammed Shafi Shajakhan <mshajakhan@atheros.com>2011-06-06 13:32:33 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-06-07 14:46:13 -0400
commit931749bf78b969c54de9bbc67cf29b13a40bb73b (patch)
treefdef4605e54d6df40e1312403cb3073d9b592607 /drivers
parent36cb7cce230a06378915d405cd33adf58dd5fe2a (diff)
ath9k: make use of a helper to get paprd scale factor
Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_paprd.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
index fee38cebdcdf..2e7f0f2567eb 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
@@ -46,11 +46,10 @@ EXPORT_SYMBOL(ar9003_paprd_enable);
46 46
47static int ar9003_get_training_power_2g(struct ath_hw *ah) 47static int ar9003_get_training_power_2g(struct ath_hw *ah)
48{ 48{
49 struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; 49 struct ath9k_channel *chan = ah->curchan;
50 struct ar9300_modal_eep_header *hdr = &eep->modalHeader2G;
51 unsigned int power, scale, delta; 50 unsigned int power, scale, delta;
52 51
53 scale = MS(le32_to_cpu(hdr->papdRateMaskHt20), AR9300_PAPRD_SCALE_1); 52 scale = ar9003_get_paprd_scale_factor(ah, chan);
54 power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE5, 53 power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE5,
55 AR_PHY_POWERTX_RATE5_POWERTXHT20_0); 54 AR_PHY_POWERTX_RATE5_POWERTXHT20_0);
56 55
@@ -67,20 +66,10 @@ static int ar9003_get_training_power_2g(struct ath_hw *ah)
67static int ar9003_get_training_power_5g(struct ath_hw *ah) 66static int ar9003_get_training_power_5g(struct ath_hw *ah)
68{ 67{
69 struct ath_common *common = ath9k_hw_common(ah); 68 struct ath_common *common = ath9k_hw_common(ah);
70 struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
71 struct ar9300_modal_eep_header *hdr = &eep->modalHeader5G;
72 struct ath9k_channel *chan = ah->curchan; 69 struct ath9k_channel *chan = ah->curchan;
73 unsigned int power, scale, delta; 70 unsigned int power, scale, delta;
74 71
75 if (chan->channel >= 5700) 72 scale = ar9003_get_paprd_scale_factor(ah, chan);
76 scale = MS(le32_to_cpu(hdr->papdRateMaskHt20),
77 AR9300_PAPRD_SCALE_1);
78 else if (chan->channel >= 5400)
79 scale = MS(le32_to_cpu(hdr->papdRateMaskHt40),
80 AR9300_PAPRD_SCALE_2);
81 else
82 scale = MS(le32_to_cpu(hdr->papdRateMaskHt40),
83 AR9300_PAPRD_SCALE_1);
84 73
85 if (IS_CHAN_HT40(chan)) 74 if (IS_CHAN_HT40(chan))
86 power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE8, 75 power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE8,