drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt76x0/phy.c- Extension
.c- Size
- 30150 bytes
- Lines
- 1216
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/etherdevice.hmt76x0.hmcu.heeprom.hphy.hinitvals.hinitvals_phy.h../mt76x02_phy.h
Detected Declarations
function Copyrightfunction mt76x0_rf_csr_rrfunction mt76x0_rf_wrfunction mt76x0_rf_rrfunction mt76x0_rf_rmwfunction mt76x0_rf_setfunction mt76x0_rf_clearfunction mt76x0_phy_rf_csr_wr_rpfunction mt76x0_phy_wait_bbp_readyfunction mt76x0_phy_set_bandfunction mt76x0_phy_set_chan_rf_paramsfunction mt76x0_phy_set_chan_bbp_paramsfunction mt76x0_phy_ant_selectfunction mt76x0_phy_bbp_set_bwfunction mt76x0_phy_tssi_dc_calibratefunction mt76x0_phy_tssi_adc_calibratefunction mt76x0_phy_get_rf_pa_modefunction mt76x0_phy_get_target_powerfunction mt76x0_phy_lin2dbfunction mt76x0_phy_get_delta_powerfunction mt76x0_phy_tssi_calibratefunction mt76x0_phy_set_txpowerfunction mt76x0_phy_calibratefunction mt76x0_phy_set_channelfunction mt76x0_phy_temp_sensorfunction mt76x0_phy_set_gain_valfunction mt76x0_phy_update_channel_gainfunction mt76x0_phy_calibration_workfunction mt76x0_rf_patch_reg_arrayfunction mt76x0_phy_rf_initfunction mt76x0_phy_initexport mt76x0_phy_calibrate
Annotated Snippet
if (channel == mt76x0_sdm_channel[i]) {
b_sdm = true;
break;
}
}
for (i = 0; i < ARRAY_SIZE(mt76x0_frequency_plan); i++) {
if (channel == mt76x0_frequency_plan[i].channel) {
rf_band = mt76x0_frequency_plan[i].band;
if (b_sdm)
freq_item = &mt76x0_sdm_frequency_plan[i];
else
freq_item = &mt76x0_frequency_plan[i];
mt76x0_rf_wr(dev, MT_RF(0, 37), freq_item->pllR37);
mt76x0_rf_wr(dev, MT_RF(0, 36), freq_item->pllR36);
mt76x0_rf_wr(dev, MT_RF(0, 35), freq_item->pllR35);
mt76x0_rf_wr(dev, MT_RF(0, 34), freq_item->pllR34);
mt76x0_rf_wr(dev, MT_RF(0, 33), freq_item->pllR33);
mt76x0_rf_rmw(dev, MT_RF(0, 32), 0xe0,
freq_item->pllR32_b7b5);
/* R32<4:0> pll_den: (Denomina - 8) */
mt76x0_rf_rmw(dev, MT_RF(0, 32), MT_RF_PLL_DEN_MASK,
freq_item->pllR32_b4b0);
/* R31<7:5> */
mt76x0_rf_rmw(dev, MT_RF(0, 31), 0xe0,
freq_item->pllR31_b7b5);
/* R31<4:0> pll_k(Nominator) */
mt76x0_rf_rmw(dev, MT_RF(0, 31), MT_RF_PLL_K_MASK,
freq_item->pllR31_b4b0);
/* R30<7> sdm_reset_n */
if (b_sdm) {
mt76x0_rf_clear(dev, MT_RF(0, 30),
MT_RF_SDM_RESET_MASK);
mt76x0_rf_set(dev, MT_RF(0, 30),
MT_RF_SDM_RESET_MASK);
} else {
mt76x0_rf_rmw(dev, MT_RF(0, 30),
MT_RF_SDM_RESET_MASK,
freq_item->pllR30_b7);
}
/* R30<6:2> sdmmash_prbs,sin */
mt76x0_rf_rmw(dev, MT_RF(0, 30),
MT_RF_SDM_MASH_PRBS_MASK,
freq_item->pllR30_b6b2);
/* R30<1> sdm_bp */
mt76x0_rf_rmw(dev, MT_RF(0, 30), MT_RF_SDM_BP_MASK,
freq_item->pllR30_b1 << 1);
/* R30<0> R29<7:0> (hex) pll_n */
mt76x0_rf_wr(dev, MT_RF(0, 29),
freq_item->pll_n & 0xff);
mt76x0_rf_rmw(dev, MT_RF(0, 30), 0x1,
(freq_item->pll_n >> 8) & 0x1);
/* R28<7:6> isi_iso */
mt76x0_rf_rmw(dev, MT_RF(0, 28), MT_RF_ISI_ISO_MASK,
freq_item->pllR28_b7b6);
/* R28<5:4> pfd_dly */
mt76x0_rf_rmw(dev, MT_RF(0, 28), MT_RF_PFD_DLY_MASK,
freq_item->pllR28_b5b4);
/* R28<3:2> clksel option */
mt76x0_rf_rmw(dev, MT_RF(0, 28), MT_RF_CLK_SEL_MASK,
freq_item->pllR28_b3b2);
/* R28<1:0> R27<7:0> R26<7:0> (hex) sdm_k */
mt76x0_rf_wr(dev, MT_RF(0, 26),
freq_item->pll_sdm_k & 0xff);
mt76x0_rf_wr(dev, MT_RF(0, 27),
(freq_item->pll_sdm_k >> 8) & 0xff);
mt76x0_rf_rmw(dev, MT_RF(0, 28), 0x3,
(freq_item->pll_sdm_k >> 16) & 0x3);
/* R24<1:0> xo_div */
mt76x0_rf_rmw(dev, MT_RF(0, 24), MT_RF_XO_DIV_MASK,
freq_item->pllR24_b1b0);
break;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/etherdevice.h`, `mt76x0.h`, `mcu.h`, `eeprom.h`, `phy.h`, `initvals.h`, `initvals_phy.h`.
- Detected declarations: `function Copyright`, `function mt76x0_rf_csr_rr`, `function mt76x0_rf_wr`, `function mt76x0_rf_rr`, `function mt76x0_rf_rmw`, `function mt76x0_rf_set`, `function mt76x0_rf_clear`, `function mt76x0_phy_rf_csr_wr_rp`, `function mt76x0_phy_wait_bbp_ready`, `function mt76x0_phy_set_band`.
- 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.