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.
46 #define AR2425(ah) ((struct ar2425State *) AH5212(ah)->ah_rfHal)
64 if (AH_PRIVATE(ah)->ah_ispcie && && ath_hal_pcieL1SKPEnable) { in ar2425WriteRegs()
98 channelSel = freq - 2272; in ar2425SetChannel()
112 freq = freq - 2; /* Align to even 5MHz raster */ in ar2425SetChannel()
114 (uint32_t)(((freq - 4800)*10)/25 + 1), 8); in ar2425SetChannel()
118 ((freq - 4800) / 20 << 2), 8); in ar2425SetChannel()
122 ((freq - 4800) / 10 << 1), 8); in ar2425SetChannel()
126 (freq - 4800) / 5, 8); in ar2425SetChannel()
141 AH_PRIVATE(ah)->ah_curchan = chan; in ar2425SetChannel()
159 (_priv)->Bank##_ix##Data[i] = ar5212Bank##_ix##_2425[i][_col];\ in ar2425SetRfRegs()
162 const HAL_EEPROM *ee = AH_PRIVATE(ah)->ah_eeprom; in ar2425SetRfRegs()
168 __func__, chan->ic_freq, chan->ic_flags, modesIndex); in ar2425SetRfRegs()
174 ob2GHz = ee->ee_obFor24; in ar2425SetRfRegs()
175 db2GHz = ee->ee_dbFor24; in ar2425SetRfRegs()
177 ob2GHz = ee->ee_obFor24g; in ar2425SetRfRegs()
178 db2GHz = ee->ee_dbFor24g; in ar2425SetRfRegs()
193 ar5212ModifyRfBuffer(priv->Bank6Data, ob2GHz, 3, 193, 0); in ar2425SetRfRegs()
194 ar5212ModifyRfBuffer(priv->Bank6Data, db2GHz, 3, 190, 0); in ar2425SetRfRegs()
200 HAL_INI_WRITE_BANK(ah, ar5212Bank1_2425, priv->Bank1Data, regWrites); in ar2425SetRfRegs()
201 HAL_INI_WRITE_BANK(ah, ar5212Bank2_2425, priv->Bank2Data, regWrites); in ar2425SetRfRegs()
202 HAL_INI_WRITE_BANK(ah, ar5212Bank3_2425, priv->Bank3Data, regWrites); in ar2425SetRfRegs()
205 HAL_INI_WRITE_BANK(ah, ar5212Bank6_2417, priv->Bank6Data, in ar2425SetRfRegs()
208 HAL_INI_WRITE_BANK(ah, ar5212Bank6_2425, priv->Bank6Data, in ar2425SetRfRegs()
210 HAL_INI_WRITE_BANK(ah, ar5212Bank7_2425, priv->Bank7Data, regWrites); in ar2425SetRfRegs()
213 ahp->ah_rfgainState = HAL_RFGAIN_INACTIVE; in ar2425SetRfRegs()
230 case 1: return priv->Bank1Data; in ar2425GetRfBank()
231 case 2: return priv->Bank2Data; in ar2425GetRfBank()
232 case 3: return priv->Bank3Data; in ar2425GetRfBank()
233 case 6: return priv->Bank6Data; in ar2425GetRfBank()
234 case 7: return priv->Bank7Data; in ar2425GetRfBank()
255 * Check first and last elements for out-of-bounds conditions. in GetLowerUpperIndex()
261 if (target >= ep[-1]) { in GetLowerUpperIndex()
262 *vlo = *vhi = listSize - 1; in GetLowerUpperIndex()
273 *vlo = *vhi = tp - (const uint16_t *) lp; in GetLowerUpperIndex()
281 *vlo = tp - (const uint16_t *) lp; in GetLowerUpperIndex()
289 * Fill the Vpdlist for indices Pmax-Pmin
308 while (ii <= (uint16_t)(Pmax - Pmin)) { in ar2425FillVpdTable()
313 if (idxL == (uint32_t)(numIntercepts - 1)) in ar2425FillVpdTable()
314 idxL = numIntercepts - 2; /* extrapolate above */ in ar2425FillVpdTable()
319 (((currPwr - pwrList[idxL])*VpdList[idxR]+ in ar2425FillVpdTable()
320 (pwrList[idxR] - currPwr)*VpdList[idxL])/ in ar2425FillVpdTable()
321 (pwrList[idxR] - pwrList[idxL])); in ar2425FillVpdTable()
324 currPwr += 2; /* half dB steps */ in ar2425FillVpdTable()
340 rv = ((target - srcLeft)*targetRight + in interpolate_signed()
341 (srcRight - target)*targetLeft) / (srcRight - srcLeft); in interpolate_signed()
361 int32_t ss;/* potentially -ve index for taking care of pdGainOverlap */ in ar2425getGainBoundariesAndPdadcsForPowers()
371 * If desired to support -ve power levels in future, just in ar2425getGainBoundariesAndPdadcsForPowers()
372 * change pwr_I_0 to signed 5-bits. in ar2425getGainBoundariesAndPdadcsForPowers()
375 /* to accommodate -ve power levels later on. */ in ar2425getGainBoundariesAndPdadcsForPowers()
377 /* to accommodate -ve power levels later on */ in ar2425getGainBoundariesAndPdadcsForPowers()
386 GetLowerUpperIndex(channel, pRawDataset->pChannels, in ar2425getGainBoundariesAndPdadcsForPowers()
387 pRawDataset->numChannels, &(idxL), &(idxR)); in ar2425getGainBoundariesAndPdadcsForPowers()
390 jj = MAX_NUM_PDGAINS_PER_CHANNEL - ii - 1; in ar2425getGainBoundariesAndPdadcsForPowers()
392 numVpd = pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].numVpd; in ar2425getGainBoundariesAndPdadcsForPowers()
394 pPdGainValues[numPdGainsUsed] = pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].pd_gain; in ar2425getGainBoundariesAndPdadcsForPowers()
395 Pmin_t2[numPdGainsUsed] = pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].pwr_t4[0]; in ar2425getGainBoundariesAndPdadcsForPowers()
396 if (Pmin_t2[numPdGainsUsed] >pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[0]) { in ar2425getGainBoundariesAndPdadcsForPowers()
397 Pmin_t2[numPdGainsUsed] = pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[0]; in ar2425getGainBoundariesAndPdadcsForPowers()
401 Pmax_t2[numPdGainsUsed] = pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].pwr_t4[numVpd-1]; in ar2425getGainBoundariesAndPdadcsForPowers()
402 …if (Pmax_t2[numPdGainsUsed] > pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[numVpd- in ar2425getGainBoundariesAndPdadcsForPowers()
404 pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[numVpd-1]; in ar2425getGainBoundariesAndPdadcsForPowers()
408 &(pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].pwr_t4[0]), in ar2425getGainBoundariesAndPdadcsForPowers()
409 &(pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].Vpd[0]), numVpd, VpdTable_L in ar2425getGainBoundariesAndPdadcsForPowers()
413 &(pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[0]), in ar2425getGainBoundariesAndPdadcsForPowers()
414 &(pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].Vpd[0]), numVpd, VpdTable_R in ar2425getGainBoundariesAndPdadcsForPowers()
416 for (kk = 0; kk < (uint16_t)(Pmax_t2[numPdGainsUsed] - Pmin_t2[numPdGainsUsed]); kk++) { in ar2425getGainBoundariesAndPdadcsForPowers()
419 channel, pRawDataset->pChannels[idxL], pRawDataset->pChannels[idxR], in ar2425getGainBoundariesAndPdadcsForPowers()
431 if (ii == (numPdGainsUsed - 1)) in ar2425getGainBoundariesAndPdadcsForPowers()
442 ss = (pPdGainBoundaries[ii-1] - Pmin_t2[ii]) - in ar2425getGainBoundariesAndPdadcsForPowers()
444 Vpd_step = (uint16_t)(VpdTable_I[ii][1] - VpdTable_I[ii][0]); in ar2425getGainBoundariesAndPdadcsForPowers()
447 *-ve ss indicates need to extrapolate data below for this pdGain in ar2425getGainBoundariesAndPdadcsForPowers()
455 sizeCurrVpdTable = Pmax_t2[ii] - Pmin_t2[ii]; in ar2425getGainBoundariesAndPdadcsForPowers()
456 tgtIndex = pPdGainBoundaries[ii] + pdGainOverlap_t2 - Pmin_t2[ii]; in ar2425getGainBoundariesAndPdadcsForPowers()
462 Vpd_step = (uint16_t)(VpdTable_I[ii][sizeCurrVpdTable-1] - in ar2425getGainBoundariesAndPdadcsForPowers()
463 VpdTable_I[ii][sizeCurrVpdTable-2]); in ar2425getGainBoundariesAndPdadcsForPowers()
472 (VpdTable_I[ii][sizeCurrVpdTable-1] + in ar2425getGainBoundariesAndPdadcsForPowers()
473 (ss-maxIndex)*Vpd_step); in ar2425getGainBoundariesAndPdadcsForPowers()
482 pPdGainBoundaries[ii] = pPdGainBoundaries[ii-1]; in ar2425getGainBoundariesAndPdadcsForPowers()
486 pPDADCValues[kk] = pPDADCValues[kk-1]; in ar2425getGainBoundariesAndPdadcsForPowers()
502 const HAL_EEPROM *ee = AH_PRIVATE(ah)->ah_eeprom; in ar2425SetPowerTable()
506 uint16_t *pdadcValues = ahp->ah_pcdacTable; in ar2425SetPowerTable()
511 __func__, freq, chan->ic_flags); in ar2425SetPowerTable()
514 pRawDataset = &ee->ee_rawDataset2413[headerInfo11G]; in ar2425SetPowerTable()
516 pRawDataset = &ee->ee_rawDataset2413[headerInfo11B]; in ar2425SetPowerTable()
530 (pRawDataset->pDataPerChannel[0].numPdGains - 1)); in ar2425SetPowerTable()
533 * Note the pdadc table may not start at 0 dBm power, could be in ar2425SetPowerTable()
538 ahp->ah_txPowerIndexOffset = (int16_t)(0 - minCalPower2413_t2); in ar2425SetPowerTable()
540 ahp->ah_txPowerIndexOffset = 0; in ar2425SetPowerTable()
570 jj = MAX_NUM_PDGAINS_PER_CHANNEL - ii - 1; in ar2425GetMinPower()
572 numVpd = data->pDataPerPDGain[jj].numVpd; in ar2425GetMinPower()
574 Pmin = data->pDataPerPDGain[jj].pwr_t4[0]; in ar2425GetMinPower()
589 numVpd = data->pDataPerPDGain[ii].numVpd; in ar2425GetMaxPower()
591 Pmax = data->pDataPerPDGain[ii].pwr_t4[numVpd-1]; in ar2425GetMaxPower()
604 uint16_t freq = chan->ic_freq; /* NB: never mapped */ in ar2425GetChannelMaxMinPower()
605 const HAL_EEPROM *ee = AH_PRIVATE(ah)->ah_eeprom; in ar2425GetChannelMaxMinPower()
614 pRawDataset = &ee->ee_rawDataset2413[headerInfo11G]; in ar2425GetChannelMaxMinPower()
616 pRawDataset = &ee->ee_rawDataset2413[headerInfo11B]; in ar2425GetChannelMaxMinPower()
620 numChannels = pRawDataset->numChannels; in ar2425GetChannelMaxMinPower()
621 data = pRawDataset->pDataPerChannel; in ar2425GetChannelMaxMinPower()
630 (freq > data[numChannels-1].channelValue)) { in ar2425GetChannelMaxMinPower()
636 *maxPow = ar2425GetMaxPower(ah, &data[numChannels - 1]); in ar2425GetChannelMaxMinPower()
637 *minPow = ar2425GetMinPower(ah, &data[numChannels - 1]); in ar2425GetChannelMaxMinPower()
645 totalD = data[i].channelValue - data[last].channelValue; in ar2425GetChannelMaxMinPower()
647 totalF = ar2425GetMaxPower(ah, &data[i]) - ar2425GetMaxPower(ah, &data[last]); in ar2425GetChannelMaxMinPower()
648 *maxPow = (int8_t) ((totalF*(freq-data[last].channelValue) + in ar2425GetChannelMaxMinPower()
650 totalMin = ar2425GetMinPower(ah, &data[i]) - ar2425GetMinPower(ah, &data[last]); in ar2425GetChannelMaxMinPower()
651 *minPow = (int8_t) ((totalMin*(freq-data[last].channelValue) + in ar2425GetChannelMaxMinPower()
672 HALASSERT(ahp->ah_rfHal != AH_NULL); in ar2425RfDetach()
673 ath_hal_free(ahp->ah_rfHal); in ar2425RfDetach()
674 ahp->ah_rfHal = AH_NULL; in ar2425RfDetach()
687 HALASSERT(ah->ah_magic == AR5212_MAGIC); in ar2425RfAttach()
689 HALASSERT(ahp->ah_rfHal == AH_NULL); in ar2425RfAttach()
697 priv->base.rfDetach = ar2425RfDetach; in ar2425RfAttach()
698 priv->base.writeRegs = ar2425WriteRegs; in ar2425RfAttach()
699 priv->base.getRfBank = ar2425GetRfBank; in ar2425RfAttach()
700 priv->base.setChannel = ar2425SetChannel; in ar2425RfAttach()
701 priv->base.setRfRegs = ar2425SetRfRegs; in ar2425RfAttach()
702 priv->base.setPowerTable = ar2425SetPowerTable; in ar2425RfAttach()
703 priv->base.getChannelMaxMinPower = ar2425GetChannelMaxMinPower; in ar2425RfAttach()
704 priv->base.getNfAdjust = ar5212GetNfAdjust; in ar2425RfAttach()
706 ahp->ah_pcdacTable = priv->pcdacTable; in ar2425RfAttach()
707 ahp->ah_pcdacTableSize = sizeof(priv->pcdacTable); in ar2425RfAttach()
708 ahp->ah_rfHal = &priv->base; in ar2425RfAttach()