summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2011-04-16 11:59:37 +0000
committeradrian <adrian@FreeBSD.org>2011-04-16 11:59:37 +0000
commit88b52115839109a8a8b7002dd0f27f4ea05a0bf3 (patch)
treed395049b1c52a3737de956c9b8be627f572adbb3
parentf9dcba71778b4db10527f5e1e69c24ec79f7b7f5 (diff)
downloadFreeBSD-src-88b52115839109a8a8b7002dd0f27f4ea05a0bf3.zip
FreeBSD-src-88b52115839109a8a8b7002dd0f27f4ea05a0bf3.tar.gz
Remove some duplicate code from the AR9285 TX power configuration path.
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416.h2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_reset.c4
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9285_reset.c57
3 files changed, 5 insertions, 58 deletions
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416.h b/sys/dev/ath/ath_hal/ar5416/ar5416.h
index e04e618..5f9ed57 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416.h
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416.h
@@ -246,6 +246,8 @@ extern void ar5416InitChainMasks(struct ath_hal *ah);
extern void ar5416RestoreChainMask(struct ath_hal *ah);
extern void ar5416EepromSetAddac(struct ath_hal *ah,
const struct ieee80211_channel *chan);
+extern uint16_t ar5416GetMaxEdgePower(uint16_t freq,
+ CAL_CTL_EDGES *pRdEdgesPower, HAL_BOOL is2GHz);
/* TX power setup related routines in ar5416_reset.c */
extern void ar5416GetGainBoundariesAndPdadcs(struct ath_hal *ah,
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
index c4ebec0..d220dc6 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
@@ -61,8 +61,6 @@ static HAL_BOOL ar5416SetPowerPerRateTable(struct ath_hal *ah,
uint16_t cfgCtl, uint16_t AntennaReduction,
uint16_t twiceMaxRegulatoryPower,
uint16_t powerLimit);
-static uint16_t ar5416GetMaxEdgePower(uint16_t freq,
- CAL_CTL_EDGES *pRdEdgesPower, HAL_BOOL is2GHz);
static void ar5416Set11nRegs(struct ath_hal *ah, const struct ieee80211_channel *chan);
/*
@@ -1779,7 +1777,7 @@ fbin2freq(uint8_t fbin, HAL_BOOL is2GHz)
*
* Find the maximum conformance test limit for the given channel and CTL info
*/
-static uint16_t
+uint16_t
ar5416GetMaxEdgePower(uint16_t freq, CAL_CTL_EDGES *pRdEdgesPower, HAL_BOOL is2GHz)
{
uint16_t twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c b/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c
index fd69de6..1b1c10e 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c
@@ -65,7 +65,6 @@ static void ar9285GetGainBoundariesAndPdadcs(struct ath_hal *ah,
uint16_t tPdGainOverlap, int16_t *pMinCalPower,
uint16_t * pPdGainBoundaries, uint8_t * pPDADCValues,
uint16_t numXpdGains);
-static uint16_t ar9285GetMaxEdgePower(uint16_t, CAL_CTL_EDGES *);
HAL_BOOL
ar9285SetTransmitPower(struct ath_hal *ah,
@@ -558,9 +557,9 @@ ar9285SetPowerPerRateTable(struct ath_hal *ah, struct ar5416eeprom_4k *pEepData,
(((cfgCtl & ~CTL_MODE_M) | (pCtlMode[ctlMode] & CTL_MODE_M)) ==
((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL))) {
rep = &(pEepData->ctlData[i]);
- twiceMinEdgePower = ar9285GetMaxEdgePower(freq,
+ twiceMinEdgePower = ar5416GetMaxEdgePower(freq,
rep->ctlEdges[
- owl_get_ntxchains(AH5416(ah)->ah_tx_chainmask) - 1]);
+ owl_get_ntxchains(AH5416(ah)->ah_tx_chainmask) - 1], AH_TRUE);
if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) {
/* Find the minimum of all CTL edge powers that apply to this channel */
twiceMaxEdgePower = AH_MIN(twiceMaxEdgePower, twiceMinEdgePower);
@@ -643,58 +642,6 @@ ar9285SetPowerPerRateTable(struct ath_hal *ah, struct ar5416eeprom_4k *pEepData,
#undef N
}
-/**************************************************************************
- * fbin2freq
- *
- * Get channel value from binary representation held in eeprom
- * RETURNS: the frequency in MHz
- */
-static uint16_t
-fbin2freq(uint8_t fbin)
-{
- /*
- * Reserved value 0xFF provides an empty definition both as
- * an fbin and as a frequency - do not convert
- */
- if (fbin == AR5416_BCHAN_UNUSED) {
- return fbin;
- }
-
- return (uint16_t)(2300 + fbin);
-}
-
-/*
- * XXX almost the same as ar5416GetMaxEdgePower.
- */
-static uint16_t
-ar9285GetMaxEdgePower(uint16_t freq, CAL_CTL_EDGES *pRdEdgesPower)
-{
- uint16_t twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
- int i;
-
- /* Get the edge power */
- for (i = 0; (i < AR5416_NUM_BAND_EDGES) && (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED) ; i++) {
- /*
- * If there's an exact channel match or an inband flag set
- * on the lower channel use the given rdEdgePower
- */
- if (freq == fbin2freq(pRdEdgesPower[i].bChannel)) {
- twiceMaxEdgePower = MS(pRdEdgesPower[i].tPowerFlag, CAL_CTL_EDGES_POWER);
- break;
- } else if ((i > 0) && (freq < fbin2freq(pRdEdgesPower[i].bChannel))) {
- if (fbin2freq(pRdEdgesPower[i - 1].bChannel) < freq && (pRdEdgesPower[i - 1].tPowerFlag & CAL_CTL_EDGES_FLAG) != 0) {
- twiceMaxEdgePower = MS(pRdEdgesPower[i - 1].tPowerFlag, CAL_CTL_EDGES_POWER);
- }
- /* Leave loop - no more affecting edges possible in this monotonic increasing list */
- break;
- }
- }
- HALASSERT(twiceMaxEdgePower > 0);
- return twiceMaxEdgePower;
-}
-
-
-
static HAL_BOOL
ar9285SetPowerCalTable(struct ath_hal *ah, struct ar5416eeprom_4k *pEepData,
const struct ieee80211_channel *chan, int16_t *pTxPowerIndexOffset)
OpenPOWER on IntegriCloud