diff options
author | David S. Miller <davem@davemloft.net> | 2009-08-14 15:29:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-14 15:29:17 -0400 |
commit | a8519de4a030d130e0d18147a2af3112b7951e0b (patch) | |
tree | 59f89418cf7f311d896c38ff774398e052b709d8 /drivers/net/wireless/ath/ath5k/phy.c | |
parent | 5c16807d3d196203d2d3c9fae51ac7e422091904 (diff) | |
parent | 560ad81b6c90e0fddc4d6c280f16ddf18d47eeb1 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/phy.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/phy.c | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 2075ba993966..298fcf015227 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -740,13 +740,22 @@ int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, | |||
740 | AR5K_RF_XPD_GAIN, true); | 740 | AR5K_RF_XPD_GAIN, true); |
741 | 741 | ||
742 | } else { | 742 | } else { |
743 | /* TODO: Set high and low gain bits */ | 743 | u8 *pdg_curve_to_idx = ee->ee_pdc_to_idx[ee_mode]; |
744 | ath5k_hw_rfb_op(ah, rf_regs, | 744 | if (ee->ee_pd_gains[ee_mode] > 1) { |
745 | ee->ee_x_gain[ee_mode], | 745 | ath5k_hw_rfb_op(ah, rf_regs, |
746 | pdg_curve_to_idx[0], | ||
746 | AR5K_RF_PD_GAIN_LO, true); | 747 | AR5K_RF_PD_GAIN_LO, true); |
747 | ath5k_hw_rfb_op(ah, rf_regs, | 748 | ath5k_hw_rfb_op(ah, rf_regs, |
748 | ee->ee_x_gain[ee_mode], | 749 | pdg_curve_to_idx[1], |
749 | AR5K_RF_PD_GAIN_HI, true); | 750 | AR5K_RF_PD_GAIN_HI, true); |
751 | } else { | ||
752 | ath5k_hw_rfb_op(ah, rf_regs, | ||
753 | pdg_curve_to_idx[0], | ||
754 | AR5K_RF_PD_GAIN_LO, true); | ||
755 | ath5k_hw_rfb_op(ah, rf_regs, | ||
756 | pdg_curve_to_idx[0], | ||
757 | AR5K_RF_PD_GAIN_HI, true); | ||
758 | } | ||
750 | 759 | ||
751 | /* Lower synth voltage on Rev 2 */ | 760 | /* Lower synth voltage on Rev 2 */ |
752 | ath5k_hw_rfb_op(ah, rf_regs, 2, | 761 | ath5k_hw_rfb_op(ah, rf_regs, 2, |
@@ -1095,6 +1104,29 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel) | |||
1095 | PHY calibration | 1104 | PHY calibration |
1096 | \*****************/ | 1105 | \*****************/ |
1097 | 1106 | ||
1107 | void | ||
1108 | ath5k_hw_calibration_poll(struct ath5k_hw *ah) | ||
1109 | { | ||
1110 | /* Calibration interval in jiffies */ | ||
1111 | unsigned long cal_intval; | ||
1112 | |||
1113 | cal_intval = msecs_to_jiffies(ah->ah_cal_intval * 1000); | ||
1114 | |||
1115 | /* Initialize timestamp if needed */ | ||
1116 | if (!ah->ah_cal_tstamp) | ||
1117 | ah->ah_cal_tstamp = jiffies; | ||
1118 | |||
1119 | /* For now we always do full calibration | ||
1120 | * Mark software interrupt mask and fire software | ||
1121 | * interrupt (bit gets auto-cleared) */ | ||
1122 | if (time_is_before_eq_jiffies(ah->ah_cal_tstamp + cal_intval)) { | ||
1123 | ah->ah_cal_tstamp = jiffies; | ||
1124 | ah->ah_swi_mask = AR5K_SWI_FULL_CALIBRATION; | ||
1125 | AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI); | ||
1126 | } | ||
1127 | |||
1128 | } | ||
1129 | |||
1098 | /** | 1130 | /** |
1099 | * ath5k_hw_noise_floor_calibration - perform PHY noise floor calibration | 1131 | * ath5k_hw_noise_floor_calibration - perform PHY noise floor calibration |
1100 | * | 1132 | * |
@@ -1896,8 +1928,9 @@ ath5k_get_linear_pcdac_min(const u8 *stepL, const u8 *stepR, | |||
1896 | s16 min_pwrL, min_pwrR; | 1928 | s16 min_pwrL, min_pwrR; |
1897 | s16 pwr_i; | 1929 | s16 pwr_i; |
1898 | 1930 | ||
1899 | if (WARN_ON(stepL[0] == stepL[1] || stepR[0] == stepR[1])) | 1931 | /* Some vendors write the same pcdac value twice !!! */ |
1900 | return 0; | 1932 | if (stepL[0] == stepL[1] || stepR[0] == stepR[1]) |
1933 | return max(pwrL[0], pwrR[0]); | ||
1901 | 1934 | ||
1902 | if (pwrL[0] == pwrL[1]) | 1935 | if (pwrL[0] == pwrL[1]) |
1903 | min_pwrL = pwrL[0]; | 1936 | min_pwrL = pwrL[0]; |