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.
58 #define AR2413(ah) ((struct ar2413State *) AH5212(ah)->ah_rfHal)
91 if (((freq - 2192) % 5) == 0) { in ar2413SetChannel()
92 channelSel = ((freq - 672) * 2 - 3040)/10; in ar2413SetChannel()
94 } else if (((freq - 2224) % 5) == 0) { in ar2413SetChannel()
95 channelSel = ((freq - 704) * 2 - 3040) / 10; in ar2413SetChannel()
117 freq = freq - 2; /* Align to even 5MHz raster */ in ar2413SetChannel()
119 (uint32_t)(((freq - 4800)*10)/25 + 1), 8); in ar2413SetChannel()
123 ((freq - 4800) / 20 << 2), 8); in ar2413SetChannel()
127 ((freq - 4800) / 10 << 1), 8); in ar2413SetChannel()
131 (freq - 4800) / 5, 8); in ar2413SetChannel()
146 AH_PRIVATE(ah)->ah_curchan = chan; in ar2413SetChannel()
165 (_priv)->Bank##_ix##Data[i] = ar5212Bank##_ix##_2413[i][_col];\ in ar2413SetRfRegs()
168 const HAL_EEPROM *ee = AH_PRIVATE(ah)->ah_eeprom; in ar2413SetRfRegs()
174 __func__, chan->ic_freq, chan->ic_flags, modesIndex); in ar2413SetRfRegs()
180 ob2GHz = ee->ee_obFor24; in ar2413SetRfRegs()
181 db2GHz = ee->ee_dbFor24; in ar2413SetRfRegs()
183 ob2GHz = ee->ee_obFor24g; in ar2413SetRfRegs()
184 db2GHz = ee->ee_dbFor24g; in ar2413SetRfRegs()
199 ar5212ModifyRfBuffer(priv->Bank6Data, ob2GHz, 3, 168, 0); in ar2413SetRfRegs()
200 ar5212ModifyRfBuffer(priv->Bank6Data, db2GHz, 3, 165, 0); in ar2413SetRfRegs()
206 HAL_INI_WRITE_BANK(ah, ar5212Bank1_2413, priv->Bank1Data, regWrites); in ar2413SetRfRegs()
207 HAL_INI_WRITE_BANK(ah, ar5212Bank2_2413, priv->Bank2Data, regWrites); in ar2413SetRfRegs()
208 HAL_INI_WRITE_BANK(ah, ar5212Bank3_2413, priv->Bank3Data, regWrites); in ar2413SetRfRegs()
209 HAL_INI_WRITE_BANK(ah, ar5212Bank6_2413, priv->Bank6Data, regWrites); in ar2413SetRfRegs()
210 HAL_INI_WRITE_BANK(ah, ar5212Bank7_2413, priv->Bank7Data, regWrites); in ar2413SetRfRegs()
213 ahp->ah_rfgainState = HAL_RFGAIN_INACTIVE; in ar2413SetRfRegs()
229 case 1: return priv->Bank1Data; in ar2413GetRfBank()
230 case 2: return priv->Bank2Data; in ar2413GetRfBank()
231 case 3: return priv->Bank3Data; in ar2413GetRfBank()
232 case 6: return priv->Bank6Data; in ar2413GetRfBank()
233 case 7: return priv->Bank7Data; in ar2413GetRfBank()
254 * Check first and last elements for out-of-bounds conditions. in GetLowerUpperIndex()
260 if (target >= ep[-1]) { in GetLowerUpperIndex()
261 *vlo = *vhi = listSize - 1; in GetLowerUpperIndex()
272 *vlo = *vhi = tp - (const uint16_t *) lp; in GetLowerUpperIndex()
280 *vlo = tp - (const uint16_t *) lp; in GetLowerUpperIndex()
288 * Fill the Vpdlist for indices Pmax-Pmin
306 while (ii <= (uint16_t)(Pmax - Pmin)) { in ar2413FillVpdTable()
311 if (idxL == (uint32_t)(numIntercepts - 1)) in ar2413FillVpdTable()
312 idxL = numIntercepts - 2; /* extrapolate above */ in ar2413FillVpdTable()
317 (((currPwr - pwrList[idxL])*VpdList[idxR]+ in ar2413FillVpdTable()
318 (pwrList[idxR] - currPwr)*VpdList[idxL])/ in ar2413FillVpdTable()
319 (pwrList[idxR] - pwrList[idxL])); in ar2413FillVpdTable()
322 currPwr += 2; /* half dB steps */ in ar2413FillVpdTable()
338 rv = ((target - srcLeft)*targetRight + in interpolate_signed()
339 (srcRight - target)*targetLeft) / (srcRight - srcLeft); in interpolate_signed()
358 #define VpdTable_L priv->vpdTable_L in ar2413getGainBoundariesAndPdadcsForPowers()
359 #define VpdTable_R priv->vpdTable_R in ar2413getGainBoundariesAndPdadcsForPowers()
360 #define VpdTable_I priv->vpdTable_I in ar2413getGainBoundariesAndPdadcsForPowers()
362 int32_t ss;/* potentially -ve index for taking care of pdGainOverlap */ in ar2413getGainBoundariesAndPdadcsForPowers()
366 * If desired to support -ve power levels in future, just in ar2413getGainBoundariesAndPdadcsForPowers()
367 * change pwr_I_0 to signed 5-bits. in ar2413getGainBoundariesAndPdadcsForPowers()
370 /* to accommodate -ve power levels later on. */ in ar2413getGainBoundariesAndPdadcsForPowers()
372 /* to accommodate -ve power levels later on */ in ar2413getGainBoundariesAndPdadcsForPowers()
379 GetLowerUpperIndex(channel, pRawDataset->pChannels, in ar2413getGainBoundariesAndPdadcsForPowers()
380 pRawDataset->numChannels, &(idxL), &(idxR)); in ar2413getGainBoundariesAndPdadcsForPowers()
383 jj = MAX_NUM_PDGAINS_PER_CHANNEL - ii - 1; in ar2413getGainBoundariesAndPdadcsForPowers()
385 numVpd = pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].numVpd; in ar2413getGainBoundariesAndPdadcsForPowers()
387 pPdGainValues[numPdGainsUsed] = pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].pd_gain; in ar2413getGainBoundariesAndPdadcsForPowers()
388 Pmin_t2[numPdGainsUsed] = pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].pwr_t4[0]; in ar2413getGainBoundariesAndPdadcsForPowers()
389 if (Pmin_t2[numPdGainsUsed] >pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[0]) { in ar2413getGainBoundariesAndPdadcsForPowers()
390 Pmin_t2[numPdGainsUsed] = pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[0]; in ar2413getGainBoundariesAndPdadcsForPowers()
394 Pmax_t2[numPdGainsUsed] = pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].pwr_t4[numVpd-1]; in ar2413getGainBoundariesAndPdadcsForPowers()
395 …if (Pmax_t2[numPdGainsUsed] > pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[numVpd-… in ar2413getGainBoundariesAndPdadcsForPowers()
397 pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[numVpd-1]; in ar2413getGainBoundariesAndPdadcsForPowers()
401 &(pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].pwr_t4[0]), in ar2413getGainBoundariesAndPdadcsForPowers()
402 &(pRawDataset->pDataPerChannel[idxL].pDataPerPDGain[jj].Vpd[0]), numVpd, VpdTable_L in ar2413getGainBoundariesAndPdadcsForPowers()
406 &(pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].pwr_t4[0]), in ar2413getGainBoundariesAndPdadcsForPowers()
407 &(pRawDataset->pDataPerChannel[idxR].pDataPerPDGain[jj].Vpd[0]), numVpd, VpdTable_R in ar2413getGainBoundariesAndPdadcsForPowers()
409 for (kk = 0; kk < (uint16_t)(Pmax_t2[numPdGainsUsed] - Pmin_t2[numPdGainsUsed]); kk++) { in ar2413getGainBoundariesAndPdadcsForPowers()
412 channel, pRawDataset->pChannels[idxL], pRawDataset->pChannels[idxR], in ar2413getGainBoundariesAndPdadcsForPowers()
424 if (ii == (numPdGainsUsed - 1)) in ar2413getGainBoundariesAndPdadcsForPowers()
441 ss = (pPdGainBoundaries[ii-1] - Pmin_t2[ii]) - in ar2413getGainBoundariesAndPdadcsForPowers()
443 Vpd_step = (uint16_t)(VpdTable_I[ii][1] - VpdTable_I[ii][0]); in ar2413getGainBoundariesAndPdadcsForPowers()
446 *-ve ss indicates need to extrapolate data below for this pdGain in ar2413getGainBoundariesAndPdadcsForPowers()
454 sizeCurrVpdTable = Pmax_t2[ii] - Pmin_t2[ii]; in ar2413getGainBoundariesAndPdadcsForPowers()
455 tgtIndex = pPdGainBoundaries[ii] + pdGainOverlap_t2 - Pmin_t2[ii]; in ar2413getGainBoundariesAndPdadcsForPowers()
461 Vpd_step = (uint16_t)(VpdTable_I[ii][sizeCurrVpdTable-1] - in ar2413getGainBoundariesAndPdadcsForPowers()
462 VpdTable_I[ii][sizeCurrVpdTable-2]); in ar2413getGainBoundariesAndPdadcsForPowers()
471 (VpdTable_I[ii][sizeCurrVpdTable-1] + in ar2413getGainBoundariesAndPdadcsForPowers()
472 (ss-maxIndex)*Vpd_step); in ar2413getGainBoundariesAndPdadcsForPowers()
481 pPdGainBoundaries[ii] = pPdGainBoundaries[ii-1]; in ar2413getGainBoundariesAndPdadcsForPowers()
485 pPDADCValues[kk] = pPDADCValues[kk-1]; in ar2413getGainBoundariesAndPdadcsForPowers()
503 const HAL_EEPROM *ee = AH_PRIVATE(ah)->ah_eeprom; in ar2413SetPowerTable()
507 uint16_t *pdadcValues = ahp->ah_pcdacTable; in ar2413SetPowerTable()
516 __func__, freq, chan->ic_flags); in ar2413SetPowerTable()
519 pRawDataset = &ee->ee_rawDataset2413[headerInfo11G]; in ar2413SetPowerTable()
521 pRawDataset = &ee->ee_rawDataset2413[headerInfo11B]; in ar2413SetPowerTable()
540 * honoring their settings results in tx power 5dBm low. in ar2413SetPowerTable()
543 (pRawDataset->pDataPerChannel[0].numPdGains - 1)); in ar2413SetPowerTable()
547 | SM(numPdGainsUsed-1, AR_PHY_TPCRG1_NUM_PD_GAIN); in ar2413SetPowerTable()
564 HALDEBUG(ah, HAL_DEBUG_RFPARAM, "%s: using non-default " in ar2413SetPowerTable()
572 * Note the pdadc table may not start at 0 dBm power, could be in ar2413SetPowerTable()
577 ahp->ah_txPowerIndexOffset = (int16_t)(0 - minCalPower2413_t2); in ar2413SetPowerTable()
579 ahp->ah_txPowerIndexOffset = 0; in ar2413SetPowerTable()
609 jj = MAX_NUM_PDGAINS_PER_CHANNEL - ii - 1; in ar2413GetMinPower()
611 numVpd = data->pDataPerPDGain[jj].numVpd; in ar2413GetMinPower()
613 Pmin = data->pDataPerPDGain[jj].pwr_t4[0]; in ar2413GetMinPower()
628 numVpd = data->pDataPerPDGain[ii].numVpd; in ar2413GetMaxPower()
630 Pmax = data->pDataPerPDGain[ii].pwr_t4[numVpd-1]; in ar2413GetMaxPower()
642 uint16_t freq = chan->ic_freq; /* NB: never mapped */ in ar2413GetChannelMaxMinPower()
643 const HAL_EEPROM *ee = AH_PRIVATE(ah)->ah_eeprom; in ar2413GetChannelMaxMinPower()
652 pRawDataset = &ee->ee_rawDataset2413[headerInfo11G]; in ar2413GetChannelMaxMinPower()
654 pRawDataset = &ee->ee_rawDataset2413[headerInfo11B]; in ar2413GetChannelMaxMinPower()
658 numChannels = pRawDataset->numChannels; in ar2413GetChannelMaxMinPower()
659 data = pRawDataset->pDataPerChannel; in ar2413GetChannelMaxMinPower()
668 (freq > data[numChannels-1].channelValue)) { in ar2413GetChannelMaxMinPower()
674 *maxPow = ar2413GetMaxPower(ah, &data[numChannels - 1]); in ar2413GetChannelMaxMinPower()
675 *minPow = ar2413GetMinPower(ah, &data[numChannels - 1]); in ar2413GetChannelMaxMinPower()
683 totalD = data[i].channelValue - data[last].channelValue; in ar2413GetChannelMaxMinPower()
685 totalF = ar2413GetMaxPower(ah, &data[i]) - ar2413GetMaxPower(ah, &data[last]); in ar2413GetChannelMaxMinPower()
686 *maxPow = (int8_t) ((totalF*(freq-data[last].channelValue) + in ar2413GetChannelMaxMinPower()
688 totalMin = ar2413GetMinPower(ah, &data[i]) - ar2413GetMinPower(ah, &data[last]); in ar2413GetChannelMaxMinPower()
689 *minPow = (int8_t) ((totalMin*(freq-data[last].channelValue) + in ar2413GetChannelMaxMinPower()
710 HALASSERT(ahp->ah_rfHal != AH_NULL); in ar2413RfDetach()
711 ath_hal_free(ahp->ah_rfHal); in ar2413RfDetach()
712 ahp->ah_rfHal = AH_NULL; in ar2413RfDetach()
725 HALASSERT(ah->ah_magic == AR5212_MAGIC); in ar2413RfAttach()
727 HALASSERT(ahp->ah_rfHal == AH_NULL); in ar2413RfAttach()
735 priv->base.rfDetach = ar2413RfDetach; in ar2413RfAttach()
736 priv->base.writeRegs = ar2413WriteRegs; in ar2413RfAttach()
737 priv->base.getRfBank = ar2413GetRfBank; in ar2413RfAttach()
738 priv->base.setChannel = ar2413SetChannel; in ar2413RfAttach()
739 priv->base.setRfRegs = ar2413SetRfRegs; in ar2413RfAttach()
740 priv->base.setPowerTable = ar2413SetPowerTable; in ar2413RfAttach()
741 priv->base.getChannelMaxMinPower = ar2413GetChannelMaxMinPower; in ar2413RfAttach()
742 priv->base.getNfAdjust = ar5212GetNfAdjust; in ar2413RfAttach()
744 ahp->ah_pcdacTable = priv->pcdacTable; in ar2413RfAttach()
745 ahp->ah_pcdacTableSize = sizeof(priv->pcdacTable); in ar2413RfAttach()
746 ahp->ah_rfHal = &priv->base; in ar2413RfAttach()