Search Linux Wireless

Re: [PATCH 3/5] ath5k: Track current TX power separately from max TX power

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/12/21 Bruno Randolf <br1@xxxxxxxxxxx>:
> Add a new variable to keep track of the currently configured tx power. Before
> max_pwr was re-used for keeping the maximum allowed power as well as the
> current configuration. Doing a min() on it allows you to lower the txpower, but
> how would you be able to make it higher again?
>
> This patch fixes that by adding a new variable ah_cur_pwr which is used instead
> of txp_max_pwr to keep the current configuration. txp_max_pwr is used to check
> if we are within the limits.
>
> Another problem fixed by this patch is that it avoids setting a zero txpower
> when things are initialized first and the current power is not yet set.
>
> Signed-off-by: Bruno Randolf <br1@xxxxxxxxxxx>
> ---
> Âdrivers/net/wireless/ath/ath5k/ath5k.h | Â Â1 +
> Âdrivers/net/wireless/ath/ath5k/phy.c  |  Â7 +++----
> Â2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
> index e6491bf..342da28 100644
> --- a/drivers/net/wireless/ath/ath5k/ath5k.h
> +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
> @@ -1107,6 +1107,7 @@ struct ath5k_hw {
> Â Â Â Â Â Â Â Â/* Values in 0.25dB units */
> Â Â Â Â Â Â Â Âs16 Â Â Â Â Â Â txp_min_pwr;
> Â Â Â Â Â Â Â Âs16 Â Â Â Â Â Â txp_max_pwr;
> + Â Â Â Â Â Â Â s16 Â Â Â Â Â Â txp_cur_pwr;
> Â Â Â Â Â Â Â Â/* Values in 0.5dB units */
> Â Â Â Â Â Â Â Âs16 Â Â Â Â Â Â txp_offset;
> Â Â Â Â Â Â Â Âs16 Â Â Â Â Â Â txp_ofdm;
> diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
> index 6f0cf3a..18c58cd 100644
> --- a/drivers/net/wireless/ath/ath5k/phy.c
> +++ b/drivers/net/wireless/ath/ath5k/phy.c
> @@ -3096,7 +3096,7 @@ ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr,
>
> Â Â Â Â/* Min/max in 0.25dB units */
> Â Â Â Âah->ah_txpower.txp_min_pwr = 2 * rates[7];
> - Â Â Â ah->ah_txpower.txp_max_pwr = 2 * rates[0];
> + Â Â Â ah->ah_txpower.txp_cur_pwr = 2 * rates[0];
> Â Â Â Âah->ah_txpower.txp_ofdm = rates[7];
> Â}
>
> @@ -3150,8 +3150,6 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
> Â Â Â Â Â Â Â Â/* Reset TX power values */
> Â Â Â Â Â Â Â Âmemset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
> Â Â Â Â Â Â Â Âah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
> - Â Â Â Â Â Â Â ah->ah_txpower.txp_min_pwr = 0;
> - Â Â Â Â Â Â Â ah->ah_txpower.txp_max_pwr = AR5K_TUNE_MAX_TXPOWER;
>
> Â Â Â Â Â Â Â Â/* Calculate the powertable */
> Â Â Â Â Â Â Â Âret = ath5k_setup_channel_powertable(ah, channel,
> @@ -3290,7 +3288,8 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
> Â Â Â Â * properly set curve indices.
> Â Â Â Â */
> Â Â Â Âret = ath5k_hw_txpower(ah, channel, ee_mode,
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ah->ah_txpower.txp_max_pwr / 2);
> + Â Â Â Â Â Â Â ah->ah_txpower.txp_cur_pwr ?
> + Â Â Â Â Â Â Â Â Â Â Â ah->ah_txpower.txp_cur_pwr / 2 : AR5K_TUNE_MAX_TXPOWER);
> Â Â Â Âif (ret)
> Â Â Â Â Â Â Â Âreturn ret;
>
>
>

Acked-by: Nick Kossifidis <mickflemm@xxxxxxxxx>


-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux