wifi: mt76: mt7925: add MTCL support to enhance the regulatory compliance

Apply the MTCL configuration to improving channel availability and
regulatory compliance if MTCL table is supported.

Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250304113649.867387-6-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Ming Yen Hsieh
2025-03-04 19:36:49 +08:00
committed by Felix Fietkau
parent 7cebc2300d
commit 51ac8dbb70

View File

@@ -64,8 +64,15 @@ void mt7925_regd_be_ctrl(struct mt792x_dev *dev, u8 *alpha2)
struct mt7925_clc_rule_v2 *rule;
struct mt7925_clc *clc;
bool old = dev->has_eht, new = true;
u32 mtcl_conf = mt792x_acpi_get_mtcl_conf(&dev->phy, alpha2);
u8 *pos;
if (mtcl_conf != MT792X_ACPI_MTCL_INVALID &&
(((mtcl_conf >> 4) & 0x3) == 0)) {
new = false;
goto out;
}
if (!phy->clc[MT792x_CLC_BE_CTRL])
goto out;
@@ -101,11 +108,21 @@ mt7925_regd_channel_update(struct wiphy *wiphy, struct mt792x_dev *dev)
{
#define IS_UNII_INVALID(idx, sfreq, efreq, cfreq) \
(!(dev->phy.clc_chan_conf & BIT(idx)) && (cfreq) >= (sfreq) && (cfreq) <= (efreq))
#define MT7925_UNII_59G_IS_VALID 0x1
#define MT7925_UNII_6G_IS_VALID 0x1e
struct ieee80211_supported_band *sband;
struct mt76_dev *mdev = &dev->mt76;
struct ieee80211_channel *ch;
u32 mtcl_conf = mt792x_acpi_get_mtcl_conf(&dev->phy, mdev->alpha2);
int i;
if (mtcl_conf != MT792X_ACPI_MTCL_INVALID) {
if ((mtcl_conf & 0x3) == 0)
dev->phy.clc_chan_conf &= ~MT7925_UNII_59G_IS_VALID;
if (((mtcl_conf >> 2) & 0x3) == 0)
dev->phy.clc_chan_conf &= ~MT7925_UNII_6G_IS_VALID;
}
sband = wiphy->bands[NL80211_BAND_5GHZ];
if (!sband)
return;