drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c- Extension
.c- Size
- 10358 bytes
- Lines
- 416
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hmt7996.heeprom.h
Detected Declarations
function Copyrightfunction mt7996_eeprom_parse_streamfunction mt7996_eeprom_variant_validfunction mt7996_eeprom_check_or_use_defaultfunction mt7996_eeprom_loadfunction mt7996_check_eepromfunction mt7996_eeprom_parse_efuse_hw_capfunction mt7996_eeprom_parse_band_configfunction mt7996_eeprom_parse_hw_capfunction mt7996_eeprom_initfunction mt7996_eeprom_get_target_powerfunction mt7996_eeprom_get_power_deltafunction mt7996_eeprom_has_background_radar
Annotated Snippet
switch (dev->var.type) {
case MT7992_VAR_TYPE_23:
if (dev->var.fem == MT7996_FEM_INT)
return MT7992_EEPROM_DEFAULT_23_INT;
return MT7992_EEPROM_DEFAULT_23;
case MT7992_VAR_TYPE_24:
return MT7992_EEPROM_DEFAULT_24;
case MT7992_VAR_TYPE_44:
default:
if (dev->var.fem == MT7996_FEM_INT)
return MT7992_EEPROM_DEFAULT_INT;
if (dev->var.fem == MT7996_FEM_MIX)
return MT7992_EEPROM_DEFAULT_MIX;
return MT7992_EEPROM_DEFAULT;
}
case MT7990_DEVICE_ID:
if (dev->var.fem == MT7996_FEM_INT)
return MT7990_EEPROM_DEFAULT_INT;
return MT7990_EEPROM_DEFAULT;
case MT7996_DEVICE_ID:
default:
switch (dev->var.type) {
case MT7996_VAR_TYPE_233:
if (dev->var.fem == MT7996_FEM_INT)
return MT7996_EEPROM_DEFAULT_233_INT;
return MT7996_EEPROM_DEFAULT_233;
case MT7996_VAR_TYPE_444:
default:
if (dev->var.fem == MT7996_FEM_INT)
return MT7996_EEPROM_DEFAULT_INT;
return MT7996_EEPROM_DEFAULT;
}
}
}
static void
mt7996_eeprom_parse_stream(const u8 *eeprom, u8 band_idx, u8 *path,
u8 *rx_path, u8 *nss)
{
switch (band_idx) {
case MT_BAND1:
*path = FIELD_GET(MT_EE_WIFI_CONF2_TX_PATH_BAND1,
eeprom[MT_EE_WIFI_CONF + 2]);
*rx_path = FIELD_GET(MT_EE_WIFI_CONF3_RX_PATH_BAND1,
eeprom[MT_EE_WIFI_CONF + 3]);
*nss = FIELD_GET(MT_EE_WIFI_CONF5_STREAM_NUM_BAND1,
eeprom[MT_EE_WIFI_CONF + 5]);
break;
case MT_BAND2:
*path = FIELD_GET(MT_EE_WIFI_CONF2_TX_PATH_BAND2,
eeprom[MT_EE_WIFI_CONF + 2]);
*rx_path = FIELD_GET(MT_EE_WIFI_CONF4_RX_PATH_BAND2,
eeprom[MT_EE_WIFI_CONF + 4]);
*nss = FIELD_GET(MT_EE_WIFI_CONF5_STREAM_NUM_BAND2,
eeprom[MT_EE_WIFI_CONF + 5]);
break;
default:
*path = FIELD_GET(MT_EE_WIFI_CONF1_TX_PATH_BAND0,
eeprom[MT_EE_WIFI_CONF + 1]);
*rx_path = FIELD_GET(MT_EE_WIFI_CONF3_RX_PATH_BAND0,
eeprom[MT_EE_WIFI_CONF + 3]);
*nss = FIELD_GET(MT_EE_WIFI_CONF4_STREAM_NUM_BAND0,
eeprom[MT_EE_WIFI_CONF + 4]);
break;
}
}
static bool mt7996_eeprom_variant_valid(struct mt7996_dev *dev, const u8 *def)
{
#define FEM_INT 0
#define FEM_EXT 3
u8 *eeprom = dev->mt76.eeprom.data, fem[2];
int i;
for (i = 0; i < 2; i++)
fem[i] = u8_get_bits(eeprom[MT_EE_WIFI_CONF + 6 + i],
MT_EE_WIFI_PA_LNA_CONFIG);
if (dev->var.fem == MT7996_FEM_EXT &&
!(fem[0] == FEM_EXT && fem[1] == FEM_EXT))
return false;
else if (dev->var.fem == MT7996_FEM_INT &&
!(fem[0] == FEM_INT && fem[1] == FEM_INT))
return false;
else if (dev->var.fem == MT7996_FEM_MIX &&
!(fem[0] == FEM_INT && fem[1] == FEM_EXT))
return false;
for (i = 0; i < __MT_MAX_BAND; i++) {
u8 path, rx_path, nss;
Annotation
- Immediate include surface: `linux/firmware.h`, `mt7996.h`, `eeprom.h`.
- Detected declarations: `function Copyright`, `function mt7996_eeprom_parse_stream`, `function mt7996_eeprom_variant_valid`, `function mt7996_eeprom_check_or_use_default`, `function mt7996_eeprom_load`, `function mt7996_check_eeprom`, `function mt7996_eeprom_parse_efuse_hw_cap`, `function mt7996_eeprom_parse_band_config`, `function mt7996_eeprom_parse_hw_cap`, `function mt7996_eeprom_init`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.