diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2010-02-27 07:03:37 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-09 15:06:54 -0500 |
commit | 902db91d969c0eaf70245b6d3db5be5e3cff35f4 (patch) | |
tree | 9302f622bc7fa8c28e4a9df392a035251d9a5001 /drivers | |
parent | 036cafe4212a7d71d415b2f02cc5d6cad690dc27 (diff) |
b43: N-PHY: switch to chanspec struct
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/b43/phy_n.c | 45 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy_n.h | 11 |
2 files changed, 36 insertions, 20 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 67748976ae79..1952acc3c385 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -73,6 +73,21 @@ static void b43_nphy_rf_control_override(struct b43_wldev *dev, u16 field, | |||
73 | static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field, | 73 | static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field, |
74 | u16 value, u8 core); | 74 | u16 value, u8 core); |
75 | 75 | ||
76 | static inline bool b43_empty_chanspec(struct b43_chanspec *chanspec) | ||
77 | { | ||
78 | return !chanspec->channel && !chanspec->sideband && | ||
79 | !chanspec->b_width && !chanspec->b_freq; | ||
80 | } | ||
81 | |||
82 | static inline bool b43_eq_chanspecs(struct b43_chanspec *chanspec1, | ||
83 | struct b43_chanspec *chanspec2) | ||
84 | { | ||
85 | return (chanspec1->channel == chanspec2->channel && | ||
86 | chanspec1->sideband == chanspec2->sideband && | ||
87 | chanspec1->b_width == chanspec2->b_width && | ||
88 | chanspec1->b_freq == chanspec2->b_freq); | ||
89 | } | ||
90 | |||
76 | void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna) | 91 | void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna) |
77 | {//TODO | 92 | {//TODO |
78 | } | 93 | } |
@@ -768,7 +783,7 @@ static void b43_nphy_spur_workaround(struct b43_wldev *dev) | |||
768 | { | 783 | { |
769 | struct b43_phy_n *nphy = dev->phy.n; | 784 | struct b43_phy_n *nphy = dev->phy.n; |
770 | 785 | ||
771 | unsigned int channel; | 786 | u8 channel = nphy->radio_chanspec.channel; |
772 | int tone[2] = { 57, 58 }; | 787 | int tone[2] = { 57, 58 }; |
773 | u32 noise[2] = { 0x3FF, 0x3FF }; | 788 | u32 noise[2] = { 0x3FF, 0x3FF }; |
774 | 789 | ||
@@ -777,8 +792,6 @@ static void b43_nphy_spur_workaround(struct b43_wldev *dev) | |||
777 | if (nphy->hang_avoid) | 792 | if (nphy->hang_avoid) |
778 | b43_nphy_stay_in_carrier_search(dev, 1); | 793 | b43_nphy_stay_in_carrier_search(dev, 1); |
779 | 794 | ||
780 | /* FIXME: channel = radio_chanspec */ | ||
781 | |||
782 | if (nphy->gband_spurwar_en) { | 795 | if (nphy->gband_spurwar_en) { |
783 | /* TODO: N PHY Adjust Analog Pfbw (7) */ | 796 | /* TODO: N PHY Adjust Analog Pfbw (7) */ |
784 | if (channel == 11 && dev->phy.is_40mhz) | 797 | if (channel == 11 && dev->phy.is_40mhz) |
@@ -2015,12 +2028,12 @@ static void b43_nphy_restore_rssi_cal(struct b43_wldev *dev) | |||
2015 | u16 *rssical_phy_regs = NULL; | 2028 | u16 *rssical_phy_regs = NULL; |
2016 | 2029 | ||
2017 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | 2030 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { |
2018 | if (!nphy->rssical_chanspec_2G) | 2031 | if (b43_empty_chanspec(&nphy->rssical_chanspec_2G)) |
2019 | return; | 2032 | return; |
2020 | rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_2G; | 2033 | rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_2G; |
2021 | rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_2G; | 2034 | rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_2G; |
2022 | } else { | 2035 | } else { |
2023 | if (!nphy->rssical_chanspec_5G) | 2036 | if (b43_empty_chanspec(&nphy->rssical_chanspec_5G)) |
2024 | return; | 2037 | return; |
2025 | rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_5G; | 2038 | rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_5G; |
2026 | rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_5G; | 2039 | rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_5G; |
@@ -2440,7 +2453,7 @@ static void b43_nphy_save_cal(struct b43_wldev *dev) | |||
2440 | 2453 | ||
2441 | struct b43_phy_n_iq_comp *rxcal_coeffs = NULL; | 2454 | struct b43_phy_n_iq_comp *rxcal_coeffs = NULL; |
2442 | u16 *txcal_radio_regs = NULL; | 2455 | u16 *txcal_radio_regs = NULL; |
2443 | u8 *iqcal_chanspec; | 2456 | struct b43_chanspec *iqcal_chanspec; |
2444 | u16 *table = NULL; | 2457 | u16 *table = NULL; |
2445 | 2458 | ||
2446 | if (nphy->hang_avoid) | 2459 | if (nphy->hang_avoid) |
@@ -2496,12 +2509,12 @@ static void b43_nphy_restore_cal(struct b43_wldev *dev) | |||
2496 | struct b43_phy_n_iq_comp *rxcal_coeffs = NULL; | 2509 | struct b43_phy_n_iq_comp *rxcal_coeffs = NULL; |
2497 | 2510 | ||
2498 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | 2511 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { |
2499 | if (nphy->iqcal_chanspec_2G == 0) | 2512 | if (b43_empty_chanspec(&nphy->iqcal_chanspec_2G)) |
2500 | return; | 2513 | return; |
2501 | table = nphy->cal_cache.txcal_coeffs_2G; | 2514 | table = nphy->cal_cache.txcal_coeffs_2G; |
2502 | loft = &nphy->cal_cache.txcal_coeffs_2G[5]; | 2515 | loft = &nphy->cal_cache.txcal_coeffs_2G[5]; |
2503 | } else { | 2516 | } else { |
2504 | if (nphy->iqcal_chanspec_5G == 0) | 2517 | if (b43_empty_chanspec(&nphy->iqcal_chanspec_5G)) |
2505 | return; | 2518 | return; |
2506 | table = nphy->cal_cache.txcal_coeffs_5G; | 2519 | table = nphy->cal_cache.txcal_coeffs_5G; |
2507 | loft = &nphy->cal_cache.txcal_coeffs_5G[5]; | 2520 | loft = &nphy->cal_cache.txcal_coeffs_5G[5]; |
@@ -2746,8 +2759,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, | |||
2746 | b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length, | 2759 | b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length, |
2747 | nphy->txiqlocal_bestc); | 2760 | nphy->txiqlocal_bestc); |
2748 | nphy->txiqlocal_coeffsvalid = true; | 2761 | nphy->txiqlocal_coeffsvalid = true; |
2749 | /* TODO: Set nphy->txiqlocal_chanspec to | 2762 | nphy->txiqlocal_chanspec = nphy->radio_chanspec; |
2750 | the current channel */ | ||
2751 | } else { | 2763 | } else { |
2752 | length = 11; | 2764 | length = 11; |
2753 | if (dev->phy.rev < 3) | 2765 | if (dev->phy.rev < 3) |
@@ -2782,7 +2794,8 @@ static void b43_nphy_reapply_tx_cal_coeffs(struct b43_wldev *dev) | |||
2782 | u16 buffer[7]; | 2794 | u16 buffer[7]; |
2783 | bool equal = true; | 2795 | bool equal = true; |
2784 | 2796 | ||
2785 | if (!nphy->txiqlocal_coeffsvalid || 1 /* FIXME */) | 2797 | if (!nphy->txiqlocal_coeffsvalid || |
2798 | b43_eq_chanspecs(&nphy->txiqlocal_chanspec, &nphy->radio_chanspec)) | ||
2786 | return; | 2799 | return; |
2787 | 2800 | ||
2788 | b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 7, buffer); | 2801 | b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 7, buffer); |
@@ -3137,9 +3150,11 @@ int b43_phy_initn(struct b43_wldev *dev) | |||
3137 | do_rssi_cal = false; | 3150 | do_rssi_cal = false; |
3138 | if (phy->rev >= 3) { | 3151 | if (phy->rev >= 3) { |
3139 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) | 3152 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) |
3140 | do_rssi_cal = (nphy->rssical_chanspec_2G == 0); | 3153 | do_rssi_cal = |
3154 | b43_empty_chanspec(&nphy->rssical_chanspec_2G); | ||
3141 | else | 3155 | else |
3142 | do_rssi_cal = (nphy->rssical_chanspec_5G == 0); | 3156 | do_rssi_cal = |
3157 | b43_empty_chanspec(&nphy->rssical_chanspec_5G); | ||
3143 | 3158 | ||
3144 | if (do_rssi_cal) | 3159 | if (do_rssi_cal) |
3145 | b43_nphy_rssi_cal(dev); | 3160 | b43_nphy_rssi_cal(dev); |
@@ -3151,9 +3166,9 @@ int b43_phy_initn(struct b43_wldev *dev) | |||
3151 | 3166 | ||
3152 | if (!((nphy->measure_hold & 0x6) != 0)) { | 3167 | if (!((nphy->measure_hold & 0x6) != 0)) { |
3153 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) | 3168 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) |
3154 | do_cal = (nphy->iqcal_chanspec_2G == 0); | 3169 | do_cal = b43_empty_chanspec(&nphy->iqcal_chanspec_2G); |
3155 | else | 3170 | else |
3156 | do_cal = (nphy->iqcal_chanspec_5G == 0); | 3171 | do_cal = b43_empty_chanspec(&nphy->iqcal_chanspec_5G); |
3157 | 3172 | ||
3158 | if (nphy->mute) | 3173 | if (nphy->mute) |
3159 | do_cal = false; | 3174 | do_cal = false; |
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h index 47d20dcafbf6..e7acae278be0 100644 --- a/drivers/net/wireless/b43/phy_n.h +++ b/drivers/net/wireless/b43/phy_n.h | |||
@@ -984,7 +984,7 @@ struct b43_phy_n { | |||
984 | u16 papd_epsilon_offset[2]; | 984 | u16 papd_epsilon_offset[2]; |
985 | s32 preamble_override; | 985 | s32 preamble_override; |
986 | u32 bb_mult_save; | 986 | u32 bb_mult_save; |
987 | u16 radio_chanspec; | 987 | struct b43_chanspec radio_chanspec; |
988 | 988 | ||
989 | bool gain_boost; | 989 | bool gain_boost; |
990 | bool elna_gain_config; | 990 | bool elna_gain_config; |
@@ -1000,6 +1000,7 @@ struct b43_phy_n { | |||
1000 | u16 txiqlocal_bestc[11]; | 1000 | u16 txiqlocal_bestc[11]; |
1001 | bool txiqlocal_coeffsvalid; | 1001 | bool txiqlocal_coeffsvalid; |
1002 | struct b43_phy_n_txpwrindex txpwrindex[2]; | 1002 | struct b43_phy_n_txpwrindex txpwrindex[2]; |
1003 | struct b43_chanspec txiqlocal_chanspec; | ||
1003 | 1004 | ||
1004 | u8 txrx_chain; | 1005 | u8 txrx_chain; |
1005 | u16 tx_rx_cal_phy_saveregs[11]; | 1006 | u16 tx_rx_cal_phy_saveregs[11]; |
@@ -1015,12 +1016,12 @@ struct b43_phy_n { | |||
1015 | bool gband_spurwar_en; | 1016 | bool gband_spurwar_en; |
1016 | 1017 | ||
1017 | bool ipa2g_on; | 1018 | bool ipa2g_on; |
1018 | u8 iqcal_chanspec_2G; | 1019 | struct b43_chanspec iqcal_chanspec_2G; |
1019 | u8 rssical_chanspec_2G; | 1020 | struct b43_chanspec rssical_chanspec_2G; |
1020 | 1021 | ||
1021 | bool ipa5g_on; | 1022 | bool ipa5g_on; |
1022 | u8 iqcal_chanspec_5G; | 1023 | struct b43_chanspec iqcal_chanspec_5G; |
1023 | u8 rssical_chanspec_5G; | 1024 | struct b43_chanspec rssical_chanspec_5G; |
1024 | 1025 | ||
1025 | struct b43_phy_n_rssical_cache rssical_cache; | 1026 | struct b43_phy_n_rssical_cache rssical_cache; |
1026 | struct b43_phy_n_cal_cache cal_cache; | 1027 | struct b43_phy_n_cal_cache cal_cache; |