drivers/net/wireless/ath/ath9k/ar9003_phy.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath9k/ar9003_phy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath9k/ar9003_phy.c- Extension
.c- Size
- 62888 bytes
- Lines
- 2169
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/export.hhw.har9003_phy.har9003_eeprom.h
Detected Declarations
function ar9003_hw_set_channelfunction ar9003_hw_spur_mitigate_mrc_cckfunction ar9003_hw_spur_ofdm_clearfunction ar9003_hw_spur_ofdmfunction ar9003_hw_spur_ofdm_9565function ar9003_hw_spur_ofdm_workfunction ar9003_hw_spur_mitigate_ofdmfunction ar9003_hw_spur_mitigatefunction ar9003_hw_compute_pll_control_socfunction ar9003_hw_compute_pll_controlfunction ar9003_hw_set_channel_regsfunction ar9003_hw_init_bbfunction ar9003_hw_set_chain_masksfunction ar9003_hw_override_inifunction ar9003_hw_prog_inifunction ar9550_hw_get_modes_txgain_indexfunction ar9561_hw_get_modes_txgain_indexfunction ar9003_doubler_fixfunction ar9003_hw_process_inifunction ar9003_hw_set_rfmodefunction ar9003_hw_mark_phy_inactivefunction ar9003_hw_set_delta_slopefunction ar9003_hw_rfbus_reqfunction settlefunction ar9003_hw_ani_controlfunction ar9003_hw_do_getnffunction ar9003_hw_set_nf_limitsfunction defaultfunction ar9003_hw_set_radar_paramsfunction ar9003_hw_set_radar_conffunction ar9003_hw_antdiv_comb_conf_getfunction ar9003_hw_antdiv_comb_conf_setfunction ar9003_hw_set_bt_ant_diversityfunction ar9003_hw_fast_chan_changefunction ar9003_hw_spectral_scan_configfunction ar9003_hw_spectral_scan_triggerfunction ar9003_hw_spectral_scan_waitfunction ar9003_hw_tx99_startfunction ar9003_hw_tx99_stopfunction ar9003_hw_tx99_set_txpowerfunction ar9003_hw_init_txpower_cckfunction ar9003_hw_init_txpower_ofdmfunction ar9003_hw_init_txpower_htfunction ar9003_hw_init_txpower_stbcfunction ar9003_hw_init_rate_txpowerfunction ar9003_hw_attach_phy_opsfunction ar9003_hw_bb_watchdog_checkfunction ar9003_hw_bb_watchdog_config
Annotated Snippet
AR_SREV_9561(ah) || AR_SREV_9565(ah)) {
if (ah->is_clk_25mhz)
div = 75;
else
div = 120;
channelSel = (freq * 4) / div;
chan_frac = (((freq * 4) % div) * 0x20000) / div;
channelSel = (channelSel << 17) | chan_frac;
} else if (AR_SREV_9340(ah)) {
if (ah->is_clk_25mhz) {
channelSel = (freq * 2) / 75;
chan_frac = (((freq * 2) % 75) * 0x20000) / 75;
channelSel = (channelSel << 17) | chan_frac;
} else {
channelSel = CHANSEL_2G(freq) >> 1;
}
} else {
channelSel = CHANSEL_2G(freq);
}
/* Set to 2G mode */
bMode = 1;
} else {
if ((AR_SREV_9340(ah) || AR_SREV_9550(ah) ||
AR_SREV_9531(ah) || AR_SREV_9561(ah)) &&
ah->is_clk_25mhz) {
channelSel = freq / 75;
chan_frac = ((freq % 75) * 0x20000) / 75;
channelSel = (channelSel << 17) | chan_frac;
} else {
channelSel = CHANSEL_5G(freq);
/* Doubler is ON, so, divide channelSel by 2. */
channelSel >>= 1;
}
/* Set to 5G mode */
bMode = 0;
}
/* Enable fractional mode for all channels */
fracMode = 1;
aModeRefSel = 0;
loadSynthChannel = 0;
reg32 = (bMode << 29);
REG_WRITE(ah, AR_PHY_SYNTH_CONTROL, reg32);
/* Enable Long shift Select for Synthesizer */
REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_SYNTH4,
AR_PHY_SYNTH4_LONG_SHIFT_SELECT, 1);
/* Program Synth. setting */
reg32 = (channelSel << 2) | (fracMode << 30) |
(aModeRefSel << 28) | (loadSynthChannel << 31);
REG_WRITE(ah, AR_PHY_65NM_CH0_SYNTH7, reg32);
/* Toggle Load Synth channel bit */
loadSynthChannel = 1;
reg32 = (channelSel << 2) | (fracMode << 30) |
(aModeRefSel << 28) | (loadSynthChannel << 31);
REG_WRITE(ah, AR_PHY_65NM_CH0_SYNTH7, reg32);
ah->curchan = chan;
return 0;
}
/**
* ar9003_hw_spur_mitigate_mrc_cck - convert baseband spur frequency
* @ah: atheros hardware structure
* @chan:
*
* For single-chip solutions. Converts to baseband spur frequency given the
* input channel frequency and compute register settings below.
*
* Spur mitigation for MRC CCK
*/
static void ar9003_hw_spur_mitigate_mrc_cck(struct ath_hw *ah,
struct ath9k_channel *chan)
{
static const u32 spur_freq[4] = { 2420, 2440, 2464, 2480 };
int cur_bb_spur, negative = 0, cck_spur_freq;
int i;
int range, max_spur_cnts, synth_freq;
u8 *spur_fbin_ptr = ar9003_get_spur_chan_ptr(ah, IS_CHAN_2GHZ(chan));
/*
* Need to verify range +/- 10 MHz in control channel, otherwise spur
* is out-of-band and can be ignored.
*/
Annotation
- Immediate include surface: `linux/export.h`, `hw.h`, `ar9003_phy.h`, `ar9003_eeprom.h`.
- Detected declarations: `function ar9003_hw_set_channel`, `function ar9003_hw_spur_mitigate_mrc_cck`, `function ar9003_hw_spur_ofdm_clear`, `function ar9003_hw_spur_ofdm`, `function ar9003_hw_spur_ofdm_9565`, `function ar9003_hw_spur_ofdm_work`, `function ar9003_hw_spur_mitigate_ofdm`, `function ar9003_hw_spur_mitigate`, `function ar9003_hw_compute_pll_control_soc`, `function ar9003_hw_compute_pll_control`.
- 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.