Changeset 32793


Ignore:
Timestamp:
2012-07-24T00:20:57+02:00 (6 years ago)
Author:
nbd
Message:

ath5k: add tx power related fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/mac80211/patches/300-pending_work.patch

    r32760 r32793  
    42554255                return 0; 
    42564256        default: 
     4257--- a/drivers/net/wireless/ath/ath5k/ath5k.h 
     4258+++ b/drivers/net/wireless/ath/ath5k/ath5k.h 
     4259@@ -1418,6 +1418,7 @@ struct ath5k_hw { 
     4260                s16             txp_min_pwr; 
     4261                s16             txp_max_pwr; 
     4262                s16             txp_cur_pwr; 
     4263+               s16             txp_user_pwr; 
     4264                /* Values in 0.5dB units */ 
     4265                s16             txp_offset; 
     4266                s16             txp_ofdm; 
     4267--- a/drivers/net/wireless/ath/ath5k/base.c 
     4268+++ b/drivers/net/wireless/ath/ath5k/base.c 
     4269@@ -2953,6 +2953,9 @@ ath5k_init(struct ieee80211_hw *hw) 
     4270                hw->queues = 1; 
     4271        } 
     4272  
     4273+       /* init tx_power setting to maximum */ 
     4274+       ah->ah_txpower.txp_user_pwr = AR5K_TUNE_MAX_TXPOWER; 
     4275+ 
     4276        tasklet_init(&ah->rxtq, ath5k_tasklet_rx, (unsigned long)ah); 
     4277        tasklet_init(&ah->txtq, ath5k_tasklet_tx, (unsigned long)ah); 
     4278        tasklet_init(&ah->beacontq, ath5k_tasklet_beacon, (unsigned long)ah); 
     4279--- a/drivers/net/wireless/ath/ath5k/eeprom.c 
     4280+++ b/drivers/net/wireless/ath/ath5k/eeprom.c 
     4281@@ -1484,7 +1484,7 @@ ath5k_eeprom_read_target_rate_pwr_info(s 
     4282        case AR5K_EEPROM_MODE_11A: 
     4283                offset += AR5K_EEPROM_TARGET_PWR_OFF_11A(ee->ee_version); 
     4284                rate_pcal_info = ee->ee_rate_tpwr_a; 
     4285-               ee->ee_rate_target_pwr_num[mode] = AR5K_EEPROM_N_5GHZ_CHAN; 
     4286+               ee->ee_rate_target_pwr_num[mode] = AR5K_EEPROM_N_5GHZ_RATE_CHAN; 
     4287                break; 
     4288        case AR5K_EEPROM_MODE_11B: 
     4289                offset += AR5K_EEPROM_TARGET_PWR_OFF_11B(ee->ee_version); 
     4290--- a/drivers/net/wireless/ath/ath5k/eeprom.h 
     4291+++ b/drivers/net/wireless/ath/ath5k/eeprom.h 
     4292@@ -182,6 +182,7 @@ 
     4293 #define AR5K_EEPROM_EEP_DELTA          10 
     4294 #define AR5K_EEPROM_N_MODES            3 
     4295 #define AR5K_EEPROM_N_5GHZ_CHAN                10 
     4296+#define AR5K_EEPROM_N_5GHZ_RATE_CHAN   8 
     4297 #define AR5K_EEPROM_N_2GHZ_CHAN                3 
     4298 #define AR5K_EEPROM_N_2GHZ_CHAN_2413   4 
     4299 #define        AR5K_EEPROM_N_2GHZ_CHAN_MAX     4 
     4300--- a/drivers/net/wireless/ath/ath5k/phy.c 
     4301+++ b/drivers/net/wireless/ath/ath5k/phy.c 
     4302@@ -3585,14 +3585,12 @@ ath5k_setup_rate_powertable(struct ath5k 
     4303  * ath5k_hw_txpower() - Set transmission power limit for a given channel 
     4304  * @ah: The &struct ath5k_hw 
     4305  * @channel: The &struct ieee80211_channel 
     4306- * @txpower: Requested tx power in 0.5dB steps 
     4307  * 
     4308  * Combines all of the above to set the requested tx power limit 
     4309- * on hw. 
     4310+ * on hw to ah->ah_txpower.txp_user_pwr. 
     4311  */ 
     4312 static int 
     4313-ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, 
     4314-                u8 txpower) 
     4315+ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel) 
     4316 { 
     4317        struct ath5k_rate_pcal_info rate_info; 
     4318        struct ieee80211_channel *curr_channel = ah->ah_current_channel; 
     4319@@ -3600,11 +3598,6 @@ ath5k_hw_txpower(struct ath5k_hw *ah, st 
     4320        u8 type; 
     4321        int ret; 
     4322  
     4323-       if (txpower > AR5K_TUNE_MAX_TXPOWER) { 
     4324-               ATH5K_ERR(ah, "invalid tx power: %u\n", txpower); 
     4325-               return -EINVAL; 
     4326-       } 
     4327- 
     4328        ee_mode = ath5k_eeprom_mode_from_channel(channel); 
     4329        if (ee_mode < 0) { 
     4330                ATH5K_ERR(ah, 
     4331@@ -3669,7 +3662,7 @@ ath5k_hw_txpower(struct ath5k_hw *ah, st 
     4332        ath5k_get_rate_pcal_data(ah, channel, &rate_info); 
     4333  
     4334        /* Setup rate power table */ 
     4335-       ath5k_setup_rate_powertable(ah, txpower, &rate_info, ee_mode); 
     4336+       ath5k_setup_rate_powertable(ah, ah->ah_txpower.txp_user_pwr, &rate_info, ee_mode); 
     4337  
     4338        /* Write rate power table on hw */ 
     4339        ath5k_hw_reg_write(ah, AR5K_TXPOWER_OFDM(3, 24) | 
     4340@@ -3719,8 +3712,16 @@ ath5k_hw_set_txpower_limit(struct ath5k_ 
     4341 { 
     4342        ATH5K_DBG(ah, ATH5K_DEBUG_TXPOWER, 
     4343                "changing txpower to %d\n", txpower); 
     4344+       if (txpower) { 
     4345+               ah->ah_txpower.txp_user_pwr = txpower; 
     4346  
     4347-       return ath5k_hw_txpower(ah, ah->ah_current_channel, txpower); 
     4348+               if (ah->ah_txpower.txp_user_pwr > AR5K_TUNE_MAX_TXPOWER) { 
     4349+                       ATH5K_ERR(ah, "invalid tx power: %u\n", ah->ah_txpower.txp_user_pwr); 
     4350+                       return -EINVAL; 
     4351+               } 
     4352+       } 
     4353+ 
     4354+       return ath5k_hw_txpower(ah, ah->ah_current_channel); 
     4355 } 
     4356  
     4357  
     4358@@ -3791,8 +3792,8 @@ ath5k_hw_phy_init(struct ath5k_hw *ah, s 
     4359         * RF buffer settings on 5211/5212+ so that we 
     4360         * properly set curve indices. 
     4361         */ 
     4362-       ret = ath5k_hw_txpower(ah, channel, ah->ah_txpower.txp_cur_pwr ? 
     4363-                       ah->ah_txpower.txp_cur_pwr / 2 : AR5K_TUNE_MAX_TXPOWER); 
     4364+       ret = ath5k_hw_txpower(ah, channel); 
     4365+ 
     4366        if (ret) 
     4367                return ret; 
     4368  
Note: See TracChangeset for help on using the changeset viewer.