162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Copyright(c) 2009-2014  Realtek Corporation.*/
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef __RTL8723BE_PHY_H__
562306a36Sopenharmony_ci#define __RTL8723BE_PHY_H__
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci/* MAX_TX_COUNT must always set to 4, otherwise read efuse table sequence
862306a36Sopenharmony_ci * will be wrong.
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci#define MAX_TX_COUNT		4
1162306a36Sopenharmony_ci#define	TX_1S			0
1262306a36Sopenharmony_ci#define	TX_2S			1
1362306a36Sopenharmony_ci#define	TX_3S			2
1462306a36Sopenharmony_ci#define	TX_4S			3
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define	MAX_POWER_INDEX		0x3F
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define MAX_PRECMD_CNT			16
1962306a36Sopenharmony_ci#define MAX_RFDEPENDCMD_CNT		16
2062306a36Sopenharmony_ci#define MAX_POSTCMD_CNT			16
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define MAX_DOZE_WAITING_TIMES_9x	64
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#define RT_CANNOT_IO(hw)		false
2562306a36Sopenharmony_ci#define HIGHPOWER_RADIOA_ARRAYLEN	22
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define TARGET_CHNL_NUM_2G_5G		59
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#define IQK_ADDA_REG_NUM		16
3062306a36Sopenharmony_ci#define IQK_BB_REG_NUM			9
3162306a36Sopenharmony_ci#define MAX_TOLERANCE			5
3262306a36Sopenharmony_ci#define	IQK_DELAY_TIME			10
3362306a36Sopenharmony_ci#define	index_mapping_NUM		15
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#define	APK_BB_REG_NUM			5
3662306a36Sopenharmony_ci#define	APK_AFE_REG_NUM			16
3762306a36Sopenharmony_ci#define	APK_CURVE_REG_NUM		4
3862306a36Sopenharmony_ci#define	PATH_NUM			1
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define LOOP_LIMIT			5
4162306a36Sopenharmony_ci#define MAX_STALL_TIME			50
4262306a36Sopenharmony_ci#define ANTENNADIVERSITYVALUE		0x80
4362306a36Sopenharmony_ci#define MAX_TXPWR_IDX_NMODE_92S		63
4462306a36Sopenharmony_ci#define RESET_CNT_LIMIT			3
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#define IQK_ADDA_REG_NUM		16
4762306a36Sopenharmony_ci#define IQK_MAC_REG_NUM			4
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci#define RF6052_MAX_PATH			2
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#define CT_OFFSET_MAC_ADDR		0X16
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci#define CT_OFFSET_CCK_TX_PWR_IDX		0x5A
5462306a36Sopenharmony_ci#define CT_OFFSET_HT401S_TX_PWR_IDX		0x60
5562306a36Sopenharmony_ci#define CT_OFFSET_HT402S_TX_PWR_IDX_DIFF	0x66
5662306a36Sopenharmony_ci#define CT_OFFSET_HT20_TX_PWR_IDX_DIFF		0x69
5762306a36Sopenharmony_ci#define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF		0x6C
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci#define CT_OFFSET_HT40_MAX_PWR_OFFSET		0x6F
6062306a36Sopenharmony_ci#define CT_OFFSET_HT20_MAX_PWR_OFFSET		0x72
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci#define CT_OFFSET_CHANNEL_PLAH			0x75
6362306a36Sopenharmony_ci#define CT_OFFSET_THERMAL_METER			0x78
6462306a36Sopenharmony_ci#define CT_OFFSET_RF_OPTION			0x79
6562306a36Sopenharmony_ci#define CT_OFFSET_VERSION			0x7E
6662306a36Sopenharmony_ci#define CT_OFFSET_CUSTOMER_ID			0x7F
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#define RTL92C_MAX_PATH_NUM			2
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_cienum baseband_config_type {
7162306a36Sopenharmony_ci	BASEBAND_CONFIG_PHY_REG = 0,
7262306a36Sopenharmony_ci	BASEBAND_CONFIG_AGC_TAB = 1,
7362306a36Sopenharmony_ci};
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_cienum ant_div_type {
7662306a36Sopenharmony_ci	NO_ANTDIV		= 0xFF,
7762306a36Sopenharmony_ci	CG_TRX_HW_ANTDIV	= 0x01,
7862306a36Sopenharmony_ci	CGCS_RX_HW_ANTDIV	= 0x02,
7962306a36Sopenharmony_ci	FIXED_HW_ANTDIV         = 0x03,
8062306a36Sopenharmony_ci	CG_TRX_SMART_ANTDIV	= 0x04,
8162306a36Sopenharmony_ci	CGCS_RX_SW_ANTDIV	= 0x05,
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci};
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ciu32 rtl8723be_phy_query_rf_reg(struct ieee80211_hw *hw,
8662306a36Sopenharmony_ci			       enum radio_path rfpath,
8762306a36Sopenharmony_ci			       u32 regaddr, u32 bitmask);
8862306a36Sopenharmony_civoid rtl8723be_phy_set_rf_reg(struct ieee80211_hw *hw,
8962306a36Sopenharmony_ci			      enum radio_path rfpath,
9062306a36Sopenharmony_ci			      u32 regaddr, u32 bitmask, u32 data);
9162306a36Sopenharmony_cibool rtl8723be_phy_mac_config(struct ieee80211_hw *hw);
9262306a36Sopenharmony_cibool rtl8723be_phy_bb_config(struct ieee80211_hw *hw);
9362306a36Sopenharmony_cibool rtl8723be_phy_rf_config(struct ieee80211_hw *hw);
9462306a36Sopenharmony_civoid rtl8723be_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw);
9562306a36Sopenharmony_civoid rtl8723be_phy_set_txpower_level(struct ieee80211_hw *hw,
9662306a36Sopenharmony_ci				     u8 channel);
9762306a36Sopenharmony_civoid rtl8723be_phy_scan_operation_backup(struct ieee80211_hw *hw,
9862306a36Sopenharmony_ci					 u8 operation);
9962306a36Sopenharmony_civoid rtl8723be_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
10062306a36Sopenharmony_civoid rtl8723be_phy_set_bw_mode(struct ieee80211_hw *hw,
10162306a36Sopenharmony_ci			       enum nl80211_channel_type ch_type);
10262306a36Sopenharmony_civoid rtl8723be_phy_sw_chnl_callback(struct ieee80211_hw *hw);
10362306a36Sopenharmony_ciu8 rtl8723be_phy_sw_chnl(struct ieee80211_hw *hw);
10462306a36Sopenharmony_civoid rtl8723be_phy_iq_calibrate(struct ieee80211_hw *hw,
10562306a36Sopenharmony_ci				bool b_recovery);
10662306a36Sopenharmony_civoid rtl8723be_phy_lc_calibrate(struct ieee80211_hw *hw);
10762306a36Sopenharmony_civoid rtl8723be_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
10862306a36Sopenharmony_cibool rtl8723be_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
10962306a36Sopenharmony_ci					     enum radio_path rfpath);
11062306a36Sopenharmony_cibool rtl8723be_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
11162306a36Sopenharmony_cibool rtl8723be_phy_set_rf_power_state(struct ieee80211_hw *hw,
11262306a36Sopenharmony_ci				      enum rf_pwrstate rfpwr_state);
11362306a36Sopenharmony_ci#endif
114