linux/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c

// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2009-2010  Realtek Corporation.*/

#include "../wifi.h"
#include "../pci.h"
#include "../ps.h"
#include "reg.h"
#include "def.h"
#include "phy.h"
#include "rf.h"
#include "dm.h"
#include "table.h"
#include "trx.h"
#include "../btcoexist/halbt_precomp.h"
#include "hw.h"
#include "../efuse.h"

#define READ_NEXT_PAIR(array_table, v1, v2, i)

static u32 _rtl8821ae_phy_rf_serial_read(struct ieee80211_hw *hw,
					 enum radio_path rfpath, u32 offset);
static void _rtl8821ae_phy_rf_serial_write(struct ieee80211_hw *hw,
					   enum radio_path rfpath, u32 offset,
					   u32 data);
static bool _rtl8821ae_phy_bb8821a_config_parafile(struct ieee80211_hw *hw);
/*static bool _rtl8812ae_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);*/
static bool _rtl8821ae_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
static bool _rtl8821ae_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
						     u8 configtype);
static bool _rtl8821ae_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
						       u8 configtype);
static void phy_init_bb_rf_register_definition(struct ieee80211_hw *hw);

static long _rtl8821ae_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
					    enum wireless_mode wirelessmode,
					    u8 txpwridx);
static void rtl8821ae_phy_set_rf_on(struct ieee80211_hw *hw);
static void rtl8821ae_phy_set_io(struct ieee80211_hw *hw);

static void rtl8812ae_fixspur(struct ieee80211_hw *hw,
			      enum ht_channel_width band_width, u8 channel)
{}

u32 rtl8821ae_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr,
			       u32 bitmask)
{}

void rtl8821ae_phy_set_bb_reg(struct ieee80211_hw *hw,
			      u32 regaddr, u32 bitmask, u32 data)
{}

u32 rtl8821ae_phy_query_rf_reg(struct ieee80211_hw *hw,
			       enum radio_path rfpath, u32 regaddr,
			       u32 bitmask)
{}

void rtl8821ae_phy_set_rf_reg(struct ieee80211_hw *hw,
			   enum radio_path rfpath,
			   u32 regaddr, u32 bitmask, u32 data)
{}

static u32 _rtl8821ae_phy_rf_serial_read(struct ieee80211_hw *hw,
					 enum radio_path rfpath, u32 offset)
{}

static void _rtl8821ae_phy_rf_serial_write(struct ieee80211_hw *hw,
					   enum radio_path rfpath, u32 offset,
					   u32 data)
{}

bool rtl8821ae_phy_mac_config(struct ieee80211_hw *hw)
{}

bool rtl8821ae_phy_bb_config(struct ieee80211_hw *hw)
{}

bool rtl8821ae_phy_rf_config(struct ieee80211_hw *hw)
{}

static void _rtl8812ae_phy_set_rfe_reg_24g(struct ieee80211_hw *hw)
{}

static void _rtl8812ae_phy_set_rfe_reg_5g(struct ieee80211_hw *hw)
{}

u32 phy_get_tx_swing_8812A(struct ieee80211_hw *hw, u8	band,
			   u8 rf_path)
{}

void rtl8821ae_phy_switch_wirelessband(struct ieee80211_hw *hw, u8 band)
{}

static bool _rtl8821ae_check_positive(struct ieee80211_hw *hw,
				      const u32 condition1,
				      const u32 condition2)
{}

static bool _rtl8821ae_check_condition(struct ieee80211_hw *hw,
				       const u32 condition)
{}

static void _rtl8821ae_config_rf_reg(struct ieee80211_hw *hw,
				     u32 addr, u32 data,
				     enum radio_path rfpath, u32 regaddr)
{}

static void _rtl8821ae_config_rf_radio_a(struct ieee80211_hw *hw,
					 u32 addr, u32 data)
{}

static void _rtl8821ae_config_rf_radio_b(struct ieee80211_hw *hw,
					 u32 addr, u32 data)
{}

static void _rtl8821ae_config_bb_reg(struct ieee80211_hw *hw,
				     u32 addr, u32 data)
{}

static void _rtl8821ae_phy_init_tx_power_by_rate(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_phy_set_txpower_by_rate_base(struct ieee80211_hw *hw,
					  u8 band, u8 path,
					  u8 rate_section,
					  u8 txnum, u8 value)
{}

static u8 _rtl8821ae_phy_get_txpower_by_rate_base(struct ieee80211_hw *hw,
						  u8 band, u8 path,
						  u8 txnum, u8 rate_section)
{}

static void _rtl8821ae_phy_store_txpower_by_rate_base(struct ieee80211_hw *hw)
{}

static void _phy_convert_txpower_dbm_to_relative_value(u32 *data, u8 start,
						u8 end, u8 base_val)
{}

static void _rtl8812ae_phy_cross_reference_ht_and_vht_txpower_limit(struct ieee80211_hw *hw)
{}

static u8 _rtl8812ae_phy_get_txpower_by_rate_base_index(struct ieee80211_hw *hw,
						   enum band_type band, u8 rate)
{}

static void _rtl8812ae_phy_convert_txpower_limit_to_power_index(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_phy_init_txpower_limit(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_phy_convert_txpower_dbm_to_relative_value(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_phy_txpower_by_rate_configuration(struct ieee80211_hw *hw)
{}

/* string is in decimal */
static bool _rtl8812ae_get_integer_from_string(const char *str, u8 *pint)
{}

static s8 _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt(struct ieee80211_hw *hw,
					      u8 band, u8 channel)
{}

static void _rtl8812ae_phy_set_txpower_limit(struct ieee80211_hw *hw,
				      const char *pregulation,
				      const char *pband, const char *pbandwidth,
				      const char *prate_section, const char *prf_path,
				      const char *pchannel, const char *ppower_limit)
{}

static void _rtl8812ae_phy_config_bb_txpwr_lmt(struct ieee80211_hw *hw,
					  const char *regulation, const char *band,
					  const char *bandwidth, const char *rate_section,
					  const char *rf_path, const char *channel,
					  const char *power_limit)
{}

static void _rtl8821ae_phy_read_and_config_txpwr_lmt(struct ieee80211_hw *hw)
{}

static bool _rtl8821ae_phy_bb8821a_config_parafile(struct ieee80211_hw *hw)
{}

static bool
__rtl8821ae_phy_config_with_headerfile(struct ieee80211_hw *hw,
				       u32 *array_table, u16 arraylen,
				       void (*set_reg)(struct ieee80211_hw *hw,
						       u32 regaddr, u32 data))
{}

static bool _rtl8821ae_phy_config_mac_with_headerfile(struct ieee80211_hw *hw)
{}

static bool _rtl8821ae_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
						     u8 configtype)
{}

static u8 _rtl8821ae_get_rate_section_index(u32 regaddr)
{}

static void _rtl8821ae_store_tx_power_by_rate(struct ieee80211_hw *hw,
					      u32 band, u32 rfpath,
					      u32 txnum, u32 regaddr,
					      u32 bitmask, u32 data)
{}

static bool _rtl8821ae_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
							u8 configtype)
{}

bool rtl8812ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
					     enum radio_path rfpath)
{}

bool rtl8821ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
						enum radio_path rfpath)
{}

void rtl8821ae_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw)
{}

static void phy_init_bb_rf_register_definition(struct ieee80211_hw *hw)
{}

void rtl8821ae_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel)
{}

static bool _rtl8821ae_phy_get_chnl_index(u8 channel, u8 *chnl_index)
{}

static s8 _rtl8821ae_phy_get_ratesection_intxpower_byrate(u8 path, u8 rate)
{}

static s8 _rtl8812ae_phy_get_world_wide_limit(s8  *limit_table)
{}

static s8 _rtl8812ae_phy_get_txpower_limit(struct ieee80211_hw *hw,
					     u8 band,
					     enum ht_channel_width bandwidth,
					     enum radio_path rf_path,
					     u8 rate, u8 channel)
{}

static s8 _rtl8821ae_phy_get_txpower_by_rate(struct ieee80211_hw *hw,
					u8 band, u8 path, u8 rate)
{}

static u8 _rtl8821ae_get_txpower_index(struct ieee80211_hw *hw, u8 path,
					u8 rate, u8 bandwidth, u8 channel)
{}

static void _rtl8821ae_phy_set_txpower_index(struct ieee80211_hw *hw,
					     u8 power_index, u8 path, u8 rate)
{}

static void _rtl8821ae_phy_set_txpower_level_by_path(struct ieee80211_hw *hw,
						     u8 *array, u8 path,
						     u8 channel, u8 size)
{}

static void _rtl8821ae_phy_txpower_training_by_path(struct ieee80211_hw *hw,
						    u8 bw, u8 channel, u8 path)
{}

void rtl8821ae_phy_set_txpower_level_by_path(struct ieee80211_hw *hw,
					     u8 channel, u8 path)
{}

/*just in case, write txpower in DW, to reduce time*/
void rtl8821ae_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel)
{}

static long _rtl8821ae_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
					    enum wireless_mode wirelessmode,
					    u8 txpwridx)
{}

void rtl8821ae_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
{}

static void _rtl8821ae_phy_set_reg_bw(struct rtl_priv *rtlpriv, u8 bw)
{}

static u8 _rtl8821ae_phy_get_secondary_chnl(struct rtl_priv *rtlpriv)
{}

void rtl8821ae_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
{}

void rtl8821ae_phy_set_bw_mode(struct ieee80211_hw *hw,
			    enum nl80211_channel_type ch_type)
{}

void rtl8821ae_phy_sw_chnl_callback(struct ieee80211_hw *hw)
{}

u8 rtl8821ae_phy_sw_chnl(struct ieee80211_hw *hw)
{}

u8 _rtl8812ae_get_right_chnl_place_for_iqk(u8 chnl)
{}

#define MACBB_REG_NUM
#define AFE_REG_NUM
#define RF_REG_NUM

static void _rtl8821ae_iqk_backup_macbb(struct ieee80211_hw *hw,
					u32 *macbb_backup,
					u32 *backup_macbb_reg, u32 mac_bb_num)
{}

static void _rtl8821ae_iqk_backup_afe(struct ieee80211_hw *hw, u32 *afe_backup,
				      u32 *backup_afe_REG, u32 afe_num)
{}

static void _rtl8821ae_iqk_backup_rf(struct ieee80211_hw *hw, u32 *rfa_backup,
				     u32 *rfb_backup, u32 *backup_rf_reg,
				     u32 rf_num)
{}

static void _rtl8821ae_iqk_configure_mac(
		struct ieee80211_hw *hw
		)
{}

static void _rtl8821ae_iqk_tx_fill_iqc(struct ieee80211_hw *hw,
				       enum radio_path path, u32 tx_x, u32 tx_y)
{}

static void _rtl8821ae_iqk_rx_fill_iqc(struct ieee80211_hw *hw,
				       enum radio_path path, u32 rx_x, u32 rx_y)
{}

#define cal_num

static void _rtl8821ae_iqk_tx(struct ieee80211_hw *hw, enum radio_path path)
{}

static void _rtl8821ae_iqk_restore_rf(struct ieee80211_hw *hw,
				      enum radio_path path,
				      u32 *backup_rf_reg,
				      u32 *rf_backup, u32 rf_reg_num)
{}

static void _rtl8821ae_iqk_restore_afe(struct ieee80211_hw *hw,
				       u32 *afe_backup, u32 *backup_afe_reg,
				       u32 afe_num)
{}

static void _rtl8821ae_iqk_restore_macbb(struct ieee80211_hw *hw,
					 u32 *macbb_backup,
					 u32 *backup_macbb_reg,
					 u32 macbb_num)
{}

#undef MACBB_REG_NUM
#undef AFE_REG_NUM
#undef RF_REG_NUM

#define MACBB_REG_NUM
#define AFE_REG_NUM
#define RF_REG_NUM

static void _rtl8821ae_phy_iq_calibrate(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool main)
{}

#undef IQK_ADDA_REG_NUM
#undef IQK_DELAY_TIME

void rtl8812ae_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery)
{}

void rtl8812ae_do_iqk(struct ieee80211_hw *hw, u8 delta_thermal_index,
		      u8 thermal_value, u8 threshold)
{}

void rtl8821ae_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery)
{}

void rtl8821ae_reset_iqk_result(struct ieee80211_hw *hw)
{}

void rtl8821ae_do_iqk(struct ieee80211_hw *hw, u8 delta_thermal_index,
		      u8 thermal_value, u8 threshold)
{}

void rtl8821ae_phy_lc_calibrate(struct ieee80211_hw *hw)
{}

void rtl8821ae_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta)
{}

void rtl8821ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain)
{}

bool rtl8821ae_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype)
{}

static void rtl8821ae_phy_set_io(struct ieee80211_hw *hw)
{}

static void rtl8821ae_phy_set_rf_on(struct ieee80211_hw *hw)
{}

static bool _rtl8821ae_phy_set_rf_power_state(struct ieee80211_hw *hw,
					      enum rf_pwrstate rfpwr_state)
{}

bool rtl8821ae_phy_set_rf_power_state(struct ieee80211_hw *hw,
				      enum rf_pwrstate rfpwr_state)
{}