]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mt76: mt7925: add MTCL support to enhance the regulatory compliance
authorMing Yen Hsieh <mingyen.hsieh@mediatek.com>
Tue, 4 Mar 2025 11:36:49 +0000 (19:36 +0800)
committerFelix Fietkau <nbd@nbd.name>
Wed, 19 Mar 2025 13:47:04 +0000 (14:47 +0100)
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>
drivers/net/wireless/mediatek/mt76/mt7925/init.c

index 8732b05355dbc3f4261eecbfe537dbe9fa511a36..63cb08f4d87cc44216d9bff43546a22771392cc2 100644 (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;