xref: /linux/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.h (revision eed4edda910fe34dfae8c6bfbcf57f4593a54295)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2009-2014  Realtek Corporation.*/
3 
4 #ifndef __PHY_COMMON__
5 #define __PHY_COMMON__
6 
7 #define RT_CANNOT_IO(hw)			false
8 
9 enum swchnlcmd_id {
10 	CMDID_END,
11 	CMDID_SET_TXPOWEROWER_LEVEL,
12 	CMDID_BBREGWRITE10,
13 	CMDID_WRITEPORT_ULONG,
14 	CMDID_WRITEPORT_USHORT,
15 	CMDID_WRITEPORT_UCHAR,
16 	CMDID_RF_WRITEREG,
17 };
18 
19 struct swchnlcmd {
20 	enum swchnlcmd_id cmdid;
21 	u32 para1;
22 	u32 para2;
23 	u32 msdelay;
24 };
25 
26 u32 rtl8723_phy_query_bb_reg(struct ieee80211_hw *hw,
27 			     u32 regaddr, u32 bitmask);
28 void rtl8723_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr,
29 			      u32 bitmask, u32 data);
30 u32 rtl8723_phy_rf_serial_read(struct ieee80211_hw *hw,
31 			       enum radio_path rfpath, u32 offset);
32 void rtl8723_phy_rf_serial_write(struct ieee80211_hw *hw,
33 				 enum radio_path rfpath,
34 				 u32 offset, u32 data);
35 long rtl8723_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
36 				  enum wireless_mode wirelessmode,
37 				  u8 txpwridx);
38 void rtl8723_phy_init_bb_rf_reg_def(struct ieee80211_hw *hw);
39 bool rtl8723_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable,
40 				      u32 cmdtableidx,
41 				      u32 cmdtablesz,
42 				      enum swchnlcmd_id cmdid,
43 				      u32 para1, u32 para2,
44 				      u32 msdelay);
45 void rtl8723_phy_path_a_fill_iqk_matrix(struct ieee80211_hw *hw,
46 					bool iqk_ok,
47 					long result[][8],
48 					u8 final_candidate,
49 					bool btxonly);
50 void rtl8723_save_adda_registers(struct ieee80211_hw *hw, u32 *addareg,
51 				 u32 *addabackup, u32 registernum);
52 void rtl8723_phy_save_mac_registers(struct ieee80211_hw *hw,
53 				    u32 *macreg, u32 *macbackup);
54 void rtl8723_phy_reload_adda_registers(struct ieee80211_hw *hw,
55 				       u32 *addareg, u32 *addabackup,
56 				       u32 regiesternum);
57 void rtl8723_phy_reload_mac_registers(struct ieee80211_hw *hw,
58 				      u32 *macreg, u32 *macbackup);
59 void rtl8723_phy_path_adda_on(struct ieee80211_hw *hw, u32 *addareg,
60 			      bool is_patha_on, bool is2t);
61 void rtl8723_phy_mac_setting_calibration(struct ieee80211_hw *hw,
62 					 u32 *macreg, u32 *macbackup);
63 void rtl8723_phy_path_a_standby(struct ieee80211_hw *hw);
64 void rtl8723_phy_pi_mode_switch(struct ieee80211_hw *hw, bool pi_mode);
65 
66 #endif
67