diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2011-09-04 17:18:22 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-09-14 13:56:27 -0400 |
commit | c002831a07ddba2a81fe1172c497ec7e673ba720 (patch) | |
tree | f0f3b907b44be5b9a349310403d8f925e0ee2fff /drivers/net/wireless/b43/phy_n.c | |
parent | 7827493b886c307bc497a669305207f8a5b36eb2 (diff) |
b43: N-PHY: use helper for checking IPA
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/phy_n.c')
-rw-r--r-- | drivers/net/wireless/b43/phy_n.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 4951678c366e..40e436e0476e 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -89,6 +89,13 @@ static void b43_nphy_rf_control_override(struct b43_wldev *dev, u16 field, | |||
89 | static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field, | 89 | static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field, |
90 | u16 value, u8 core); | 90 | u16 value, u8 core); |
91 | 91 | ||
92 | static inline bool b43_nphy_ipa(struct b43_wldev *dev) | ||
93 | { | ||
94 | enum ieee80211_band band = b43_current_band(dev->wl); | ||
95 | return ((dev->phy.n->ipa2g_on && band == IEEE80211_BAND_2GHZ) || | ||
96 | (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ)); | ||
97 | } | ||
98 | |||
92 | void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna) | 99 | void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna) |
93 | {//TODO | 100 | {//TODO |
94 | } | 101 | } |
@@ -353,8 +360,7 @@ static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable) | |||
353 | if (dev->phy.rev < 2 && dev->phy.is_40mhz) | 360 | if (dev->phy.rev < 2 && dev->phy.is_40mhz) |
354 | b43_hf_write(dev, b43_hf_read(dev) & ~B43_HF_TSSIRPSMW); | 361 | b43_hf_write(dev, b43_hf_read(dev) & ~B43_HF_TSSIRPSMW); |
355 | 362 | ||
356 | if ((nphy->ipa2g_on && band == IEEE80211_BAND_2GHZ) || | 363 | if (b43_nphy_ipa(dev)) { |
357 | (nphy->ipa5g_on && band == IEEE80211_BAND_5GHZ)) { | ||
358 | b43_phy_mask(dev, B43_NPHY_PAPD_EN0, ~0x4); | 364 | b43_phy_mask(dev, B43_NPHY_PAPD_EN0, ~0x4); |
359 | b43_phy_mask(dev, B43_NPHY_PAPD_EN1, ~0x4); | 365 | b43_phy_mask(dev, B43_NPHY_PAPD_EN1, ~0x4); |
360 | } | 366 | } |
@@ -650,14 +656,10 @@ static void b43_nphy_pa_override(struct b43_wldev *dev, bool enable) | |||
650 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxLpFbw */ | 656 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxLpFbw */ |
651 | static void b43_nphy_tx_lp_fbw(struct b43_wldev *dev) | 657 | static void b43_nphy_tx_lp_fbw(struct b43_wldev *dev) |
652 | { | 658 | { |
653 | struct b43_phy_n *nphy = dev->phy.n; | ||
654 | u16 tmp; | 659 | u16 tmp; |
655 | enum ieee80211_band band = b43_current_band(dev->wl); | ||
656 | bool ipa = (nphy->ipa2g_on && band == IEEE80211_BAND_2GHZ) || | ||
657 | (nphy->ipa5g_on && band == IEEE80211_BAND_5GHZ); | ||
658 | 660 | ||
659 | if (dev->phy.rev >= 3) { | 661 | if (dev->phy.rev >= 3) { |
660 | if (ipa) { | 662 | if (b43_nphy_ipa(dev)) { |
661 | tmp = 4; | 663 | tmp = 4; |
662 | b43_phy_write(dev, B43_NPHY_TXF_40CO_B32S2, | 664 | b43_phy_write(dev, B43_NPHY_TXF_40CO_B32S2, |
663 | (((((tmp << 3) | tmp) << 3) | tmp) << 3) | tmp); | 665 | (((((tmp << 3) | tmp) << 3) | tmp) << 3) | tmp); |
@@ -2204,7 +2206,6 @@ static void b43_nphy_rev2_rssi_select(struct b43_wldev *dev, u8 code, u8 type) | |||
2204 | 2206 | ||
2205 | static void b43_nphy_rev3_rssi_select(struct b43_wldev *dev, u8 code, u8 type) | 2207 | static void b43_nphy_rev3_rssi_select(struct b43_wldev *dev, u8 code, u8 type) |
2206 | { | 2208 | { |
2207 | struct b43_phy_n *nphy = dev->phy.n; | ||
2208 | u8 i; | 2209 | u8 i; |
2209 | u16 reg, val; | 2210 | u16 reg, val; |
2210 | 2211 | ||
@@ -2268,10 +2269,7 @@ static void b43_nphy_rev3_rssi_select(struct b43_wldev *dev, u8 code, u8 type) | |||
2268 | enum ieee80211_band band = | 2269 | enum ieee80211_band band = |
2269 | b43_current_band(dev->wl); | 2270 | b43_current_band(dev->wl); |
2270 | 2271 | ||
2271 | if ((nphy->ipa2g_on && | 2272 | if (b43_nphy_ipa(dev)) |
2272 | band == IEEE80211_BAND_2GHZ) || | ||
2273 | (nphy->ipa5g_on && | ||
2274 | band == IEEE80211_BAND_5GHZ)) | ||
2275 | val = (band == IEEE80211_BAND_5GHZ) ? 0xC : 0xE; | 2273 | val = (band == IEEE80211_BAND_5GHZ) ? 0xC : 0xE; |
2276 | else | 2274 | else |
2277 | val = 0x11; | 2275 | val = 0x11; |
@@ -2897,10 +2895,7 @@ static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev) | |||
2897 | enum ieee80211_band band = | 2895 | enum ieee80211_band band = |
2898 | b43_current_band(dev->wl); | 2896 | b43_current_band(dev->wl); |
2899 | 2897 | ||
2900 | if ((nphy->ipa2g_on && | 2898 | if (b43_nphy_ipa(dev)) { |
2901 | band == IEEE80211_BAND_2GHZ) || | ||
2902 | (nphy->ipa5g_on && | ||
2903 | band == IEEE80211_BAND_5GHZ)) { | ||
2904 | table = b43_nphy_get_ipa_gain_table(dev); | 2899 | table = b43_nphy_get_ipa_gain_table(dev); |
2905 | } else { | 2900 | } else { |
2906 | if (band == IEEE80211_BAND_5GHZ) { | 2901 | if (band == IEEE80211_BAND_5GHZ) { |
@@ -3736,8 +3731,7 @@ int b43_phy_initn(struct b43_wldev *dev) | |||
3736 | } | 3731 | } |
3737 | 3732 | ||
3738 | tmp2 = b43_current_band(dev->wl); | 3733 | tmp2 = b43_current_band(dev->wl); |
3739 | if ((nphy->ipa2g_on && tmp2 == IEEE80211_BAND_2GHZ) || | 3734 | if (b43_nphy_ipa(dev)) { |
3740 | (nphy->ipa5g_on && tmp2 == IEEE80211_BAND_5GHZ)) { | ||
3741 | b43_phy_set(dev, B43_NPHY_PAPD_EN0, 0x1); | 3735 | b43_phy_set(dev, B43_NPHY_PAPD_EN0, 0x1); |
3742 | b43_phy_maskset(dev, B43_NPHY_EPS_TABLE_ADJ0, 0x007F, | 3736 | b43_phy_maskset(dev, B43_NPHY_EPS_TABLE_ADJ0, 0x007F, |
3743 | nphy->papd_epsilon_offset[0] << 7); | 3737 | nphy->papd_epsilon_offset[0] << 7); |