1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2009-2012  Realtek Corporation.*/
3 
4 #ifndef __RTL92S_PHY_H__
5 #define __RTL92S_PHY_H__
6 
7 #define MAX_TXPWR_IDX_NMODE_92S		63
8 #define MAX_DOZE_WAITING_TIMES_9x	64
9 
10 /* Channel switch:The size of
11  * command tables for switch channel */
12 #define MAX_PRECMD_CNT			16
13 #define MAX_RFDEPENDCMD_CNT		16
14 #define MAX_POSTCMD_CNT			16
15 
16 #define RF90_PATH_MAX			4
17 #define RF6052_MAX_PATH			2
18 
19 enum version_8192s {
20 	VERSION_8192S_ACUT,
21 	VERSION_8192S_BCUT,
22 	VERSION_8192S_CCUT
23 };
24 
25 enum swchnlcmd_id {
26 	CMDID_END,
27 	CMDID_SET_TXPOWEROWER_LEVEL,
28 	CMDID_BBREGWRITE10,
29 	CMDID_WRITEPORT_ULONG,
30 	CMDID_WRITEPORT_USHORT,
31 	CMDID_WRITEPORT_UCHAR,
32 	CMDID_RF_WRITEREG,
33 };
34 
35 struct swchnlcmd {
36 	enum swchnlcmd_id cmdid;
37 	u32 para1;
38 	u32 para2;
39 	u32 msdelay;
40 };
41 
42 enum baseband_config_type {
43 	/* Radio Path A */
44 	BASEBAND_CONFIG_PHY_REG = 0,
45 	/* Radio Path B */
46 	BASEBAND_CONFIG_AGC_TAB = 1,
47 };
48 
49 #define hal_get_firmwareversion(rtlpriv) \
50 	(((struct rt_firmware *)(rtlpriv->rtlhal.pfirmware))->firmwareversion)
51 
52 u32 rtl92s_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask);
53 void rtl92s_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask,
54 			   u32 data);
55 void rtl92s_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation);
56 u32 rtl92s_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
57 			    u32 regaddr, u32 bitmask);
58 void rtl92s_phy_set_rf_reg(struct ieee80211_hw *hw,	enum radio_path rfpath,
59 			   u32 regaddr, u32 bitmask, u32 data);
60 void rtl92s_phy_set_bw_mode(struct ieee80211_hw *hw,
61 			    enum nl80211_channel_type ch_type);
62 u8 rtl92s_phy_sw_chnl(struct ieee80211_hw *hw);
63 bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw,
64 				   enum rf_pwrstate rfpower_state);
65 bool rtl92s_phy_mac_config(struct ieee80211_hw *hw);
66 void rtl92s_phy_switch_ephy_parameter(struct ieee80211_hw *hw);
67 bool rtl92s_phy_bb_config(struct ieee80211_hw *hw);
68 bool rtl92s_phy_rf_config(struct ieee80211_hw *hw);
69 void rtl92s_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw);
70 void rtl92s_phy_set_txpower(struct ieee80211_hw *hw, u8	channel);
71 bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fwcmd_io);
72 void rtl92s_phy_chk_fwcmd_iodone(struct ieee80211_hw *hw);
73 void rtl92s_phy_set_beacon_hwreg(struct ieee80211_hw *hw, u16 beaconinterval);
74 u8 rtl92s_phy_config_rf(struct ieee80211_hw *hw, enum radio_path rfpath) ;
75 
76 #endif
77 
78