FreeBSD kernel ATH device code
ar9285_reset.c
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: ISC
3 *
4 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
5 * Copyright (c) 2002-2008 Atheros Communications, Inc.
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 *
19 * $FreeBSD$
20 */
21
22/*
23 * This is almost the same as ar5416_reset.c but uses the v4k EEPROM and
24 * supports only 2Ghz operation.
25 */
26
27#include "opt_ah.h"
28
29#include "ah.h"
30#include "ah_internal.h"
31#include "ah_devid.h"
32
33#include "ah_eeprom_v14.h"
34#include "ah_eeprom_v4k.h"
35
36#include "ar9002/ar9285.h"
37#include "ar5416/ar5416.h"
38#include "ar5416/ar5416reg.h"
39#include "ar5416/ar5416phy.h"
40#include "ar9002/ar9002phy.h"
41#include "ar9002/ar9285phy.h"
42#include "ar9002/ar9285an.h"
44
45/* Eeprom versioning macros. Returns true if the version is equal or newer than the ver specified */
46#define EEP_MINOR(_ah) \
47 (AH_PRIVATE(_ah)->ah_eeversion & AR5416_EEP_VER_MINOR_MASK)
48#define IS_EEP_MINOR_V2(_ah) (EEP_MINOR(_ah) >= AR5416_EEP_MINOR_VER_2)
49#define IS_EEP_MINOR_V3(_ah) (EEP_MINOR(_ah) >= AR5416_EEP_MINOR_VER_3)
50
51/* Additional Time delay to wait after activiting the Base band */
52#define BASE_ACTIVATE_DELAY 100 /* 100 usec */
53#define PLL_SETTLE_DELAY 300 /* 300 usec */
54#define RTC_PLL_SETTLE_DELAY 1000 /* 1 ms */
55
57 struct ar5416eeprom_4k *pEepData,
58 const struct ieee80211_channel *chan, int16_t *ratesArray,
59 uint16_t cfgCtl, uint16_t AntennaReduction,
60 uint16_t twiceMaxRegulatoryPower,
61 uint16_t powerLimit);
63 struct ar5416eeprom_4k *pEepData,
64 const struct ieee80211_channel *chan,
65 int16_t *pTxPowerIndexOffset);
66static void ar9285GetGainBoundariesAndPdadcs(struct ath_hal *ah,
67 const struct ieee80211_channel *chan, CAL_DATA_PER_FREQ_4K *pRawDataSet,
68 uint8_t * bChans, uint16_t availPiers,
69 uint16_t tPdGainOverlap, int16_t *pMinCalPower,
70 uint16_t * pPdGainBoundaries, uint8_t * pPDADCValues,
71 uint16_t numXpdGains);
72
75 const struct ieee80211_channel *chan, uint16_t *rfXpdGain)
76{
77#define POW_SM(_r, _s) (((_r) & 0x3f) << (_s))
78#define N(a) (sizeof (a) / sizeof (a[0]))
79
80 MODAL_EEP4K_HEADER *pModal;
81 struct ath_hal_5212 *ahp = AH5212(ah);
82 int16_t txPowerIndexOffset = 0;
83 int i;
84
85 uint16_t cfgCtl;
86 uint16_t powerLimit;
87 uint16_t twiceAntennaReduction;
88 uint16_t twiceMaxRegulatoryPower;
89 int16_t maxPower;
90 HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
91 struct ar5416eeprom_4k *pEepData = &ee->ee_base;
92
93 HALASSERT(AH_PRIVATE(ah)->ah_eeversion >= AR_EEPROM_VER14_1);
94
95 AH5416(ah)->ah_ht40PowerIncForPdadc = 2;
96
97 /* Setup info for the actual eeprom */
98 OS_MEMZERO(AH5416(ah)->ah_ratesArray, sizeof(AH5416(ah)->ah_ratesArray));
99 cfgCtl = ath_hal_getctl(ah, chan);
100 powerLimit = chan->ic_maxregpower * 2;
101 twiceAntennaReduction = chan->ic_maxantgain;
102 twiceMaxRegulatoryPower = AH_MIN(MAX_RATE_POWER, AH_PRIVATE(ah)->ah_powerLimit);
103 pModal = &pEepData->modalHeader;
104 HALDEBUG(ah, HAL_DEBUG_RESET, "%s Channel=%u CfgCtl=%u\n",
105 __func__,chan->ic_freq, cfgCtl );
106
107 if (IS_EEP_MINOR_V2(ah)) {
108 AH5416(ah)->ah_ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc;
109 }
110
111 if (!ar9285SetPowerPerRateTable(ah, pEepData, chan,
112 &AH5416(ah)->ah_ratesArray[0],cfgCtl,
113 twiceAntennaReduction,
114 twiceMaxRegulatoryPower, powerLimit)) {
116 "%s: unable to set tx power per rate table\n", __func__);
117 return AH_FALSE;
118 }
119
120 if (!ar9285SetPowerCalTable(ah, pEepData, chan, &txPowerIndexOffset)) {
121 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unable to set power table\n",
122 __func__);
123 return AH_FALSE;
124 }
125
126 maxPower = AH_MAX(AH5416(ah)->ah_ratesArray[rate6mb],
127 AH5416(ah)->ah_ratesArray[rateHt20_0]);
128 maxPower = AH_MAX(maxPower, AH5416(ah)->ah_ratesArray[rate1l]);
129
130 if (IEEE80211_IS_CHAN_HT40(chan)) {
131 maxPower = AH_MAX(maxPower, AH5416(ah)->ah_ratesArray[rateHt40_0]);
132 }
133
134 ahp->ah_tx6PowerInHalfDbm = maxPower;
135 AH_PRIVATE(ah)->ah_maxPowerLevel = maxPower;
136 ahp->ah_txPowerIndexOffset = txPowerIndexOffset;
137
138 /*
139 * txPowerIndexOffset is set by the SetPowerTable() call -
140 * adjust the rate table (0 offset if rates EEPROM not loaded)
141 */
142 for (i = 0; i < N(AH5416(ah)->ah_ratesArray); i++) {
143 AH5416(ah)->ah_ratesArray[i] = (int16_t)(txPowerIndexOffset + AH5416(ah)->ah_ratesArray[i]);
144 /* -5 dBm offset for Merlin and later; this includes Kite */
145 AH5416(ah)->ah_ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2;
146 if (AH5416(ah)->ah_ratesArray[i] > AR5416_MAX_RATE_POWER)
147 AH5416(ah)->ah_ratesArray[i] = AR5416_MAX_RATE_POWER;
148 if (AH5416(ah)->ah_ratesArray[i] < 0)
149 AH5416(ah)->ah_ratesArray[i] = 0;
150 }
151
152#ifdef AH_EEPROM_DUMP
153 ar5416PrintPowerPerRate(ah, AH5416(ah)->ah_ratesArray);
154#endif
155
156 /*
157 * Adjust the HT40 power to meet the correct target TX power
158 * for 40MHz mode, based on TX power curves that are established
159 * for 20MHz mode.
160 *
161 * XXX handle overflow/too high power level?
162 */
163 if (IEEE80211_IS_CHAN_HT40(chan)) {
164 AH5416(ah)->ah_ratesArray[rateHt40_0] +=
165 AH5416(ah)->ah_ht40PowerIncForPdadc;
166 AH5416(ah)->ah_ratesArray[rateHt40_1] +=
167 AH5416(ah)->ah_ht40PowerIncForPdadc;
168 AH5416(ah)->ah_ratesArray[rateHt40_2] +=
169 AH5416(ah)->ah_ht40PowerIncForPdadc;
170 AH5416(ah)->ah_ratesArray[rateHt40_3] +=
171 AH5416(ah)->ah_ht40PowerIncForPdadc;
172 AH5416(ah)->ah_ratesArray[rateHt40_4] +=
173 AH5416(ah)->ah_ht40PowerIncForPdadc;
174 AH5416(ah)->ah_ratesArray[rateHt40_5] +=
175 AH5416(ah)->ah_ht40PowerIncForPdadc;
176 AH5416(ah)->ah_ratesArray[rateHt40_6] +=
177 AH5416(ah)->ah_ht40PowerIncForPdadc;
178 AH5416(ah)->ah_ratesArray[rateHt40_7] +=
179 AH5416(ah)->ah_ht40PowerIncForPdadc;
180 }
181
182 /* Write the TX power rate registers */
183 ar5416WriteTxPowerRateRegisters(ah, chan, AH5416(ah)->ah_ratesArray);
184
185 return AH_TRUE;
186#undef POW_SM
187#undef N
188}
189
190static void
192 const struct ar5416eeprom_4k *eep, uint8_t txRxAttenLocal)
193{
195 pModal->antCtrlChain[0]);
196
203
206 txRxAttenLocal = pModal->txRxAttenCh[0];
207
216
217 /* Set the block 1 value to block 0 value */
220 pModal->bswMargin[0]);
225 pModal->xatten2Margin[0]);
228 }
229
231 AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
234
235 OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000,
236 AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
237 OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000,
239}
240
241/*
242 * Read EEPROM header info and program the device for correct operation
243 * given the channel value.
244 */
246ar9285SetBoardValues(struct ath_hal *ah, const struct ieee80211_channel *chan)
247{
248 const HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
249 const struct ar5416eeprom_4k *eep = &ee->ee_base;
250 const MODAL_EEP4K_HEADER *pModal;
251 uint8_t txRxAttenLocal;
252 uint8_t ob[5], db1[5], db2[5];
253
254 pModal = &eep->modalHeader;
255 txRxAttenLocal = 23;
256
258
259 /* Single chain for 4K EEPROM*/
260 ar9285SetBoardGain(ah, pModal, eep, txRxAttenLocal);
261
262 /* Initialize Ant Diversity settings if supported */
263 (void) ar9285SetAntennaSwitch(ah, AH5212(ah)->ah_antControl);
264
265 /* Configure TX power calibration */
266 if (pModal->version >= 2) {
267 ob[0] = pModal->ob_0;
268 ob[1] = pModal->ob_1;
269 ob[2] = pModal->ob_2;
270 ob[3] = pModal->ob_3;
271 ob[4] = pModal->ob_4;
272
273 db1[0] = pModal->db1_0;
274 db1[1] = pModal->db1_1;
275 db1[2] = pModal->db1_2;
276 db1[3] = pModal->db1_3;
277 db1[4] = pModal->db1_4;
278
279 db2[0] = pModal->db2_0;
280 db2[1] = pModal->db2_1;
281 db2[2] = pModal->db2_2;
282 db2[3] = pModal->db2_3;
283 db2[4] = pModal->db2_4;
284 } else if (pModal->version == 1) {
285 ob[0] = pModal->ob_0;
286 ob[1] = ob[2] = ob[3] = ob[4] = pModal->ob_1;
287 db1[0] = pModal->db1_0;
288 db1[1] = db1[2] = db1[3] = db1[4] = pModal->db1_1;
289 db2[0] = pModal->db2_0;
290 db2[1] = db2[2] = db2[3] = db2[4] = pModal->db2_1;
291 } else {
292 int i;
293
294 for (i = 0; i < 5; i++) {
295 ob[i] = pModal->ob_0;
296 db1[i] = pModal->db1_0;
297 db2[i] = pModal->db1_0;
298 }
299 }
300
306
312
318
320 pModal->switchSettling);
322 pModal->adcDesiredSize);
323
329
331 pModal->txEndToRxOn);
332
334 pModal->thresh62);
336 pModal->thresh62);
337
341 pModal->txFrameToDataStart);
343 pModal->txFrameToPaOn);
344 }
345
348 if (IEEE80211_IS_CHAN_HT40(chan))
351 }
352
353 /*
354 * Program the CCK TX gain factor appropriately if needed.
355 * The AR9285/AR9271 has a non-constant PA tx gain behaviour
356 * for CCK versus OFDM rates; other chips deal with this
357 * differently.
358 *
359 * The mask/shift/multiply hackery is done so place the same
360 * value (bb_desired_scale) into multiple 5-bit fields.
361 * For example, AR_PHY_TX_PWRCTRL9 has bb_desired_scale written
362 * to three fields: (0..4), (5..9) and (10..14).
363 */
364 if (AR_SREV_9271(ah) || AR_SREV_KITE(ah)) {
365 uint8_t bb_desired_scale = (pModal->bb_scale_smrt_antenna & EEP_4K_BB_DESIRED_SCALE_MASK);
366 if ((eep->baseEepHeader.txGainType == 0) && (bb_desired_scale != 0)) {
367 ath_hal_printf(ah, "[ath]: adjusting cck tx gain factor\n");
368 uint32_t pwrctrl, mask, clr;
369
370 mask = (1<<0) | (1<<5) | (1<<10) | (1<<15) | (1<<20) | (1<<25);
371 pwrctrl = mask * bb_desired_scale;
372 clr = mask * 0x1f;
373 OS_REG_RMW(ah, AR_PHY_TX_PWRCTRL8, pwrctrl, clr);
374 OS_REG_RMW(ah, AR_PHY_TX_PWRCTRL10, pwrctrl, clr);
375 OS_REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL12, pwrctrl, clr);
376
377 mask = (1<<0) | (1<<5) | (1<<15);
378 pwrctrl = mask * bb_desired_scale;
379 clr = mask * 0x1f;
380 OS_REG_RMW(ah, AR_PHY_TX_PWRCTRL9, pwrctrl, clr);
381
382 mask = (1<<0) | (1<<5);
383 pwrctrl = mask * bb_desired_scale;
384 clr = mask * 0x1f;
385 OS_REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL11, pwrctrl, clr);
386 OS_REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL13, pwrctrl, clr);
387 }
388 }
389
390 return AH_TRUE;
391}
392
393/*
394 * Helper functions common for AP/CB/XB
395 */
396
397static HAL_BOOL
399 const struct ieee80211_channel *chan,
400 int16_t *ratesArray, uint16_t cfgCtl,
401 uint16_t AntennaReduction,
402 uint16_t twiceMaxRegulatoryPower,
403 uint16_t powerLimit)
404{
405#define N(a) (sizeof(a)/sizeof(a[0]))
406/* Local defines to distinguish between extension and control CTL's */
407#define EXT_ADDITIVE (0x8000)
408#define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE)
409#define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE)
410
411 uint16_t twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
412 int i;
413 int16_t twiceLargestAntenna;
414 CAL_CTL_DATA_4K *rep;
415 CAL_TARGET_POWER_LEG targetPowerOfdm, targetPowerCck = {0, {0, 0, 0, 0}};
416 CAL_TARGET_POWER_LEG targetPowerOfdmExt = {0, {0, 0, 0, 0}}, targetPowerCckExt = {0, {0, 0, 0, 0}};
417 CAL_TARGET_POWER_HT targetPowerHt20, targetPowerHt40 = {0, {0, 0, 0, 0}};
418 int16_t scaledPower, minCtlPower;
419
420#define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */
421 static const uint16_t ctlModesFor11g[] = {
423 };
424 const uint16_t *pCtlMode;
425 uint16_t numCtlModes, ctlMode, freq;
426 CHAN_CENTERS centers;
427
428 ar5416GetChannelCenters(ah, chan, &centers);
429
430 /* Compute TxPower reduction due to Antenna Gain */
431
432 twiceLargestAntenna = pEepData->modalHeader.antennaGainCh[0];
433 twiceLargestAntenna = (int16_t)AH_MIN((AntennaReduction) - twiceLargestAntenna, 0);
434
435 /* XXX setup for 5212 use (really used?) */
436 ath_hal_eepromSet(ah, AR_EEP_ANTGAINMAX_2, twiceLargestAntenna);
437
438 /*
439 * scaledPower is the minimum of the user input power level and
440 * the regulatory allowed power level
441 */
442 scaledPower = AH_MIN(powerLimit, twiceMaxRegulatoryPower + twiceLargestAntenna);
443
444 /* Get target powers from EEPROM - our baseline for TX Power */
445 /* Setup for CTL modes */
446 numCtlModes = N(ctlModesFor11g) - SUB_NUM_CTL_MODES_AT_2G_40; /* CTL_11B, CTL_11G, CTL_2GHT20 */
447 pCtlMode = ctlModesFor11g;
448
450 AR5416_4K_NUM_2G_CCK_TARGET_POWERS, &targetPowerCck, 4, AH_FALSE);
451 ar5416GetTargetPowersLeg(ah, chan, pEepData->calTargetPower2G,
452 AR5416_4K_NUM_2G_20_TARGET_POWERS, &targetPowerOfdm, 4, AH_FALSE);
454 AR5416_4K_NUM_2G_20_TARGET_POWERS, &targetPowerHt20, 8, AH_FALSE);
455
456 if (IEEE80211_IS_CHAN_HT40(chan)) {
457 numCtlModes = N(ctlModesFor11g); /* All 2G CTL's */
458
460 AR5416_4K_NUM_2G_40_TARGET_POWERS, &targetPowerHt40, 8, AH_TRUE);
461 /* Get target powers for extension channels */
463 AR5416_4K_NUM_2G_CCK_TARGET_POWERS, &targetPowerCckExt, 4, AH_TRUE);
464 ar5416GetTargetPowersLeg(ah, chan, pEepData->calTargetPower2G,
465 AR5416_4K_NUM_2G_20_TARGET_POWERS, &targetPowerOfdmExt, 4, AH_TRUE);
466 }
467
468 /*
469 * For MIMO, need to apply regulatory caps individually across dynamically
470 * running modes: CCK, OFDM, HT20, HT40
471 *
472 * The outer loop walks through each possible applicable runtime mode.
473 * The inner loop walks through each ctlIndex entry in EEPROM.
474 * The ctl value is encoded as [7:4] == test group, [3:0] == test mode.
475 *
476 */
477 for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
478 HAL_BOOL isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) ||
479 (pCtlMode[ctlMode] == CTL_2GHT40);
480 if (isHt40CtlMode) {
481 freq = centers.ctl_center;
482 } else if (pCtlMode[ctlMode] & EXT_ADDITIVE) {
483 freq = centers.ext_center;
484 } else {
485 freq = centers.ctl_center;
486 }
487
488 /* walk through each CTL index stored in EEPROM */
489 for (i = 0; (i < AR5416_4K_NUM_CTLS) && pEepData->ctlIndex[i]; i++) {
490 uint16_t twiceMinEdgePower;
491
492 /* compare test group from regulatory channel list with test mode from pCtlMode list */
493 if ((((cfgCtl & ~CTL_MODE_M) | (pCtlMode[ctlMode] & CTL_MODE_M)) == pEepData->ctlIndex[i]) ||
494 (((cfgCtl & ~CTL_MODE_M) | (pCtlMode[ctlMode] & CTL_MODE_M)) ==
495 ((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL))) {
496 rep = &(pEepData->ctlData[i]);
497 twiceMinEdgePower = ar5416GetMaxEdgePower(freq,
498 rep->ctlEdges[
499 owl_get_ntxchains(AH5416(ah)->ah_tx_chainmask) - 1], AH_TRUE);
500 if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) {
501 /* Find the minimum of all CTL edge powers that apply to this channel */
502 twiceMaxEdgePower = AH_MIN(twiceMaxEdgePower, twiceMinEdgePower);
503 } else {
504 /* specific */
505 twiceMaxEdgePower = twiceMinEdgePower;
506 break;
507 }
508 }
509 }
510 minCtlPower = (uint8_t)AH_MIN(twiceMaxEdgePower, scaledPower);
511 /* Apply ctl mode to correct target power set */
512 switch(pCtlMode[ctlMode]) {
513 case CTL_11B:
514 for (i = 0; i < N(targetPowerCck.tPow2x); i++) {
515 targetPowerCck.tPow2x[i] = (uint8_t)AH_MIN(targetPowerCck.tPow2x[i], minCtlPower);
516 }
517 break;
518 case CTL_11A:
519 case CTL_11G:
520 for (i = 0; i < N(targetPowerOfdm.tPow2x); i++) {
521 targetPowerOfdm.tPow2x[i] = (uint8_t)AH_MIN(targetPowerOfdm.tPow2x[i], minCtlPower);
522 }
523 break;
524 case CTL_5GHT20:
525 case CTL_2GHT20:
526 for (i = 0; i < N(targetPowerHt20.tPow2x); i++) {
527 targetPowerHt20.tPow2x[i] = (uint8_t)AH_MIN(targetPowerHt20.tPow2x[i], minCtlPower);
528 }
529 break;
530 case CTL_11B_EXT:
531 targetPowerCckExt.tPow2x[0] = (uint8_t)AH_MIN(targetPowerCckExt.tPow2x[0], minCtlPower);
532 break;
533 case CTL_11G_EXT:
534 targetPowerOfdmExt.tPow2x[0] = (uint8_t)AH_MIN(targetPowerOfdmExt.tPow2x[0], minCtlPower);
535 break;
536 case CTL_5GHT40:
537 case CTL_2GHT40:
538 for (i = 0; i < N(targetPowerHt40.tPow2x); i++) {
539 targetPowerHt40.tPow2x[i] = (uint8_t)AH_MIN(targetPowerHt40.tPow2x[i], minCtlPower);
540 }
541 break;
542 default:
543 return AH_FALSE;
544 break;
545 }
546 } /* end ctl mode checking */
547
548 /* Set rates Array from collected data */
549 ar5416SetRatesArrayFromTargetPower(ah, chan, ratesArray,
550 &targetPowerCck,
551 &targetPowerCckExt,
552 &targetPowerOfdm,
553 &targetPowerOfdmExt,
554 &targetPowerHt20,
555 &targetPowerHt40);
556
557 return AH_TRUE;
558#undef EXT_ADDITIVE
559#undef CTL_11G_EXT
560#undef CTL_11B_EXT
561#undef SUB_NUM_CTL_MODES_AT_2G_40
562#undef N
563}
564
565static HAL_BOOL
566ar9285SetPowerCalTable(struct ath_hal *ah, struct ar5416eeprom_4k *pEepData,
567 const struct ieee80211_channel *chan, int16_t *pTxPowerIndexOffset)
568{
569 CAL_DATA_PER_FREQ_4K *pRawDataset;
570 uint8_t *pCalBChans = AH_NULL;
571 uint16_t pdGainOverlap_t2;
572 static uint8_t pdadcValues[AR5416_NUM_PDADC_VALUES];
573 uint16_t gainBoundaries[AR5416_PD_GAINS_IN_MASK];
574 uint16_t numPiers, i;
575 int16_t tMinCalPower;
576 uint16_t numXpdGain, xpdMask;
577 uint16_t xpdGainValues[4]; /* v4k eeprom has 2; the other two stay 0 */
578 uint32_t regChainOffset;
579
580 OS_MEMZERO(xpdGainValues, sizeof(xpdGainValues));
581
582 xpdMask = pEepData->modalHeader.xpdGain;
583
584 if (IS_EEP_MINOR_V2(ah)) {
585 pdGainOverlap_t2 = pEepData->modalHeader.pdGainOverlap;
586 } else {
587 pdGainOverlap_t2 = (uint16_t)(MS(OS_REG_READ(ah, AR_PHY_TPCRG5), AR_PHY_TPCRG5_PD_GAIN_OVERLAP));
588 }
589
590 pCalBChans = pEepData->calFreqPier2G;
592 numXpdGain = 0;
593
594 /* Calculate the value of xpdgains from the xpdGain Mask */
595 for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) {
596 if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) {
597 if (numXpdGain >= AR5416_4K_NUM_PD_GAINS) {
598 HALASSERT(0);
599 break;
600 }
601 xpdGainValues[numXpdGain] = (uint16_t)(AR5416_PD_GAINS_IN_MASK - i);
602 numXpdGain++;
603 }
604 }
605
606 /* Write the detector gain biases and their number */
607 ar5416WriteDetectorGainBiases(ah, numXpdGain, xpdGainValues);
608
609 for (i = 0; i < AR5416_MAX_CHAINS; i++) {
610 regChainOffset = ar5416GetRegChainOffset(ah, i);
611 if (pEepData->baseEepHeader.txMask & (1 << i)) {
612 pRawDataset = pEepData->calPierData2G[i];
613
614 ar9285GetGainBoundariesAndPdadcs(ah, chan, pRawDataset,
615 pCalBChans, numPiers,
616 pdGainOverlap_t2,
617 &tMinCalPower, gainBoundaries,
618 pdadcValues, numXpdGain);
619
620 if ((i == 0) || AR_SREV_5416_V20_OR_LATER(ah)) {
621 /*
622 * Note the pdadc table may not start at 0 dBm power, could be
623 * negative or greater than 0. Need to offset the power
624 * values by the amount of minPower for griffin
625 */
626 ar5416SetGainBoundariesClosedLoop(ah, i, pdGainOverlap_t2, gainBoundaries);
627 }
628
629 /* Write the power values into the baseband power table */
630 ar5416WritePdadcValues(ah, i, pdadcValues);
631 }
632 }
633 *pTxPowerIndexOffset = 0;
634
635 return AH_TRUE;
636}
637
638static void
640 const struct ieee80211_channel *chan,
641 CAL_DATA_PER_FREQ_4K *pRawDataSet,
642 uint8_t * bChans, uint16_t availPiers,
643 uint16_t tPdGainOverlap, int16_t *pMinCalPower, uint16_t * pPdGainBoundaries,
644 uint8_t * pPDADCValues, uint16_t numXpdGains)
645{
646
647 int i, j, k;
648 int16_t ss; /* potentially -ve index for taking care of pdGainOverlap */
649 uint16_t idxL, idxR, numPiers; /* Pier indexes */
650
651 /* filled out Vpd table for all pdGains (chanL) */
653
654 /* filled out Vpd table for all pdGains (chanR) */
656
657 /* filled out Vpd table for all pdGains (interpolated) */
659
660 uint8_t *pVpdL, *pVpdR, *pPwrL, *pPwrR;
661 uint8_t minPwrT4[AR5416_4K_NUM_PD_GAINS];
662 uint8_t maxPwrT4[AR5416_4K_NUM_PD_GAINS];
663 int16_t vpdStep;
664 int16_t tmpVal;
665 uint16_t sizeCurrVpdTable, maxIndex, tgtIndex;
666 HAL_BOOL match;
667 int16_t minDelta = 0;
668 CHAN_CENTERS centers;
669
670 ar5416GetChannelCenters(ah, chan, &centers);
671
672 /* Trim numPiers for the number of populated channel Piers */
673 for (numPiers = 0; numPiers < availPiers; numPiers++) {
674 if (bChans[numPiers] == AR5416_BCHAN_UNUSED) {
675 break;
676 }
677 }
678
679 /* Find pier indexes around the current channel */
680 match = ath_ee_getLowerUpperIndex((uint8_t)FREQ2FBIN(centers.synth_center,
681 IEEE80211_IS_CHAN_2GHZ(chan)), bChans, numPiers, &idxL, &idxR);
682
683 if (match) {
684 /* Directly fill both vpd tables from the matching index */
685 for (i = 0; i < numXpdGains; i++) {
686 minPwrT4[i] = pRawDataSet[idxL].pwrPdg[i][0];
687 maxPwrT4[i] = pRawDataSet[idxL].pwrPdg[i][4];
688 ath_ee_FillVpdTable(minPwrT4[i], maxPwrT4[i],
689 pRawDataSet[idxL].pwrPdg[i],
690 pRawDataSet[idxL].vpdPdg[i],
691 AR5416_PD_GAIN_ICEPTS, vpdTableI[i]);
692 }
693 } else {
694 for (i = 0; i < numXpdGains; i++) {
695 pVpdL = pRawDataSet[idxL].vpdPdg[i];
696 pPwrL = pRawDataSet[idxL].pwrPdg[i];
697 pVpdR = pRawDataSet[idxR].vpdPdg[i];
698 pPwrR = pRawDataSet[idxR].pwrPdg[i];
699
700 /* Start Vpd interpolation from the max of the minimum powers */
701 minPwrT4[i] = AH_MAX(pPwrL[0], pPwrR[0]);
702
703 /* End Vpd interpolation from the min of the max powers */
704 maxPwrT4[i] = AH_MIN(pPwrL[AR5416_PD_GAIN_ICEPTS - 1], pPwrR[AR5416_PD_GAIN_ICEPTS - 1]);
705 HALASSERT(maxPwrT4[i] > minPwrT4[i]);
706
707 /* Fill pier Vpds */
708 ath_ee_FillVpdTable(minPwrT4[i], maxPwrT4[i], pPwrL, pVpdL,
709 AR5416_PD_GAIN_ICEPTS, vpdTableL[i]);
710 ath_ee_FillVpdTable(minPwrT4[i], maxPwrT4[i], pPwrR, pVpdR,
711 AR5416_PD_GAIN_ICEPTS, vpdTableR[i]);
712
713 /* Interpolate the final vpd */
714 for (j = 0; j <= (maxPwrT4[i] - minPwrT4[i]) / 2; j++) {
715 vpdTableI[i][j] = (uint8_t)(ath_ee_interpolate((uint16_t)FREQ2FBIN(centers.synth_center,
716 IEEE80211_IS_CHAN_2GHZ(chan)),
717 bChans[idxL], bChans[idxR], vpdTableL[i][j], vpdTableR[i][j]));
718 }
719 }
720 }
721 *pMinCalPower = (int16_t)(minPwrT4[0] / 2);
722
723 k = 0; /* index for the final table */
724 for (i = 0; i < numXpdGains; i++) {
725 if (i == (numXpdGains - 1)) {
726 pPdGainBoundaries[i] = (uint16_t)(maxPwrT4[i] / 2);
727 } else {
728 pPdGainBoundaries[i] = (uint16_t)((maxPwrT4[i] + minPwrT4[i+1]) / 4);
729 }
730
731 pPdGainBoundaries[i] = (uint16_t)AH_MIN(AR5416_MAX_RATE_POWER, pPdGainBoundaries[i]);
732
733 /* NB: only applies to owl 1.0 */
734 if ((i == 0) && !AR_SREV_5416_V20_OR_LATER(ah) ) {
735 /*
736 * fix the gain delta, but get a delta that can be applied to min to
737 * keep the upper power values accurate, don't think max needs to
738 * be adjusted because should not be at that area of the table?
739 */
740 minDelta = pPdGainBoundaries[0] - 23;
741 pPdGainBoundaries[0] = 23;
742 }
743 else {
744 minDelta = 0;
745 }
746
747 /* Find starting index for this pdGain */
748 if (i == 0) {
750 ss = (int16_t)(0 - (minPwrT4[i] / 2));
751 else
752 ss = 0; /* for the first pdGain, start from index 0 */
753 } else {
754 /* need overlap entries extrapolated below. */
755 ss = (int16_t)((pPdGainBoundaries[i-1] - (minPwrT4[i] / 2)) - tPdGainOverlap + 1 + minDelta);
756 }
757 vpdStep = (int16_t)(vpdTableI[i][1] - vpdTableI[i][0]);
758 vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
759 /*
760 *-ve ss indicates need to extrapolate data below for this pdGain
761 */
762 while ((ss < 0) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
763 tmpVal = (int16_t)(vpdTableI[i][0] + ss * vpdStep);
764 pPDADCValues[k++] = (uint8_t)((tmpVal < 0) ? 0 : tmpVal);
765 ss++;
766 }
767
768 sizeCurrVpdTable = (uint8_t)((maxPwrT4[i] - minPwrT4[i]) / 2 +1);
769 tgtIndex = (uint8_t)(pPdGainBoundaries[i] + tPdGainOverlap - (minPwrT4[i] / 2));
770 maxIndex = (tgtIndex < sizeCurrVpdTable) ? tgtIndex : sizeCurrVpdTable;
771
772 while ((ss < maxIndex) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
773 pPDADCValues[k++] = vpdTableI[i][ss++];
774 }
775
776 vpdStep = (int16_t)(vpdTableI[i][sizeCurrVpdTable - 1] - vpdTableI[i][sizeCurrVpdTable - 2]);
777 vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
778 /*
779 * for last gain, pdGainBoundary == Pmax_t2, so will
780 * have to extrapolate
781 */
782 if (tgtIndex >= maxIndex) { /* need to extrapolate above */
783 while ((ss <= tgtIndex) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
784 tmpVal = (int16_t)((vpdTableI[i][sizeCurrVpdTable - 1] +
785 (ss - maxIndex +1) * vpdStep));
786 pPDADCValues[k++] = (uint8_t)((tmpVal > 255) ? 255 : tmpVal);
787 ss++;
788 }
789 } /* extrapolated above */
790 } /* for all pdGainUsed */
791
792 /* Fill out pdGainBoundaries - only up to 2 allowed here, but hardware allows up to 4 */
793 while (i < AR5416_PD_GAINS_IN_MASK) {
794 pPdGainBoundaries[i] = AR5416_4K_EEP_PD_GAIN_BOUNDARY_DEFAULT;
795 i++;
796 }
797
798 while (k < AR5416_NUM_PDADC_VALUES) {
799 pPDADCValues[k] = pPDADCValues[k-1];
800 k++;
801 }
802 return;
803}
HAL_BOOL ath_ee_FillVpdTable(uint8_t pwrMin, uint8_t pwrMax, uint8_t *pPwrList, uint8_t *pVpdList, uint16_t numIntercepts, uint8_t *pRetVpdList)
Definition: ah.c:1418
HAL_BOOL ath_ee_getLowerUpperIndex(uint8_t target, uint8_t *pList, uint16_t listSize, uint16_t *indexL, uint16_t *indexR)
Definition: ah.c:1369
int16_t ath_ee_interpolate(uint16_t target, uint16_t srcLeft, uint16_t srcRight, int16_t targetLeft, int16_t targetRight)
Definition: ah.c:1452
HAL_BOOL
Definition: ah.h:93
@ AH_FALSE
Definition: ah.h:94
@ AH_TRUE
Definition: ah.h:95
@ HAL_DEBUG_RESET
Definition: ah_debug.h:31
@ HAL_DEBUG_ANY
Definition: ah_debug.h:62
#define CTL_2GHT20
Definition: ah_eeprom.h:131
#define CTL_2GHT40
Definition: ah_eeprom.h:133
#define AR_EEPROM_VER14_1
Definition: ah_eeprom.h:59
#define CTL_MODE_M
Definition: ah_eeprom.h:125
#define CTL_11G
Definition: ah_eeprom.h:128
#define CTL_5GHT20
Definition: ah_eeprom.h:132
#define CTL_11A
Definition: ah_eeprom.h:126
#define MAX_RATE_POWER
Definition: ah_eeprom.h:163
#define SD_NO_CTL
Definition: ah_eeprom.h:123
@ AR_EEP_ANTGAINMAX_2
Definition: ah_eeprom.h:103
#define CTL_11B
Definition: ah_eeprom.h:127
#define CTL_5GHT40
Definition: ah_eeprom.h:134
#define AR5416_EEP_VER_MINOR_MASK
Definition: ah_eeprom_v14.h:47
#define AR5416_PD_GAIN_ICEPTS
Definition: ah_eeprom_v14.h:75
#define owl_get_ntxchains(_txchainmask)
Definition: ah_eeprom_v14.h:34
#define AR5416_NUM_PDADC_VALUES
Definition: ah_eeprom_v14.h:78
#define FREQ2FBIN(x, y)
Definition: ah_eeprom_v14.h:83
#define AR5416_EEP_MINOR_VER_3
Definition: ah_eeprom_v14.h:51
#define AR5416_MAX_RATE_POWER
Definition: ah_eeprom_v14.h:77
#define AR5416_MAX_PWR_RANGE_IN_HALF_DB
Definition: ah_eeprom_v14.h:81
#define AR5416_PWR_TABLE_OFFSET_DB
Definition: ah_eeprom_v14.h:85
#define AR5416_MAX_CHAINS
Definition: ah_eeprom_v14.h:84
#define AR5416_BCHAN_UNUSED
Definition: ah_eeprom_v14.h:80
#define AR5416_EEP_MINOR_VER_2
Definition: ah_eeprom_v14.h:49
#define AR5416_PD_GAINS_IN_MASK
Definition: ah_eeprom_v14.h:74
#define AR5416_4K_NUM_2G_40_TARGET_POWERS
Definition: ah_eeprom_v4k.h:48
#define EEP_4K_BB_DESIRED_SCALE_MASK
#define AR5416_4K_NUM_2G_20_TARGET_POWERS
Definition: ah_eeprom_v4k.h:47
#define AR5416_4K_EEP_PD_GAIN_BOUNDARY_DEFAULT
Definition: ah_eeprom_v4k.h:34
#define AR5416_4K_NUM_CTLS
Definition: ah_eeprom_v4k.h:49
#define AR5416_4K_NUM_2G_CAL_PIERS
Definition: ah_eeprom_v4k.h:45
#define AR5416_4K_NUM_2G_CCK_TARGET_POWERS
Definition: ah_eeprom_v4k.h:46
#define AR5416_4K_NUM_PD_GAINS
Definition: ah_eeprom_v4k.h:51
u_int ath_hal_getctl(struct ath_hal *, const struct ieee80211_channel *)
Definition: ah_regdomain.c:932
#define ath_hal_eepromSet(_ah, _param, _val)
Definition: ah_internal.h:488
#define SM(_v, _f)
Definition: ah_internal.h:587
#define MS(_v, _f)
Definition: ah_internal.h:588
#define AH_PRIVATE(_ah)
Definition: ah_internal.h:442
#define OS_REG_RMW(_a, _r, _set, _clr)
Definition: ah_internal.h:589
#define OS_REG_RMW_FIELD(_a, _r, _f, _v)
Definition: ah_internal.h:591
#define AH_NULL
Definition: ah_internal.h:28
#define HALASSERT(_x)
Definition: ah_internal.h:683
#define HALDEBUG(_ah, __m,...)
Definition: ah_internal.h:658
#define AH_MIN(a, b)
Definition: ah_internal.h:29
#define AH_MAX(a, b)
Definition: ah_internal.h:30
#define OS_A_REG_RMW_FIELD(_a, _r, _f, _v)
Definition: ah_internal.h:610
void ath_hal_printf(struct ath_hal *, const char *,...)
Definition: ah_osdep.c:80
#define OS_MEMZERO(_a, _n)
Definition: ah_osdep.h:72
#define OS_REG_WRITE(_ah, _reg, _val)
Definition: ah_osdep.h:139
#define OS_REG_READ(_ah, _reg)
Definition: ah_osdep.h:140
#define AH5212(_ah)
Definition: ar5212.h:354
#define AR_PHY_SETTLING_SWITCH
Definition: ar5212phy.h:84
#define AR_PHY_GAIN_2GHZ
Definition: ar5212phy.h:320
#define AR_PHY_TPCRG5
Definition: ar5212phy.h:349
#define AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF
Definition: ar5212phy.h:166
#define AR_PHY_SETTLING
Definition: ar5212phy.h:81
#define AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF
Definition: ar5212phy.h:164
#define AR_PHY_DESIRED_SZ_ADC
Definition: ar5212phy.h:94
#define AR_PHY_RXGAIN
Definition: ar5212phy.h:87
#define AR_PHY_TPCRG5_PD_GAIN_OVERLAP
Definition: ar5212phy.h:350
#define AR_PHY_DESIRED_SZ
Definition: ar5212phy.h:93
void ar5416SetGainBoundariesClosedLoop(struct ath_hal *ah, int i, uint16_t pdGainOverlap_t2, uint16_t gainBoundaries[])
void ar5416GetChannelCenters(struct ath_hal *, const struct ieee80211_channel *chan, CHAN_CENTERS *centers)
void ar5416WriteDetectorGainBiases(struct ath_hal *ah, uint16_t numXpdGain, uint16_t xpdGainValues[])
void ar5416WriteTxPowerRateRegisters(struct ath_hal *ah, const struct ieee80211_channel *chan, const int16_t ratesArray[])
Definition: ar5416_reset.c:966
#define AH5416(_ah)
Definition: ar5416.h:162
void ar5416WritePdadcValues(struct ath_hal *ah, int i, uint8_t pdadcValues[])
void ar5416GetTargetPowersLeg(struct ath_hal *ah, const struct ieee80211_channel *chan, CAL_TARGET_POWER_LEG *powInfo, uint16_t numChannels, CAL_TARGET_POWER_LEG *pNewPower, uint16_t numRates, HAL_BOOL isExtTarget)
void ar5416GetTargetPowers(struct ath_hal *ah, const struct ieee80211_channel *chan, CAL_TARGET_POWER_HT *powInfo, uint16_t numChannels, CAL_TARGET_POWER_HT *pNewPower, uint16_t numRates, HAL_BOOL isHt40Target)
uint16_t ar5416GetMaxEdgePower(uint16_t freq, CAL_CTL_EDGES *pRdEdgesPower, HAL_BOOL is2GHz)
void ar5416SetRatesArrayFromTargetPower(struct ath_hal *ah, const struct ieee80211_channel *chan, int16_t *ratesArray, const CAL_TARGET_POWER_LEG *targetPowerCck, const CAL_TARGET_POWER_LEG *targetPowerCckExt, const CAL_TARGET_POWER_LEG *targetPowerOfdm, const CAL_TARGET_POWER_LEG *targetPowerOfdmExt, const CAL_TARGET_POWER_HT *targetPowerHt20, const CAL_TARGET_POWER_HT *targetPowerHt40)
@ rateHt40_2
Definition: ar5416.h:43
@ rateHt40_4
Definition: ar5416.h:44
@ rateHt40_7
Definition: ar5416.h:44
@ rateHt20_0
Definition: ar5416.h:41
@ rateHt40_6
Definition: ar5416.h:44
@ rate6mb
Definition: ar5416.h:37
@ rate1l
Definition: ar5416.h:39
@ rateHt40_1
Definition: ar5416.h:43
@ rateHt40_5
Definition: ar5416.h:44
@ rateHt40_0
Definition: ar5416.h:43
@ rateHt40_3
Definition: ar5416.h:43
int ar5416GetRegChainOffset(struct ath_hal *ah, int i)
#define AR_PHY_RF_CTL4
Definition: ar5416phy.h:298
#define AR_PHY_EXT_CCA0
Definition: ar5416phy.h:270
#define AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN
Definition: ar5416phy.h:174
#define AR_PHY_RF_CTL4_TX_END_XPAB_OFF
Definition: ar5416phy.h:299
#define AR_PHY_GAIN_2GHZ_XATTEN1_DB
Definition: ar5416phy.h:178
#define AR9280_PHY_RXGAIN_TXRX_MARGIN
Definition: ar5416phy.h:183
#define AR_PHY_TX_PWRCTRL9
Definition: ar5416phy.h:388
#define AR_PHY_GAIN_2GHZ_XATTEN2_DB
Definition: ar5416phy.h:176
#define AR9280_PHY_RXGAIN_TXRX_ATTEN
Definition: ar5416phy.h:181
#define AR_PHY_SWITCH_CHAIN_0
Definition: ar5416phy.h:285
#define AR_PHY_TX_END_TO_A2_RX_ON
Definition: ar5416phy.h:295
#define AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN
Definition: ar5416phy.h:172
#define AR_PHY_SWITCH_COM
Definition: ar5416phy.h:286
#define AR_PHY_RF_CTL4_FRAME_XPAB_ON
Definition: ar5416phy.h:303
#define AR_PHY_RF_CTL3
Definition: ar5416phy.h:294
#define AR9280_PHY_CCA_THRESH62
Definition: ar5416phy.h:238
#define AR_PHY_CCA
Definition: ar5416phy.h:233
#define AR_PHY_RF_CTL4_TX_END_XPAA_OFF
Definition: ar5416phy.h:301
#define AR_PHY_EXT_CCA0_THRESH62
Definition: ar5416phy.h:271
#define AR_PHY_RF_CTL4_FRAME_XPAA_ON
Definition: ar5416phy.h:305
#define AR_PHY_RF_CTL2
Definition: ar5416phy.h:288
#define AR_PHY_TX_FRAME_TO_DATA_START
Definition: ar5416phy.h:289
#define AR_PHY_TX_FRAME_TO_PA_ON
Definition: ar5416phy.h:291
#define AR_PHY_TIMING_CTRL4_CHAIN(_i)
Definition: ar5416phy.h:147
#define AR_SREV_5416_V20_OR_LATER(_ah)
Definition: ar5416reg.h:653
#define AR_SREV_KITE(_ah)
Definition: ar5416reg.h:754
#define AR_SREV_MERLIN_20_OR_LATER(_ah)
Definition: ar5416reg.h:747
#define AR_SREV_9271(_ah)
Definition: ar5416reg.h:810
#define AR_PHY_TX_PWRCTRL8
Definition: ar9002phy.h:47
#define AR_PHY_CH0_TX_PWRCTRL12
Definition: ar9002phy.h:56
#define AR_PHY_CH0_TX_PWRCTRL13
Definition: ar9002phy.h:57
#define AR_PHY_TX_PWRCTRL10
Definition: ar9002phy.h:48
#define AR_PHY_CH0_TX_PWRCTRL11
Definition: ar9002phy.h:54
HAL_BOOL ar9285SetAntennaSwitch(struct ath_hal *ah, HAL_ANT_SETTING settings)
#define CTL_11G_EXT
#define EXT_ADDITIVE
static void ar9285SetBoardGain(struct ath_hal *ah, const MODAL_EEP4K_HEADER *pModal, const struct ar5416eeprom_4k *eep, uint8_t txRxAttenLocal)
Definition: ar9285_reset.c:191
static void ar9285GetGainBoundariesAndPdadcs(struct ath_hal *ah, const struct ieee80211_channel *chan, CAL_DATA_PER_FREQ_4K *pRawDataSet, uint8_t *bChans, uint16_t availPiers, uint16_t tPdGainOverlap, int16_t *pMinCalPower, uint16_t *pPdGainBoundaries, uint8_t *pPDADCValues, uint16_t numXpdGains)
Definition: ar9285_reset.c:639
#define CTL_11B_EXT
static HAL_BOOL ar9285SetPowerPerRateTable(struct ath_hal *ah, struct ar5416eeprom_4k *pEepData, const struct ieee80211_channel *chan, int16_t *ratesArray, uint16_t cfgCtl, uint16_t AntennaReduction, uint16_t twiceMaxRegulatoryPower, uint16_t powerLimit)
Definition: ar9285_reset.c:398
HAL_BOOL ar9285SetBoardValues(struct ath_hal *ah, const struct ieee80211_channel *chan)
Definition: ar9285_reset.c:246
HAL_BOOL ar9285SetTransmitPower(struct ath_hal *ah, const struct ieee80211_channel *chan, uint16_t *rfXpdGain)
Definition: ar9285_reset.c:74
#define IS_EEP_MINOR_V2(_ah)
Definition: ar9285_reset.c:48
#define SUB_NUM_CTL_MODES_AT_2G_40
#define N(a)
static HAL_BOOL ar9285SetPowerCalTable(struct ath_hal *ah, struct ar5416eeprom_4k *pEepData, const struct ieee80211_channel *chan, int16_t *pTxPowerIndexOffset)
Definition: ar9285_reset.c:566
#define AR9285_AN_RF2G4_DB2_2
Definition: ar9285an.h:75
#define AR9285_AN_RF2G3_DB1_1
Definition: ar9285an.h:59
#define AR9285_AN_RF2G4_DB2_1
Definition: ar9285an.h:73
#define AR9285_AN_RF2G4_DB1_4
Definition: ar9285an.h:68
#define AR9285_AN_RF2G3
Definition: ar9285an.h:43
#define AR9285_AN_RF2G4
Definition: ar9285an.h:64
#define AR9285_AN_RF2G3_OB_1
Definition: ar9285an.h:49
#define AR9285_AN_RF2G4_DB2_3
Definition: ar9285an.h:77
#define AR9285_AN_RF2G3_DB1_0
Definition: ar9285an.h:57
#define AR9285_AN_RF2G3_DB1_2
Definition: ar9285an.h:61
#define AR9285_AN_RF2G3_OB_3
Definition: ar9285an.h:53
#define AR9285_AN_RF2G3_OB_4
Definition: ar9285an.h:55
#define AR9285_AN_RF2G4_DB2_4
Definition: ar9285an.h:79
#define AR9285_AN_RF2G3_OB_2
Definition: ar9285an.h:51
#define AR9285_AN_RF2G3_OB_0
Definition: ar9285an.h:47
#define AR9285_AN_RF2G4_DB1_3
Definition: ar9285an.h:66
#define AR9285_AN_RF2G4_DB2_0
Definition: ar9285an.h:71
uint16_t version
Definition: ah_eeprom_v4k.h:63
uint8_t txGainType
Definition: ah_eeprom_v4k.h:77
uint16_t ctl_center
Definition: ar5416.h:32
uint16_t ext_center
Definition: ar5416.h:33
uint16_t synth_center
Definition: ar5416.h:31
CAL_CTL_EDGES ctlEdges[AR5416_4K_MAX_CHAINS][AR5416_4K_NUM_BAND_EDGES]
uint8_t tPow2x[8]
struct ar5416eeprom_4k ee_base
uint8_t txFrameToDataStart
uint8_t bb_scale_smrt_antenna
uint8_t ht40PowerIncForPdadc
uint32_t antCtrlChain[AR5416_4K_MAX_CHAINS]
Definition: ah_eeprom_v4k.h:81
int8_t antennaGainCh[AR5416_4K_MAX_CHAINS]
Definition: ah_eeprom_v4k.h:83
int8_t iqCalQCh[AR5416_4K_MAX_CHAINS]
Definition: ah_eeprom_v4k.h:98
uint8_t switchSettling
Definition: ah_eeprom_v4k.h:84
uint32_t antCtrlCommon
Definition: ah_eeprom_v4k.h:82
uint8_t txRxAttenCh[AR5416_4K_MAX_CHAINS]
Definition: ah_eeprom_v4k.h:85
int8_t iqCalICh[AR5416_4K_MAX_CHAINS]
Definition: ah_eeprom_v4k.h:97
uint8_t xatten2Margin[AR5416_4K_MAX_CHAINS]
uint8_t xatten2Db[AR5416_4K_MAX_CHAINS]
uint8_t txFrameToXpaOn
Definition: ah_eeprom_v4k.h:92
uint8_t bswAtten[AR5416_4K_MAX_CHAINS]
uint8_t txEndToXpaOff
Definition: ah_eeprom_v4k.h:90
uint8_t bswMargin[AR5416_4K_MAX_CHAINS]
uint8_t adcDesiredSize
Definition: ah_eeprom_v4k.h:87
uint8_t rxTxMarginCh[AR5416_4K_MAX_CHAINS]
Definition: ah_eeprom_v4k.h:86
uint8_t ctlIndex[AR5416_4K_NUM_CTLS]
CAL_TARGET_POWER_HT calTargetPower2GHT20[AR5416_4K_NUM_2G_20_TARGET_POWERS]
BASE_EEP4K_HEADER baseEepHeader
CAL_DATA_PER_FREQ_4K calPierData2G[AR5416_4K_MAX_CHAINS][AR5416_4K_NUM_2G_CAL_PIERS]
CAL_TARGET_POWER_LEG calTargetPowerCck[AR5416_4K_NUM_2G_CCK_TARGET_POWERS]
CAL_TARGET_POWER_HT calTargetPower2GHT40[AR5416_4K_NUM_2G_40_TARGET_POWERS]
MODAL_EEP4K_HEADER modalHeader
uint8_t calFreqPier2G[AR5416_4K_NUM_2G_CAL_PIERS]
CAL_CTL_DATA_4K ctlData[AR5416_4K_NUM_CTLS]
CAL_TARGET_POWER_LEG calTargetPower2G[AR5416_4K_NUM_2G_20_TARGET_POWERS]
int16_t ah_txPowerIndexOffset
Definition: ar5212.h:301
uint32_t ah_tx6PowerInHalfDbm
Definition: ar5212.h:285
Definition: ah.h:1219
uint8_t vpdPdg[AR5416_4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]
uint8_t pwrPdg[AR5416_4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]