drivers/net/wireless/mediatek/mt76/mt7925/regd.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt7925/regd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt7925/regd.c- Extension
.c- Size
- 6288 bytes
- Lines
- 267
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
mt7925.hregd.hmcu.h
Detected Declarations
function mt7925_regd_clc_supportedfunction mt7925_regd_be_ctrlfunction mt7925_regd_channel_updatefunction mt7925_mcu_regd_updatefunction mt7925_regd_notifierfunction mt7925_regd_is_valid_alpha2function mt7925_regd_changefunction mt7925_regd_initexport mt7925_mcu_regd_updateexport mt7925_regd_change
Annotated Snippet
// SPDX-License-Identifier: BSD-3-Clause-Clear
/* Copyright (C) 2025 MediaTek Inc. */
#include "mt7925.h"
#include "regd.h"
#include "mcu.h"
static bool mt7925_disable_clc;
module_param_named(disable_clc, mt7925_disable_clc, bool, 0644);
MODULE_PARM_DESC(disable_clc, "disable CLC support");
bool mt7925_regd_clc_supported(struct mt792x_dev *dev)
{
if (mt7925_disable_clc ||
mt76_is_usb(&dev->mt76))
return false;
return true;
}
void mt7925_regd_be_ctrl(struct mt792x_dev *dev, u8 *alpha2)
{
struct mt792x_phy *phy = &dev->phy;
struct mt7925_clc_rule_v2 *rule;
struct mt7925_clc *clc;
bool old = dev->has_eht, new = true;
u32 mtcl_conf = mt792x_acpi_get_mtcl_conf(&dev->phy, alpha2);
u8 *pos;
if (mtcl_conf != MT792X_ACPI_MTCL_INVALID &&
(((mtcl_conf >> 4) & 0x3) == 0)) {
new = false;
goto out;
}
if (!phy->clc[MT792x_CLC_BE_CTRL])
goto out;
clc = (struct mt7925_clc *)phy->clc[MT792x_CLC_BE_CTRL];
pos = clc->data;
while (1) {
rule = (struct mt7925_clc_rule_v2 *)pos;
if (rule->alpha2[0] == alpha2[0] &&
rule->alpha2[1] == alpha2[1]) {
new = false;
break;
}
/* Check the last one */
if (rule->flag & BIT(0))
break;
pos += sizeof(*rule);
}
out:
if (old == new)
return;
dev->has_eht = new;
mt7925_set_stream_he_eht_caps(phy);
}
static void
mt7925_regd_channel_update(struct wiphy *wiphy, struct mt792x_dev *dev)
{
#define IS_UNII_INVALID(idx, sfreq, efreq, cfreq) \
(!(dev->phy.clc_chan_conf & BIT(idx)) && (cfreq) >= (sfreq) && (cfreq) <= (efreq))
#define MT7925_UNII_59G_IS_VALID 0x1
#define MT7925_UNII_6G_IS_VALID 0x1e
struct ieee80211_supported_band *sband;
struct mt76_dev *mdev = &dev->mt76;
struct ieee80211_channel *ch;
u32 mtcl_conf = mt792x_acpi_get_mtcl_conf(&dev->phy, mdev->alpha2);
int i;
if (mtcl_conf != MT792X_ACPI_MTCL_INVALID) {
if ((mtcl_conf & 0x3) == 0)
dev->phy.clc_chan_conf &= ~MT7925_UNII_59G_IS_VALID;
if (((mtcl_conf >> 2) & 0x3) == 0)
dev->phy.clc_chan_conf &= ~MT7925_UNII_6G_IS_VALID;
}
sband = wiphy->bands[NL80211_BAND_2GHZ];
if (!sband)
return;
for (i = 0; i < sband->n_channels; i++) {
Annotation
- Immediate include surface: `mt7925.h`, `regd.h`, `mcu.h`.
- Detected declarations: `function mt7925_regd_clc_supported`, `function mt7925_regd_be_ctrl`, `function mt7925_regd_channel_update`, `function mt7925_mcu_regd_update`, `function mt7925_regd_notifier`, `function mt7925_regd_is_valid_alpha2`, `function mt7925_regd_change`, `function mt7925_regd_init`, `export mt7925_mcu_regd_update`, `export mt7925_regd_change`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
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.