ath5k: Allow user/driver to set txpower

* Now that we have regulatory control enable the driver to set
 txpower on hw

 * Also use txpower table offset so that we can match
 power range set by user/driver with indices on power table.

 Tested 2 different cards (a CM9 and an RF5112-based ubnt) and got
 the same output using a remote machine to measure per-packet rssi
 (conected the cards using attenuators). I also switched between
 various tx power levels and i saw an equal power change on the remote
 machine (so txpower changes as expected) and verified that we have
 the same output on each rate.

 Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
 Signed-off-by: Bob Copeland <me@bobcopeland.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Nick Kossifidis
2009-04-30 15:55:44 -04:00
committed by John W. Linville
parent 15e469284d
commit a082381044
4 changed files with 52 additions and 13 deletions

View File

@@ -2747,12 +2747,21 @@ static int
ath5k_config(struct ieee80211_hw *hw, u32 changed)
{
struct ath5k_softc *sc = hw->priv;
struct ath5k_hw *ah = sc->ah;
struct ieee80211_conf *conf = &hw->conf;
int ret;
mutex_lock(&sc->lock);
sc->power_level = conf->power_level;
sc->bintval = conf->beacon_int;
if ((changed & IEEE80211_CONF_CHANGE_POWER) &&
(sc->power_level != conf->power_level)) {
sc->power_level = conf->power_level;
/* Half dB steps */
ath5k_hw_set_txpower_limit(ah, (conf->power_level * 2));
}
ret = ath5k_chan_set(sc, conf->channel);