mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 15:13:44 -04:00
wifi: rtw89: regd/acpi: support country CA by BIT(1) in 6 GHz SP conf
ACPI DSM function 7 is used to decide whether 6 GHz Standard Power (SP) is allowed on given countries. Now, add BIT(1) for country CA. Besides, for searching country index, replace for-loop with index getter function. Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20250709065006.32028-2-pkshih@realtek.com
This commit is contained in:
committed by
Ping-Ke Shih
parent
4b295f4fdc
commit
75bb7774a1
@@ -56,6 +56,7 @@ struct rtw89_acpi_policy_6ghz {
|
||||
|
||||
enum rtw89_acpi_conf_6ghz_sp {
|
||||
RTW89_ACPI_CONF_6GHZ_SP_US = BIT(0),
|
||||
RTW89_ACPI_CONF_6GHZ_SP_CA = BIT(1),
|
||||
};
|
||||
|
||||
struct rtw89_acpi_policy_6ghz_sp {
|
||||
|
||||
@@ -490,12 +490,11 @@ static void rtw89_regd_setup_policy_6ghz(struct rtw89_dev *rtwdev)
|
||||
static void rtw89_regd_setup_policy_6ghz_sp(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory;
|
||||
const struct rtw89_regd_ctrl *regd_ctrl = ®ulatory->ctrl;
|
||||
const struct rtw89_acpi_policy_6ghz_sp *ptr;
|
||||
struct rtw89_acpi_dsm_result res = {};
|
||||
bool enable_by_us;
|
||||
bool enable;
|
||||
u8 index;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
ret = rtw89_acpi_evaluate_dsm(rtwdev, RTW89_ACPI_DSM_FUNC_6GHZ_SP_SUP, &res);
|
||||
if (ret) {
|
||||
@@ -520,14 +519,15 @@ static void rtw89_regd_setup_policy_6ghz_sp(struct rtw89_dev *rtwdev)
|
||||
|
||||
bitmap_fill(regulatory->block_6ghz_sp, RTW89_REGD_MAX_COUNTRY_NUM);
|
||||
|
||||
enable_by_us = u8_get_bits(ptr->conf, RTW89_ACPI_CONF_6GHZ_SP_US);
|
||||
index = rtw89_regd_get_index_by_name(rtwdev, "US");
|
||||
enable = u8_get_bits(ptr->conf, RTW89_ACPI_CONF_6GHZ_SP_US);
|
||||
if (enable && index != RTW89_REGD_MAX_COUNTRY_NUM)
|
||||
clear_bit(index, regulatory->block_6ghz_sp);
|
||||
|
||||
for (i = 0; i < regd_ctrl->nr; i++) {
|
||||
const struct rtw89_regd *tmp = ®d_ctrl->map[i];
|
||||
|
||||
if (enable_by_us && memcmp(tmp->alpha2, "US", 2) == 0)
|
||||
clear_bit(i, regulatory->block_6ghz_sp);
|
||||
}
|
||||
index = rtw89_regd_get_index_by_name(rtwdev, "CA");
|
||||
enable = u8_get_bits(ptr->conf, RTW89_ACPI_CONF_6GHZ_SP_CA);
|
||||
if (enable && index != RTW89_REGD_MAX_COUNTRY_NUM)
|
||||
clear_bit(index, regulatory->block_6ghz_sp);
|
||||
|
||||
out:
|
||||
kfree(ptr);
|
||||
|
||||
Reference in New Issue
Block a user