Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340909
b: refs/heads/master
c: 1e4cf24
h: refs/heads/master
i:
  340907: 96b50ca
v: v3
  • Loading branch information
Stanislaw Gruszka authored and John W. Linville committed Oct 19, 2012
1 parent d6f7c2f commit 28e8004
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 146c3b0ccd09dbd21f7dd6c9ed10094cb91f9a2d
refs/heads/master: 1e4cf249a43da5c441c1025aca588ca65185fb61
27 changes: 27 additions & 0 deletions trunk/drivers/net/wireless/rt2x00/rt2800lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2520,6 +2520,27 @@ static int rt2800_get_txpower_bw_comp(struct rt2x00_dev *rt2x00dev,
return comp_value;
}

static int rt2800_get_txpower_reg_delta(struct rt2x00_dev *rt2x00dev,
int power_level, int max_power)
{
int delta;

if (test_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags))
return 0;

/*
* XXX: We don't know the maximum transmit power of our hardware since
* the EEPROM doesn't expose it. We only know that we are calibrated
* to 100% tx power.
*
* Hence, we assume the regulatory limit that cfg80211 calulated for
* the current channel is our maximum and if we are requested to lower
* the value we just reduce our tx power accordingly.
*/
delta = power_level - max_power;
return min(delta, 0);
}

static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b,
enum ieee80211_band band, int power_level,
u8 txpower, int delta)
Expand Down Expand Up @@ -2585,6 +2606,12 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
*/
delta += rt2800_get_gain_calibration_delta(rt2x00dev);

/*
* Apply regulatory delta.
*/
delta += rt2800_get_txpower_reg_delta(rt2x00dev, power_level,
chan->max_power);

/*
* BBP_R1 controls TX power for all rates, it allow to set the following
* gains -12, -6, 0, +6 dBm by setting values 2, 1, 0, 3 respectively.
Expand Down

0 comments on commit 28e8004

Please sign in to comment.