xref: /linux/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2009-2012  Realtek Corporation.*/
3 
4 #ifndef __RTL92D_PHY_H__
5 #define __RTL92D_PHY_H__
6 
7 #define MAX_PRECMD_CNT				16
8 #define MAX_RFDEPENDCMD_CNT			16
9 #define MAX_POSTCMD_CNT				16
10 
11 #define MAX_DOZE_WAITING_TIMES_9x		64
12 
13 #define HIGHPOWER_RADIOA_ARRAYLEN		22
14 
15 #define	APK_BB_REG_NUM				5
16 #define	APK_AFE_REG_NUM				16
17 #define	APK_CURVE_REG_NUM			4
18 #define	PATH_NUM				2
19 
20 #define LOOP_LIMIT				5
21 #define MAX_STALL_TIME				50
22 #define ANTENNA_DIVERSITY_VALUE			0x80
23 #define MAX_TXPWR_IDX_NMODE_92S			63
24 #define RESET_CNT_LIMIT				3
25 
26 #define IQK_ADDA_REG_NUM			16
27 #define IQK_BB_REG_NUM_test			6
28 #define IQK_MAC_REG_NUM				4
29 
30 #define CT_OFFSET_MAC_ADDR			0X16
31 
32 #define CT_OFFSET_CCK_TX_PWR_IDX		0x5A
33 #define CT_OFFSET_HT401S_TX_PWR_IDX		0x60
34 #define CT_OFFSET_HT402S_TX_PWR_IDX_DIFF	0x66
35 #define CT_OFFSET_HT20_TX_PWR_IDX_DIFF		0x69
36 #define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF		0x6C
37 
38 #define CT_OFFSET_HT40_MAX_PWR_OFFSET		0x6F
39 #define CT_OFFSET_HT20_MAX_PWR_OFFSET		0x72
40 
41 #define CT_OFFSET_CHANNEL_PLAH			0x75
42 #define CT_OFFSET_THERMAL_METER			0x78
43 #define CT_OFFSET_RF_OPTION			0x79
44 #define CT_OFFSET_VERSION			0x7E
45 #define CT_OFFSET_CUSTOMER_ID			0x7F
46 
47 enum swchnlcmd_id {
48 	CMDID_END,
49 	CMDID_SET_TXPOWEROWER_LEVEL,
50 	CMDID_BBREGWRITE10,
51 	CMDID_WRITEPORT_ULONG,
52 	CMDID_WRITEPORT_USHORT,
53 	CMDID_WRITEPORT_UCHAR,
54 	CMDID_RF_WRITEREG,
55 };
56 
57 struct swchnlcmd {
58 	enum swchnlcmd_id cmdid;
59 	u32 para1;
60 	u32 para2;
61 	u32 msdelay;
62 };
63 
64 u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw,
65 			    u32 regaddr, u32 bitmask);
66 void rtl92d_phy_set_bb_reg(struct ieee80211_hw *hw,
67 			   u32 regaddr, u32 bitmask, u32 data);
68 bool rtl92d_phy_mac_config(struct ieee80211_hw *hw);
69 bool rtl92d_phy_bb_config(struct ieee80211_hw *hw);
70 bool rtl92d_phy_rf_config(struct ieee80211_hw *hw);
71 bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw,
72 					  enum radio_path rfpath);
73 void rtl92d_phy_set_bw_mode(struct ieee80211_hw *hw,
74 			    enum nl80211_channel_type ch_type);
75 u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw);
76 bool rtl92d_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
77 					  enum rf_content content,
78 					  enum radio_path rfpath);
79 bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw,
80 				   enum rf_pwrstate rfpwr_state);
81 
82 void rtl92d_phy_set_poweron(struct ieee80211_hw *hw);
83 bool rtl92d_phy_check_poweroff(struct ieee80211_hw *hw);
84 void rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t);
85 void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw);
86 void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
87 void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw);
88 void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel);
89 
90 #endif
91