From c5c714eb4b70ebbb060b7d3c0534ed21660678e4 Mon Sep 17 00:00:00 2001 From: Vasantha kumar Thiagaranjan Date: Mon, 21 Jul 2008 00:55:05 -0800 Subject: [PATCH] Configure the h/w with appropriate tx power Configure the h/w with appropriate tx power whenever there is a change in tx power level. Clean ups in the functions which configure tx power. Signed-off-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath9k/ath9k.h | 3 +-- drivers/net/wireless/ath9k/core.c | 22 ++++++++-------------- drivers/net/wireless/ath9k/core.h | 5 +---- drivers/net/wireless/ath9k/hw.c | 4 +--- drivers/net/wireless/ath9k/main.c | 8 +------- 5 files changed, 12 insertions(+), 30 deletions(-) diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h index cf73a74..ed440a0 100644 --- a/drivers/net/wireless/ath9k/ath9k.h +++ b/drivers/net/wireless/ath9k/ath9k.h @@ -1169,8 +1169,7 @@ void ath9k_hw_gettxintrtxqs(struct ath_hal *ah, u_int32_t *txqs); void ath9k_hw_clr11n_aggr(struct ath_hal *ah, struct ath_desc *ds); void ath9k_hw_set11n_virtualmorefrag(struct ath_hal *ah, struct ath_desc *ds, u_int vmf); -enum hal_bool ath9k_hw_SetTxPowerLimit(struct ath_hal *ah, u_int32_t limit, - u_int16_t tpcInDb); +enum hal_bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u_int32_t limit); enum hal_bool ath9k_regd_is_public_safety_sku(struct ath_hal *ah); int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum hal_tx_queue type, const struct hal_txq_info *qInfo); diff --git a/drivers/net/wireless/ath9k/core.c b/drivers/net/wireless/ath9k/core.c index 2bdf12a..dbb826f 100644 --- a/drivers/net/wireless/ath9k/core.c +++ b/drivers/net/wireless/ath9k/core.c @@ -452,7 +452,7 @@ int ath_set_channel(struct ath_softc *sc, struct hal_channel *hchan) * if we're switching; e.g. 11a to 11b/g. */ ath_chan_change(sc, hchan); - ath_update_txpow(sc, 0); /* update tx power state */ + ath_update_txpow(sc); /* update tx power state */ /* * Re-enable interrupts. */ @@ -1020,7 +1020,7 @@ int ath_open(struct ath_softc *sc, struct hal_channel *initial_chan) * This is needed only to setup initial state * but it's best done after a reset. */ - ath_update_txpow(sc, 0); + ath_update_txpow(sc); /* * Setup the hardware after reset: @@ -1111,7 +1111,7 @@ static int ath_reset_end(struct ath_softc *sc, u_int32_t flag) */ ath_chan_change(sc, &sc->sc_curchan); - ath_update_txpow(sc, 0); /* update tx power state */ + ath_update_txpow(sc); /* update tx power state */ if (sc->sc_beacons) ath_beacon_config(sc, ATH_IF_ID_ANY); /* restart beacons */ @@ -1827,20 +1827,16 @@ int ath_keyset(struct ath_softc *sc, * Set Transmit power in HAL * * This routine makes the actual HAL calls to set the new transmit power - * limit. This also calls back into the protocol layer setting the max - * transmit power limit. + * limit. */ -void ath_update_txpow(struct ath_softc *sc, u_int16_t tpcInDb) +void ath_update_txpow(struct ath_softc *sc) { struct ath_hal *ah = sc->sc_ah; - u_int32_t txpow, txpowlimit; + u_int32_t txpow; - txpowlimit = (sc->sc_config.txpowlimit_override) ? - sc->sc_config.txpowlimit_override : sc->sc_config.txpowlimit; - - if (sc->sc_curtxpow != txpowlimit) { - ath9k_hw_SetTxPowerLimit(ah, txpowlimit, tpcInDb); + if (sc->sc_curtxpow != sc->sc_config.txpowlimit) { + ath9k_hw_set_txpowerlimit(ah, sc->sc_config.txpowlimit); /* read back in case value is clamped */ ath9k_hw_getcapability(ah, HAL_CAP_TXPOW, 1, &txpow); sc->sc_curtxpow = txpow; @@ -1848,8 +1844,6 @@ void ath_update_txpow(struct ath_softc *sc, u_int16_t tpcInDb) /* Fetch max tx power level and update protocal stack */ ath9k_hw_getcapability(ah, HAL_CAP_TXPOW, 2, &txpow); - - ath__update_txpow(sc, sc->sc_curtxpow, txpow); } /* Return the current country and domain information */ diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h index 520a6ef..9348107 100644 --- a/drivers/net/wireless/ath9k/core.h +++ b/drivers/net/wireless/ath9k/core.h @@ -1211,7 +1211,7 @@ int ath_keyset(struct ath_softc *sc, int ath_get_hal_qnum(u16 queue, struct ath_softc *sc); int ath_get_mac80211_qnum(u_int queue, struct ath_softc *sc); void ath_setslottime(struct ath_softc *sc); -void ath_update_txpow(struct ath_softc *sc, u_int16_t tpcInDb); +void ath_update_txpow(struct ath_softc *sc); int ath_cabq_update(struct ath_softc *); void ath_get_currentCountry(struct ath_softc *sc, struct hal_country_entry *ctry); @@ -1227,9 +1227,6 @@ void ath_skb_unmap_single(struct ath_softc *sc, int direction, dma_addr_t *pa); void ath_mcast_merge(struct ath_softc *sc, u_int32_t mfilt[2]); -void ath__update_txpow(struct ath_softc *sc, - u_int16_t txpowlimit, - u_int16_t txpowlevel); enum hal_ht_macmode ath_cwm_macmode(struct ath_softc *sc); #endif /* CORE_H */ diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c index 4562ec2..6063ecf 100644 --- a/drivers/net/wireless/ath9k/hw.c +++ b/drivers/net/wireless/ath9k/hw.c @@ -6389,9 +6389,7 @@ ath9k_hw_adc_dccal_calibrate(struct ath_hal *ah, u_int8_t numChains) AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE); } -enum hal_bool -ath9k_hw_SetTxPowerLimit(struct ath_hal *ah, u_int32_t limit, - u_int16_t tpcInDb) +enum hal_bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u_int32_t limit) { struct ath_hal_5416 *ahp = AH5416(ah); struct hal_channel_internal *ichan = ah->ah_curchan; diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 42706bb..670a516 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c @@ -525,6 +525,7 @@ static int ath9k_config(struct ieee80211_hw *hw, hchan.channel = curchan->center_freq; hchan.channelFlags = ath_chan2flags(curchan, sc); + sc->sc_config.txpowlimit = 2 * conf->power_level; /* set h/w channel */ if (ath_set_channel(sc, &hchan) < 0) @@ -1061,13 +1062,6 @@ void ath_setup_channel_list(struct ath_softc *sc, } } -void ath__update_txpow(struct ath_softc *sc, - u_int16_t txpowlimit, - u_int16_t txpowlevel) -{ - -} - void ath_get_beaconconfig(struct ath_softc *sc, int if_id, struct ath_beacon_config *conf) -- 1.5.4.3