wifi: rtw89: support U-NII-4 5.9GHz channels
Ping-Ke Shih
maintainercover wifi: rtw89: support U-NII-4 5.9GHz channels
8852B, 8852C and upcoming 8851B can support U-NII-4, so add this patchset to enable this feature. However, we can't turn it on unconditionally, because hardware may not get certification in certain platforms, so add a flag in BIOS ACPI to determine if we should disable these channels.
Zong-Zhe Yang (3):
wifi: rtw89: introduce realtek ACPI DSM method
wifi: rtw89: regd: judge UNII-4 according to BIOS and chip
wifi: rtw89: support U-NII-4 channels on 5GHz band
drivers/net/wireless/realtek/rtw89/Makefile | 3 +- drivers/net/wireless/realtek/rtw89/acpi.c | 52 ++++++++++++++++ drivers/net/wireless/realtek/rtw89/acpi.h | 21 +++++++ drivers/net/wireless/realtek/rtw89/core.c | 10 ++- drivers/net/wireless/realtek/rtw89/core.h | 2 + drivers/net/wireless/realtek/rtw89/regd.c | 61 +++++++++++++++++++ drivers/net/wireless/realtek/rtw89/rtw8851b.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852b.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852c.c | 1 + 10 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 drivers/net/wireless/realtek/rtw89/acpi.c create mode 100644 drivers/net/wireless/realtek/rtw89/acpi.h
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 1/3 wifi: rtw89: introduce realtek ACPI DSM method
From: Zong-Zhe Yang <[email protected]>
Introduce realtek ACPI DSM method to get required BIOS configurations. It will be used in the following commits.
And, enum rtw89_acpi_dsm_func is added for listing the functions which are currently recognized.
--- drivers/net/wireless/realtek/rtw89/Makefile | 3 +- drivers/net/wireless/realtek/rtw89/acpi.c | 52 +++++++++++++++++++++ drivers/net/wireless/realtek/rtw89/acpi.h | 21 +++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 drivers/net/wireless/realtek/rtw89/acpi.c create mode 100644 drivers/net/wireless/realtek/rtw89/acpi.h
drivers/net/wireless/realtek/rtw89/Makefile +2 -1
@@ -13,7 +13,8 @@ rtw89_core-y += core.o \ coex.o \ ps.o \ chan.o \ - ser.o + ser.o \ + acpi.o rtw89_core-$(CONFIG_PM) += wow.o
drivers/net/wireless/realtek/rtw89/acpi.c new file +52 -0
52 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/acpi.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ +/* Copyright(c) 2021-2023 Realtek Corporation +*/ + +#ifndef __RTW89_ACPI_H__ +#define __RTW89_ACPI_H__ + +#include "core.h" + +enum rtw89_acpi_dsm_func { +RTW89_ACPI_DSM_FUNC_IDN_BAND_SUP =2 , +RTW89_ACPI_DSM_FUNC_6G_DIS =3 , +RTW89_ACPI_DSM_FUNC_6G_BP =4 , +RTW89_ACPI_DSM_FUNC_TAS_EN =5 , +RTW89_ACPI_DSM_FUNC_59G_EN =6 , +}; + +int rtw89_acpi_evaluate_dsm (struct rtw89_dev *rtwdev, +enum rtw89_acpi_dsm_func func,u8 *value); + +#endif
Signature · 1 line
2.25.1
Re: [PATCH 1/3] wifi: rtw89: introduce realtek ACPI DSM method
Quoted 10 lines · Ping-Ke Shih
From: Zong-Zhe Yang <[email protected]>
Introduce realtek ACPI DSM method to get required BIOS configurations. It will be used in the following commits.
And, enum
rtw89_acpi_dsm_funcis added for listing the functions which are currently recognized.Signed-off-by Zong-Zhe Yang <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>
3 patches applied to wireless-next.git, thanks.
e897b0bef38a wifi: rtw89: introduce realtek ACPI DSM method a002f98123dd wifi: rtw89: regd: judge UNII-4 according to BIOS and chip e3b77c06c886 wifi: rtw89: support U-NII-4 channels on 5GHz band
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Ping-Ke Shih
maintainerPATCH 2/3 wifi: rtw89: regd: judge UNII-4 according to BIOS and chip
In reply to Ping-Ke ShihFrom: Zong-Zhe Yang <[email protected]>
For realtek regulatory, there are following two kinds of configurations to determine whether to allow UNII-4 band, i.e. 5.9GHz channels.
1. default setting according to whether chip support it or not
2. evaluate realtek ACPI DSM with RTW89_ACPI_DSM_FUNC_59G_EN (func. 6)
If (1) is false, we won't try (2) and just disallow UNII-4. Otherwise, if (2) is not supported or returns a non-specific value, we follow the default setting either. Besides, this commit aims to add decision logic in rtw89 regulatory. Actually, driver doesn't register UNII-4 yet. That will be handled by another commit.
--- drivers/net/wireless/realtek/rtw89/core.c | 7 ++- drivers/net/wireless/realtek/rtw89/core.h | 2 + drivers/net/wireless/realtek/rtw89/regd.c | 51 +++++++++++++++++++ drivers/net/wireless/realtek/rtw89/rtw8851b.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852b.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852c.c | 1 + 7 files changed, 63 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/core.c +6 -1
@@ -3850,7 +3850,12 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)return ret; } - hw->wiphy->reg_notifier = rtw89_regd_notifier; + ret =rtw89_regd_setup (rtwdev); +if (ret) { +rtw89_err (rtwdev,"failed to set up regd\n" ); + goto err_free_supported_band; + } + hw->wiphy->sar_capa = &rtw89_sar_capa; ret =ieee80211_register_hw (hw);
drivers/net/wireless/realtek/rtw89/core.h +2 -0
@@ -3179,6 +3179,7 @@ struct rtw89_chip_info {u8 support_chanctx_num;u8 support_bands;bool support_bw160; +bool support_unii4;bool support_ul_tb_ctrl;bool hw_sec_hdr;u8 rf_path_num;
@@ -5044,6 +5045,7 @@ int rtw89_core_release_sta_ba_entry(struct rtw89_dev *rtwdev,void rtw89_vif_type_mapping (struct ieee80211_vif *vif,bool assoc);int rtw89_chip_info_setup (struct rtw89_dev *rtwdev);bool rtw89_ra_report_to_bitrate (struct rtw89_dev *rtwdev,u8 rpt_rate,u16 *bitrate); +int rtw89_regd_setup (struct rtw89_dev *rtwdev);int rtw89_regd_init (struct rtw89_dev *rtwdev,void (*reg_notifier)(struct wiphy *wiphy,struct regulatory_request *request));void rtw89_regd_notifier (struct wiphy *wiphy,struct regulatory_request *request);
drivers/net/wireless/realtek/rtw89/regd.c +51 -0
63 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/rtw8851b.c +1 -0
@@ -123,6 +123,7 @@ const struct rtw89_chip_info rtw8851b_chip_info = { .support_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ), .support_bw160 = false, + .support_unii4 = true, .support_ul_tb_ctrl = true, .hw_sec_hdr = false, .rf_path_num = 1,
drivers/net/wireless/realtek/rtw89/rtw8852a.c +1 -0
@@ -2105,6 +2105,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = { .support_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ), .support_bw160 = false, + .support_unii4 = false, .support_ul_tb_ctrl = false, .hw_sec_hdr = false, .rf_path_num = 2,
drivers/net/wireless/realtek/rtw89/rtw8852b.c +1 -0
@@ -2536,6 +2536,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = { .support_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ), .support_bw160 = false, + .support_unii4 = true, .support_ul_tb_ctrl = true, .hw_sec_hdr = false, .rf_path_num = 2,
drivers/net/wireless/realtek/rtw89/rtw8852c.c +1 -0
@@ -2836,6 +2836,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {BIT (NL80211_BAND_5GHZ ) | BIT(NL80211_BAND_6GHZ), .support_bw160 = true, + .support_unii4 = true, .support_ul_tb_ctrl = false, .hw_sec_hdr = true, .rf_path_num = 2,
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 3/3 wifi: rtw89: support U-NII-4 channels on 5GHz band
In reply to Ping-Ke ShihFrom: Zong-Zhe Yang <[email protected]>
U-NII-4 band, i.e 5.9GHz channels, can be supported by chip 8852C, 8852B and 8851B. But, it is not supported by chip 8852A. Flag support_unii4 is added in chip info and defined by chip accordingly to indicate that. We reference this flag of runtime chip to decide whether to register 5.9GHz channels.
After that, we consider if U-NII-4 band is allowed by our regulatory rule of U-NII-4. If chip::support_unii4 but not regd::allow_unii4, we stll do not register 5.9GHz channels.
--- drivers/net/wireless/realtek/rtw89/core.c | 3 +++ drivers/net/wireless/realtek/rtw89/regd.c | 10 ++++++++++ 2 files changed, 13 insertions(+)
drivers/net/wireless/realtek/rtw89/core.c +3 -0
@@ -77,6 +77,9 @@ static struct ieee80211_channel rtw89_channels_5ghz[] = {RTW89_DEF_CHAN_5G (5785 ,157 ),RTW89_DEF_CHAN_5G (5805 ,161 ),RTW89_DEF_CHAN_5G_NO_HT40MINUS (5825 ,165 ), +RTW89_DEF_CHAN_5G (5845 ,169 ), +RTW89_DEF_CHAN_5G (5865 ,173 ), + RTW89_DEF_CHAN_5G(5885, 177), }; static struct ieee80211_channel rtw89_channels_6ghz[] = {
drivers/net/wireless/realtek/rtw89/regd.c +10 -0
@@ -288,6 +288,7 @@ static void rtw89_regd_setup_unii4(struct rtw89_dev *rtwdev, {const struct rtw89_chip_info *chip = rtwdev->chip;bool regd_allow_unii_4 = chip->support_unii4; +struct ieee80211_supported_band *sband;int ret;u8 val;
@@ -318,6 +319,15 @@ static void rtw89_regd_setup_unii4(struct rtw89_dev *rtwdev, bottom:rtw89_debug (rtwdev,RTW89_DBG_REGD ,"regd: allow unii 4: %d\n" , regd_allow_unii_4); + +if (regd_allow_unii_4) +return ; + + sband = wiphy->bands[NL80211_BAND_5GHZ ]; +if (!sband) +return ; + + sband->n_channels -=3 ; }int rtw89_regd_setup (struct rtw89_dev *rtwdev)
Signature · 1 line
2.25.1