mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: fix rounding issues on converting per-chain and combined txpower
Unify code converting between the different txpower values. Always add/remove the combined txpower delta before dividing half-dB values. Also fix the combined txpower delta values. The correct half-dB delta for 3 chains is 9, not 8. Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
+2
-18
@@ -1050,25 +1050,9 @@ int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
{
|
||||
struct mt76_phy *phy = hw->priv;
|
||||
int n_chains = hweight8(phy->antenna_mask);
|
||||
int delta = mt76_tx_power_nss_delta(n_chains);
|
||||
|
||||
*dbm = DIV_ROUND_UP(phy->txpower_cur, 2);
|
||||
|
||||
/* convert from per-chain power to combined
|
||||
* output power
|
||||
*/
|
||||
switch (n_chains) {
|
||||
case 4:
|
||||
*dbm += 6;
|
||||
break;
|
||||
case 3:
|
||||
*dbm += 4;
|
||||
break;
|
||||
case 2:
|
||||
*dbm += 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*dbm = DIV_ROUND_UP(phy->txpower_cur + delta, 2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user