提交 59af099b 编写于 作者: R Rafał Miłecki 提交者: John W. Linville

b43: N-PHY: add TX tone

Signed-off-by: NRafał Miłecki <zajec5@gmail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 45ca697e
...@@ -816,6 +816,43 @@ static void b43_nphy_stop_playback(struct b43_wldev *dev) ...@@ -816,6 +816,43 @@ static void b43_nphy_stop_playback(struct b43_wldev *dev)
b43_nphy_stay_in_carrier_search(dev, 0); b43_nphy_stay_in_carrier_search(dev, 0);
} }
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GenLoadSamples */
static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
bool test)
{
int i;
u16 bw, len, num, rot, angle;
/* TODO: *buffer; */
bw = (dev->phy.is_40mhz) ? 40 : 20;
len = bw << 3;
if (test) {
if (b43_phy_read(dev, B43_NPHY_BBCFG) & B43_NPHY_BBCFG_RSTRX)
bw = 82;
else
bw = 80;
if (dev->phy.is_40mhz)
bw <<= 1;
len = bw << 1;
}
/* TODO: buffer = kzalloc(len * sizeof(u32), GFP_KERNEL); */
num = len;
rot = (((freq * 36) / bw) << 16) / 100;
angle = 0;
for (i = 0; i < num; i++) {
/* TODO */
}
/* TODO: Call N PHY Load Sample Table with buffer, num as arguments */
/* TODO: kfree(buffer); */
return num;
}
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */ /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */
static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops, static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops,
u16 wait, bool iqmode, bool dac_test) 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,6 +913,20 @@ static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops,
b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode); b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode);
} }
/*
* Transmits a known value for LO calibration
* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TXTone
*/
static int b43_nphy_tx_tone(struct b43_wldev *dev, u32 freq, u16 max_val,
bool iqmode, bool dac_test)
{
u16 samp = b43_nphy_gen_load_samples(dev, freq, max_val, dac_test);
if (samp == 0)
return -1;
b43_nphy_run_samples(dev, samp, 0xFFFF, 0, iqmode, dac_test);
return 0;
}
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */ /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */
static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev) static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev)
{ {
...@@ -1969,8 +2020,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, ...@@ -1969,8 +2020,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
b43_nphy_run_samples(dev, (dev->phy.is_40mhz ? 40 : 20) * 8, b43_nphy_run_samples(dev, (dev->phy.is_40mhz ? 40 : 20) * 8,
0xFFFF, 0, true, false); 0xFFFF, 0, true, false);
else else
;/* TODO: Call N PHY TX Tone with freq, 250, 1, 0 as arguments error = b43_nphy_tx_tone(dev, freq, 250, true, false);
and save result as error */
if (error == 0) { if (error == 0) {
if (nphy->mphase_cal_phase_id > 2) { if (nphy->mphase_cal_phase_id > 2) {
...@@ -2254,9 +2304,9 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev, ...@@ -2254,9 +2304,9 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
b43_nphy_stop_playback(dev); b43_nphy_stop_playback(dev);
if (playtone) { if (playtone) {
/* TODO: Call N PHY TX Tone with 4000, ret = b43_nphy_tx_tone(dev, 4000,
(nphy_rxcalparams & 0xffff), 0, 0 (nphy->rxcalparams & 0xFFFF),
as arguments and save result as ret */ false, false);
playtone = false; playtone = false;
} else { } else {
b43_nphy_run_samples(dev, 160, 0xFFFF, 0, b43_nphy_run_samples(dev, 160, 0xFFFF, 0,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册