]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: regd: apply ACPI policy even if country code is programmed
authorZong-Zhe Yang <kevin_yang@realtek.com>
Tue, 21 Oct 2025 13:33:59 +0000 (21:33 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 28 Oct 2025 01:49:49 +0000 (09:49 +0800)
There are regulatory related policy according to BIOS/ACPI configuration,
e.g. distro decides to disable some bands or some channels. Even if chip
has a programmed country code, these policy should still be applied within
regulatory notifier.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20251021133402.15467-6-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/regd.c

index 7c74ed3cfaf7479729b511f68ab130482093281f..ae98d6866b30a9ce3aa34cecd6b415e9b75dc6fb 100644 (file)
@@ -5449,6 +5449,8 @@ struct rtw89_regd_ctrl {
 struct rtw89_regulatory_info {
        struct rtw89_regd_ctrl ctrl;
        const struct rtw89_regd *regd;
+       bool programmed;
+
        enum rtw89_reg_6ghz_power reg_6ghz_power;
        struct rtw89_reg_6ghz_tpe reg_6ghz_tpe;
        bool txpwr_uk_follow_etsi;
index 58582f8d2b74c2dbb3930254b865fb06b27fa81b..209d84909f8855e50a7aa376c6143596b88564bd 100644 (file)
@@ -723,6 +723,8 @@ int rtw89_regd_init_hint(struct rtw89_dev *rtwdev)
        chip_regd = rtw89_regd_find_reg_by_name(rtwdev, rtwdev->efuse.country_code);
        if (!rtw89_regd_is_ww(chip_regd)) {
                rtwdev->regulatory.regd = chip_regd;
+               rtwdev->regulatory.programmed = true;
+
                /* Ignore country ie if there is a country domain programmed in chip */
                wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE;
                wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
@@ -867,11 +869,6 @@ static void rtw89_regd_notifier_apply(struct rtw89_dev *rtwdev,
                wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE;
        else
                wiphy->regulatory_flags &= ~REGULATORY_COUNTRY_IE_IGNORE;
-
-       rtw89_regd_apply_policy_unii4(rtwdev, wiphy);
-       rtw89_regd_apply_policy_6ghz(rtwdev, wiphy);
-       rtw89_regd_apply_policy_tas(rtwdev);
-       rtw89_regd_apply_policy_ant_gain(rtwdev);
 }
 
 static
@@ -883,19 +880,22 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request
        wiphy_lock(wiphy);
        rtw89_leave_ps_mode(rtwdev);
 
-       if (wiphy->regd) {
-               rtw89_debug(rtwdev, RTW89_DBG_REGD,
-                           "There is a country domain programmed in chip, ignore notifications\n");
-               goto exit;
-       }
+       if (rtwdev->regulatory.programmed)
+               goto policy;
+
        rtw89_regd_notifier_apply(rtwdev, wiphy, request);
        rtw89_debug_regd(rtwdev, rtwdev->regulatory.regd,
                         "get from initiator %d, alpha2",
                         request->initiator);
 
+policy:
+       rtw89_regd_apply_policy_unii4(rtwdev, wiphy);
+       rtw89_regd_apply_policy_6ghz(rtwdev, wiphy);
+       rtw89_regd_apply_policy_tas(rtwdev);
+       rtw89_regd_apply_policy_ant_gain(rtwdev);
+
        rtw89_core_set_chip_txpwr(rtwdev);
 
-exit:
        wiphy_unlock(wiphy);
 }