drivers/net/wireless/mediatek/mt76/eeprom.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/eeprom.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/eeprom.c- Extension
.c- Size
- 12926 bytes
- Lines
- 532
- 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.
- 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/of.hlinux/of_net.hlinux/mtd/mtd.hlinux/mtd/partitions.hlinux/nvmem-consumer.hlinux/etherdevice.hmt76.hmt76_connac.h
Detected Declarations
enum mt76_sku_typefunction mt76_get_of_eeprom_datafunction mt76_get_of_data_from_mtdfunction mt76_get_of_data_from_nvmemfunction mt76_get_of_eepromfunction mt76_eeprom_overridefunction mt76_string_prop_findfunction mt76_find_power_limits_nodefunction for_each_child_of_nodefunction mt76_get_of_arrayfunction mt76_get_of_array_s8function mt76_find_channel_nodefunction for_each_child_of_nodefunction mt76_get_txs_deltafunction mt76_backoff_n_chainsfunction mt76_apply_array_limitfunction mt76_apply_multi_array_limitfunction mt76_get_rate_power_limitsfunction mt76_eeprom_initexport mt76_get_of_data_from_mtdexport mt76_get_of_data_from_nvmemexport mt76_eeprom_overrideexport mt76_find_power_limits_nodeexport mt76_find_channel_nodeexport mt76_get_rate_power_limitsexport mt76_eeprom_init
Annotated Snippet
if (!country && !regd) {
fallback = cur;
continue;
}
if (mt76_string_prop_find(country, dev->alpha2) ||
mt76_string_prop_find(regd, region_name)) {
of_node_put(np);
return cur;
}
}
of_node_put(np);
return fallback;
}
EXPORT_SYMBOL_GPL(mt76_find_power_limits_node);
static const __be32 *
mt76_get_of_array(struct device_node *np, char *name, size_t *len, int min)
{
struct property *prop = of_find_property(np, name, NULL);
if (!prop || !prop->value || prop->length < min * 4)
return NULL;
*len = prop->length;
return prop->value;
}
static const s8 *
mt76_get_of_array_s8(struct device_node *np, char *name, size_t *len, int min)
{
struct property *prop = of_find_property(np, name, NULL);
if (!prop || !prop->value || prop->length < min)
return NULL;
*len = prop->length;
return prop->value;
}
struct device_node *
mt76_find_channel_node(struct device_node *np, struct ieee80211_channel *chan)
{
struct device_node *cur;
const __be32 *val;
size_t len;
for_each_child_of_node(np, cur) {
val = mt76_get_of_array(cur, "channels", &len, 2);
if (!val)
continue;
while (len >= 2 * sizeof(*val)) {
if (chan->hw_value >= be32_to_cpu(val[0]) &&
chan->hw_value <= be32_to_cpu(val[1]))
return cur;
val += 2;
len -= 2 * sizeof(*val);
}
}
return NULL;
}
EXPORT_SYMBOL_GPL(mt76_find_channel_node);
static s8
mt76_get_txs_delta(struct device_node *np, u8 nss)
{
const __be32 *val;
size_t len;
val = mt76_get_of_array(np, "txs-delta", &len, nss);
if (!val)
return 0;
return be32_to_cpu(val[nss - 1]);
}
static inline u8 mt76_backoff_n_chains(struct mt76_dev *dev, u8 idx)
{
/* 0:1T1ss, 1:2T1ss, ..., 14:5T5ss */
static const u8 connac3_table[] = {
1, 2, 3, 4, 5, 2, 3, 4, 5, 3, 4, 5, 4, 5, 5};
static const u8 connac2_table[] = {
1, 2, 3, 4, 2, 3, 4, 3, 4, 4, 0, 0, 0, 0, 0};
Annotation
- Immediate include surface: `linux/of.h`, `linux/of_net.h`, `linux/mtd/mtd.h`, `linux/mtd/partitions.h`, `linux/nvmem-consumer.h`, `linux/etherdevice.h`, `mt76.h`, `mt76_connac.h`.
- Detected declarations: `enum mt76_sku_type`, `function mt76_get_of_eeprom_data`, `function mt76_get_of_data_from_mtd`, `function mt76_get_of_data_from_nvmem`, `function mt76_get_of_eeprom`, `function mt76_eeprom_override`, `function mt76_string_prop_find`, `function mt76_find_power_limits_node`, `function for_each_child_of_node`, `function mt76_get_of_array`.
- 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.