48 const struct ieee80211_channel *chan, int16_t *pTxPowerIndexOffset)
51 uint8_t *pCalBChans = NULL;
52 uint16_t pdGainOverlap_t2;
53 uint16_t numPiers = 0, i;
54 uint16_t numXpdGain, xpdMask;
56 uint32_t regChainOffset;
70 if (IEEE80211_IS_CHAN_2GHZ(chan)) {
74 AH5416(ah)->initPDADC = pRawDatasetOpenLoop->
vpdPdg[0][0];
83 xpdGainValues[numXpdGain] =
90 (numXpdGain - 1) & 0x3);
99 regChainOffset = i * 0x1000;
103 pRawDatasetOpenLoop =
107 pCalBChans, numPiers,
113 *pTxPowerIndexOffset = 0;
117#define REDUCE_SCALED_POWER_BY_TWO_CHAIN 6
130 const struct ieee80211_channel *chan,
131 int16_t *ratesArray, uint16_t cfgCtl,
132 uint16_t AntennaReduction,
133 uint16_t twiceMaxRegulatoryPower,
136#define N(a) (sizeof(a)/sizeof(a[0]))
138#define EXT_ADDITIVE (0x8000)
139#define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE)
140#define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE)
141#define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE)
145 int16_t twiceLargestAntenna;
153 int16_t scaledPower, minCtlPower;
155#define SUB_NUM_CTL_MODES_AT_2G_40 3
156 static const uint16_t ctlModesFor11g[] = {
159 const uint16_t *pCtlMode;
160 uint16_t numCtlModes, ctlMode, freq;
167 twiceLargestAntenna =
AH_MAX(
171 twiceLargestAntenna = (int16_t)
AH_MIN((AntennaReduction) - twiceLargestAntenna, 0);
180 scaledPower =
AH_MIN(powerLimit, twiceMaxRegulatoryPower + twiceLargestAntenna);
194 scaledPower =
AH_MAX(0, scaledPower);
201 pCtlMode = ctlModesFor11g;
210 if (IEEE80211_IS_CHAN_HT40(chan)) {
211 numCtlModes =
N(ctlModesFor11g);
232 for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
245 uint16_t twiceMinEdgePower;
254 IEEE80211_IS_CHAN_2GHZ(chan));
257 twiceMaxEdgePower =
AH_MIN(twiceMaxEdgePower, twiceMinEdgePower);
260 twiceMaxEdgePower = twiceMinEdgePower;
265 minCtlPower = (uint8_t)
AH_MIN(twiceMaxEdgePower, scaledPower);
267 switch(pCtlMode[ctlMode]) {
269 for (i = 0; i <
N(targetPowerCck.
tPow2x); i++) {
275 for (i = 0; i <
N(targetPowerOfdm.
tPow2x); i++) {
281 for (i = 0; i <
N(targetPowerHt20.
tPow2x); i++) {
286 targetPowerCckExt.
tPow2x[0] = (uint8_t)
AH_MIN(targetPowerCckExt.
tPow2x[0], minCtlPower);
290 targetPowerOfdmExt.
tPow2x[0] = (uint8_t)
AH_MIN(targetPowerOfdmExt.
tPow2x[0], minCtlPower);
294 for (i = 0; i <
N(targetPowerHt40.
tPow2x); i++) {
317#undef SUB_NUM_CTL_MODES_AT_5G_40
318#undef SUB_NUM_CTL_MODES_AT_2G_40
322#undef REDUCE_SCALED_POWER_BY_TWO_CHAIN
330 const struct ieee80211_channel *chan, uint16_t *rfXpdGain)
332#define POW_SM(_r, _s) (((_r) & 0x3f) << (_s))
333#define N(a) (sizeof (a) / sizeof (a[0]))
337 int16_t txPowerIndexOffset = 0;
342 uint16_t twiceAntennaReduction;
343 uint16_t twiceMaxRegulatoryPower;
348 AH5416(ah)->ah_ht40PowerIncForPdadc = 2;
352 sizeof(
AH5416(ah)->ah_ratesArray));
354 powerLimit = chan->ic_maxregpower * 2;
355 twiceAntennaReduction = chan->ic_maxantgain;
360 __func__,chan->ic_freq, cfgCtl );
367 &
AH5416(ah)->ah_ratesArray[0],
369 twiceAntennaReduction,
370 twiceMaxRegulatoryPower, powerLimit)) {
372 "%s: unable to set tx power per rate table\n", __func__);
382 maxPower =
AH_MAX(maxPower,
385 if (IEEE80211_IS_CHAN_HT40(chan))
386 maxPower =
AH_MAX(maxPower,
398 for (i = 0; i <
N(
AH5416(ah)->ah_ratesArray); i++) {
399 AH5416(ah)->ah_ratesArray[i] =
400 (int16_t)(txPowerIndexOffset +
401 AH5416(ah)->ah_ratesArray[i]);
406 if (
AH5416(ah)->ah_ratesArray[i] < 0)
407 AH5416(ah)->ah_ratesArray[i] = 0;
411 ar5416PrintPowerPerRate(ah,
AH5416(ah)->ah_ratesArray);
421 if (IEEE80211_IS_CHAN_HT40(chan)) {
423 AH5416(ah)->ah_ht40PowerIncForPdadc;
425 AH5416(ah)->ah_ht40PowerIncForPdadc;
427 AH5416(ah)->ah_ht40PowerIncForPdadc;
429 AH5416(ah)->ah_ht40PowerIncForPdadc;
431 AH5416(ah)->ah_ht40PowerIncForPdadc;
433 AH5416(ah)->ah_ht40PowerIncForPdadc;
435 AH5416(ah)->ah_ht40PowerIncForPdadc;
437 AH5416(ah)->ah_ht40PowerIncForPdadc;
459 uint32_t regChainOffset, regval;
460 uint8_t txRxAttenLocal;
461 int i, j, offset_num;
465 antWrites[0] = (uint16_t)((pModal->
antCtrlCommon >> 28) & 0xF);
466 antWrites[1] = (uint16_t)((pModal->
antCtrlCommon >> 24) & 0xF);
467 antWrites[2] = (uint16_t)((pModal->
antCtrlCommon >> 20) & 0xF);
468 antWrites[3] = (uint16_t)((pModal->
antCtrlCommon >> 16) & 0xF);
469 antWrites[4] = (uint16_t)((pModal->
antCtrlCommon >> 12) & 0xF);
470 antWrites[5] = (uint16_t)((pModal->
antCtrlCommon >> 8) & 0xF);
471 antWrites[6] = (uint16_t)((pModal->
antCtrlCommon >> 4) & 0xF);
477 antWrites[j++] = (uint16_t)((pModal->
antCtrlChain[i] >> 28) & 0xf);
478 antWrites[j++] = (uint16_t)((pModal->
antCtrlChain[i] >> 10) & 0x3);
479 antWrites[j++] = (uint16_t)((pModal->
antCtrlChain[i] >> 8) & 0x3);
481 antWrites[j++] = (uint16_t)((pModal->
antCtrlChain[i] >> 6) & 0x3);
482 antWrites[j++] = (uint16_t)((pModal->
antCtrlChain[i] >> 4) & 0x3);
483 antWrites[j++] = (uint16_t)((pModal->
antCtrlChain[i] >> 2) & 0x3);
484 antWrites[j++] = (uint16_t)(pModal->
antCtrlChain[i] & 0x3);
490 regChainOffset = i * 0x1000;
521 if (IEEE80211_IS_CHAN_HT40(chan))
#define AR9287_NUM_2G_20_TARGET_POWERS
#define AR9287_EEP_VER_MINOR_MASK
#define AR9287_NUM_2G_CCK_TARGET_POWERS
#define AR9287_NUM_2G_40_TARGET_POWERS
#define AR9287_MAX_CHAINS
#define AR9287_NUM_2G_CAL_PIERS
#define AR9287_EEP_MINOR_VER_2
#define owl_get_ntxchains(_txchainmask)
#define AR5416_MAX_RATE_POWER
#define AR5416_NUM_PD_GAINS
#define AR5416_PWR_TABLE_OFFSET_DB
#define AR5416_PD_GAINS_IN_MASK
u_int ath_hal_getctl(struct ath_hal *, const struct ieee80211_channel *)
#define ath_hal_eepromSet(_ah, _param, _val)
#define OS_A_REG_WRITE(_a, _r, _v)
#define OS_REG_RMW_FIELD(_a, _r, _f, _v)
#define HALDEBUG(_ah, __m,...)
#define OS_A_REG_RMW_FIELD(_a, _r, _f, _v)
#define OS_MEMZERO(_a, _n)
#define OS_REG_WRITE(_ah, _reg, _val)
#define OS_REG_READ(_ah, _reg)
#define AR_PHY_SETTLING_SWITCH
#define AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF
#define AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF
#define AR_PHY_DESIRED_SZ_ADC
#define AR_PHY_TPCRG5_PD_GAIN_OVERLAP
#define AR_PHY_TPCRG1_NUM_PD_GAIN
#define AR_PHY_DESIRED_SZ
void ar5416GetChannelCenters(struct ath_hal *, const struct ieee80211_channel *chan, CHAN_CENTERS *centers)
void ar5416WriteTxPowerRateRegisters(struct ath_hal *ah, const struct ieee80211_channel *chan, const int16_t ratesArray[])
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)
#define AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN
#define AR_PHY_TPCRG1_PD_GAIN_2
#define AR_PHY_RF_CTL4_TX_END_XPAB_OFF
#define AR_PHY_GAIN_2GHZ_XATTEN1_DB
#define AR9280_PHY_RXGAIN_TXRX_MARGIN
#define AR9280_PHY_RXGAIN_TXRX_ATTEN
#define AR_PHY_SWITCH_CHAIN_0
#define AR_PHY_TX_END_TO_A2_RX_ON
#define AR_PHY_SWITCH_COM
#define AR_PHY_RF_CTL4_FRAME_XPAB_ON
#define AR_PHY_TPCRG1_PD_GAIN_3
#define AR9280_PHY_CCA_THRESH62
#define AR_PHY_RF_CTL4_TX_END_XPAA_OFF
#define AR_PHY_EXT_CCA0_THRESH62
#define AR_PHY_TPCRG1_PD_GAIN_1
#define AR_PHY_RF_CTL4_FRAME_XPAA_ON
#define AR_PHY_TX_FRAME_TO_DATA_START
#define AR_PHY_TX_FRAME_TO_PA_ON
#define AR_PHY_TIMING_CTRL4_CHAIN(_i)
void ar9287olcGetTxGainIndex(struct ath_hal *ah, const struct ieee80211_channel *chan, struct cal_data_op_loop_ar9287 *pRawDatasetOpLoop, uint8_t *pCalChans, uint16_t availPiers, int8_t *pPwr)
void ar9287olcSetPDADCs(struct ath_hal *ah, int32_t txPower, uint16_t chain)
#define REDUCE_SCALED_POWER_BY_TWO_CHAIN
HAL_BOOL ar9287SetBoardValues(struct ath_hal *ah, const struct ieee80211_channel *chan)
HAL_BOOL ar9287SetTransmitPower(struct ath_hal *ah, const struct ieee80211_channel *chan, uint16_t *rfXpdGain)
#define SUB_NUM_CTL_MODES_AT_2G_40
static void ar9287SetPowerCalTable(struct ath_hal *ah, const struct ieee80211_channel *chan, int16_t *pTxPowerIndexOffset)
static HAL_BOOL ar9287SetPowerPerRateTable(struct ath_hal *ah, struct ar9287_eeprom *pEepData, const struct ieee80211_channel *chan, int16_t *ratesArray, uint16_t cfgCtl, uint16_t AntennaReduction, uint16_t twiceMaxRegulatoryPower, uint16_t powerLimit)
#define AR9287_AN_RF2G3_DB2
#define AR9287_AN_RF2G3_CH0
#define AR9287_AN_RF2G3_DB1
#define AR9287_AN_TOP2_XPABIAS_LVL
#define AR9287_AN_RF2G3_OB_PSK
#define AR9287_AN_RF2G3_OB_CCK
#define AR9287_AN_RF2G3_OB_QAM
#define AR9287_AN_RF2G3_OB_PAL_OFF
#define AR9287_AN_RF2G3_CH1
struct ar9287_eeprom ee_base
CAL_TARGET_POWER_LEG calTargetPower2G[AR9287_NUM_2G_20_TARGET_POWERS]
struct base_eep_ar9287_header baseEepHeader
uint8_t calFreqPier2G[AR9287_NUM_2G_CAL_PIERS]
struct modal_eep_ar9287_header modalHeader
struct cal_ctl_data_ar9287 ctlData[AR9287_NUM_CTLS]
CAL_TARGET_POWER_HT calTargetPower2GHT20[AR9287_NUM_2G_20_TARGET_POWERS]
CAL_TARGET_POWER_LEG calTargetPowerCck[AR9287_NUM_2G_CCK_TARGET_POWERS]
uint8_t ctlIndex[AR9287_NUM_CTLS]
union cal_data_per_freq_ar9287_u calPierData2G[AR9287_MAX_CHAINS][AR9287_NUM_2G_CAL_PIERS]
CAL_TARGET_POWER_HT calTargetPower2GHT40[AR9287_NUM_2G_40_TARGET_POWERS]
int16_t ah_txPowerIndexOffset
uint32_t ah_tx6PowerInHalfDbm
CAL_CTL_EDGES ctlEdges[AR9287_MAX_CHAINS][AR9287_NUM_BAND_EDGES]