public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain
@ 2024-04-12  8:53 Mingyen Hsieh
  2024-04-12  9:27 ` Nicolas Escande
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mingyen Hsieh @ 2024-04-12  8:53 UTC (permalink / raw)
  To: nbd, lorenzo
  Cc: deren.wu, Sean.Wang, Soul.Huang, Leon.Yen, Eric-SY.Chang, km.lin,
	robin.chiu, ch.yeh, posh.sun, Quan.Zhou, Ryder.Lee, Shayne.Chen,
	linux-wireless, linux-mediatek, Leon Yen, Ming Yen Hsieh

From: Leon Yen <leon.yen@mediatek.com>

Some countries have strict RF restrictions where changing the regulatory
domain dynamically based on the connected AP is not acceptable.
This patch disables Beacon country IE hinting when a valid country code
is set from usersland (e.g., by system using iw or CRDA).

Signed-off-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7921/init.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
index ef0c721d26e3..3c9a5fcd6924 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
@@ -135,6 +135,13 @@ mt7921_regd_notifier(struct wiphy *wiphy,
 	dev->mt76.region = request->dfs_region;
 	dev->country_ie_env = request->country_ie_env;
 
+	if (request->initiator == NL80211_REGDOM_SET_BY_USER) {
+		if (dev->mt76.alpha2[0] == '0' && dev->mt76.alpha2[1] == '0')
+			wiphy->regulatory_flags &= ~REGULATORY_COUNTRY_IE_IGNORE;
+		else
+			wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE;
+	}
+
 	if (pm->suspended)
 		return;
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-01-06  5:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-12  8:53 [PATCH] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Mingyen Hsieh
2024-04-12  9:27 ` Nicolas Escande
2024-04-15  5:53   ` Mingyen Hsieh (謝明諺)
2024-04-15 10:26     ` Nicolas Escande
2024-04-22  6:32       ` Mingyen Hsieh (謝明諺)
2024-10-28  1:55       ` Mingyen Hsieh (謝明諺)
2024-06-10 16:16 ` David Ruth
2024-12-30 19:05 ` Felix Fietkau
     [not found]   ` <SI2PR03MB5322E7B73B5AB27215A5436585102@SI2PR03MB5322.apcprd03.prod.outlook.com>
2025-01-06  5:58     ` Mingyen Hsieh (謝明諺)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox