#include <linux/cordic.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/types.h>
#include "b43.h"
#include "phy_n.h"
#include "tables_nphy.h"
#include "radio_2055.h"
#include "radio_2056.h"
#include "radio_2057.h"
#include "main.h"
#include "ppr.h"
struct nphy_txgains { … };
struct nphy_iqcal_params { … };
struct nphy_iq_est { … };
enum b43_nphy_rf_sequence { … };
enum n_rf_ctl_over_cmd { … };
enum n_intc_override { … };
enum n_rssi_type { … };
enum n_rail_type { … };
static inline bool b43_nphy_ipa(struct b43_wldev *dev)
{ … }
static u8 b43_nphy_get_rx_core_state(struct b43_wldev *dev)
{ … }
static void b43_nphy_force_rf_sequence(struct b43_wldev *dev,
enum b43_nphy_rf_sequence seq)
{ … }
static void b43_nphy_rf_ctl_override_rev19(struct b43_wldev *dev, u16 field,
u16 value, u8 core, bool off,
u8 override_id)
{ … }
static void b43_nphy_rf_ctl_override_rev7(struct b43_wldev *dev, u16 field,
u16 value, u8 core, bool off,
u8 override)
{ … }
static void b43_nphy_rf_ctl_override_one_to_many(struct b43_wldev *dev,
enum n_rf_ctl_over_cmd cmd,
u16 value, u8 core, bool off)
{ … }
static void b43_nphy_rf_ctl_override(struct b43_wldev *dev, u16 field,
u16 value, u8 core, bool off)
{ … }
static void b43_nphy_rf_ctl_intc_override_rev7(struct b43_wldev *dev,
enum n_intc_override intc_override,
u16 value, u8 core_sel)
{ … }
static void b43_nphy_rf_ctl_intc_override(struct b43_wldev *dev,
enum n_intc_override intc_override,
u16 value, u8 core)
{ … }
static void b43_nphy_write_clip_detection(struct b43_wldev *dev,
const u16 *clip_st)
{ … }
static void b43_nphy_read_clip_detection(struct b43_wldev *dev, u16 *clip_st)
{ … }
static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
{ … }
static void b43_nphy_reset_cca(struct b43_wldev *dev)
{ … }
static void b43_nphy_stay_in_carrier_search(struct b43_wldev *dev, bool enable)
{ … }
static u16 b43_nphy_read_lpf_ctl(struct b43_wldev *dev, u16 offset)
{ … }
static void b43_nphy_adjust_lna_gain_table(struct b43_wldev *dev)
{ … }
static void b43_nphy_set_rf_sequence(struct b43_wldev *dev, u8 cmd,
u8 *events, u8 *delays, u8 length)
{ … }
static void b43_radio_2057_chantab_upload(struct b43_wldev *dev,
const struct b43_nphy_chantabent_rev7 *e_r7,
const struct b43_nphy_chantabent_rev7_2g *e_r7_2g)
{ … }
static void b43_radio_2057_setup(struct b43_wldev *dev,
const struct b43_nphy_chantabent_rev7 *tabent_r7,
const struct b43_nphy_chantabent_rev7_2g *tabent_r7_2g)
{ … }
static u8 b43_radio_2057_rcal(struct b43_wldev *dev)
{ … }
static u16 b43_radio_2057_rccal(struct b43_wldev *dev)
{ … }
static void b43_radio_2057_init_pre(struct b43_wldev *dev)
{ … }
static void b43_radio_2057_init_post(struct b43_wldev *dev)
{ … }
static void b43_radio_2057_init(struct b43_wldev *dev)
{ … }
static void b43_chantab_radio_2056_upload(struct b43_wldev *dev,
const struct b43_nphy_channeltab_entry_rev3 *e)
{ … }
static void b43_radio_2056_setup(struct b43_wldev *dev,
const struct b43_nphy_channeltab_entry_rev3 *e)
{ … }
static u8 b43_radio_2056_rcal(struct b43_wldev *dev)
{ … }
static void b43_radio_init2056_pre(struct b43_wldev *dev)
{ … }
static void b43_radio_init2056_post(struct b43_wldev *dev)
{ … }
static void b43_radio_init2056(struct b43_wldev *dev)
{ … }
static void b43_chantab_radio_upload(struct b43_wldev *dev,
const struct b43_nphy_channeltab_entry_rev2 *e)
{ … }
static void b43_radio_2055_setup(struct b43_wldev *dev,
const struct b43_nphy_channeltab_entry_rev2 *e)
{ … }
static void b43_radio_init2055_pre(struct b43_wldev *dev)
{ … }
static void b43_radio_init2055_post(struct b43_wldev *dev)
{ … }
static void b43_radio_init2055(struct b43_wldev *dev)
{ … }
static int b43_nphy_load_samples(struct b43_wldev *dev,
struct cordic_iq *samples, u16 len) { … }
static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
bool test)
{ … }
static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops,
u16 wait, bool iqmode, bool dac_test,
bool modify_bbmult)
{ … }
static void b43_nphy_scale_offset_rssi(struct b43_wldev *dev, u16 scale,
s8 offset, u8 core,
enum n_rail_type rail,
enum n_rssi_type rssi_type)
{ … }
static void b43_nphy_rssi_select_rev19(struct b43_wldev *dev, u8 code,
enum n_rssi_type rssi_type)
{ … }
static void b43_nphy_rev3_rssi_select(struct b43_wldev *dev, u8 code,
enum n_rssi_type rssi_type)
{ … }
static void b43_nphy_rev2_rssi_select(struct b43_wldev *dev, u8 code,
enum n_rssi_type rssi_type)
{ … }
static void b43_nphy_rssi_select(struct b43_wldev *dev, u8 code,
enum n_rssi_type type)
{ … }
static void b43_nphy_set_rssi_2055_vcm(struct b43_wldev *dev,
enum n_rssi_type rssi_type, u8 *buf)
{ … }
static int b43_nphy_poll_rssi(struct b43_wldev *dev, enum n_rssi_type rssi_type,
s32 *buf, u8 nsamp)
{ … }
static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
{ … }
static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, enum n_rssi_type type)
{ … }
static void b43_nphy_rssi_cal(struct b43_wldev *dev)
{ … }
static void b43_nphy_gain_ctl_workarounds_rev19(struct b43_wldev *dev)
{ … }
static void b43_nphy_gain_ctl_workarounds_rev7(struct b43_wldev *dev)
{ … }
static void b43_nphy_gain_ctl_workarounds_rev3(struct b43_wldev *dev)
{ … }
static void b43_nphy_gain_ctl_workarounds_rev1_2(struct b43_wldev *dev)
{ … }
static void b43_nphy_gain_ctl_workarounds(struct b43_wldev *dev)
{ … }
static void b43_nphy_workarounds_rev7plus(struct b43_wldev *dev)
{ … }
static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)
{ … }
static void b43_nphy_workarounds_rev1_2(struct b43_wldev *dev)
{ … }
static void b43_nphy_workarounds(struct b43_wldev *dev)
{ … }
static int b43_nphy_tx_tone(struct b43_wldev *dev, u32 freq, u16 max_val,
bool iqmode, bool dac_test, bool modify_bbmult)
{ … }
static void b43_nphy_update_txrx_chain(struct b43_wldev *dev)
{ … }
static void b43_nphy_stop_playback(struct b43_wldev *dev)
{ … }
static void b43_nphy_iq_cal_gain_params(struct b43_wldev *dev, u16 core,
struct nphy_txgains target,
struct nphy_iqcal_params *params)
{ … }
static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable)
{ … }
static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
{ … }
static void b43_nphy_ipa_internal_tssi_setup(struct b43_wldev *dev)
{ … }
static void b43_nphy_tx_power_ctl_idle_tssi(struct b43_wldev *dev)
{ … }
static void b43_nphy_tx_prepare_adjusted_power_table(struct b43_wldev *dev)
{ … }
static void b43_nphy_tx_power_ctl_setup(struct b43_wldev *dev)
{ … }
static void b43_nphy_tx_gain_table_upload(struct b43_wldev *dev)
{ … }
static void b43_nphy_pa_override(struct b43_wldev *dev, bool enable)
{ … }
static void b43_nphy_tx_lpf_bw(struct b43_wldev *dev)
{ … }
static void b43_nphy_rx_iq_est(struct b43_wldev *dev, struct nphy_iq_est *est,
u16 samps, u8 time, bool wait)
{ … }
static void b43_nphy_rx_iq_coeffs(struct b43_wldev *dev, bool write,
struct b43_phy_n_iq_comp *pcomp)
{ … }
#if 0
static void b43_nphy_rx_cal_phy_cleanup(struct b43_wldev *dev, u8 core)
{
u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs;
b43_phy_write(dev, B43_NPHY_RFSEQCA, regs[0]);
if (core == 0) {
b43_phy_write(dev, B43_NPHY_AFECTL_C1, regs[1]);
b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, regs[2]);
} else {
b43_phy_write(dev, B43_NPHY_AFECTL_C2, regs[1]);
b43_phy_write(dev, B43_NPHY_AFECTL_OVER, regs[2]);
}
b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs[3]);
b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs[4]);
b43_phy_write(dev, B43_NPHY_RFCTL_RSSIO1, regs[5]);
b43_phy_write(dev, B43_NPHY_RFCTL_RSSIO2, regs[6]);
b43_phy_write(dev, B43_NPHY_TXF_40CO_B1S1, regs[7]);
b43_phy_write(dev, B43_NPHY_RFCTL_OVER, regs[8]);
b43_phy_write(dev, B43_NPHY_PAPD_EN0, regs[9]);
b43_phy_write(dev, B43_NPHY_PAPD_EN1, regs[10]);
}
static void b43_nphy_rx_cal_phy_setup(struct b43_wldev *dev, u8 core)
{
u8 rxval, txval;
u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs;
regs[0] = b43_phy_read(dev, B43_NPHY_RFSEQCA);
if (core == 0) {
regs[1] = b43_phy_read(dev, B43_NPHY_AFECTL_C1);
regs[2] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER1);
} else {
regs[1] = b43_phy_read(dev, B43_NPHY_AFECTL_C2);
regs[2] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER);
}
regs[3] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1);
regs[4] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2);
regs[5] = b43_phy_read(dev, B43_NPHY_RFCTL_RSSIO1);
regs[6] = b43_phy_read(dev, B43_NPHY_RFCTL_RSSIO2);
regs[7] = b43_phy_read(dev, B43_NPHY_TXF_40CO_B1S1);
regs[8] = b43_phy_read(dev, B43_NPHY_RFCTL_OVER);
regs[9] = b43_phy_read(dev, B43_NPHY_PAPD_EN0);
regs[10] = b43_phy_read(dev, B43_NPHY_PAPD_EN1);
b43_phy_mask(dev, B43_NPHY_PAPD_EN0, ~0x0001);
b43_phy_mask(dev, B43_NPHY_PAPD_EN1, ~0x0001);
b43_phy_maskset(dev, B43_NPHY_RFSEQCA,
~B43_NPHY_RFSEQCA_RXDIS & 0xFFFF,
((1 - core) << B43_NPHY_RFSEQCA_RXDIS_SHIFT));
b43_phy_maskset(dev, B43_NPHY_RFSEQCA, ~B43_NPHY_RFSEQCA_TXEN,
((1 - core) << B43_NPHY_RFSEQCA_TXEN_SHIFT));
b43_phy_maskset(dev, B43_NPHY_RFSEQCA, ~B43_NPHY_RFSEQCA_RXEN,
(core << B43_NPHY_RFSEQCA_RXEN_SHIFT));
b43_phy_maskset(dev, B43_NPHY_RFSEQCA, ~B43_NPHY_RFSEQCA_TXDIS,
(core << B43_NPHY_RFSEQCA_TXDIS_SHIFT));
if (core == 0) {
b43_phy_mask(dev, B43_NPHY_AFECTL_C1, ~0x0007);
b43_phy_set(dev, B43_NPHY_AFECTL_OVER1, 0x0007);
} else {
b43_phy_mask(dev, B43_NPHY_AFECTL_C2, ~0x0007);
b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x0007);
}
b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_PA, 0, 3);
b43_nphy_rf_ctl_override(dev, 8, 0, 3, false);
b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RX2TX);
if (core == 0) {
rxval = 1;
txval = 8;
} else {
rxval = 4;
txval = 2;
}
b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_TRSW, rxval,
core + 1);
b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_TRSW, txval,
2 - core);
}
#endif
static void b43_nphy_calc_rx_iq_comp(struct b43_wldev *dev, u8 mask)
{ … }
static void b43_nphy_tx_iq_workaround(struct b43_wldev *dev)
{ … }
static void b43_nphy_spur_workaround(struct b43_wldev *dev)
{ … }
static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev)
{ … }
static void b43_nphy_restore_rssi_cal(struct b43_wldev *dev)
{ … }
static void b43_nphy_tx_cal_radio_setup_rev19(struct b43_wldev *dev)
{ … }
static void b43_nphy_tx_cal_radio_setup_rev7(struct b43_wldev *dev)
{ … }
static void b43_nphy_tx_cal_radio_setup(struct b43_wldev *dev)
{ … }
static void b43_nphy_update_tx_cal_ladder(struct b43_wldev *dev, u16 core)
{ … }
static void b43_nphy_pa_set_tx_dig_filter(struct b43_wldev *dev, u16 offset,
const s16 *filter)
{ … }
static void b43_nphy_ext_pa_set_tx_dig_filters(struct b43_wldev *dev)
{ … }
static void b43_nphy_int_pa_set_tx_dig_filters(struct b43_wldev *dev)
{ … }
static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev)
{ … }
static void b43_nphy_tx_cal_phy_cleanup(struct b43_wldev *dev)
{ … }
static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
{ … }
static void b43_nphy_save_cal(struct b43_wldev *dev)
{ … }
static void b43_nphy_restore_cal(struct b43_wldev *dev)
{ … }
static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
struct nphy_txgains target,
bool full, bool mphase)
{ … }
static void b43_nphy_reapply_tx_cal_coeffs(struct b43_wldev *dev)
{ … }
static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
struct nphy_txgains target, u8 type, bool debug)
{ … }
static int b43_nphy_rev3_cal_rx_iq(struct b43_wldev *dev,
struct nphy_txgains target, u8 type, bool debug)
{ … }
static int b43_nphy_cal_rx_iq(struct b43_wldev *dev,
struct nphy_txgains target, u8 type, bool debug)
{ … }
static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask)
{ … }
static enum b43_txpwr_result b43_nphy_op_recalc_txpower(struct b43_wldev *dev,
bool ignore_tssi)
{ … }
static void b43_nphy_update_mimo_config(struct b43_wldev *dev, s32 preamble)
{ … }
static void b43_nphy_bphy_init(struct b43_wldev *dev)
{ … }
static void b43_nphy_superswitch_init(struct b43_wldev *dev, bool init)
{ … }
static int b43_phy_initn(struct b43_wldev *dev)
{ … }
static void b43_chantab_phy_upload(struct b43_wldev *dev,
const struct b43_phy_n_sfo_cfg *e)
{ … }
static void b43_nphy_pmu_spur_avoid(struct b43_wldev *dev, bool avoid)
{ … }
static void b43_nphy_channel_setup(struct b43_wldev *dev,
const struct b43_phy_n_sfo_cfg *e,
struct ieee80211_channel *new_channel)
{ … }
static int b43_nphy_set_channel(struct b43_wldev *dev,
struct ieee80211_channel *channel,
enum nl80211_channel_type channel_type)
{ … }
static int b43_nphy_op_allocate(struct b43_wldev *dev)
{ … }
static void b43_nphy_op_prepare_structs(struct b43_wldev *dev)
{ … }
static void b43_nphy_op_free(struct b43_wldev *dev)
{ … }
static int b43_nphy_op_init(struct b43_wldev *dev)
{ … }
static inline void check_phyreg(struct b43_wldev *dev, u16 offset)
{ … }
static void b43_nphy_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask,
u16 set)
{ … }
static u16 b43_nphy_op_radio_read(struct b43_wldev *dev, u16 reg)
{ … }
static void b43_nphy_op_radio_write(struct b43_wldev *dev, u16 reg, u16 value)
{ … }
static void b43_nphy_op_software_rfkill(struct b43_wldev *dev,
bool blocked)
{ … }
static void b43_nphy_op_switch_analog(struct b43_wldev *dev, bool on)
{ … }
static int b43_nphy_op_switch_channel(struct b43_wldev *dev,
unsigned int new_channel)
{ … }
static unsigned int b43_nphy_op_get_default_chan(struct b43_wldev *dev)
{ … }
const struct b43_phy_operations b43_phyops_n = …;