Fix two small issues with user txpower setting

1)
ath5k is not setting max_power in the channel info, I'm using
AR5K_TUNE_MAX_TXPOWER/2 (31dBm) as the default in this patch.

2)
The newly added ah->ah_txpower.txp_user_pwr gets reset on channel
change, save the value and restore it after clearing the ah_txpower
struct.

Signed-off-by: Tobias Diedrich <ranma+open...@tdiedrich.de>


diff --git a/drivers/net/wireless/ath/ath5k/base.c 
b/drivers/net/wireless/ath/ath5k/base.c
index 8c4c040..391a916 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -323,6 +323,8 @@ ath5k_setup_channels(struct ath5k_hw *ah, struct 
ieee80211_channel *channels,
                if (!ath5k_is_standard_channel(ch, band))
                        continue;
 
+               channels[count].max_power = AR5K_TUNE_MAX_TXPOWER/2;
+
                count++;
        }
 
diff --git a/drivers/net/wireless/ath/ath5k/phy.c 
b/drivers/net/wireless/ath/ath5k/phy.c
index 8b71a2d..a5e76a4 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -3640,7 +3640,9 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct 
ieee80211_channel *channel,
            (channel->hw_value != curr_channel->hw_value) ||
            (channel->center_freq != curr_channel->center_freq)) {
                /* Reset TX power values */
+               s16 txp_user_pwr = ah->ah_txpower.txp_user_pwr;
                memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
+               ah->ah_txpower.txp_user_pwr = txp_user_pwr;
                ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
 
                /* Calculate the powertable */

-- 
Tobias                                          PGP: http://8ef7ddba.uguu.de
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to