aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/phy_n.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2010-01-21 19:53:16 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-01-22 16:11:40 -0500
commit59af099b1956086b06c0d0f32ea99ce136b415b7 (patch)
tree11a1f4ec01021d8e4bef70ec9ababc77d979500a /drivers/net/wireless/b43/phy_n.c
parent45ca697e60eb5d3cac4530ae3a88f96c297efb09 (diff)
b43: N-PHY: add TX tone
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.c60
1 files changed, 55 insertions, 5 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 97a44e43d057..a45a1f3ced42 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -816,6 +816,43 @@ static void b43_nphy_stop_playback(struct b43_wldev *dev)
816 b43_nphy_stay_in_carrier_search(dev, 0); 816 b43_nphy_stay_in_carrier_search(dev, 0);
817} 817}
818 818
819/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GenLoadSamples */
820static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
821 bool test)
822{
823 int i;
824 u16 bw, len, num, rot, angle;
825 /* TODO: *buffer; */
826
827 bw = (dev->phy.is_40mhz) ? 40 : 20;
828 len = bw << 3;
829
830 if (test) {
831 if (b43_phy_read(dev, B43_NPHY_BBCFG) & B43_NPHY_BBCFG_RSTRX)
832 bw = 82;
833 else
834 bw = 80;
835
836 if (dev->phy.is_40mhz)
837 bw <<= 1;
838
839 len = bw << 1;
840 }
841
842 /* TODO: buffer = kzalloc(len * sizeof(u32), GFP_KERNEL); */
843 num = len;
844 rot = (((freq * 36) / bw) << 16) / 100;
845 angle = 0;
846
847 for (i = 0; i < num; i++) {
848 /* TODO */
849 }
850
851 /* TODO: Call N PHY Load Sample Table with buffer, num as arguments */
852 /* TODO: kfree(buffer); */
853 return num;
854}
855
819/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */ 856/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */
820static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops, 857static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops,
821 u16 wait, bool iqmode, bool dac_test) 858 u16 wait, bool iqmode, bool dac_test)
@@ -876,6 +913,20 @@ static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops,
876 b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode); 913 b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode);
877} 914}
878 915
916/*
917 * Transmits a known value for LO calibration
918 * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TXTone
919 */
920static int b43_nphy_tx_tone(struct b43_wldev *dev, u32 freq, u16 max_val,
921 bool iqmode, bool dac_test)
922{
923 u16 samp = b43_nphy_gen_load_samples(dev, freq, max_val, dac_test);
924 if (samp == 0)
925 return -1;
926 b43_nphy_run_samples(dev, samp, 0xFFFF, 0, iqmode, dac_test);
927 return 0;
928}
929
879/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */ 930/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */
880static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev) 931static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev)
881{ 932{
@@ -1969,8 +2020,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
1969 b43_nphy_run_samples(dev, (dev->phy.is_40mhz ? 40 : 20) * 8, 2020 b43_nphy_run_samples(dev, (dev->phy.is_40mhz ? 40 : 20) * 8,
1970 0xFFFF, 0, true, false); 2021 0xFFFF, 0, true, false);
1971 else 2022 else
1972 ;/* TODO: Call N PHY TX Tone with freq, 250, 1, 0 as arguments 2023 error = b43_nphy_tx_tone(dev, freq, 250, true, false);
1973 and save result as error */
1974 2024
1975 if (error == 0) { 2025 if (error == 0) {
1976 if (nphy->mphase_cal_phase_id > 2) { 2026 if (nphy->mphase_cal_phase_id > 2) {
@@ -2254,9 +2304,9 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
2254 b43_nphy_stop_playback(dev); 2304 b43_nphy_stop_playback(dev);
2255 2305
2256 if (playtone) { 2306 if (playtone) {
2257 /* TODO: Call N PHY TX Tone with 4000, 2307 ret = b43_nphy_tx_tone(dev, 4000,
2258 (nphy_rxcalparams & 0xffff), 0, 0 2308 (nphy->rxcalparams & 0xFFFF),
2259 as arguments and save result as ret */ 2309 false, false);
2260 playtone = false; 2310 playtone = false;
2261 } else { 2311 } else {
2262 b43_nphy_run_samples(dev, 160, 0xFFFF, 0, 2312 b43_nphy_run_samples(dev, 160, 0xFFFF, 0,