drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c- Extension
.c- Size
- 102526 bytes
- Lines
- 4004
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/firmware.hmt7925.hregd.hmcu.hmac.h
Detected Declarations
struct uni_cmd_access_reg_basicstruct uni_cmd_access_rf_reg_basicstruct mt7925_mcu_txs_eventstruct mt7925_uni_debug_msgstruct idxlogstruct txtlogstruct evtstruct mt7925_thermal_evtstruct mt7925_mcu_phy_capstruct mt7925_mcu_eml_capstruct mt76_connac_cap_hdrstruct roc_abort_tlvstruct ps_tlvstruct bcnft_tlvstruct bcnft_tlvstruct pm_disablestruct sta_rec_state_v2struct sniffer_enable_tlvstruct config_tlvstruct req_hdrstruct bcn_content_tlvstruct bss_sec_tlvstruct req_tlvstruct scan_hdrstruct scan_cancel_tlvstruct n_chanstruct mt76_connac_mcu_chanstruct mt7925_radio_status_eventfunction mt7925_mcu_parse_responsefunction mt7925_mcu_regvalfunction mt7925_mcu_update_arp_filterfunction mt7925_connac_mcu_set_wow_ctrlfunction mt7925_mcu_set_wow_patternfunction mt7925_mcu_set_suspend_iterfunction mt7925_mcu_connection_loss_iterfunction mt7925_mcu_connection_loss_eventfunction mt7925_mcu_roc_iterfunction mt7925_mcu_roc_handle_grantfunction mt7925_mcu_handle_hif_ctrl_basicfunction mt7925_mcu_uni_hif_ctrl_eventfunction mt7925_mcu_uni_roc_eventfunction mt7925_mcu_scan_eventfunction mt7925_mcu_tx_done_eventfunction mt7925_mcu_rssi_monitor_iterfunction mt7925_mcu_rssi_monitor_eventfunction mt7925_mcu_uni_debug_msg_eventfunction mt7925_mcu_handle_mbmc_eventfunction mt7925_mcu_uni_rx_unsolicited_event
Annotated Snippet
struct uni_cmd_access_reg_basic {
__le16 tag;
__le16 len;
__le32 idx;
__le32 data;
} __packed reg;
struct uni_cmd_access_rf_reg_basic {
__le16 tag;
__le16 len;
__le16 ant;
u8 __rsv[2];
__le32 idx;
__le32 data;
} __packed rf_reg;
};
} __packed * res, req;
struct sk_buff *skb;
int ret;
if (u32_get_bits(regidx, MT_RF_REG_HDR) == RF_REG_PREFIX) {
req.rf_reg.tag = cpu_to_le16(UNI_CMD_ACCESS_RF_REG_BASIC);
req.rf_reg.len = cpu_to_le16(sizeof(req.rf_reg));
req.rf_reg.ant = cpu_to_le16(u32_get_bits(regidx, MT_RF_REG_ANT));
req.rf_reg.idx = cpu_to_le32(regidx);
req.rf_reg.data = set ? cpu_to_le32(*val) : 0;
} else {
req.reg.tag = cpu_to_le16(UNI_CMD_ACCESS_REG_BASIC);
req.reg.len = cpu_to_le16(sizeof(req.reg));
req.reg.idx = cpu_to_le32(regidx);
req.reg.data = set ? cpu_to_le32(*val) : 0;
}
if (set)
return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(REG_ACCESS),
&req, sizeof(req), true);
ret = mt76_mcu_send_and_get_msg(&dev->mt76,
MCU_WM_UNI_CMD_QUERY(REG_ACCESS),
&req, sizeof(req), true, &skb);
if (ret)
return ret;
res = (void *)skb->data;
if (u32_get_bits(regidx, MT_RF_REG_HDR) == RF_REG_PREFIX)
*val = le32_to_cpu(res->rf_reg.data);
else
*val = le32_to_cpu(res->reg.data);
dev_kfree_skb(skb);
return 0;
}
EXPORT_SYMBOL_GPL(mt7925_mcu_regval);
int mt7925_mcu_update_arp_filter(struct mt76_dev *dev,
struct ieee80211_bss_conf *link_conf)
{
struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf);
struct ieee80211_vif *mvif = link_conf->vif;
struct sk_buff *skb;
int i, len = min_t(int, mvif->cfg.arp_addr_cnt,
IEEE80211_BSS_ARP_ADDR_LIST_LEN);
struct {
struct {
u8 bss_idx;
u8 pad[3];
} __packed hdr;
struct mt7925_arpns_tlv arp;
} req = {
.hdr = {
.bss_idx = mconf->mt76.idx,
},
.arp = {
.tag = cpu_to_le16(UNI_OFFLOAD_OFFLOAD_ARP),
.len = cpu_to_le16(sizeof(req) - 4 + len * 2 * sizeof(__be32)),
.ips_num = len,
.enable = true,
},
};
skb = mt76_mcu_msg_alloc(dev, NULL, sizeof(req) + len * 2 * sizeof(__be32));
if (!skb)
return -ENOMEM;
skb_put_data(skb, &req, sizeof(req));
for (i = 0; i < len; i++) {
skb_put_data(skb, &mvif->cfg.arp_addr_list[i], sizeof(__be32));
skb_put_zero(skb, sizeof(__be32));
}
Annotation
- Immediate include surface: `linux/fs.h`, `linux/firmware.h`, `mt7925.h`, `regd.h`, `mcu.h`, `mac.h`.
- Detected declarations: `struct uni_cmd_access_reg_basic`, `struct uni_cmd_access_rf_reg_basic`, `struct mt7925_mcu_txs_event`, `struct mt7925_uni_debug_msg`, `struct idxlog`, `struct txtlog`, `struct evt`, `struct mt7925_thermal_evt`, `struct mt7925_mcu_phy_cap`, `struct mt7925_mcu_eml_cap`.
- 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.