xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8189fs/include/Hal8192EPhyCfg.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2012 - 2017 Realtek Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  *****************************************************************************/
16 #ifndef __INC_HAL8192EPHYCFG_H__
17 #define __INC_HAL8192EPHYCFG_H__
18 
19 
20 /*--------------------------Define Parameters-------------------------------*/
21 #define LOOP_LIMIT				5
22 #define MAX_STALL_TIME			50		/* us */
23 #define AntennaDiversityValue	0x80	/* (Adapter->bSoftwareAntennaDiversity ? 0x00 : 0x80) */
24 #define MAX_TXPWR_IDX_NMODE_92S	63
25 #define Reset_Cnt_Limit			3
26 
27 #ifdef CONFIG_PCI_HCI
28 	#define MAX_AGGR_NUM	0x0B
29 #else
30 	#define MAX_AGGR_NUM	0x07
31 #endif /* CONFIG_PCI_HCI */
32 
33 
34 /*--------------------------Define Parameters-------------------------------*/
35 
36 /*------------------------------Define structure----------------------------*/
37 
38 /* BB/RF related */
39 
40 /*------------------------------Define structure----------------------------*/
41 
42 
43 /*------------------------Export global variable----------------------------*/
44 /*------------------------Export global variable----------------------------*/
45 
46 
47 /*------------------------Export Marco Definition---------------------------*/
48 /*------------------------Export Marco Definition---------------------------*/
49 
50 
51 /*--------------------------Exported Function prototype---------------------*/
52 /*
53  * BB and RF register read/write
54  *   */
55 u32	PHY_QueryBBReg8192E(PADAPTER	Adapter,
56 				u32			RegAddr,
57 				u32			BitMask);
58 void	PHY_SetBBReg8192E(PADAPTER		Adapter,
59 				u32			RegAddr,
60 				u32			BitMask,
61 				u32			Data);
62 u32	PHY_QueryRFReg8192E(PADAPTER	Adapter,
63 				enum rf_path	eRFPath,
64 				u32			RegAddr,
65 				u32			BitMask);
66 void	PHY_SetRFReg8192E(PADAPTER		Adapter,
67 				enum rf_path	eRFPath,
68 				u32			RegAddr,
69 				u32			BitMask,
70 				u32			Data);
71 
72 /*
73  * Initialization related function
74  *
75  * MAC/BB/RF HAL config */
76 int	PHY_MACConfig8192E(PADAPTER	Adapter);
77 int	PHY_BBConfig8192E(PADAPTER	Adapter);
78 int	PHY_RFConfig8192E(PADAPTER	Adapter);
79 
80 /* RF config */
81 
82 
83 /*
84  * BB TX Power R/W
85  *   */
86 void	PHY_SetTxPowerLevel8192E(PADAPTER	Adapter, u8	channel);
87 
88 void
89 PHY_SetTxPowerIndex_8192E(
90 		PADAPTER			Adapter,
91 		u32					PowerIndex,
92 		enum rf_path			RFPath,
93 		u8					Rate
94 );
95 
96 u8
97 PHY_GetTxPowerIndex_8192E(
98 		PADAPTER			pAdapter,
99 		enum rf_path			RFPath,
100 		u8					Rate,
101 		u8					BandWidth,
102 		u8					Channel,
103 	struct txpwr_idx_comp *tic
104 );
105 
106 /*
107  * channel switch related funciton
108  *   */
109 void
110 PHY_SetSwChnlBWMode8192E(
111 		PADAPTER			Adapter,
112 		u8					channel,
113 		enum channel_width	Bandwidth,
114 		u8					Offset40,
115 		u8					Offset80
116 );
117 
118 void
119 PHY_SetRFEReg_8192E(
120 		PADAPTER		Adapter
121 );
122 
123 void
124 phy_SpurCalibration_8192E(
125 		PADAPTER			Adapter,
126 		enum spur_cal_method	method
127 );
128 void PHY_SpurCalibration_8192E( PADAPTER Adapter);
129 
130 #ifdef CONFIG_SPUR_CAL_NBI
131 void
132 phy_SpurCalibration_8192E_NBI(
133 		PADAPTER			Adapter
134 );
135 #endif
136 /*
137  * BB/MAC/RF other monitor API
138  *   */
139 
140 void
141 phy_set_rf_path_switch_8192e(
142 		struct dm_struct		*phydm,
143 		bool		bMain
144 );
145 
146 /*--------------------------Exported Function prototype---------------------*/
147 #endif /* __INC_HAL8192CPHYCFG_H */
148