Skip to content

Commit

Permalink
rt2800: limit TX_PWR_CFG_ values to 0xc
Browse files Browse the repository at this point in the history
Based on AsicAdjustTxPower function from vendor driver
(2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO)
limit per rate TX power values we program into TX_PWR_CFG_ registers.

Note that on some configurations (devices/rates) is allowed to use
bigger values than 0xc, but we use safe maximum value for now. Further
work need to be done to allow use bigger values than 0xc.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Stanislaw Gruszka authored and John W. Linville committed Oct 19, 2012
1 parent cee2c73 commit 19f3fa2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/wireless/rt2x00/rt2800lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2563,7 +2563,8 @@ static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b,
} else
reg_limit = 0;

return txpower + delta - reg_limit;
txpower = max(0, txpower + delta - reg_limit);
return min_t(u8, txpower, 0xc);
}

static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
Expand Down

0 comments on commit 19f3fa2

Please sign in to comment.