提交 db91f2e4 编写于 作者: V Vivek Natarajan 提交者: John W. Linville

ath9k: Add open loop power control support for AR9287.

Signed-off-by: NVivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 1e711bee
...@@ -729,26 +729,42 @@ s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan) ...@@ -729,26 +729,42 @@ s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
static void ath9k_olc_temp_compensation(struct ath_hw *ah) static void ath9k_olc_temp_compensation(struct ath_hw *ah)
{ {
u32 rddata, i; u32 rddata, i;
int delta, currPDADC, regval; int delta, currPDADC, regval, slope;
rddata = REG_READ(ah, AR_PHY_TX_PWRCTRL4); rddata = REG_READ(ah, AR_PHY_TX_PWRCTRL4);
currPDADC = MS(rddata, AR_PHY_TX_PWRCTRL_PD_AVG_OUT); currPDADC = MS(rddata, AR_PHY_TX_PWRCTRL_PD_AVG_OUT);
if (ah->eep_ops->get_eeprom(ah, EEP_DAC_HPWR_5G))
delta = (currPDADC - ah->initPDADC + 4) / 8;
else
delta = (currPDADC - ah->initPDADC + 5) / 10;
if (delta != ah->PDADCdelta) { if (OLC_FOR_AR9287_10_LATER) {
ah->PDADCdelta = delta; if (ah->initPDADC == 0 || currPDADC == 0) {
for (i = 1; i < AR9280_TX_GAIN_TABLE_SIZE; i++) { return;
regval = ah->originalGain[i] - delta; } else {
if (regval < 0) slope = ah->eep_ops->get_eeprom(ah, EEP_TEMPSENSE_SLOPE);
regval = 0; if (slope == 0)
delta = 0;
else
delta = ((currPDADC - ah->initPDADC)*4) / slope;
REG_RMW_FIELD(ah, AR_PHY_CH0_TX_PWRCTRL11,
AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, delta);
REG_RMW_FIELD(ah, AR_PHY_CH1_TX_PWRCTRL11,
AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, delta);
}
} else {
if (ah->eep_ops->get_eeprom(ah, EEP_DAC_HPWR_5G))
delta = (currPDADC - ah->initPDADC + 4) / 8;
else
delta = (currPDADC - ah->initPDADC + 5) / 10;
if (delta != ah->PDADCdelta) {
ah->PDADCdelta = delta;
for (i = 1; i < AR9280_TX_GAIN_TABLE_SIZE; i++) {
regval = ah->originalGain[i] - delta;
if (regval < 0)
regval = 0;
REG_RMW_FIELD(ah, AR_PHY_TX_GAIN_TBL1 + i * 4, REG_RMW_FIELD(ah, AR_PHY_TX_GAIN_TBL1 + i * 4,
AR_PHY_TX_GAIN, regval); AR_PHY_TX_GAIN, regval);
}
} }
} }
} }
......
...@@ -1332,11 +1332,21 @@ static void ath9k_olc_init(struct ath_hw *ah) ...@@ -1332,11 +1332,21 @@ static void ath9k_olc_init(struct ath_hw *ah)
{ {
u32 i; u32 i;
for (i = 0; i < AR9280_TX_GAIN_TABLE_SIZE; i++) if (OLC_FOR_AR9287_10_LATER) {
ah->originalGain[i] = REG_SET_BIT(ah, AR_PHY_TX_PWRCTRL9,
MS(REG_READ(ah, AR_PHY_TX_GAIN_TBL1 + i * 4), AR_PHY_TX_PWRCTRL9_RES_DC_REMOVAL);
AR_PHY_TX_GAIN); ath9k_hw_analog_shift_rmw(ah, AR9287_AN_TXPC0,
ah->PDADCdelta = 0; AR9287_AN_TXPC0_TXPCMODE,
AR9287_AN_TXPC0_TXPCMODE_S,
AR9287_AN_TXPC0_TXPCMODE_TEMPSENSE);
udelay(100);
} else {
for (i = 0; i < AR9280_TX_GAIN_TABLE_SIZE; i++)
ah->originalGain[i] =
MS(REG_READ(ah, AR_PHY_TX_GAIN_TBL1 + i * 4),
AR_PHY_TX_GAIN);
ah->PDADCdelta = 0;
}
} }
static u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, static u32 ath9k_regd_get_ctl(struct ath_regulatory *reg,
......
...@@ -490,11 +490,18 @@ bool ath9k_hw_init_rf(struct ath_hw *ah, ...@@ -490,11 +490,18 @@ bool ath9k_hw_init_rf(struct ath_hw *ah,
#define AR_PHY_TX_PWRCTRL9 0xa27C #define AR_PHY_TX_PWRCTRL9 0xa27C
#define AR_PHY_TX_DESIRED_SCALE_CCK 0x00007C00 #define AR_PHY_TX_DESIRED_SCALE_CCK 0x00007C00
#define AR_PHY_TX_DESIRED_SCALE_CCK_S 10 #define AR_PHY_TX_DESIRED_SCALE_CCK_S 10
#define AR_PHY_TX_PWRCTRL9_RES_DC_REMOVAL 0x80000000
#define AR_PHY_TX_PWRCTRL9_RES_DC_REMOVAL_S 31
#define AR_PHY_TX_GAIN_TBL1 0xa300 #define AR_PHY_TX_GAIN_TBL1 0xa300
#define AR_PHY_TX_GAIN 0x0007F000 #define AR_PHY_TX_GAIN 0x0007F000
#define AR_PHY_TX_GAIN_S 12 #define AR_PHY_TX_GAIN_S 12
#define AR_PHY_CH0_TX_PWRCTRL11 0xa398
#define AR_PHY_CH1_TX_PWRCTRL11 0xb398
#define AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP 0x0000FC00
#define AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP_S 10
#define AR_PHY_VIT_MASK2_M_46_61 0xa3a0 #define AR_PHY_VIT_MASK2_M_46_61 0xa3a0
#define AR_PHY_MASK2_M_31_45 0xa3a4 #define AR_PHY_MASK2_M_31_45 0xa3a4
#define AR_PHY_MASK2_M_16_30 0xa3a8 #define AR_PHY_MASK2_M_16_30 0xa3a8
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册