mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
wifi: mt76: connac: factor out rate power limit calculation
Factor out the per-channel rate power limit calculation into a shared helper. This avoids duplicating the same regulatory, SAR and rate-limit logic in multiple paths. Reported-by: Devin Wittmayer <lucid_duck@justthetip.ca> Closes: https://lore.kernel.org/linux-wireless/20260130215839.53270-1-lucid_duck@justthetip.ca/ Tested-by: Devin Wittmayer <lucid_duck@justthetip.ca> Tested-by: Satadru Pramanik <satadru@gmail.com> Co-developed-by: Devin Wittmayer <lucid_duck@justthetip.ca> Signed-off-by: Devin Wittmayer <lucid_duck@justthetip.ca> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Link: https://patch.msgid.link/20260401182322.64355-2-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
8286bbf62d
commit
317bc1a059
|
|
@ -437,6 +437,9 @@ void mt76_connac_gen_ppe_thresh(u8 *he_ppet, int nss, enum nl80211_band band);
|
|||
int mt76_connac_init_tx_queues(struct mt76_phy *phy, int idx, int n_desc,
|
||||
int ring_base, void *wed, u32 flags);
|
||||
void mt76_connac_set_txpower_cur(struct mt76_phy *phy, s8 max_power);
|
||||
s8 mt76_connac_get_rate_power_limit(struct mt76_phy *phy,
|
||||
struct ieee80211_channel *chan,
|
||||
struct mt76_power_limits *limits);
|
||||
void mt76_connac_write_hw_txp(struct mt76_dev *dev,
|
||||
struct mt76_tx_info *tx_info,
|
||||
void *txp_ptr, u32 id);
|
||||
|
|
|
|||
|
|
@ -2235,15 +2235,10 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
|
|||
.hw_value = ch_list[idx],
|
||||
.band = band,
|
||||
};
|
||||
s8 reg_power, sar_power, max_power;
|
||||
|
||||
reg_power = mt76_connac_get_ch_power(phy, &chan,
|
||||
tx_power);
|
||||
sar_power = mt76_get_sar_power(phy, &chan, reg_power);
|
||||
|
||||
max_power = mt76_get_rate_power_limits(phy, &chan, limits,
|
||||
sar_power);
|
||||
s8 max_power;
|
||||
|
||||
max_power = mt76_connac_get_rate_power_limit(phy, &chan,
|
||||
limits);
|
||||
if (phy->chandef.chan &&
|
||||
phy->chandef.chan->hw_value == ch_list[idx] &&
|
||||
phy->chandef.chan->band == band)
|
||||
|
|
@ -2979,6 +2974,23 @@ int mt76_connac_mcu_rdd_cmd(struct mt76_dev *dev, int cmd, u8 index,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_connac_mcu_rdd_cmd);
|
||||
|
||||
s8 mt76_connac_get_rate_power_limit(struct mt76_phy *phy,
|
||||
struct ieee80211_channel *chan,
|
||||
struct mt76_power_limits *limits)
|
||||
{
|
||||
s8 reg_power, sar_power;
|
||||
int tx_power;
|
||||
|
||||
tx_power = 2 * phy->hw->conf.power_level;
|
||||
if (!tx_power)
|
||||
tx_power = 127;
|
||||
|
||||
reg_power = mt76_connac_get_ch_power(phy, chan, tx_power);
|
||||
sar_power = mt76_get_sar_power(phy, chan, reg_power);
|
||||
return mt76_get_rate_power_limits(phy, chan, limits, sar_power);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_connac_get_rate_power_limit);
|
||||
|
||||
static int
|
||||
mt76_connac_mcu_send_ram_firmware(struct mt76_dev *dev,
|
||||
const struct mt76_connac2_fw_trailer *hdr,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user