162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Copyright(c) 2009-2012  Realtek Corporation.*/
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef __RTL92C_PHY_H__
562306a36Sopenharmony_ci#define __RTL92C_PHY_H__
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#define MAX_PRECMD_CNT			16
862306a36Sopenharmony_ci#define MAX_RFDEPENDCMD_CNT		16
962306a36Sopenharmony_ci#define MAX_POSTCMD_CNT			16
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define MAX_DOZE_WAITING_TIMES_9x	64
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#define RT_CANNOT_IO(hw)		false
1462306a36Sopenharmony_ci#define HIGHPOWER_RADIOA_ARRAYLEN	22
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define MAX_TOLERANCE			5
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define	APK_BB_REG_NUM			5
1962306a36Sopenharmony_ci#define	APK_AFE_REG_NUM			16
2062306a36Sopenharmony_ci#define	APK_CURVE_REG_NUM		4
2162306a36Sopenharmony_ci#define	PATH_NUM			2
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci#define LOOP_LIMIT			5
2462306a36Sopenharmony_ci#define MAX_STALL_TIME			50
2562306a36Sopenharmony_ci#define ANTENNADIVERSITYVALUE		0x80
2662306a36Sopenharmony_ci#define MAX_TXPWR_IDX_NMODE_92S		63
2762306a36Sopenharmony_ci#define RESET_CNT_LIMIT			3
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#define IQK_ADDA_REG_NUM		16
3062306a36Sopenharmony_ci#define IQK_MAC_REG_NUM			4
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define IQK_DELAY_TIME			1
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define RF90_PATH_MAX			2
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci#define CT_OFFSET_MAC_ADDR		0X16
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define CT_OFFSET_CCK_TX_PWR_IDX	0x5A
3962306a36Sopenharmony_ci#define CT_OFFSET_HT401S_TX_PWR_IDX	0x60
4062306a36Sopenharmony_ci#define CT_OFFSET_HT402S_TX_PWR_IDX_DIF	0x66
4162306a36Sopenharmony_ci#define CT_OFFSET_HT20_TX_PWR_IDX_DIFF	0x69
4262306a36Sopenharmony_ci#define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF	0x6C
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define CT_OFFSET_HT40_MAX_PWR_OFFSET	0x6F
4562306a36Sopenharmony_ci#define CT_OFFSET_HT20_MAX_PWR_OFFSET	0x72
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define CT_OFFSET_CHANNEL_PLAH		0x75
4862306a36Sopenharmony_ci#define CT_OFFSET_THERMAL_METER		0x78
4962306a36Sopenharmony_ci#define CT_OFFSET_RF_OPTION		0x79
5062306a36Sopenharmony_ci#define CT_OFFSET_VERSION		0x7E
5162306a36Sopenharmony_ci#define CT_OFFSET_CUSTOMER_ID		0x7F
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci#define RTL92C_MAX_PATH_NUM		2
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_cibool rtl92c_phy_bb_config(struct ieee80211_hw *hw);
5662306a36Sopenharmony_ciu32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask);
5762306a36Sopenharmony_civoid rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask,
5862306a36Sopenharmony_ci			   u32 data);
5962306a36Sopenharmony_ciu32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
6062306a36Sopenharmony_ci			    u32 regaddr, u32 bitmask);
6162306a36Sopenharmony_civoid rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
6262306a36Sopenharmony_ci			    u32 regaddr, u32 bitmask, u32 data);
6362306a36Sopenharmony_cibool rtl92c_phy_mac_config(struct ieee80211_hw *hw);
6462306a36Sopenharmony_cibool rtl92ce_phy_bb_config(struct ieee80211_hw *hw);
6562306a36Sopenharmony_cibool rtl92c_phy_rf_config(struct ieee80211_hw *hw);
6662306a36Sopenharmony_cibool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw,
6762306a36Sopenharmony_ci					  enum radio_path rfpath);
6862306a36Sopenharmony_civoid rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw);
6962306a36Sopenharmony_civoid rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel);
7062306a36Sopenharmony_civoid rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel);
7162306a36Sopenharmony_cibool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw,
7262306a36Sopenharmony_ci					  long power_indbm);
7362306a36Sopenharmony_civoid rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
7462306a36Sopenharmony_ci			    enum nl80211_channel_type ch_type);
7562306a36Sopenharmony_civoid rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw);
7662306a36Sopenharmony_ciu8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw);
7762306a36Sopenharmony_civoid rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
7862306a36Sopenharmony_civoid rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, u16 beaconinterval);
7962306a36Sopenharmony_civoid rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
8062306a36Sopenharmony_civoid rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw);
8162306a36Sopenharmony_civoid _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t);
8262306a36Sopenharmony_civoid rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
8362306a36Sopenharmony_cibool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
8462306a36Sopenharmony_ci					  enum radio_path rfpath);
8562306a36Sopenharmony_cibool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw,
8662306a36Sopenharmony_ci				       u32 rfpath);
8762306a36Sopenharmony_cibool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
8862306a36Sopenharmony_ci				    enum rf_pwrstate rfpwr_state);
8962306a36Sopenharmony_civoid rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw);
9062306a36Sopenharmony_cibool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
9162306a36Sopenharmony_civoid rtl92c_phy_set_io(struct ieee80211_hw *hw);
9262306a36Sopenharmony_civoid rtl92c_bb_block_on(struct ieee80211_hw *hw);
9362306a36Sopenharmony_ciu32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, enum radio_path rfpath,
9462306a36Sopenharmony_ci			       u32 offset);
9562306a36Sopenharmony_ciu32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw,
9662306a36Sopenharmony_ci				  enum radio_path rfpath, u32 offset);
9762306a36Sopenharmony_civoid _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
9862306a36Sopenharmony_ci				 enum radio_path rfpath, u32 offset, u32 data);
9962306a36Sopenharmony_civoid _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,
10062306a36Sopenharmony_ci				    enum radio_path rfpath, u32 offset,
10162306a36Sopenharmony_ci				    u32 data);
10262306a36Sopenharmony_civoid _rtl92c_store_pwrindex_diffrate_offset(struct ieee80211_hw *hw,
10362306a36Sopenharmony_ci					    u32 regaddr, u32 bitmask, u32 data);
10462306a36Sopenharmony_cibool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
10562306a36Sopenharmony_civoid _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw);
10662306a36Sopenharmony_cibool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw);
10762306a36Sopenharmony_civoid _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw);
10862306a36Sopenharmony_cibool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw,
10962306a36Sopenharmony_ci				   enum rf_pwrstate rfpwr_state);
11062306a36Sopenharmony_cibool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
11162306a36Sopenharmony_ci					    u8 configtype);
11262306a36Sopenharmony_cibool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
11362306a36Sopenharmony_ci					      u8 configtype);
11462306a36Sopenharmony_civoid rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci#endif
117