summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZong-Zhe Yang <kevin_yang@realtek.com>2025-10-21 21:33:59 +0800
committerPing-Ke Shih <pkshih@realtek.com>2025-10-28 09:49:49 +0800
commit0ac5ead00bf90f3280b8f5c0a0ad12e9800da8ec (patch)
treead53dc216ea55bfa4f2ff541c22c0bcdd537e0d2
parent438c9178cd8ab629025374ea598b060024a410e7 (diff)
wifi: rtw89: regd: apply ACPI policy even if country code is programmed
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
-rw-r--r--drivers/net/wireless/realtek/rtw89/core.h2
-rw-r--r--drivers/net/wireless/realtek/rtw89/regd.c22
2 files changed, 13 insertions, 11 deletions
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index 7c74ed3cfaf7..ae98d6866b30 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -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;
diff --git a/drivers/net/wireless/realtek/rtw89/regd.c b/drivers/net/wireless/realtek/rtw89/regd.c
index 58582f8d2b74..209d84909f88 100644
--- a/drivers/net/wireless/realtek/rtw89/regd.c
+++ b/drivers/net/wireless/realtek/rtw89/regd.c
@@ -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);
}