aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorNick Kossifidis <mickflemm@gmail.com>2012-08-05 15:35:36 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-08-10 15:26:57 -0400
commit987af54fa93b1c01eb3a85229bc93dfe77e6d2e1 (patch)
tree4ec197947f716e51234885fca69ab87d43c9f018 /drivers/net
parent493ca5ef4ec8a7e8396d6ab26f48de66bdf73dca (diff)
ath5k: Put power_level where it belongs and rename it
Put power_level to ah_txpower struct with the rest tx power infos and also rename it to txp_requested to make more sense. v2 make sure we don't memset it to zero on reset Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath5k/ath5k.h2
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c5
-rw-r--r--drivers/net/wireless/ath/ath5k/mac80211-ops.c4
-rw-r--r--drivers/net/wireless/ath/ath5k/phy.c14
4 files changed, 17 insertions, 8 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 64a453a6dfe4..3150def17193 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1331,7 +1331,6 @@ struct ath5k_hw {
1331 unsigned int nexttbtt; /* next beacon time in TU */ 1331 unsigned int nexttbtt; /* next beacon time in TU */
1332 struct ath5k_txq *cabq; /* content after beacon */ 1332 struct ath5k_txq *cabq; /* content after beacon */
1333 1333
1334 int power_level; /* Requested tx power in dBm */
1335 bool assoc; /* associate state */ 1334 bool assoc; /* associate state */
1336 bool enable_beacon; /* true if beacons are on */ 1335 bool enable_beacon; /* true if beacons are on */
1337 1336
@@ -1425,6 +1424,7 @@ struct ath5k_hw {
1425 /* Value in dB units */ 1424 /* Value in dB units */
1426 s16 txp_cck_ofdm_pwr_delta; 1425 s16 txp_cck_ofdm_pwr_delta;
1427 bool txp_setup; 1426 bool txp_setup;
1427 int txp_requested; /* Requested tx power in dBm */
1428 } ah_txpower; 1428 } ah_txpower;
1429 1429
1430 struct ath5k_nfcal_hist ah_nfcal_hist; 1430 struct ath5k_nfcal_hist ah_nfcal_hist;
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 8c4c040a47b8..9d48f9a461e1 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -723,7 +723,7 @@ ath5k_txbuf_setup(struct ath5k_hw *ah, struct ath5k_buf *bf,
723 ret = ah->ah_setup_tx_desc(ah, ds, pktlen, 723 ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
724 ieee80211_get_hdrlen_from_skb(skb), padsize, 724 ieee80211_get_hdrlen_from_skb(skb), padsize,
725 get_hw_packet_type(skb), 725 get_hw_packet_type(skb),
726 (ah->power_level * 2), 726 (ah->ah_txpower.txp_requested * 2),
727 hw_rate, 727 hw_rate,
728 info->control.rates[0].count, keyidx, ah->ah_tx_ant, flags, 728 info->control.rates[0].count, keyidx, ah->ah_tx_ant, flags,
729 cts_rate, duration); 729 cts_rate, duration);
@@ -1778,7 +1778,8 @@ ath5k_beacon_setup(struct ath5k_hw *ah, struct ath5k_buf *bf)
1778 ds->ds_data = bf->skbaddr; 1778 ds->ds_data = bf->skbaddr;
1779 ret = ah->ah_setup_tx_desc(ah, ds, skb->len, 1779 ret = ah->ah_setup_tx_desc(ah, ds, skb->len,
1780 ieee80211_get_hdrlen_from_skb(skb), padsize, 1780 ieee80211_get_hdrlen_from_skb(skb), padsize,
1781 AR5K_PKT_TYPE_BEACON, (ah->power_level * 2), 1781 AR5K_PKT_TYPE_BEACON,
1782 (ah->ah_txpower.txp_requested * 2),
1782 ieee80211_get_tx_rate(ah->hw, info)->hw_value, 1783 ieee80211_get_tx_rate(ah->hw, info)->hw_value,
1783 1, AR5K_TXKEYIX_INVALID, 1784 1, AR5K_TXKEYIX_INVALID,
1784 antenna, flags, 0, 0); 1785 antenna, flags, 0, 0);
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
index 260e7dc7f751..92ee3a0a5192 100644
--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
@@ -207,8 +207,8 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
207 } 207 }
208 208
209 if ((changed & IEEE80211_CONF_CHANGE_POWER) && 209 if ((changed & IEEE80211_CONF_CHANGE_POWER) &&
210 (ah->power_level != conf->power_level)) { 210 (ah->ah_txpower.txp_requested != conf->power_level)) {
211 ah->power_level = conf->power_level; 211 ah->ah_txpower.txp_requested = conf->power_level;
212 212
213 /* Half dB steps */ 213 /* Half dB steps */
214 ath5k_hw_set_txpower_limit(ah, (conf->power_level * 2)); 214 ath5k_hw_set_txpower_limit(ah, (conf->power_level * 2));
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 27ca993586d7..01c90ed58453 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -3652,10 +3652,17 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
3652 if (!ah->ah_txpower.txp_setup || 3652 if (!ah->ah_txpower.txp_setup ||
3653 (channel->hw_value != curr_channel->hw_value) || 3653 (channel->hw_value != curr_channel->hw_value) ||
3654 (channel->center_freq != curr_channel->center_freq)) { 3654 (channel->center_freq != curr_channel->center_freq)) {
3655 /* Reset TX power values */ 3655 /* Reset TX power values but preserve requested
3656 * tx power from above */
3657 int requested_txpower = ah->ah_txpower.txp_requested;
3658
3656 memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower)); 3659 memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
3660
3661 /* Restore TPC setting and requested tx power */
3657 ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER; 3662 ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
3658 3663
3664 ah->ah_txpower.txp_requested = requested_txpower;
3665
3659 /* Calculate the powertable */ 3666 /* Calculate the powertable */
3660 ret = ath5k_setup_channel_powertable(ah, channel, 3667 ret = ath5k_setup_channel_powertable(ah, channel,
3661 ee_mode, type); 3668 ee_mode, type);
@@ -3802,8 +3809,9 @@ ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
3802 * RF buffer settings on 5211/5212+ so that we 3809 * RF buffer settings on 5211/5212+ so that we
3803 * properly set curve indices. 3810 * properly set curve indices.
3804 */ 3811 */
3805 ret = ath5k_hw_txpower(ah, channel, ah->power_level ? 3812 ret = ath5k_hw_txpower(ah, channel, ah->ah_txpower.txp_requested ?
3806 ah->power_level * 2 : AR5K_TUNE_MAX_TXPOWER); 3813 ah->ah_txpower.txp_requested * 2 :
3814 AR5K_TUNE_MAX_TXPOWER);
3807 if (ret) 3815 if (ret)
3808 return ret; 3816 return ret;
3809 3817