Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Apr 2011 11:59:37 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r220713 - in head/sys/dev/ath/ath_hal: ar5416 ar9002
Message-ID:  <201104161159.p3GBxbDH004047@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sat Apr 16 11:59:37 2011
New Revision: 220713
URL: http://svn.freebsd.org/changeset/base/220713

Log:
  Remove some duplicate code from the AR9285 TX power configuration path.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
  head/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416.h	Sat Apr 16 11:15:57 2011	(r220712)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h	Sat Apr 16 11:59:37 2011	(r220713)
@@ -246,6 +246,8 @@ extern	void ar5416InitChainMasks(struct 
 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,

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c	Sat Apr 16 11:15:57 2011	(r220712)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c	Sat Apr 16 11:59:37 2011	(r220713)
@@ -61,8 +61,6 @@ static HAL_BOOL ar5416SetPowerPerRateTab
 	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;

Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c	Sat Apr 16 11:15:57 2011	(r220712)
+++ head/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c	Sat Apr 16 11:59:37 2011	(r220713)
@@ -65,7 +65,6 @@ static void ar9285GetGainBoundariesAndPd
 	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_ha
 				(((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_ha
 #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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104161159.p3GBxbDH004047>