2
0

324-ath9k_hw-fix-channel-maximum-power-level-test.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Date: Wed, 22 Mar 2017 20:37:04 +0100
  3. Subject: [PATCH] ath9k_hw: fix channel maximum power level test
  4. The tx power applied by set_txpower is limited by the CTL (conformance
  5. test limit) entries in the EEPROM. These can change based on the user
  6. configured regulatory domain.
  7. Depending on the EEPROM data this can cause the tx power to become too
  8. limited, if the original regdomain CTLs impose lowr limits than the CTLs
  9. of the user configured regdomain.
  10. To fix this issue, set the initial channel limits without any CTL
  11. restrictions and only apply the CTL at run time when setting the channel
  12. and the real tx power.
  13. Cc: stable@vger.kernel.org
  14. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  15. ---
  16. --- a/drivers/net/wireless/ath/ath9k/hw.c
  17. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  18. @@ -2937,10 +2937,14 @@ void ath9k_hw_apply_txpower(struct ath_h
  19. struct ieee80211_channel *channel;
  20. int chan_pwr, new_pwr, max_gain;
  21. int ant_gain, ant_reduction = 0;
  22. + u16 ctl = NO_CTL;
  23. if (!chan)
  24. return;
  25. + if (!test)
  26. + ctl = ath9k_regd_get_ctl(reg, chan);
  27. +
  28. channel = chan->chan;
  29. chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
  30. new_pwr = min_t(int, chan_pwr, reg->power_limit);
  31. @@ -2950,9 +2954,7 @@ void ath9k_hw_apply_txpower(struct ath_h
  32. if (ant_gain > max_gain)
  33. ant_reduction = ant_gain - max_gain;
  34. - ah->eep_ops->set_txpower(ah, chan,
  35. - ath9k_regd_get_ctl(reg, chan),
  36. - ant_reduction, new_pwr, test);
  37. + ah->eep_ops->set_txpower(ah, chan, ctl, ant_reduction, new_pwr, test);
  38. }
  39. void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)