diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2012-10-05 07:44:15 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-10-19 15:53:14 -0400 |
commit | 7a66205a218c4b22ced8b3326ab925136b160b01 (patch) | |
tree | 5fb7b36d8f913754d281339c5c6021c21a69e36a | |
parent | 1e4cf249a43da5c441c1025aca588ca65185fb61 (diff) |
rt2800: comment tx power settings
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 3e059b6c484d..3bc206d06cd1 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -2586,6 +2586,15 @@ static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b, | |||
2586 | return min_t(u8, txpower, 0xc); | 2586 | return min_t(u8, txpower, 0xc); |
2587 | } | 2587 | } |
2588 | 2588 | ||
2589 | /* | ||
2590 | * We configure transmit power using MAC TX_PWR_CFG_{0,...,N} registers and | ||
2591 | * BBP R1 register. TX_PWR_CFG_X allow to configure per rate TX power values, | ||
2592 | * 4 bits for each rate (tune from 0 to 15 dBm). BBP_R1 controls transmit power | ||
2593 | * for all rates, but allow to set only 4 discrete values: -12, -6, 0 and 6 dBm. | ||
2594 | * Reference per rate transmit power values are located in the EEPROM at | ||
2595 | * EEPROM_TXPOWER_BYRATE offset. We adjust them and BBP R1 settings according to | ||
2596 | * current conditions (i.e. band, bandwidth, temperature, user settings). | ||
2597 | */ | ||
2589 | static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, | 2598 | static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, |
2590 | struct ieee80211_channel *chan, | 2599 | struct ieee80211_channel *chan, |
2591 | int power_level) | 2600 | int power_level) |
@@ -2597,17 +2606,24 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, | |||
2597 | enum ieee80211_band band = chan->band; | 2606 | enum ieee80211_band band = chan->band; |
2598 | 2607 | ||
2599 | /* | 2608 | /* |
2600 | * Calculate HT40 compensation delta | 2609 | * Calculate HT40 compensation. For 40MHz we need to add or subtract |
2610 | * value read from EEPROM (different for 2GHz and for 5GHz). | ||
2601 | */ | 2611 | */ |
2602 | delta = rt2800_get_txpower_bw_comp(rt2x00dev, band); | 2612 | delta = rt2800_get_txpower_bw_comp(rt2x00dev, band); |
2603 | 2613 | ||
2604 | /* | 2614 | /* |
2605 | * calculate temperature compensation delta | 2615 | * Calculate temperature compensation. Depends on measurement of current |
2616 | * TSSI (Transmitter Signal Strength Indication) we know TX power (due | ||
2617 | * to temperature or maybe other factors) is smaller or bigger than | ||
2618 | * expected. We adjust it, based on TSSI reference and boundaries values | ||
2619 | * provided in EEPROM. | ||
2606 | */ | 2620 | */ |
2607 | delta += rt2800_get_gain_calibration_delta(rt2x00dev); | 2621 | delta += rt2800_get_gain_calibration_delta(rt2x00dev); |
2608 | 2622 | ||
2609 | /* | 2623 | /* |
2610 | * Apply regulatory delta. | 2624 | * Decrease power according to user settings, on devices with unknown |
2625 | * maximum tx power. For other devices we take user power_level into | ||
2626 | * consideration on rt2800_compensate_txpower(). | ||
2611 | */ | 2627 | */ |
2612 | delta += rt2800_get_txpower_reg_delta(rt2x00dev, power_level, | 2628 | delta += rt2800_get_txpower_reg_delta(rt2x00dev, power_level, |
2613 | chan->max_power); | 2629 | chan->max_power); |