drivers/net/wireless/realtek/rtw89/regd.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtw89/regd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtw89/regd.c- Extension
.c- Size
- 39639 bytes
- Lines
- 1211
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
acpi.hdebug.hps.hutil.h
Detected Declarations
function rtw89_regd_is_wwfunction rtw89_regd_get_indexfunction rtw89_regd_get_index_by_namefunction rtw89_regd_setup_unii4function __rtw89_regd_setup_policy_6ghzfunction rtw89_regd_setup_policy_6ghzfunction rtw89_regd_setup_policy_6ghz_spfunction rtw89_regd_setup_policy_6ghz_vlpfunction rtw89_regd_setup_6ghzfunction rtw89_regd_setup_reg_rulesfunction rtw89_regd_setupfunction rtw89_regd_init_hintfunction rtw89_regd_apply_policy_unii4function regd_is_6ghz_blockedfunction regd_is_6ghz_not_applicablefunction rtw89_regd_apply_policy_6ghzfunction rtw89_regd_apply_policy_tasfunction rtw89_regd_apply_policy_ant_gainfunction rtw89_regd_notifier_applyfunction rtw89_regd_notifierfunction tpe_get_constraintfunction tpe_intersect_constraintfunction tpe_deal_with_eirpfunction tpe_convert_psd_to_eirpfunction tpe_deal_with_psdfunction rtw89_calculate_tpefunction __rtw89_reg_6ghz_tpe_recalcfunction rtw89_for_each_rtwviffunction rtw89_vif_for_each_linkfunction rtw89_reg_6ghz_tpe_recalcfunction __rtw89_reg_6ghz_power_recalcfunction rtw89_for_each_rtwviffunction rtw89_reg_6ghz_power_recalcfunction rtw89_reg_6ghz_recalc
Annotated Snippet
if (memcmp("EU", country->alpha2, 2) != 0) {
__rtw89_regd_setup_policy_6ghz(rtwdev, to_block,
country->alpha2);
continue;
}
for (j = 0; j < ARRAY_SIZE(rtw89_alpha2_list_eu); j++)
__rtw89_regd_setup_policy_6ghz(rtwdev, to_block,
rtw89_alpha2_list_eu[j]);
}
out:
kfree(ptr);
}
static void rtw89_regd_setup_policy_6ghz_sp(struct rtw89_dev *rtwdev)
{
struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory;
bool skip_acpi_dsm = rtwdev->hci.type == RTW89_HCI_TYPE_USB;
const struct rtw89_acpi_policy_6ghz_sp *ptr;
struct rtw89_acpi_dsm_result res = {};
bool enable;
u8 index;
int ret;
if (skip_acpi_dsm)
return;
ret = rtw89_acpi_evaluate_dsm(rtwdev, RTW89_ACPI_DSM_FUNC_6GHZ_SP_SUP, &res);
if (ret) {
rtw89_debug(rtwdev, RTW89_DBG_REGD,
"acpi: cannot eval policy 6ghz-sp: %d\n", ret);
return;
}
ptr = res.u.policy_6ghz_sp;
switch (ptr->override) {
default:
rtw89_debug(rtwdev, RTW89_DBG_REGD,
"%s: unknown override case: %d\n", __func__,
ptr->override);
fallthrough;
case 0:
goto out;
case 1:
break;
}
bitmap_fill(regulatory->block_6ghz_sp, RTW89_REGD_MAX_COUNTRY_NUM);
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);
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);
}
static void rtw89_regd_setup_policy_6ghz_vlp(struct rtw89_dev *rtwdev)
{
struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory;
bool skip_acpi_dsm = rtwdev->hci.type == RTW89_HCI_TYPE_USB;
const struct rtw89_acpi_policy_6ghz_vlp *ptr = NULL;
struct rtw89_acpi_dsm_result res = {};
bool enable;
u8 index;
int ret;
u8 val;
if (skip_acpi_dsm)
return;
/* By default, allow 6 GHz VLP on all countries except US and CA. */
val = ~(RTW89_ACPI_CONF_6GHZ_VLP_US | RTW89_ACPI_CONF_6GHZ_VLP_CA);
ret = rtw89_acpi_evaluate_dsm(rtwdev, RTW89_ACPI_DSM_FUNC_6GHZ_VLP_SUP, &res);
if (ret) {
rtw89_debug(rtwdev, RTW89_DBG_REGD,
"acpi: cannot eval policy 6ghz-vlp: %d\n", ret);
goto bottom;
}
ptr = res.u.policy_6ghz_vlp;
Annotation
- Immediate include surface: `acpi.h`, `debug.h`, `ps.h`, `util.h`.
- Detected declarations: `function rtw89_regd_is_ww`, `function rtw89_regd_get_index`, `function rtw89_regd_get_index_by_name`, `function rtw89_regd_setup_unii4`, `function __rtw89_regd_setup_policy_6ghz`, `function rtw89_regd_setup_policy_6ghz`, `function rtw89_regd_setup_policy_6ghz_sp`, `function rtw89_regd_setup_policy_6ghz_vlp`, `function rtw89_regd_setup_6ghz`, `function rtw89_regd_setup_reg_rules`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.