drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c- Extension
.c- Size
- 88283 bytes
- Lines
- 3304
- 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/firmware.hmt76_connac2_mac.hmt76_connac_mcu.hmt792x_regs.h
Detected Declarations
struct mt76_connac_mcu_channel_domainstruct mt76_connac_mcu_chanstruct req_tlvstruct rlm_tlvstruct req_hdrstruct hif_suspend_tlvfunction mt76_connac_mcu_start_firmwarefunction mt76_connac_mcu_patch_sem_ctrlfunction mt76_connac_mcu_start_patchfunction mt76_connac_mcu_init_downloadfunction mt76_connac_mcu_set_channel_domainfunction mt76_connac_mcu_set_mac_enablefunction mt76_connac_mcu_set_vif_psfunction mt76_connac_mcu_set_rts_threshfunction mt76_connac_mcu_beacon_loss_iterfunction mt76_connac_mcu_add_nested_tlvfunction __mt76_connac_mcu_alloc_sta_reqfunction mt76_connac_mcu_alloc_wtbl_reqfunction mt76_connac_mcu_bss_omac_tlvfunction mt76_connac_mcu_sta_basic_tlvfunction mt76_connac_mcu_sta_uapsdfunction mt76_connac_mcu_wtbl_hdr_trans_tlvfunction mt76_connac_mcu_sta_update_hdr_transfunction mt76_connac_mcu_wtbl_update_hdr_transfunction mt76_connac_mcu_wtbl_generic_tlvfunction mt76_connac_mcu_sta_amsdu_tlvfunction mt76_connac_mcu_sta_he_tlvfunction mt76_connac_mcu_sta_he_tlv_v2function mt76_connac_get_phy_mode_v2function mt76_connac_mcu_sta_tlvfunction mt76_connac_mcu_wtbl_smps_tlvfunction mt76_connac_mcu_wtbl_ht_tlvfunction mt76_connac_mcu_sta_cmdfunction mt76_connac_mcu_wtbl_ba_tlvfunction mt76_connac_mcu_uni_add_devfunction mt76_connac_mcu_sta_ba_tlvfunction mt76_connac_mcu_sta_wed_updatefunction mt76_connac_mcu_sta_bafunction mt76_connac_get_phy_modefunction mt76_connac_get_phy_mode_extfunction mt76_connac_get_he_phy_capfunction mt76_connac_get_eht_phy_capfunction mt76_connac_mcu_uni_bss_he_tlvfunction mt76_connac_mcu_uni_set_chctxfunction mt76_connac_mcu_uni_add_bssfunction mt76_connac_mcu_build_rnr_scan_paramfunction mt76_connac_mcu_hw_scanfunction mt76_connac_mcu_cancel_hw_scan
Annotated Snippet
struct mt76_connac_mcu_channel_domain {
u8 alpha2[4]; /* regulatory_request.alpha2 */
u8 bw_2g; /* BW_20_40M 0
* BW_20M 1
* BW_20_40_80M 2
* BW_20_40_80_160M 3
* BW_20_40_80_8080M 4
*/
u8 bw_5g;
u8 bw_6g;
u8 pad;
u8 n_2ch;
u8 n_5ch;
u8 n_6ch;
u8 pad2;
} __packed hdr = {
.bw_2g = 0,
.bw_5g = 3, /* BW_20_40_80_160M */
.bw_6g = 3,
};
struct mt76_connac_mcu_chan {
__le16 hw_value;
__le16 pad;
__le32 flags;
} __packed channel;
struct mt76_dev *dev = phy->dev;
struct ieee80211_channel *chan;
struct sk_buff *skb;
n_max_channels = phy->sband_2g.sband.n_channels +
phy->sband_5g.sband.n_channels +
phy->sband_6g.sband.n_channels;
len = sizeof(hdr) + n_max_channels * sizeof(channel);
skb = mt76_mcu_msg_alloc(dev, NULL, len);
if (!skb)
return -ENOMEM;
skb_reserve(skb, sizeof(hdr));
for (i = 0; i < phy->sband_2g.sband.n_channels; i++) {
chan = &phy->sband_2g.sband.channels[i];
if (chan->flags & IEEE80211_CHAN_DISABLED)
continue;
channel.hw_value = cpu_to_le16(chan->hw_value);
channel.flags = cpu_to_le32(chan->flags);
channel.pad = 0;
skb_put_data(skb, &channel, sizeof(channel));
n_2ch++;
}
for (i = 0; i < phy->sband_5g.sband.n_channels; i++) {
chan = &phy->sband_5g.sband.channels[i];
if (chan->flags & IEEE80211_CHAN_DISABLED)
continue;
channel.hw_value = cpu_to_le16(chan->hw_value);
channel.flags = cpu_to_le32(chan->flags);
channel.pad = 0;
skb_put_data(skb, &channel, sizeof(channel));
n_5ch++;
}
for (i = 0; i < phy->sband_6g.sband.n_channels; i++) {
chan = &phy->sband_6g.sband.channels[i];
if (chan->flags & IEEE80211_CHAN_DISABLED)
continue;
channel.hw_value = cpu_to_le16(chan->hw_value);
channel.flags = cpu_to_le32(chan->flags);
channel.pad = 0;
skb_put_data(skb, &channel, sizeof(channel));
n_6ch++;
}
BUILD_BUG_ON(sizeof(dev->alpha2) > sizeof(hdr.alpha2));
memcpy(hdr.alpha2, dev->alpha2, sizeof(dev->alpha2));
hdr.n_2ch = n_2ch;
hdr.n_5ch = n_5ch;
hdr.n_6ch = n_6ch;
memcpy(__skb_push(skb, sizeof(hdr)), &hdr, sizeof(hdr));
return mt76_mcu_skb_send_msg(dev, skb, MCU_CE_CMD(SET_CHAN_DOMAIN),
false);
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_channel_domain);
Annotation
- Immediate include surface: `linux/firmware.h`, `mt76_connac2_mac.h`, `mt76_connac_mcu.h`, `mt792x_regs.h`.
- Detected declarations: `struct mt76_connac_mcu_channel_domain`, `struct mt76_connac_mcu_chan`, `struct req_tlv`, `struct rlm_tlv`, `struct req_hdr`, `struct hif_suspend_tlv`, `function mt76_connac_mcu_start_firmware`, `function mt76_connac_mcu_patch_sem_ctrl`, `function mt76_connac_mcu_start_patch`, `function mt76_connac_mcu_init_download`.
- 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.