]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mt76: mt7925: fix tx power setting failure after chip reset
authorLeon Yen <leon.yen@mediatek.com>
Tue, 20 Jan 2026 16:31:52 +0000 (00:31 +0800)
committerFelix Fietkau <nbd@nbd.name>
Mon, 23 Mar 2026 09:23:01 +0000 (09:23 +0000)
After the chip reset, the procedure to set the tx power will not be
successful because the previous region setting is still remains.
Clear the region setting during MAC initialization and allow it to be
reset to finalize the TX power setting.

Fixes: 3bc62aa4484d ("wifi: mt76: mt7925: add auto regdomain switch support")
Signed-off-by: Leon Yen <leon.yen@mediatek.com>
Link: https://patch.msgid.link/20260120163152.3694116-1-leon.yen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7925/init.c
drivers/net/wireless/mediatek/mt76/mt7925/regd.c

index 3ce5d6fcc69df9f31cab1ee120b2de2ac85ac6ab..c0c5cb9aff75a4707e14aa35f7c9f1bfc067ce48 100644 (file)
@@ -91,6 +91,8 @@ int mt7925_mac_init(struct mt792x_dev *dev)
 
        mt7925_mac_init_basic_rates(dev);
 
+       memzero_explicit(&dev->mt76.alpha2, sizeof(dev->mt76.alpha2));
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(mt7925_mac_init);
index 292087e882d1f12fcce03e9274e904d6d42d8c86..16f56ee879d453bda0f57f9430cc918dd8863921 100644 (file)
@@ -232,7 +232,8 @@ int mt7925_regd_change(struct mt792x_phy *phy, char *alpha2)
            dev->regd_user)
                return -EINVAL;
 
-       if (mdev->alpha2[0] != '0' && mdev->alpha2[1] != '0')
+       if ((mdev->alpha2[0] && mdev->alpha2[0] != '0') &&
+           (mdev->alpha2[1] && mdev->alpha2[1] != '0'))
                return 0;
 
        /* do not need to update the same country twice */