diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2010-02-27 07:03:38 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-09 15:06:55 -0500 |
commit | d24019adaae5a6498c189b42431000cf24d4d355 (patch) | |
tree | 7d4fdd49b2b3aa4c8f8310aedc956b106095305d /drivers/net/wireless/b43 | |
parent | 902db91d969c0eaf70245b6d3db5be5e3cff35f4 (diff) |
b43: N-PHY: adjust gain table
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')
-rw-r--r-- | drivers/net/wireless/b43/phy_n.c | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 1952acc3c385..30f8bf24ac69 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -837,6 +837,62 @@ static void b43_nphy_spur_workaround(struct b43_wldev *dev) | |||
837 | b43_nphy_stay_in_carrier_search(dev, 0); | 837 | b43_nphy_stay_in_carrier_search(dev, 0); |
838 | } | 838 | } |
839 | 839 | ||
840 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/AdjustLnaGainTbl */ | ||
841 | static void b43_nphy_adjust_lna_gain_table(struct b43_wldev *dev) | ||
842 | { | ||
843 | struct b43_phy_n *nphy = dev->phy.n; | ||
844 | |||
845 | u8 i; | ||
846 | s16 tmp; | ||
847 | u16 data[4]; | ||
848 | s16 gain[2]; | ||
849 | u16 minmax[2]; | ||
850 | u16 lna_gain[4] = { -2, 10, 19, 25 }; | ||
851 | |||
852 | if (nphy->hang_avoid) | ||
853 | b43_nphy_stay_in_carrier_search(dev, 1); | ||
854 | |||
855 | if (nphy->gain_boost) { | ||
856 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | ||
857 | gain[0] = 6; | ||
858 | gain[1] = 6; | ||
859 | } else { | ||
860 | tmp = 40370 - 315 * nphy->radio_chanspec.channel; | ||
861 | gain[0] = ((tmp >> 13) + ((tmp >> 12) & 1)); | ||
862 | tmp = 23242 - 224 * nphy->radio_chanspec.channel; | ||
863 | gain[1] = ((tmp >> 13) + ((tmp >> 12) & 1)); | ||
864 | } | ||
865 | } else { | ||
866 | gain[0] = 0; | ||
867 | gain[1] = 0; | ||
868 | } | ||
869 | |||
870 | for (i = 0; i < 2; i++) { | ||
871 | if (nphy->elna_gain_config) { | ||
872 | data[0] = 19 + gain[i]; | ||
873 | data[1] = 25 + gain[i]; | ||
874 | data[2] = 25 + gain[i]; | ||
875 | data[3] = 25 + gain[i]; | ||
876 | } else { | ||
877 | data[0] = lna_gain[0] + gain[i]; | ||
878 | data[1] = lna_gain[1] + gain[i]; | ||
879 | data[2] = lna_gain[2] + gain[i]; | ||
880 | data[3] = lna_gain[3] + gain[i]; | ||
881 | } | ||
882 | b43_ntab_write_bulk(dev, B43_NTAB16(10, 8), 4, data); | ||
883 | |||
884 | minmax[i] = 23 + gain[i]; | ||
885 | } | ||
886 | |||
887 | b43_phy_maskset(dev, B43_NPHY_C1_MINMAX_GAIN, ~B43_NPHY_C1_MINGAIN, | ||
888 | minmax[0] << B43_NPHY_C1_MINGAIN_SHIFT); | ||
889 | b43_phy_maskset(dev, B43_NPHY_C2_MINMAX_GAIN, ~B43_NPHY_C2_MINGAIN, | ||
890 | minmax[1] << B43_NPHY_C2_MINGAIN_SHIFT); | ||
891 | |||
892 | if (nphy->hang_avoid) | ||
893 | b43_nphy_stay_in_carrier_search(dev, 0); | ||
894 | } | ||
895 | |||
840 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/WorkaroundsGainCtrl */ | 896 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/WorkaroundsGainCtrl */ |
841 | static void b43_nphy_gain_crtl_workarounds(struct b43_wldev *dev) | 897 | static void b43_nphy_gain_crtl_workarounds(struct b43_wldev *dev) |
842 | { | 898 | { |
@@ -921,7 +977,7 @@ static void b43_nphy_gain_crtl_workarounds(struct b43_wldev *dev) | |||
921 | b43_phy_write(dev, B43_NPHY_TABLE_DATALO, | 977 | b43_phy_write(dev, B43_NPHY_TABLE_DATALO, |
922 | (code << 8 | 0x7C)); | 978 | (code << 8 | 0x7C)); |
923 | 979 | ||
924 | /* TODO: b43_nphy_adjust_lna_gain_table(dev); */ | 980 | b43_nphy_adjust_lna_gain_table(dev); |
925 | 981 | ||
926 | if (nphy->elna_gain_config) { | 982 | if (nphy->elna_gain_config) { |
927 | b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x0808); | 983 | b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x0808); |