wifi: mt76: mt7915: add bf backoff limit table support

The commit 22b980badc0f ("mt76: add functions for parsing rate power limits
from DT") introduced generic support for rates limits in the devicetree.
But the mt7915 supports beamforming and has another table for configuring
the backoff limits. These can be configured in the DT with the paths-*
properties. The path-*-bf are the ones relevant for beamforming and the
ones without -bf suffix for "traditional" path backoff.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Sven Eckelmann (Plasma Cloud) <[email protected]>
Link: https://patch.msgid.link/20251007-backoff-table-support-v3-3-fd6e2684988f@simonwunderlich.de
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Shayne Chen
2025-10-13 12:49:20 +02:00
committed by Felix Fietkau
parent 95c4df3233
commit 6f27d647c0
10 changed files with 277 additions and 55 deletions
+33 -5
View File
@@ -344,9 +344,10 @@ mt76_apply_array_limit(s8 *pwr, size_t pwr_len, const s8 *data,
static void
mt76_apply_multi_array_limit(s8 *pwr, size_t pwr_len, s8 pwr_num,
const s8 *data, size_t len, s8 target_power,
s8 nss_delta, s8 *max_power)
s8 nss_delta)
{
int i, cur;
s8 max_power = -128;
if (!data)
return;
@@ -357,7 +358,7 @@ mt76_apply_multi_array_limit(s8 *pwr, size_t pwr_len, s8 pwr_num,
break;
mt76_apply_array_limit(pwr + pwr_len * i, pwr_len, data + 1,
target_power, nss_delta, max_power);
target_power, nss_delta, &max_power);
if (--cur > 0)
continue;
@@ -384,12 +385,16 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
char band;
size_t len;
s8 max_power = 0;
s8 max_power_backoff = -127;
s8 txs_delta;
int n_chains = hweight16(phy->chainmask);
s8 target_power_combine = target_power + mt76_tx_power_path_delta(n_chains);
if (!mcs_rates)
mcs_rates = 10;
memset(dest, target_power, sizeof(*dest));
memset(dest, target_power, sizeof(*dest) - sizeof(dest->path));
memset(&dest->path, 0, sizeof(dest->path));
if (!IS_ENABLED(CONFIG_OF))
return target_power;
@@ -435,12 +440,35 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
val = mt76_get_of_array_s8(np, "rates-mcs", &len, mcs_rates + 1);
mt76_apply_multi_array_limit(dest->mcs[0], ARRAY_SIZE(dest->mcs[0]),
ARRAY_SIZE(dest->mcs), val, len,
target_power, txs_delta, &max_power);
target_power, txs_delta);
val = mt76_get_of_array_s8(np, "rates-ru", &len, ru_rates + 1);
mt76_apply_multi_array_limit(dest->ru[0], ARRAY_SIZE(dest->ru[0]),
ARRAY_SIZE(dest->ru), val, len,
target_power, txs_delta, &max_power);
target_power, txs_delta);
max_power_backoff = max_power;
val = mt76_get_of_array_s8(np, "paths-cck", &len, ARRAY_SIZE(dest->path.cck));
mt76_apply_array_limit(dest->path.cck, ARRAY_SIZE(dest->path.cck), val,
target_power_combine, txs_delta, &max_power_backoff);
val = mt76_get_of_array_s8(np, "paths-ofdm", &len, ARRAY_SIZE(dest->path.ofdm));
mt76_apply_array_limit(dest->path.ofdm, ARRAY_SIZE(dest->path.ofdm), val,
target_power_combine, txs_delta, &max_power_backoff);
val = mt76_get_of_array_s8(np, "paths-ofdm-bf", &len, ARRAY_SIZE(dest->path.ofdm_bf));
mt76_apply_array_limit(dest->path.ofdm_bf, ARRAY_SIZE(dest->path.ofdm_bf), val,
target_power_combine, txs_delta, &max_power_backoff);
val = mt76_get_of_array_s8(np, "paths-ru", &len, ARRAY_SIZE(dest->path.ru[0]) + 1);
mt76_apply_multi_array_limit(dest->path.ru[0], ARRAY_SIZE(dest->path.ru[0]),
ARRAY_SIZE(dest->path.ru), val, len,
target_power_combine, txs_delta);
val = mt76_get_of_array_s8(np, "paths-ru-bf", &len, ARRAY_SIZE(dest->path.ru_bf[0]) + 1);
mt76_apply_multi_array_limit(dest->path.ru_bf[0], ARRAY_SIZE(dest->path.ru_bf[0]),
ARRAY_SIZE(dest->path.ru_bf), val, len,
target_power_combine, txs_delta);
return max_power;
}