drivers/net/wireless/mediatek/mt76/mt792x_core.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt792x_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt792x_core.c- Extension
.c- Size
- 27392 bytes
- Lines
- 1045
- 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.
- 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
linux/module.hlinux/firmware.hmt792x.hdma.h
Detected Declarations
function mt792x_txfunction mt792x_stopfunction mt792x_mac_link_bss_removefunction mt792x_remove_interfacefunction mt792x_conf_txfunction mt792x_get_statsfunction mt792x_get_tsffunction mt792x_set_tsffunction mt792x_tx_workerfunction mt792x_roc_timerfunction mt792x_csa_timerfunction mt792x_flushfunction mt792x_get_txpowerfunction mt792x_assign_vif_chanctxfunction mt792x_unassign_vif_chanctxfunction mt792x_set_wakeupfunction mt792x_get_et_stringsfunction mt792x_get_et_sset_countfunction mt792x_ethtool_workerfunction mt792x_get_et_statsfunction mt792x_sta_statisticsfunction mt792x_set_coverage_classfunction mt792x_init_wiphyfunction mt792x_get_offload_capabilityfunction mt792x_needs_cnm_runtimefunction mt792x_get_mac80211_opsfunction mt792x_init_wcidfunction mt792x_mcu_drv_pmctrlfunction mt792x_mcu_fw_pmctrlfunction __mt792xe_mcu_drv_pmctrlfunction mt792xe_mcu_drv_pmctrlfunction mt792xe_mcu_fw_pmctrlfunction mt792x_load_firmwarefunction mt792x_config_mac_addr_listexport mt792x_txexport mt792x_stopexport mt792x_mac_link_bss_removeexport mt792x_remove_interfaceexport mt792x_conf_txexport mt792x_get_statsexport mt792x_get_tsfexport mt792x_set_tsfexport mt792x_tx_workerexport mt792x_roc_timerexport mt792x_csa_timerexport mt792x_flushexport mt792x_get_txpowerexport mt792x_assign_vif_chanctx
Annotated Snippet
if (rel_info->tag == MT792x_FW_TAG_FEATURE) {
struct mt792x_fw_features *features;
features = (struct mt792x_fw_features *)data;
offload_caps = features->data;
break;
}
data += le16_to_cpu(rel_info->len) + rel_info->pad_len;
}
out:
release_firmware(fw);
return offload_caps;
}
static bool mt792x_needs_cnm_runtime(const void *drv_data)
{
const char *fw_wm = drv_data;
return fw_wm && !strcmp(fw_wm, MT7927_FIRMWARE_WM);
}
struct ieee80211_ops *
mt792x_get_mac80211_ops(struct device *dev,
const struct ieee80211_ops *mac80211_ops,
void *drv_data, u8 *fw_features)
{
struct ieee80211_ops *ops;
ops = devm_kmemdup(dev, mac80211_ops, sizeof(struct ieee80211_ops),
GFP_KERNEL);
if (!ops)
return NULL;
*fw_features = mt792x_get_offload_capability(dev, drv_data);
if (mt792x_needs_cnm_runtime(drv_data))
*fw_features |= MT792x_FW_CAP_CNM;
if (!(*fw_features & MT792x_FW_CAP_CNM)) {
ops->remain_on_channel = NULL;
ops->cancel_remain_on_channel = NULL;
ops->add_chanctx = ieee80211_emulate_add_chanctx;
ops->remove_chanctx = ieee80211_emulate_remove_chanctx;
ops->change_chanctx = ieee80211_emulate_change_chanctx;
ops->switch_vif_chanctx = ieee80211_emulate_switch_vif_chanctx;
ops->assign_vif_chanctx = NULL;
ops->unassign_vif_chanctx = NULL;
ops->mgd_prepare_tx = NULL;
ops->mgd_complete_tx = NULL;
}
return ops;
}
EXPORT_SYMBOL_GPL(mt792x_get_mac80211_ops);
int mt792x_init_wcid(struct mt792x_dev *dev)
{
int idx;
/* Beacon and mgmt frames should occupy wcid 0 */
idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1);
if (idx)
return -ENOSPC;
dev->mt76.global_wcid.idx = idx;
dev->mt76.global_wcid.hw_key_idx = -1;
dev->mt76.global_wcid.tx_info |= MT_WCID_TX_INFO_SET;
rcu_assign_pointer(dev->mt76.wcid[idx], &dev->mt76.global_wcid);
return 0;
}
EXPORT_SYMBOL_GPL(mt792x_init_wcid);
int mt792x_mcu_drv_pmctrl(struct mt792x_dev *dev)
{
struct mt76_phy *mphy = &dev->mt76.phy;
struct mt76_connac_pm *pm = &dev->pm;
int err = 0;
mutex_lock(&pm->mutex);
if (!test_bit(MT76_STATE_PM, &mphy->state))
goto out;
err = __mt792x_mcu_drv_pmctrl(dev);
out:
mutex_unlock(&pm->mutex);
Annotation
- Immediate include surface: `linux/module.h`, `linux/firmware.h`, `mt792x.h`, `dma.h`.
- Detected declarations: `function mt792x_tx`, `function mt792x_stop`, `function mt792x_mac_link_bss_remove`, `function mt792x_remove_interface`, `function mt792x_conf_tx`, `function mt792x_get_stats`, `function mt792x_get_tsf`, `function mt792x_set_tsf`, `function mt792x_tx_worker`, `function mt792x_roc_timer`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.