Commit 931749bf authored by Mohammed Shafi Shajakhan's avatar Mohammed Shafi Shajakhan Committed by John W. Linville

ath9k: make use of a helper to get paprd scale factor

Signed-off-by: default avatarMohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 36cb7cce
...@@ -46,11 +46,10 @@ EXPORT_SYMBOL(ar9003_paprd_enable); ...@@ -46,11 +46,10 @@ EXPORT_SYMBOL(ar9003_paprd_enable);
static int ar9003_get_training_power_2g(struct ath_hw *ah) static int ar9003_get_training_power_2g(struct ath_hw *ah)
{ {
struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; struct ath9k_channel *chan = ah->curchan;
struct ar9300_modal_eep_header *hdr = &eep->modalHeader2G;
unsigned int power, scale, delta; unsigned int power, scale, delta;
scale = MS(le32_to_cpu(hdr->papdRateMaskHt20), AR9300_PAPRD_SCALE_1); scale = ar9003_get_paprd_scale_factor(ah, chan);
power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE5, power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE5,
AR_PHY_POWERTX_RATE5_POWERTXHT20_0); AR_PHY_POWERTX_RATE5_POWERTXHT20_0);
...@@ -67,20 +66,10 @@ static int ar9003_get_training_power_2g(struct ath_hw *ah) ...@@ -67,20 +66,10 @@ static int ar9003_get_training_power_2g(struct ath_hw *ah)
static int ar9003_get_training_power_5g(struct ath_hw *ah) static int ar9003_get_training_power_5g(struct ath_hw *ah)
{ {
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
struct ar9300_modal_eep_header *hdr = &eep->modalHeader5G;
struct ath9k_channel *chan = ah->curchan; struct ath9k_channel *chan = ah->curchan;
unsigned int power, scale, delta; unsigned int power, scale, delta;
if (chan->channel >= 5700) scale = ar9003_get_paprd_scale_factor(ah, chan);
scale = MS(le32_to_cpu(hdr->papdRateMaskHt20),
AR9300_PAPRD_SCALE_1);
else if (chan->channel >= 5400)
scale = MS(le32_to_cpu(hdr->papdRateMaskHt40),
AR9300_PAPRD_SCALE_2);
else
scale = MS(le32_to_cpu(hdr->papdRateMaskHt40),
AR9300_PAPRD_SCALE_1);
if (IS_CHAN_HT40(chan)) if (IS_CHAN_HT40(chan))
power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE8, power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE8,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment