linux/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c

// SPDX-License-Identifier: ISC
/*
 * Copyright (c) 2010 Broadcom Corporation
 */

#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/cordic.h>

#include <pmu.h>
#include <d11.h>
#include <phy_shim.h>
#include "phy_qmath.h"
#include "phy_hal.h"
#include "phy_radio.h"
#include "phytbl_lcn.h"
#include "phy_lcn.h"

#define PLL_2064_NDIV
#define PLL_2064_LOW_END_VCO
#define PLL_2064_LOW_END_KVCO
#define PLL_2064_HIGH_END_VCO
#define PLL_2064_HIGH_END_KVCO
#define PLL_2064_LOOP_BW_DOUBLER
#define PLL_2064_D30_DOUBLER
#define PLL_2064_LOOP_BW
#define PLL_2064_D30
#define PLL_2064_CAL_REF_TO
#define PLL_2064_MHZ
#define PLL_2064_OPEN_LOOP_DELAY

#define TEMPSENSE
#define VBATSENSE

#define NOISE_IF_UPD_CHK_INTERVAL
#define NOISE_IF_UPD_RST_INTERVAL
#define NOISE_IF_UPD_THRESHOLD_CNT
#define NOISE_IF_UPD_TRHRESHOLD
#define NOISE_IF_UPD_TIMEOUT
#define NOISE_IF_OFF
#define NOISE_IF_CHK
#define NOISE_IF_ON

#define PAPD_BLANKING_PROFILE
#define PAPD2LUT
#define PAPD_CORR_NORM
#define PAPD_BLANKING_THRESHOLD
#define PAPD_STOP_AFTER_LAST_UPDATE

#define LCN_TARGET_PWR

#define LCN_VBAT_OFFSET_433X
#define LCN_VBAT_SLOPE_433X

#define LCN_VBAT_SCALE_NOM
#define LCN_VBAT_SCALE_DEN

#define LCN_TEMPSENSE_OFFSET
#define LCN_TEMPSENSE_DEN

#define LCN_BW_LMT
#define LCN_CUR_LMT
#define LCN_MULT
#define LCN_VCO_DIV
#define LCN_OFFSET
#define LCN_FACT
#define LCN_CUR_DIV

#define LCNPHY_txgainctrlovrval1_pagain_ovr_val1_SHIFT
#define LCNPHY_txgainctrlovrval1_pagain_ovr_val1_MASK

#define LCNPHY_stxtxgainctrlovrval1_pagain_ovr_val1_SHIFT
#define LCNPHY_stxtxgainctrlovrval1_pagain_ovr_val1_MASK

#define wlc_lcnphy_enable_tx_gain_override(pi)
#define wlc_lcnphy_disable_tx_gain_override(pi)

#define wlc_lcnphy_iqcal_active(pi)

#define txpwrctrl_off(pi)
#define wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)
#define wlc_lcnphy_tssi_based_pwr_ctrl_enabled(pi)

#define SWCTRL_BT_TX
#define SWCTRL_OVR_DISABLE

#define AFE_CLK_INIT_MODE_TXRX2X
#define AFE_CLK_INIT_MODE_PAPD

#define LCNPHY_TBL_ID_IQLOCAL

#define LCNPHY_TBL_ID_RFSEQ
#define LCNPHY_TBL_ID_GAIN_IDX
#define LCNPHY_TBL_ID_SW_CTRL
#define LCNPHY_TBL_ID_GAIN_TBL
#define LCNPHY_TBL_ID_SPUR
#define LCNPHY_TBL_ID_SAMPLEPLAY
#define LCNPHY_TBL_ID_SAMPLEPLAY1

#define LCNPHY_TX_PWR_CTRL_RATE_OFFSET
#define LCNPHY_TX_PWR_CTRL_MAC_OFFSET
#define LCNPHY_TX_PWR_CTRL_GAIN_OFFSET
#define LCNPHY_TX_PWR_CTRL_IQ_OFFSET
#define LCNPHY_TX_PWR_CTRL_LO_OFFSET
#define LCNPHY_TX_PWR_CTRL_PWR_OFFSET

#define LCNPHY_TX_PWR_CTRL_START_INDEX_2G_4313

#define LCNPHY_TX_PWR_CTRL_START_NPT
#define LCNPHY_TX_PWR_CTRL_MAX_NPT

#define LCNPHY_NOISE_SAMPLES_DEFAULT

#define LCNPHY_ACI_DETECT_START
#define LCNPHY_ACI_DETECT_PROGRESS
#define LCNPHY_ACI_DETECT_STOP

#define LCNPHY_ACI_CRSHIFRMLO_TRSH
#define LCNPHY_ACI_GLITCH_TRSH
#define LCNPHY_ACI_TMOUT
#define LCNPHY_ACI_DETECT_TIMEOUT
#define LCNPHY_ACI_START_DELAY

#define wlc_lcnphy_tx_gain_override_enabled(pi)

#define wlc_lcnphy_total_tx_frames(pi)

struct lcnphy_txgains {};

enum lcnphy_cal_mode {};

struct lcnphy_rx_iqcomp {};

struct lcnphy_spb_tone {};

struct lcnphy_unsign16_struct {};

struct lcnphy_iq_est {};

struct lcnphy_sfo_cfg {};

enum lcnphy_papd_cal_type {};

iqcal_gain_params_lcnphy;

static const iqcal_gain_params_lcnphy tbl_iqcal_gainparams_lcnphy_2G[] =;

static const iqcal_gain_params_lcnphy *tbl_iqcal_gainparams_lcnphy[1] =;

static const u16 iqcal_gainparams_numgains_lcnphy[1] =;

static const struct lcnphy_sfo_cfg lcnphy_sfo_cfg[] =;

static const
u16 lcnphy_iqcal_loft_gainladder[] =;

static const
u16 lcnphy_iqcal_ir_gainladder[] =;

static const
struct lcnphy_spb_tone lcnphy_spb_tone_3750[] =;

static const
u16 iqlo_loopback_rf_regs[20] =;

static const
u16 tempsense_phy_regs[14] =;

static const
u16 rxiq_cal_rf_reg[11] =;

static const u32 lcnphy_23bitgaincode_table[] =;

static const s8 lcnphy_gain_table[] =;

static const s8 lcnphy_gain_index_offset_for_rssi[] =;

struct chan_info_2064_lcnphy {};

static const struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] =;

static const struct lcnphy_radio_regs lcnphy_radio_regs_2064[] =;

#define LCNPHY_NUM_DIG_FILT_COEFFS
#define LCNPHY_NUM_TX_DIG_FILTERS_CCK

static const u16 LCNPHY_txdigfiltcoeffs_cck[LCNPHY_NUM_TX_DIG_FILTERS_CCK]
	[LCNPHY_NUM_DIG_FILT_COEFFS + 1] =;

#define LCNPHY_NUM_TX_DIG_FILTERS_OFDM
static const u16 LCNPHY_txdigfiltcoeffs_ofdm[LCNPHY_NUM_TX_DIG_FILTERS_OFDM]
	[LCNPHY_NUM_DIG_FILT_COEFFS + 1] =;

#define wlc_lcnphy_set_start_tx_pwr_idx(pi, idx)

#define wlc_lcnphy_set_tx_pwr_npt(pi, npt)

#define wlc_lcnphy_get_tx_pwr_ctrl(pi)

#define wlc_lcnphy_get_tx_pwr_npt(pi)

#define wlc_lcnphy_get_current_tx_pwr_idx_if_pwrctrl_on(pi)

#define wlc_lcnphy_get_target_tx_pwr(pi)

#define wlc_lcnphy_set_target_tx_pwr(pi, target)

#define wlc_radio_2064_rcal_done(pi)

#define tempsense_done(pi)

#define LCNPHY_IQLOCC_READ(val)

#define FIXED_TXPWR
#define LCNPHY_TEMPSENSE(val)

void wlc_lcnphy_write_table(struct brcms_phy *pi, const struct phytbl_info *pti)
{}

void wlc_lcnphy_read_table(struct brcms_phy *pi, struct phytbl_info *pti)
{}

static void
wlc_lcnphy_common_read_table(struct brcms_phy *pi, u32 tbl_id,
			     const u16 *tbl_ptr, u32 tbl_len,
			     u32 tbl_width, u32 tbl_offset)
{}

static void
wlc_lcnphy_common_write_table(struct brcms_phy *pi, u32 tbl_id,
			      const u16 *tbl_ptr, u32 tbl_len,
			      u32 tbl_width, u32 tbl_offset)
{}

static u32
wlc_lcnphy_qdiv_roundup(u32 dividend, u32 divisor, u8 precision)
{}

static int wlc_lcnphy_calc_floor(s16 coeff_x, int type)
{}

static void
wlc_lcnphy_get_tx_gain(struct brcms_phy *pi, struct lcnphy_txgains *gains)
{}


static void wlc_lcnphy_set_dac_gain(struct brcms_phy *pi, u16 dac_gain)
{}

static void wlc_lcnphy_set_tx_gain_override(struct brcms_phy *pi, bool bEnable)
{}

static void
wlc_lcnphy_rx_gain_override_enable(struct brcms_phy *pi, bool enable)
{}

static void
wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi,
				       u16 trsw,
				       u16 ext_lna,
				       u16 biq2,
				       u16 biq1,
				       u16 tia, u16 lna2, u16 lna1)
{}

static void wlc_lcnphy_set_trsw_override(struct brcms_phy *pi, bool tx, bool rx)
{}

static void wlc_lcnphy_clear_trsw_override(struct brcms_phy *pi)
{}

static void wlc_lcnphy_set_rx_iq_comp(struct brcms_phy *pi, u16 a, u16 b)
{}

static bool
wlc_lcnphy_rx_iq_est(struct brcms_phy *pi,
		     u16 num_samps,
		     u8 wait_time, struct lcnphy_iq_est *iq_est)
{}

static bool wlc_lcnphy_calc_rx_iq_comp(struct brcms_phy *pi, u16 num_samps)
{}

static u32 wlc_lcnphy_measure_digital_power(struct brcms_phy *pi, u16 nsamples)
{}

static bool wlc_lcnphy_rx_iq_cal_gain(struct brcms_phy *pi, u16 biq1_gain,
				      u16 tia_gain, u16 lna2_gain)
{}

static bool
wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
		     const struct lcnphy_rx_iqcomp *iqcomp,
		     int iqcomp_sz, bool tx_switch, bool rx_switch, int module,
		     int tx_gain_idx)
{}

s8 wlc_lcnphy_get_current_tx_pwr_idx(struct brcms_phy *pi)
{}

void wlc_lcnphy_crsuprs(struct brcms_phy *pi, int channel)
{}

static void wlc_lcnphy_toggle_afe_pwdn(struct brcms_phy *pi)
{}

static void
wlc_lcnphy_txrx_spur_avoidance_mode(struct brcms_phy *pi, bool enable)
{}

static void
wlc_lcnphy_set_chanspec_tweaks(struct brcms_phy *pi, u16 chanspec)
{}

static void
wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel)
{}

static int
wlc_lcnphy_load_tx_iir_filter(struct brcms_phy *pi, bool is_ofdm, s16 filt_type)
{}

static u16 wlc_lcnphy_get_pa_gain(struct brcms_phy *pi)
{}

static void wlc_lcnphy_set_tx_gain(struct brcms_phy *pi,
				   struct lcnphy_txgains *target_gains)
{}

static u8 wlc_lcnphy_get_bbmult(struct brcms_phy *pi)
{}

static void wlc_lcnphy_set_bbmult(struct brcms_phy *pi, u8 m0)
{}

static void wlc_lcnphy_clear_tx_power_offsets(struct brcms_phy *pi)
{}

enum lcnphy_tssi_mode {};

static void
wlc_lcnphy_set_tssi_mux(struct brcms_phy *pi, enum lcnphy_tssi_mode pos)
{}

static u16 wlc_lcnphy_rfseq_tbl_adc_pwrup(struct brcms_phy *pi)
{}

static void wlc_lcnphy_pwrctrl_rssiparams(struct brcms_phy *pi)
{}

static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
{}

void wlc_lcnphy_tx_pwr_update_npt(struct brcms_phy *pi)
{}

s32 wlc_lcnphy_tssi2dbm(s32 tssi, s32 a1, s32 b0, s32 b1)
{}

static void wlc_lcnphy_txpower_reset_npt(struct brcms_phy *pi)
{}

void wlc_lcnphy_txpower_recalc_target(struct brcms_phy *pi)
{}

static void wlc_lcnphy_set_tx_pwr_soft_ctrl(struct brcms_phy *pi, s8 index)
{}

static s8 wlc_lcnphy_tempcompensated_txpwrctrl(struct brcms_phy *pi)
{}

static u16 wlc_lcnphy_set_tx_pwr_ctrl_mode(struct brcms_phy *pi, u16 mode)
{}

void wlc_lcnphy_set_tx_pwr_ctrl(struct brcms_phy *pi, u16 mode)
{}

static void
wlc_lcnphy_tx_iqlo_loopback(struct brcms_phy *pi, u16 *values_to_save)
{}

static bool wlc_lcnphy_iqcal_wait(struct brcms_phy *pi)
{}

static void
wlc_lcnphy_tx_iqlo_loopback_cleanup(struct brcms_phy *pi, u16 *values_to_save)
{}

static void
wlc_lcnphy_tx_iqlo_cal(struct brcms_phy *pi,
		       struct lcnphy_txgains *target_gains,
		       enum lcnphy_cal_mode cal_mode, bool keep_tone)
{}

static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
{}

static void wlc_lcnphy_vbat_temp_sense_setup(struct brcms_phy *pi, u8 mode)
{}

static void wlc_lcnphy_tx_pwr_ctrl_init(struct brcms_phy_pub *ppi)
{}

static void wlc_lcnphy_set_pa_gain(struct brcms_phy *pi, u16 gain)
{}

void
wlc_lcnphy_get_radio_loft(struct brcms_phy *pi,
			  u8 *ei0, u8 *eq0, u8 *fi0, u8 *fq0)
{}

void wlc_lcnphy_set_tx_iqcc(struct brcms_phy *pi, u16 a, u16 b)
{}

void wlc_lcnphy_set_tx_locc(struct brcms_phy *pi, u16 didq)
{}

void wlc_lcnphy_set_tx_pwr_by_index(struct brcms_phy *pi, int index)
{}

static void wlc_lcnphy_clear_papd_comptable(struct brcms_phy *pi)
{}

void wlc_lcnphy_tx_pu(struct brcms_phy *pi, bool bEnable)
{}

static void
wlc_lcnphy_run_samples(struct brcms_phy *pi,
		       u16 num_samps,
		       u16 num_loops, u16 wait, bool iqcalmode)
{}

void wlc_lcnphy_deaf_mode(struct brcms_phy *pi, bool mode)
{}

void
wlc_lcnphy_start_tx_tone(struct brcms_phy *pi, s32 f_kHz, u16 max_val,
			 bool iqcalmode)
{}

void wlc_lcnphy_stop_tx_tone(struct brcms_phy *pi)
{}

static void
wlc_lcnphy_set_cc(struct brcms_phy *pi, int cal_type, s16 coeff_x, s16 coeff_y)
{}

static struct lcnphy_unsign16_struct
wlc_lcnphy_get_cc(struct brcms_phy *pi, int cal_type)
{}

static void
wlc_lcnphy_samp_cap(struct brcms_phy *pi, int clip_detect_algo, u16 thresh,
		    s16 *ptr, int mode)
{}

static void
wlc_lcnphy_a1(struct brcms_phy *pi, int cal_type, int num_levels,
	      int step_size_lg2)
{}

void wlc_lcnphy_get_tx_iqcc(struct brcms_phy *pi, u16 *a, u16 *b)
{}

static void wlc_lcnphy_tx_iqlo_soft_cal_full(struct brcms_phy *pi)
{}

u16 wlc_lcnphy_get_tx_locc(struct brcms_phy *pi)
{}

static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi)
{}

s16 wlc_lcnphy_tempsense_new(struct brcms_phy *pi, bool mode)
{}

u16 wlc_lcnphy_tempsense(struct brcms_phy *pi, bool mode)
{}

s8 wlc_lcnphy_tempsense_degree(struct brcms_phy *pi, bool mode)
{}

s8 wlc_lcnphy_vbatsense(struct brcms_phy *pi, bool mode)
{}

static void wlc_lcnphy_afe_clk_init(struct brcms_phy *pi, u8 mode)
{}

static void wlc_lcnphy_temp_adj(struct brcms_phy *pi)
{}

static void wlc_lcnphy_glacial_timer_based_cal(struct brcms_phy *pi)
{}

static void wlc_lcnphy_periodic_cal(struct brcms_phy *pi)
{}

void wlc_lcnphy_calib_modes(struct brcms_phy *pi, uint mode)
{}

void wlc_lcnphy_get_tssi(struct brcms_phy *pi, s8 *ofdm_pwr, s8 *cck_pwr)
{}

void wlc_phy_cal_init_lcnphy(struct brcms_phy *pi)
{}

void wlc_lcnphy_tx_power_adjustment(struct brcms_phy_pub *ppi)
{}

static void
wlc_lcnphy_load_tx_gain_table(struct brcms_phy *pi,
			      const struct lcnphy_tx_gain_tbl_entry *gain_table)
{}

static void wlc_lcnphy_load_rfpower(struct brcms_phy *pi)
{}

static void wlc_lcnphy_bu_tweaks(struct brcms_phy *pi)
{}

static void wlc_lcnphy_rcal(struct brcms_phy *pi)
{}

static void wlc_lcnphy_rc_cal(struct brcms_phy *pi)
{}

static void wlc_radio_2064_init(struct brcms_phy *pi)
{}

static void wlc_lcnphy_radio_init(struct brcms_phy *pi)
{}

static void wlc_lcnphy_tbl_init(struct brcms_phy *pi)
{}

static void wlc_lcnphy_rev0_baseband_init(struct brcms_phy *pi)
{}

static void wlc_lcnphy_rev2_baseband_init(struct brcms_phy *pi)
{}

static void wlc_lcnphy_agc_temp_init(struct brcms_phy *pi)
{}

static void wlc_lcnphy_baseband_init(struct brcms_phy *pi)
{}

void wlc_phy_init_lcnphy(struct brcms_phy *pi)
{}

static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
{}

void wlc_2064_vco_cal(struct brcms_phy *pi)
{}

bool wlc_phy_tpc_isenabled_lcnphy(struct brcms_phy *pi)
{}

void wlc_phy_txpower_recalc_target_lcnphy(struct brcms_phy *pi)
{}

void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec)
{}

void wlc_phy_detach_lcnphy(struct brcms_phy *pi)
{}

bool wlc_phy_attach_lcnphy(struct brcms_phy *pi)
{}

static void wlc_lcnphy_set_rx_gain(struct brcms_phy *pi, u32 gain)
{}

static u32 wlc_lcnphy_get_receive_power(struct brcms_phy *pi, s32 *gain_index)
{}

s32 wlc_lcnphy_rx_signal_power(struct brcms_phy *pi, s32 gain_index)
{}