drivers/net/wireless/mediatek/mt76/mt7915/soc.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt7915/soc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt7915/soc.c- Extension
.c- Size
- 32131 bytes
- Lines
- 1313
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/platform_device.hlinux/pinctrl/consumer.hlinux/of.hlinux/of_reserved_mem.hlinux/iopoll.hlinux/reset.hlinux/of_net.hlinux/clk.hmt7915.h
Detected Declarations
function mt76_wmac_spi_readfunction mt76_wmac_spi_writefunction mt76_wmac_spi_rmwfunction mt7986_wmac_adie_efuse_readfunction mt76_wmac_spi_lockfunction mt76_wmac_spi_unlockfunction mt76_wmac_rmwfunction mt798x_wmac_check_adie_typefunction mt7986_wmac_consys_resetfunction mt7986_wmac_gpio_setupfunction mt7986_wmac_consys_lockupfunction mt798x_wmac_coninfra_checkfunction mt798x_wmac_coninfra_setupfunction mt798x_wmac_sku_setupfunction mt7986_adie_idxfunction is_7975function is_7976function mt7986_wmac_adie_thermal_calfunction mt7986_read_efuse_xo_trim_7976function mt7986_wmac_adie_xtal_trim_7976function mt798x_wmac_adie_patch_7976function mt7986_read_efuse_xo_trim_7975function mt7986_wmac_adie_xtal_trim_7975function mt7986_wmac_adie_patch_7975function mt7986_wmac_adie_cfgfunction mt7986_wmac_afe_calfunction mt7986_wmac_subsys_pll_initialfunction mt7986_wmac_subsys_settingfunction mt7986_wmac_bus_timeoutfunction mt7986_wmac_clock_enablefunction mt7986_wmac_top_wfsys_wakeupfunction mt7986_wmac_wm_enablefunction mt7986_wmac_wfsys_poweronfunction mt7986_wmac_wfsys_settingfunction mt7986_wmac_wfsys_set_timeoutfunction mt7986_wmac_sku_updatefunction mt7986_wmac_adie_setupfunction mt7986_wmac_subsys_powerupfunction mt7986_wmac_wfsys_powerupfunction mt7986_wmac_enablefunction mt7986_wmac_disablefunction mt798x_wmac_initfunction mt798x_wmac_probefunction mt798x_wmac_remove
Annotated Snippet
if (is_mt7981(&dev->mt76)) {
rg_xo_01 = 0x1959c80f;
} else if (is_mt7986(&dev->mt76)) {
rg_xo_01 = 0x1959f80f;
} else {
WARN_ON(1);
return -EINVAL;
}
rg_xo_03 = 0x34d00fe0;
}
ret = mt76_wmac_spi_write(dev, adie, MT_ADIE_RG_XO_01, rg_xo_01);
if (ret)
return ret;
return mt76_wmac_spi_write(dev, adie, MT_ADIE_RG_XO_03, rg_xo_03);
}
static int
mt7986_read_efuse_xo_trim_7975(struct mt7915_dev *dev, u8 adie,
u32 addr, u32 *result)
{
int ret;
u32 data;
ret = mt7986_wmac_adie_efuse_read(dev, adie, addr, &data);
if (ret)
return ret;
if ((data & MT_ADIE_XO_TRIM_EN_MASK)) {
if ((data & MT_ADIE_XTAL_DECREASE_MASK))
*result -= (data & MT_ADIE_EFUSE_TRIM_MASK);
else
*result += (data & MT_ADIE_EFUSE_TRIM_MASK);
*result = (*result & MT_ADIE_TRIM_MASK);
}
return 0;
}
static int mt7986_wmac_adie_xtal_trim_7975(struct mt7915_dev *dev, u8 adie)
{
int ret;
u32 data, result = 0, value;
ret = mt7986_wmac_adie_efuse_read(dev, adie, MT_ADIE_7975_XTAL_EN,
&data);
if (ret || !(data & BIT(1)))
return 0;
ret = mt7986_wmac_adie_efuse_read(dev, adie, MT_ADIE_7975_XTAL_CAL,
&data);
if (ret)
return ret;
if (data & MT_ADIE_XO_TRIM_EN_MASK)
result = (data & MT_ADIE_TRIM_MASK);
ret = mt7986_read_efuse_xo_trim_7975(dev, adie, MT_ADIE_7975_XO_TRIM2,
&result);
if (ret)
return ret;
ret = mt7986_read_efuse_xo_trim_7975(dev, adie, MT_ADIE_7975_XO_TRIM3,
&result);
if (ret)
return ret;
ret = mt7986_read_efuse_xo_trim_7975(dev, adie, MT_ADIE_7975_XO_TRIM4,
&result);
if (ret)
return ret;
/* Update trim value to C1 and C2*/
value = FIELD_GET(MT_ADIE_7975_XO_CTRL2_C1_MASK, result) |
FIELD_GET(MT_ADIE_7975_XO_CTRL2_C2_MASK, result);
ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_7975_XO_CTRL2,
MT_ADIE_7975_XO_CTRL2_MASK, value);
if (ret)
return ret;
ret = mt76_wmac_spi_read(dev, adie, MT_ADIE_7975_XTAL, &value);
if (ret)
return ret;
if (value & MT_ADIE_7975_XTAL_EN_MASK) {
ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_7975_XO_2,
MT_ADIE_7975_XO_2_FIX_EN, 0x0);
if (ret)
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/platform_device.h`, `linux/pinctrl/consumer.h`, `linux/of.h`, `linux/of_reserved_mem.h`, `linux/iopoll.h`, `linux/reset.h`.
- Detected declarations: `function mt76_wmac_spi_read`, `function mt76_wmac_spi_write`, `function mt76_wmac_spi_rmw`, `function mt7986_wmac_adie_efuse_read`, `function mt76_wmac_spi_lock`, `function mt76_wmac_spi_unlock`, `function mt76_wmac_rmw`, `function mt798x_wmac_check_adie_type`, `function mt7986_wmac_consys_reset`, `function mt7986_wmac_gpio_setup`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.