ar9287_olc.c (222308) | ar9287_olc.c (222314) |
---|---|
1/* 2 * Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 * | 1/* 2 * Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 * |
25 * $FreeBSD: head/sys/dev/ath/ath_hal/ar9002/ar9287_olc.c 222308 2011-05-26 14:29:05Z adrian $ | 25 * $FreeBSD: head/sys/dev/ath/ath_hal/ar9002/ar9287_olc.c 222314 2011-05-26 16:52:37Z adrian $ |
26 */ 27#include "opt_ah.h" 28 29#include "ah.h" 30#include "ah_internal.h" 31 32#include "ah_eeprom_v14.h" 33#include "ah_eeprom_9287.h" --- 31 unchanged lines hidden (view full) --- 65ar9287olcTemperatureCompensation(struct ath_hal *ah) 66{ 67 uint32_t rddata; 68 int32_t delta, currPDADC, slope; 69 70 rddata = OS_REG_READ(ah, AR_PHY_TX_PWRCTRL4); 71 currPDADC = MS(rddata, AR_PHY_TX_PWRCTRL_PD_AVG_OUT); 72 | 26 */ 27#include "opt_ah.h" 28 29#include "ah.h" 30#include "ah_internal.h" 31 32#include "ah_eeprom_v14.h" 33#include "ah_eeprom_9287.h" --- 31 unchanged lines hidden (view full) --- 65ar9287olcTemperatureCompensation(struct ath_hal *ah) 66{ 67 uint32_t rddata; 68 int32_t delta, currPDADC, slope; 69 70 rddata = OS_REG_READ(ah, AR_PHY_TX_PWRCTRL4); 71 currPDADC = MS(rddata, AR_PHY_TX_PWRCTRL_PD_AVG_OUT); 72 |
73 HALDEBUG(ah, HAL_DEBUG_PERCAL, "%s: initPDADC=%d, currPDADC=%d\n", 74 __func__, AH5416(ah)->initPDADC, currPDADC); 75 |
|
73 if (AH5416(ah)->initPDADC == 0 || currPDADC == 0) { 74 /* 75 * Zero value indicates that no frames have been transmitted 76 * yet, can't do temperature compensation until frames are 77 * transmitted. 78 */ 79 return; 80 } else { --- 5 unchanged lines hidden (view full) --- 86 delta = 0; 87 } else { 88 delta = ((currPDADC - AH5416(ah)->initPDADC)*4) / slope; 89 } 90 OS_REG_RMW_FIELD(ah, AR_PHY_CH0_TX_PWRCTRL11, 91 AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, delta); 92 OS_REG_RMW_FIELD(ah, AR_PHY_CH1_TX_PWRCTRL11, 93 AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, delta); | 76 if (AH5416(ah)->initPDADC == 0 || currPDADC == 0) { 77 /* 78 * Zero value indicates that no frames have been transmitted 79 * yet, can't do temperature compensation until frames are 80 * transmitted. 81 */ 82 return; 83 } else { --- 5 unchanged lines hidden (view full) --- 89 delta = 0; 90 } else { 91 delta = ((currPDADC - AH5416(ah)->initPDADC)*4) / slope; 92 } 93 OS_REG_RMW_FIELD(ah, AR_PHY_CH0_TX_PWRCTRL11, 94 AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, delta); 95 OS_REG_RMW_FIELD(ah, AR_PHY_CH1_TX_PWRCTRL11, 96 AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, delta); |
97 98 HALDEBUG(ah, HAL_DEBUG_PERCAL, "%s: delta=%d\n", __func__, delta); |
|
94 } 95} 96 97void 98ar9287olcGetTxGainIndex(struct ath_hal *ah, 99 const struct ieee80211_channel *chan, 100 struct cal_data_op_loop_ar9287 *pRawDatasetOpLoop, 101 uint8_t *pCalChans, uint16_t availPiers, int8_t *pPwr) --- 65 unchanged lines hidden --- | 99 } 100} 101 102void 103ar9287olcGetTxGainIndex(struct ath_hal *ah, 104 const struct ieee80211_channel *chan, 105 struct cal_data_op_loop_ar9287 *pRawDatasetOpLoop, 106 uint8_t *pCalChans, uint16_t availPiers, int8_t *pPwr) --- 65 unchanged lines hidden --- |