31 return (
u16) ((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin));
38 if (
ah->config.analog_shiftreg)
48 regVal |= (
val << shift) & mask;
52 if (
ah->config.analog_shiftreg)
61 if (srcRight == srcLeft) {
64 rv = (
int16_t) (((target - srcLeft) * targetRight +
65 (srcRight - target) * targetLeft) /
66 (srcRight - srcLeft));
76 if (target <= pList[0]) {
77 *indexL = *indexR = 0;
80 if (target >= pList[listSize - 1]) {
81 *indexL = *indexR = (
u16) (listSize - 1);
85 for (i = 0; i < listSize - 1; i++) {
86 if (pList[i] == target) {
87 *indexL = *indexR = i;
90 if (target < pList[i + 1]) {
92 *indexR = (
u16) (i + 1);
100 int eep_start_loc,
int size)
113 for (j = 0; j < i; j++) {
124 for (j = 0; j < i; j++) {
137 u8 *pVpdList,
u16 numIntercepts,
142 u16 idxL = 0, idxR = 0;
144 for (i = 0; i <= (pwrMax - pwrMin) / 2; i++) {
146 numIntercepts, &(idxL),
150 if (idxL == numIntercepts - 1)
151 idxL = (
u16) (numIntercepts - 2);
152 if (pPwrList[idxL] == pPwrList[idxR])
155 k = (
u16)(((currPwr - pPwrList[idxL]) * pVpdList[idxR] +
156 (pPwrList[idxR] - currPwr) * pVpdList[idxL]) /
157 (pPwrList[idxR] - pPwrList[idxL]));
158 pRetVpdList[i] = (
u8)
k;
168 u16 numRates,
int isExtTarget)
173 int matchIndex = -1, lowIndex = -1;
183 for (i = 0; (i < numChannels) &&
197 if ((matchIndex == -1) && (lowIndex == -1))
201 if (matchIndex != -1) {
202 *pNewPower = powInfo[matchIndex];
209 for (i = 0; i < numRates; i++) {
212 powInfo[lowIndex].
tPow2x[i],
213 powInfo[lowIndex + 1].
tPow2x[i]);
223 u16 numRates,
int isHt40Target)
228 int matchIndex = -1, lowIndex = -1;
237 for (i = 0; (i < numChannels) &&
252 if ((matchIndex == -1) && (lowIndex == -1))
256 if (matchIndex != -1) {
257 *pNewPower = powInfo[matchIndex];
264 for (i = 0; i < numRates; i++) {
267 powInfo[lowIndex].
tPow2x[i],
268 powInfo[lowIndex + 1].
tPow2x[i]);
274 int is2GHz,
int num_band_edges)
279 for (i = 0; (i < num_band_edges) &&
284 }
else if ((i > 0) &&
297 return twiceMaxEdgePower;
315 "Invalid chainmask configuration\n");
323 u8 *bChans,
u16 availPiers,
325 u16 *pPdGainBoundaries,
u8 *pPDADCValues,
330 u16 idxL = 0, idxR = 0, numPiers;
338 u8 *pVpdL, *pVpdR, *pPwrL, *pPwrR;
343 u16 sizeCurrVpdTable, maxIndex, tgtIndex;
347 int pdgain_boundary_default;
362 for (numPiers = 0; numPiers < availPiers; numPiers++) {
369 bChans, numPiers, &idxL, &idxR);
373 for (i = 0; i < numXpdGains; i++) {
374 minPwrT4[i] = data_9287[idxL].
pwrPdg[i][0];
375 maxPwrT4[i] = data_9287[idxL].
pwrPdg[i][intercepts - 1];
377 data_9287[idxL].
pwrPdg[i],
378 data_9287[idxL].
vpdPdg[i],
382 }
else if (eeprom_4k) {
383 for (i = 0; i < numXpdGains; i++) {
384 minPwrT4[i] = data_4k[idxL].
pwrPdg[i][0];
385 maxPwrT4[i] = data_4k[idxL].
pwrPdg[i][intercepts - 1];
393 for (i = 0; i < numXpdGains; i++) {
394 minPwrT4[i] = data_def[idxL].
pwrPdg[i][0];
395 maxPwrT4[i] = data_def[idxL].
pwrPdg[i][intercepts - 1];
404 for (i = 0; i < numXpdGains; i++) {
406 pVpdL = data_9287[idxL].
vpdPdg[i];
407 pPwrL = data_9287[idxL].
pwrPdg[i];
408 pVpdR = data_9287[idxR].
vpdPdg[i];
409 pPwrR = data_9287[idxR].
pwrPdg[i];
410 }
else if (eeprom_4k) {
411 pVpdL = data_4k[idxL].
vpdPdg[i];
412 pPwrL = data_4k[idxL].
pwrPdg[i];
413 pVpdR = data_4k[idxR].
vpdPdg[i];
414 pPwrR = data_4k[idxR].
pwrPdg[i];
416 pVpdL = data_def[idxL].
vpdPdg[i];
417 pPwrL = data_def[idxL].
pwrPdg[i];
418 pVpdR = data_def[idxR].
vpdPdg[i];
419 pPwrR = data_def[idxR].
pwrPdg[i];
422 minPwrT4[i] =
max(pPwrL[0], pPwrR[0]);
425 min(pPwrL[intercepts - 1],
426 pPwrR[intercepts - 1]);
438 for (j = 0; j <= (maxPwrT4[i] - minPwrT4[i]) / 2; j++) {
445 bChans[idxL], bChans[idxR],
446 vpdTableL[i][j], vpdTableR[i][j]));
453 for (i = 0; i < numXpdGains; i++) {
454 if (i == (numXpdGains - 1))
455 pPdGainBoundaries[i] =
456 (
u16)(maxPwrT4[i] / 2);
458 pPdGainBoundaries[i] =
459 (
u16)((maxPwrT4[i] + minPwrT4[i + 1]) / 4);
461 pPdGainBoundaries[i] =
465 minDelta = pPdGainBoundaries[0] - 23;
466 pPdGainBoundaries[0] = 23;
477 ss = (
int16_t)((pPdGainBoundaries[i - 1] -
479 tPdGainOverlap + 1 + minDelta);
481 vpdStep = (
int16_t)(vpdTableI[i][1] - vpdTableI[i][0]);
482 vpdStep = (
int16_t)((vpdStep < 1) ? 1 : vpdStep);
485 tmpVal = (
int16_t)(vpdTableI[i][0] +
ss * vpdStep);
486 pPDADCValues[
k++] = (
u8)((tmpVal < 0) ? 0 : tmpVal);
490 sizeCurrVpdTable = (
u8) ((maxPwrT4[i] - minPwrT4[i]) / 2 + 1);
491 tgtIndex = (
u8)(pPdGainBoundaries[i] + tPdGainOverlap -
493 maxIndex = (tgtIndex < sizeCurrVpdTable) ?
494 tgtIndex : sizeCurrVpdTable;
497 pPDADCValues[
k++] = vpdTableI[i][
ss++];
500 vpdStep = (
int16_t)(vpdTableI[i][sizeCurrVpdTable - 1] -
501 vpdTableI[i][sizeCurrVpdTable - 2]);
502 vpdStep = (
int16_t)((vpdStep < 1) ? 1 : vpdStep);
504 if (tgtIndex >= maxIndex) {
505 while ((
ss <= tgtIndex) &&
507 tmpVal = (
int16_t)((vpdTableI[i][sizeCurrVpdTable - 1] +
508 (
ss - maxIndex + 1) * vpdStep));
509 pPDADCValues[
k++] = (
u8)((tmpVal > 255) ?
517 pdgain_boundary_default = 58;
519 pdgain_boundary_default = pPdGainBoundaries[i - 1];
522 pPdGainBoundaries[i] = pdgain_boundary_default;
527 pPDADCValues[
k] = pPDADCValues[
k - 1];
546 if (!
ah->eep_ops->fill_eeprom(
ah))
void ath9k_hw_get_target_powers(struct ath_hw *ah, struct ath9k_channel *chan, struct cal_target_power_ht *powInfo, u16 numChannels, struct cal_target_power_ht *pNewPower, u16 numRates, int isHt40Target)
#define AR5416_NUM_PD_GAINS
static u16 ath9k_hw_fbin2freq(u8 fbin, int is2GHz)
#define AR_SREV_9280_20_OR_LATER(_ah)
static unsigned int unsigned int reg
#define ar5416_get_ntxchains(_txchainmask)
int ath9k_hw_eeprom_init(struct ath_hw *ah)
#define CTL_EDGE_FLAGS(_ctl)
uint16_t size
Buffer size.
u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]
const struct eeprom_ops eep_4k_ops
#define AR_SREV_5416_20_OR_LATER(_ah)
#define AR_SREV_9285(_ah)
struct net80211_channel * chan
const struct eeprom_ops eep_def_ops
int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, int16_t targetLeft, int16_t targetRight)
u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]
#define AR5416_PD_GAINS_IN_MASK
#define AR_SREV_9287(_ah)
void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, u8 *pVpdList, u16 numIntercepts, u8 *pRetVpdList)
#define AR_SREV_9300_20_OR_LATER(_ah)
void ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val)
u8 pwrPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]
#define REG_READ_MULTI(_ah, _addr, _val, _cnt)
void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, struct ath9k_channel *chan, void *pRawDataSet, u8 *bChans, u16 availPiers, u16 tPdGainOverlap, u16 *pPdGainBoundaries, u8 *pPDADCValues, u16 numXpdGains)
static struct ath_regulatory * ath9k_hw_regulatory(struct ath_hw *ah)
const struct eeprom_ops eep_ar9300_ops
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
u8 pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]
#define AR5416_PD_GAIN_ICEPTS
#define AR5416_NUM_PDADC_VALUES
const struct eeprom_ops eep_ar9287_ops
int ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, u16 *indexL, u16 *indexR)
int ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data)
u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, int is2GHz, int num_band_edges)
#define AR5416_BCHAN_UNUSED
#define AR9287_PD_GAIN_ICEPTS
uint32_t addr
Buffer address.
u8 vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]
void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, u32 shift, u32 val)
static const uint32_t k[64]
MD5 constants.
struct ib_cm_common common
#define REG_READ(_ah, _reg)
void ath9k_hw_get_legacy_target_powers(struct ath_hw *ah, struct ath9k_channel *chan, struct cal_target_power_leg *powInfo, u16 numChannels, struct cal_target_power_leg *pNewPower, u16 numRates, int isExtTarget)
u8 vpdPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]
#define INCREASE_MAXPOW_BY_TWO_CHAIN
#define INCREASE_MAXPOW_BY_THREE_CHAIN
void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, int eep_start_loc, int size)
#define REG_WRITE(_ah, _reg, _val)
#define EIO
Input/output error.
#define AR_SREV_9271(_ah)
uint8_t data[48]
Additional event data.
void ath9k_hw_get_channel_centers(struct ath_hw *ah __unused, struct ath9k_channel *chan, struct chan_centers *centers)
#define AR5416_MAX_PWR_RANGE_IN_HALF_DB
void ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah)
#define CTL_EDGE_TPOWER(_ctl)
#define AR5416_EEPROM_OFFSET
if(natsemi->flags &NATSEMI_64BIT) return 1
void * memset(void *dest, int character, size_t len) __nonnull