Lines Matching +full:half +full:- +full:dbm
1 /*-
2 * SPDX-License-Identifier: ISC
4 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
5 * Copyright (c) 2002-2008 Atheros Communications, Inc.
62 #define AR2317(ah) ((struct ar2317State *) AH5212(ah)->ah_rfHal)
94 channelSel = freq - 2272 ; in ar2317SetChannel()
108 ((freq - 4800) / 20 << 2), 8); in ar2317SetChannel()
112 ((freq - 4800) / 10 << 1), 8); in ar2317SetChannel()
116 (freq - 4800) / 5, 8); in ar2317SetChannel()
131 AH_PRIVATE(ah)->ah_curchan = chan; in ar2317SetChannel()
149 (_priv)->Bank##_ix##Data[i] = ar5212Bank##_ix##_2317[i][_col];\ in ar2317SetRfRegs()
152 const HAL_EEPROM *ee = AH_PRIVATE(ah)->ah_eeprom; in ar2317SetRfRegs()
158 __func__, chan->ic_freq, chan->ic_flags, modesIndex); in ar2317SetRfRegs()
164 ob2GHz = ee->ee_obFor24; in ar2317SetRfRegs()
165 db2GHz = ee->ee_dbFor24; in ar2317SetRfRegs()
167 ob2GHz = ee->ee_obFor24g; in ar2317SetRfRegs()
168 db2GHz = ee->ee_dbFor24g; in ar2317SetRfRegs()
183 ar5212ModifyRfBuffer(priv->Bank6Data, ob2GHz, 3, 193, 0); in ar2317SetRfRegs()
184 ar5212ModifyRfBuffer(priv->Bank6Data, db2GHz, 3, 190, 0); in ar2317SetRfRegs()
190 HAL_INI_WRITE_BANK(ah, ar5212Bank1_2317, priv->Bank1Data, regWrites); in ar2317SetRfRegs()
191 HAL_INI_WRITE_BANK(ah, ar5212Bank2_2317, priv->Bank2Data, regWrites); in ar2317SetRfRegs()
192 HAL_INI_WRITE_BANK(ah, ar5212Bank3_2317, priv->Bank3Data, regWrites); in ar2317SetRfRegs()
193 HAL_INI_WRITE_BANK(ah, ar5212Bank6_2317, priv->Bank6Data, regWrites); in ar2317SetRfRegs()
194 HAL_INI_WRITE_BANK(ah, ar5212Bank7_2317, priv->Bank7Data, regWrites); in ar2317SetRfRegs()
196 ahp->ah_rfgainState = HAL_RFGAIN_INACTIVE; in ar2317SetRfRegs()
212 case 1: return priv->Bank1Data; in ar2317GetRfBank()
213 case 2: return priv->Bank2Data; in ar2317GetRfBank()
214 case 3: return priv->Bank3Data; in ar2317GetRfBank()
215 case 6: return priv->Bank6Data; in ar2317GetRfBank()
216 case 7: return priv->Bank7Data; in ar2317GetRfBank()
237 * Check first and last elements for out-of-bounds conditions. in GetLowerUpperIndex()
243 if (target >= ep[-1]) { in GetLowerUpperIndex()
244 *vlo = *vhi = listSize - 1; in GetLowerUpperIndex()
255 *vlo = *vhi = tp - (const int16_t *) lp; in GetLowerUpperIndex()
263 *vlo = tp - (const int16_t *) lp; in GetLowerUpperIndex()
271 * Fill the Vpdlist for indices Pmax-Pmin
289 while (ii <= (uint16_t)(Pmax - Pmin)) { in ar2317FillVpdTable()
294 if (idxL == (uint32_t)(numIntercepts - 1)) in ar2317FillVpdTable()
295 idxL = numIntercepts - 2; /* extrapolate above */ in ar2317FillVpdTable()
300 (((currPwr - pwrList[idxL])*VpdList[idxR]+ in ar2317FillVpdTable()
301 (pwrList[idxR] - currPwr)*VpdList[idxL])/ in ar2317FillVpdTable()
302 (pwrList[idxR] - pwrList[idxL])); in ar2317FillVpdTable()
305 currPwr += 2; /* half dB steps */ in ar2317FillVpdTable()
321 rv = ((target - srcLeft)*targetRight + in interpolate_signed()
322 (srcRight - target)*targetLeft) / (srcRight - srcLeft); in interpolate_signed()
341 #define VpdTable_L priv->vpdTable_L in ar2317getGainBoundariesAndPdadcsForPowers()
342 #define VpdTable_R priv->vpdTable_R in ar2317getGainBoundariesAndPdadcsForPowers()
343 #define VpdTable_I priv->vpdTable_I in ar2317getGainBoundariesAndPdadcsForPowers()
346 int32_t ss;/* potentially -ve index for taking care of pdGainOverlap */ in ar2317getGainBoundariesAndPdadcsForPowers()
350 * If desired to support -ve power levels in future, just in ar2317getGainBoundariesAndPdadcsForPowers()
351 * change pwr_I_0 to signed 5-bits. in ar2317getGainBoundariesAndPdadcsForPowers()
354 /* to accommodate -ve power levels later on. */ in ar2317getGainBoundariesAndPdadcsForPowers()
356 /* to accommodate -ve power levels later on */ in ar2317getGainBoundariesAndPdadcsForPowers()
363 GetLowerUpperIndex(channel, pRawDataset->pChannels, in ar2317getGainBoundariesAndPdadcsForPowers()
364 pRawDataset->numChannels, &(idxL), &(idxR)); in ar2317getGainBoundariesAndPdadcsForPowers()
367 jj = MAX_NUM_PDGAINS_PER_CHANNEL - ii - 1; in ar2317getGainBoundariesAndPdadcsForPowers()
369 numVpd = pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].numVpd; in ar2317getGainBoundariesAndPdadcsForPowers()
371 pPdGainValues[numPdGainsUsed] = pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].pd_gain; in ar2317getGainBoundariesAndPdadcsForPowers()
372 Pmin_t2[numPdGainsUsed] = pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].pwr_t4[0]; in ar2317getGainBoundariesAndPdadcsForPowers()
373 if (Pmin_t2[numPdGainsUsed] >pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[0]) { in ar2317getGainBoundariesAndPdadcsForPowers()
374 Pmin_t2[numPdGainsUsed] = pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[0]; in ar2317getGainBoundariesAndPdadcsForPowers()
378 Pmax_t2[numPdGainsUsed] = pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].pwr_t4[numVpd-1]; in ar2317getGainBoundariesAndPdadcsForPowers()
379 …if (Pmax_t2[numPdGainsUsed] > pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[numVpd-… in ar2317getGainBoundariesAndPdadcsForPowers()
381 pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[numVpd-1]; in ar2317getGainBoundariesAndPdadcsForPowers()
385 &(pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].pwr_t4[0]), in ar2317getGainBoundariesAndPdadcsForPowers()
386 &(pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].Vpd[0]), numVpd, VpdTable_L in ar2317getGainBoundariesAndPdadcsForPowers()
390 &(pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[0]), in ar2317getGainBoundariesAndPdadcsForPowers()
391 &(pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].Vpd[0]), numVpd, VpdTable_R in ar2317getGainBoundariesAndPdadcsForPowers()
393 for (kk = 0; kk < (uint16_t)(Pmax_t2[numPdGainsUsed] - Pmin_t2[numPdGainsUsed]); kk++) { in ar2317getGainBoundariesAndPdadcsForPowers()
396 channel, pRawDataset->pChannels[idxL], pRawDataset->pChannels[idxR], in ar2317getGainBoundariesAndPdadcsForPowers()
408 if (ii == (numPdGainsUsed - 1)) in ar2317getGainBoundariesAndPdadcsForPowers()
425 ss = (pPdGainBoundaries[ii-1] - Pmin_t2[ii]) - in ar2317getGainBoundariesAndPdadcsForPowers()
427 Vpd_step = (uint16_t)(VpdTable_I[ii][1] - VpdTable_I[ii][0]); in ar2317getGainBoundariesAndPdadcsForPowers()
430 *-ve ss indicates need to extrapolate data below for this pdGain in ar2317getGainBoundariesAndPdadcsForPowers()
438 sizeCurrVpdTable = Pmax_t2[ii] - Pmin_t2[ii]; in ar2317getGainBoundariesAndPdadcsForPowers()
439 tgtIndex = pPdGainBoundaries[ii] + pdGainOverlap_t2 - Pmin_t2[ii]; in ar2317getGainBoundariesAndPdadcsForPowers()
445 Vpd_step = (uint16_t)(VpdTable_I[ii][sizeCurrVpdTable-1] - in ar2317getGainBoundariesAndPdadcsForPowers()
446 VpdTable_I[ii][sizeCurrVpdTable-2]); in ar2317getGainBoundariesAndPdadcsForPowers()
455 (VpdTable_I[ii][sizeCurrVpdTable-1] + in ar2317getGainBoundariesAndPdadcsForPowers()
456 (ss-maxIndex)*Vpd_step); in ar2317getGainBoundariesAndPdadcsForPowers()
465 pPdGainBoundaries[ii] = pPdGainBoundaries[ii-1]; in ar2317getGainBoundariesAndPdadcsForPowers()
469 pPDADCValues[kk] = pPDADCValues[kk-1]; in ar2317getGainBoundariesAndPdadcsForPowers()
486 const HAL_EEPROM *ee = AH_PRIVATE(ah)->ah_eeprom; in ar2317SetPowerTable()
490 uint16_t *pdadcValues = ahp->ah_pcdacTable; in ar2317SetPowerTable()
499 __func__, chan->ic_freq, chan->ic_flags); in ar2317SetPowerTable()
502 pRawDataset = &ee->ee_rawDataset2413[headerInfo11G]; in ar2317SetPowerTable()
504 pRawDataset = &ee->ee_rawDataset2413[headerInfo11B]; in ar2317SetPowerTable()
514 chan->channel, pRawDataset, pdGainOverlap_t2, in ar2317SetPowerTable()
523 * honoring their settings results in tx power 5dBm low. in ar2317SetPowerTable()
526 (pRawDataset->pDataPerChannel[0].numPdGains - 1)); in ar2317SetPowerTable()
530 | SM(numPdGainsUsed-1, AR_PHY_TPCRG1_NUM_PD_GAIN); in ar2317SetPowerTable()
547 HALDEBUG(ah, HAL_DEBUG_RFPARAM, "%s: using non-default " in ar2317SetPowerTable()
555 * Note the pdadc table may not start at 0 dBm power, could be in ar2317SetPowerTable()
560 ahp->ah_txPowerIndexOffset = (int16_t)(0 - minCalPower2317_t2); in ar2317SetPowerTable()
562 ahp->ah_txPowerIndexOffset = 0; in ar2317SetPowerTable()
592 jj = MAX_NUM_PDGAINS_PER_CHANNEL - ii - 1; in ar2317GetMinPower()
594 numVpd = data->pDataPerPDGain[jj].numVpd; in ar2317GetMinPower()
596 Pmin = data->pDataPerPDGain[jj].pwr_t4[0]; in ar2317GetMinPower()
612 numVpd = data->pDataPerPDGain[ii].numVpd; in ar2317GetMaxPower()
614 Pmax = data->pDataPerPDGain[ii].pwr_t4[numVpd-1]; in ar2317GetMaxPower()
615 vpdmax = data->pDataPerPDGain[ii].Vpd[numVpd-1]; in ar2317GetMaxPower()
627 uint16_t freq = chan->ic_freq; /* NB: never mapped */ in ar2317GetChannelMaxMinPower()
628 const HAL_EEPROM *ee = AH_PRIVATE(ah)->ah_eeprom; in ar2317GetChannelMaxMinPower()
637 pRawDataset = &ee->ee_rawDataset2413[headerInfo11G]; in ar2317GetChannelMaxMinPower()
639 pRawDataset = &ee->ee_rawDataset2413[headerInfo11B]; in ar2317GetChannelMaxMinPower()
643 numChannels = pRawDataset->numChannels; in ar2317GetChannelMaxMinPower()
644 data = pRawDataset->pDataPerChannel; in ar2317GetChannelMaxMinPower()
653 (freq > data[numChannels-1].channelValue)) { in ar2317GetChannelMaxMinPower()
659 *maxPow = ar2317GetMaxPower(ah, &data[numChannels - 1]); in ar2317GetChannelMaxMinPower()
660 *minPow = ar2317GetMinPower(ah, &data[numChannels - 1]); in ar2317GetChannelMaxMinPower()
668 totalD = data[i].channelValue - data[last].channelValue; in ar2317GetChannelMaxMinPower()
670 totalF = ar2317GetMaxPower(ah, &data[i]) - ar2317GetMaxPower(ah, &data[last]); in ar2317GetChannelMaxMinPower()
671 *maxPow = (int8_t) ((totalF*(freq-data[last].channelValue) + in ar2317GetChannelMaxMinPower()
673 totalMin = ar2317GetMinPower(ah, &data[i]) - ar2317GetMinPower(ah, &data[last]); in ar2317GetChannelMaxMinPower()
674 *minPow = (int8_t) ((totalMin*(freq-data[last].channelValue) + in ar2317GetChannelMaxMinPower()
695 HALASSERT(ahp->ah_rfHal != AH_NULL); in ar2317RfDetach()
696 ath_hal_free(ahp->ah_rfHal); in ar2317RfDetach()
697 ahp->ah_rfHal = AH_NULL; in ar2317RfDetach()
710 HALASSERT(ah->ah_magic == AR5212_MAGIC); in ar2317RfAttach()
712 HALASSERT(ahp->ah_rfHal == AH_NULL); in ar2317RfAttach()
720 priv->base.rfDetach = ar2317RfDetach; in ar2317RfAttach()
721 priv->base.writeRegs = ar2317WriteRegs; in ar2317RfAttach()
722 priv->base.getRfBank = ar2317GetRfBank; in ar2317RfAttach()
723 priv->base.setChannel = ar2317SetChannel; in ar2317RfAttach()
724 priv->base.setRfRegs = ar2317SetRfRegs; in ar2317RfAttach()
725 priv->base.setPowerTable = ar2317SetPowerTable; in ar2317RfAttach()
726 priv->base.getChannelMaxMinPower = ar2317GetChannelMaxMinPower; in ar2317RfAttach()
727 priv->base.getNfAdjust = ar5212GetNfAdjust; in ar2317RfAttach()
729 ahp->ah_pcdacTable = priv->pcdacTable; in ar2317RfAttach()
730 ahp->ah_pcdacTableSize = sizeof(priv->pcdacTable); in ar2317RfAttach()
731 ahp->ah_rfHal = &priv->base; in ar2317RfAttach()