ath5k: Use correct value for min_pwr and cur_pwr

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Sep 29 10:59:29 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=d12c5c53ce4c8c65c694d1103673182ef5afdc65
Commit:     d12c5c53ce4c8c65c694d1103673182ef5afdc65
Parent:     94f3457f4da43a44f17789f3e0bc8fb2ee9593ca
Author:     Nick Kossifidis <mickflemm at gmail.com>
AuthorDate: Sun Aug 5 22:35:33 2012 +0300
Committer:  John W. Linville <linville at tuxdriver.com>
CommitDate: Fri Aug 10 15:26:55 2012 -0400

    ath5k: Use correct value for min_pwr and cur_pwr
    
    Make sure we don't store the table offsets for min and cur power levels,
    store the 0.25dB values instead. This way we don't clamp the tx power level
    to max (because now cur_pwr holds the 0.25dB value, not the table offset) after
    re-using cur_pwr on reset.
    
    Signed-off-by: Nick Kossifidis <mickflemm at gmail.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>
---
 drivers/net/wireless/ath/ath5k/phy.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 8b71a2d..aa1a77d 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -3562,6 +3562,20 @@ ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr,
 		for (i = 8; i <= 15; i++)
 			rates[i] -= ah->ah_txpower.txp_cck_ofdm_gainf_delta;
 
+	/* Save min/max and current tx power for this channel
+	 * in 0.25dB units.
+	 *
+	 * Note: We use rates[0] for current tx power because
+	 * it covers most of the rates, in most cases. It's our
+	 * tx power limit and what the user expects to see. */
+	ah->ah_txpower.txp_min_pwr = 2 * rates[7];
+	ah->ah_txpower.txp_cur_pwr = 2 * rates[0];
+
+	/* Set max txpower for correct OFDM operation on all rates
+	 * -that is the txpower for 54Mbit-, it's used for the PAPD
+	 * gain probe and it's in 0.5dB units */
+	ah->ah_txpower.txp_ofdm = rates[7];
+
 	/* Now that we have all rates setup use table offset to
 	 * match the power range set by user with the power indices
 	 * on PCDAC/PDADC table */
@@ -3571,11 +3585,6 @@ ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr,
 		if (rates[i] > 63)
 			rates[i] = 63;
 	}
-
-	/* Min/max in 0.25dB units */
-	ah->ah_txpower.txp_min_pwr = 2 * rates[7];
-	ah->ah_txpower.txp_cur_pwr = 2 * rates[0];
-	ah->ah_txpower.txp_ofdm = rates[7];
 }
 
 



More information about the linux-mtd-cvs mailing list