drivers/net/wireless/ath/ath9k/ar9003_calib.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath9k/ar9003_calib.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath9k/ar9003_calib.c- Extension
.c- Size
- 47135 bytes
- Lines
- 1699
- 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
hw.hhw-ops.har9003_phy.har9003_rtt.har9003_mci.h
Detected Declarations
struct coeffenum ar9003_cal_typesfunction ar9003_hw_setup_calibrationfunction ar9003_hw_per_calibrationfunction ar9003_hw_calibratefunction ar9003_hw_iqcal_collectfunction ar9003_hw_iqcalibratefunction ar9003_hw_init_cal_settingsfunction ar9003_hw_dynamic_osdac_selectionfunction ar9003_hw_solve_iq_calfunction ar9003_hw_find_mag_approxfunction ar9003_hw_calc_iq_corrfunction ar9003_hw_detect_outlierfunction ar9003_hw_tx_iq_cal_outlier_detectionfunction ar9003_hw_tx_iq_cal_runfunction __ar955x_tx_iq_cal_sortfunction ar955x_tx_iq_cal_medianfunction ar9003_hw_tx_iq_cal_post_procfunction ar9003_hw_tx_iq_cal_reloadfunction ar9003_hw_manual_peak_calfunction ar9003_hw_do_pcoem_manual_peak_calfunction ar9003_hw_cl_cal_post_procfunction ar9003_hw_init_cal_commonfunction ar9003_hw_init_cal_pcoemfunction do_ar9003_agc_calfunction ar9003_hw_init_cal_socfunction ar9003_hw_attach_calib_ops
Annotated Snippet
struct coeff {
int mag_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT][MAXIQCAL];
int phs_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT][MAXIQCAL];
int iqc_coeff[2];
};
enum ar9003_cal_types {
IQ_MISMATCH_CAL = BIT(0),
};
static void ar9003_hw_setup_calibration(struct ath_hw *ah,
struct ath9k_cal_list *currCal)
{
struct ath_common *common = ath9k_hw_common(ah);
/* Select calibration to run */
switch (currCal->calData->calType) {
case IQ_MISMATCH_CAL:
/*
* Start calibration with
* 2^(INIT_IQCAL_LOG_COUNT_MAX+1) samples
*/
REG_RMW_FIELD(ah, AR_PHY_TIMING4,
AR_PHY_TIMING4_IQCAL_LOG_COUNT_MAX,
currCal->calData->calCountMax);
REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ);
ath_dbg(common, CALIBRATE,
"starting IQ Mismatch Calibration\n");
/* Kick-off cal */
REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL);
break;
default:
ath_err(common, "Invalid calibration type\n");
break;
}
}
/*
* Generic calibration routine.
* Recalibrate the lower PHY chips to account for temperature/environment
* changes.
*/
static bool ar9003_hw_per_calibration(struct ath_hw *ah,
struct ath9k_channel *ichan,
u8 rxchainmask,
struct ath9k_cal_list *currCal)
{
struct ath9k_hw_cal_data *caldata = ah->caldata;
const struct ath9k_percal_data *cur_caldata = currCal->calData;
/* Calibration in progress. */
if (currCal->calState == CAL_RUNNING) {
/* Check to see if it has finished. */
if (REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)
return false;
/*
* Accumulate cal measures for active chains
*/
cur_caldata->calCollect(ah);
ah->cal_samples++;
if (ah->cal_samples >= cur_caldata->calNumSamples) {
unsigned int i, numChains = 0;
for (i = 0; i < AR9300_MAX_CHAINS; i++) {
if (rxchainmask & (1 << i))
numChains++;
}
/*
* Process accumulated data
*/
cur_caldata->calPostProc(ah, numChains);
/* Calibration has finished. */
caldata->CalValid |= cur_caldata->calType;
currCal->calState = CAL_DONE;
return true;
} else {
/*
* Set-up collection of another sub-sample until we
* get desired number
*/
ar9003_hw_setup_calibration(ah, currCal);
}
} else if (!(caldata->CalValid & cur_caldata->calType)) {
/* If current cal is marked invalid in channel, kick it off */
ath9k_hw_reset_calibration(ah, currCal);
Annotation
- Immediate include surface: `hw.h`, `hw-ops.h`, `ar9003_phy.h`, `ar9003_rtt.h`, `ar9003_mci.h`.
- Detected declarations: `struct coeff`, `enum ar9003_cal_types`, `function ar9003_hw_setup_calibration`, `function ar9003_hw_per_calibration`, `function ar9003_hw_calibrate`, `function ar9003_hw_iqcal_collect`, `function ar9003_hw_iqcalibrate`, `function ar9003_hw_init_cal_settings`, `function ar9003_hw_dynamic_osdac_selection`, `function ar9003_hw_solve_iq_cal`.
- 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.