diff options
author | Bruno Randolf <br1@einfach.org> | 2010-12-21 03:30:26 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-12-22 15:43:27 -0500 |
commit | 56bd29d361a53f3bf6b815b5bf570a23bdc55b35 (patch) | |
tree | 368b45e674db8a608561080874cb8e3c366b8f29 | |
parent | 26c7fc436422de5d6d2b491f777e965e96f5c3a2 (diff) |
ath5k: Separate powertable setup and writing
And rename functions which write the powertable to make it clearer.
Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath5k/phy.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 7c6d7dc62f3a..6f0cf3a09b2c 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -2593,7 +2593,7 @@ ath5k_combine_linear_pcdac_curves(struct ath5k_hw *ah, s16* table_min, | |||
2593 | 2593 | ||
2594 | /* Write PCDAC values on hw */ | 2594 | /* Write PCDAC values on hw */ |
2595 | static void | 2595 | static void |
2596 | ath5k_setup_pcdac_table(struct ath5k_hw *ah) | 2596 | ath5k_write_pcdac_table(struct ath5k_hw *ah) |
2597 | { | 2597 | { |
2598 | u8 *pcdac_out = ah->ah_txpower.txp_pd_table; | 2598 | u8 *pcdac_out = ah->ah_txpower.txp_pd_table; |
2599 | int i; | 2599 | int i; |
@@ -2742,7 +2742,7 @@ ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah, | |||
2742 | 2742 | ||
2743 | /* Write PDADC values on hw */ | 2743 | /* Write PDADC values on hw */ |
2744 | static void | 2744 | static void |
2745 | ath5k_setup_pwr_to_pdadc_table(struct ath5k_hw *ah, u8 ee_mode) | 2745 | ath5k_write_pwr_to_pdadc_table(struct ath5k_hw *ah, u8 ee_mode) |
2746 | { | 2746 | { |
2747 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; | 2747 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; |
2748 | u8 *pdadc_out = ah->ah_txpower.txp_pd_table; | 2748 | u8 *pdadc_out = ah->ah_txpower.txp_pd_table; |
@@ -2957,8 +2957,7 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah, | |||
2957 | (s16) pcinfo_R->freq, | 2957 | (s16) pcinfo_R->freq, |
2958 | pcinfo_L->max_pwr, pcinfo_R->max_pwr); | 2958 | pcinfo_L->max_pwr, pcinfo_R->max_pwr); |
2959 | 2959 | ||
2960 | /* We are ready to go, fill PCDAC/PDADC | 2960 | /* Fill PCDAC/PDADC table */ |
2961 | * table and write settings on hardware */ | ||
2962 | switch (type) { | 2961 | switch (type) { |
2963 | case AR5K_PWRTABLE_LINEAR_PCDAC: | 2962 | case AR5K_PWRTABLE_LINEAR_PCDAC: |
2964 | /* For RF5112 we can have one or two curves | 2963 | /* For RF5112 we can have one or two curves |
@@ -2971,9 +2970,6 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah, | |||
2971 | * match max power value with max | 2970 | * match max power value with max |
2972 | * table index */ | 2971 | * table index */ |
2973 | ah->ah_txpower.txp_offset = 64 - (table_max[0] / 2); | 2972 | ah->ah_txpower.txp_offset = 64 - (table_max[0] / 2); |
2974 | |||
2975 | /* Write settings on hw */ | ||
2976 | ath5k_setup_pcdac_table(ah); | ||
2977 | break; | 2973 | break; |
2978 | case AR5K_PWRTABLE_PWR_TO_PCDAC: | 2974 | case AR5K_PWRTABLE_PWR_TO_PCDAC: |
2979 | /* We are done for RF5111 since it has only | 2975 | /* We are done for RF5111 since it has only |
@@ -2983,9 +2979,6 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah, | |||
2983 | /* No rate powertable adjustment for RF5111 */ | 2979 | /* No rate powertable adjustment for RF5111 */ |
2984 | ah->ah_txpower.txp_min_idx = 0; | 2980 | ah->ah_txpower.txp_min_idx = 0; |
2985 | ah->ah_txpower.txp_offset = 0; | 2981 | ah->ah_txpower.txp_offset = 0; |
2986 | |||
2987 | /* Write settings on hw */ | ||
2988 | ath5k_setup_pcdac_table(ah); | ||
2989 | break; | 2982 | break; |
2990 | case AR5K_PWRTABLE_PWR_TO_PDADC: | 2983 | case AR5K_PWRTABLE_PWR_TO_PDADC: |
2991 | /* Set PDADC boundaries and fill | 2984 | /* Set PDADC boundaries and fill |
@@ -2993,9 +2986,6 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah, | |||
2993 | ath5k_combine_pwr_to_pdadc_curves(ah, table_min, table_max, | 2986 | ath5k_combine_pwr_to_pdadc_curves(ah, table_min, table_max, |
2994 | ee->ee_pd_gains[ee_mode]); | 2987 | ee->ee_pd_gains[ee_mode]); |
2995 | 2988 | ||
2996 | /* Write settings on hw */ | ||
2997 | ath5k_setup_pwr_to_pdadc_table(ah, ee_mode); | ||
2998 | |||
2999 | /* Set txp.offset, note that table_min | 2989 | /* Set txp.offset, note that table_min |
3000 | * can be negative */ | 2990 | * can be negative */ |
3001 | ah->ah_txpower.txp_offset = table_min[0]; | 2991 | ah->ah_txpower.txp_offset = table_min[0]; |
@@ -3009,6 +2999,15 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah, | |||
3009 | return 0; | 2999 | return 0; |
3010 | } | 3000 | } |
3011 | 3001 | ||
3002 | /* Write power table for current channel to hw */ | ||
3003 | static void | ||
3004 | ath5k_write_channel_powertable(struct ath5k_hw *ah, u8 ee_mode, u8 type) | ||
3005 | { | ||
3006 | if (type == AR5K_PWRTABLE_PWR_TO_PDADC) | ||
3007 | ath5k_write_pwr_to_pdadc_table(ah, ee_mode); | ||
3008 | else | ||
3009 | ath5k_write_pcdac_table(ah); | ||
3010 | } | ||
3012 | 3011 | ||
3013 | /* | 3012 | /* |
3014 | * Per-rate tx power setting | 3013 | * Per-rate tx power setting |
@@ -3159,11 +3158,10 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, | |||
3159 | ee_mode, type); | 3158 | ee_mode, type); |
3160 | if (ret) | 3159 | if (ret) |
3161 | return ret; | 3160 | return ret; |
3162 | /* Write cached table on hw */ | 3161 | } |
3163 | } else if (type == AR5K_PWRTABLE_PWR_TO_PDADC) | 3162 | |
3164 | ath5k_setup_pwr_to_pdadc_table(ah, ee_mode); | 3163 | /* Write table on hw */ |
3165 | else | 3164 | ath5k_write_channel_powertable(ah, ee_mode, type); |
3166 | ath5k_setup_pcdac_table(ah); | ||
3167 | 3165 | ||
3168 | /* Limit max power if we have a CTL available */ | 3166 | /* Limit max power if we have a CTL available */ |
3169 | ath5k_get_max_ctl_power(ah, channel); | 3167 | ath5k_get_max_ctl_power(ah, channel); |