wifi: mt76: mt7921: disable auto regd changes after user set

Add regd_user flag to block automatic regulatory domain updates
if set by user.

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: JB Tsai <jb.tsai@mediatek.com>
Link: https://patch.msgid.link/20260303053637.465465-5-jb.tsai@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
JB Tsai 2026-03-03 13:36:37 +08:00 committed by Felix Fietkau
parent ae05055d30
commit 9c082046c3
2 changed files with 7 additions and 1 deletions

View File

@ -419,6 +419,7 @@ static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name)
u8 *clc_base = NULL, hw_encap = 0;
dev->phy.clc_chan_conf = 0xff;
dev->regd_user = false;
if (!mt7921_regd_clc_supported(dev))
return 0;

View File

@ -117,6 +117,10 @@ void mt7921_regd_notifier(struct wiphy *wiphy,
struct mt76_connac_pm *pm = &dev->pm;
struct mt76_dev *mdev = &dev->mt76;
if (req->initiator == NL80211_REGDOM_SET_BY_USER &&
!dev->regd_user)
dev->regd_user = true;
/* do not need to update the same country twice */
if (!memcmp(req->alpha2, mdev->alpha2, 2) &&
dev->country_ie_env == req->country_ie_env)
@ -168,7 +172,8 @@ int mt7921_regd_change(struct mt792x_phy *phy, char *alpha2)
return 0;
if (!mt7921_regd_is_valid_alpha2(alpha2) ||
!mt7921_regd_clc_supported(dev))
!mt7921_regd_clc_supported(dev) ||
dev->regd_user)
return -EINVAL;
if (mdev->alpha2[0] != '0' && mdev->alpha2[1] != '0')