xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8821cs/include/Hal8814PhyCfg.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 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_HAL8814PHYCFG_H__
17 #define __INC_HAL8814PHYCFG_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 
28 #ifdef CONFIG_PCI_HCI
29 	#define MAX_AGGR_NUM	0x0B
30 #else
31 	#define MAX_AGGR_NUM	0x07
32 #endif /* CONFIG_PCI_HCI */
33 
34 
35 /*--------------------------Define Parameters-------------------------------*/
36 
37 /*------------------------------Define structure----------------------------*/
38 
39 
40 /* BB/RF related */
41 
42 #define	SIC_ENABLE				0
43 
44 /*------------------------------Define structure----------------------------*/
45 
46 
47 /*------------------------Export global variable----------------------------*/
48 /*------------------------Export global variable----------------------------*/
49 
50 
51 /*------------------------Export Marco Definition---------------------------*/
52 /*------------------------Export Marco Definition---------------------------*/
53 
54 
55 /*--------------------------Exported Function prototype---------------------*/
56 /* 1. BB register R/W API */
57 
58 extern	u32
59 PHY_QueryBBReg8814A(PADAPTER	Adapter,
60 			u32		RegAddr,
61 			u32		BitMask);
62 
63 
64 void
65 PHY_SetBBReg8814A(PADAPTER	Adapter,
66 			u32		RegAddr,
67 			u32		BitMask,
68 			u32		Data);
69 
70 
71 extern	u32
72 PHY_QueryRFReg8814A(PADAPTER			Adapter,
73 			enum rf_path	eRFPath,
74 			u32			RegAddr,
75 			u32			BitMask);
76 
77 
78 void
79 PHY_SetRFReg8814A(PADAPTER			Adapter,
80 			enum rf_path		eRFPath,
81 			u32				RegAddr,
82 			u32				BitMask,
83 			u32				Data);
84 
85 /* 1 3. Initial BB/RF config by reading MAC/BB/RF txt. */
86 s32
87 phy_BB8814A_Config_ParaFile(
88 		PADAPTER	Adapter
89 );
90 
91 void
92 PHY_ConfigBB_8814A(
93 		PADAPTER	Adapter
94 );
95 
96 
97 void
98 phy_ADC_CLK_8814A(
99 		PADAPTER	Adapter
100 );
101 
102 s32
103 PHY_RFConfig8814A(
104 		PADAPTER	Adapter
105 );
106 
107 /*
108  * RF Power setting
109  *
110  * BOOLEAN	PHY_SetRFPowerState8814A(PADAPTER Adapter, rt_rf_power_state	eRFPowerState); */
111 
112 /* 1 5. Tx  Power setting API */
113 
114 void
115 PHY_SetTxPowerLevel8814(
116 		PADAPTER		Adapter,
117 		u8			Channel
118 );
119 
120 u8
121 phy_get_tx_power_index_8814a(
122 		PADAPTER		Adapter,
123 		enum rf_path		RFPath,
124 		u8				Rate,
125 		enum channel_width BandWidth,
126 		u8				Channel
127 );
128 
129 void
130 PHY_SetTxPowerIndex_8814A(
131 		PADAPTER		Adapter,
132 		u32				PowerIndex,
133 		enum rf_path		RFPath,
134 		u8				Rate
135 );
136 
137 u32
138 PHY_GetTxBBSwing_8814A(
139 		PADAPTER	Adapter,
140 		BAND_TYPE	Band,
141 		enum rf_path	RFPath
142 );
143 
144 
145 
146 /* 1 6. Channel setting API */
147 #if 0
148 void
149 PHY_SwChnlTimerCallback8814A(
150 		struct timer_list		*p_timer
151 );
152 #endif
153 void
154 PHY_SwChnlWorkItemCallback8814A(
155 		void *pContext
156 );
157 
158 
159 void
160 HAL_HandleSwChnl8814A(
161 		PADAPTER	pAdapter,
162 		u8		channel
163 );
164 
165 void
166 PHY_SwChnlSynchronously8814A(PADAPTER		pAdapter,
167 				u8			channel);
168 
169 void
170 PHY_HandleSwChnlAndSetBW8814A(
171 		PADAPTER			Adapter,
172 		BOOLEAN				bSwitchChannel,
173 		BOOLEAN				bSetBandWidth,
174 		u8					ChannelNum,
175 		enum channel_width	ChnlWidth,
176 		u8					ChnlOffsetOf40MHz,
177 		u8					ChnlOffsetOf80MHz,
178 		u8					CenterFrequencyIndex1
179 );
180 
181 
182 BOOLEAN
183 PHY_QueryRFPathSwitch_8814A(PADAPTER	pAdapter);
184 
185 
186 
187 #if (USE_WORKITEM)
188 void
189 RtCheckForHangWorkItemCallback8814A(
190 		void *pContext
191 );
192 #endif
193 
194 BOOLEAN
195 SetAntennaConfig8814A(
196 		PADAPTER	Adapter,
197 		u8		DefaultAnt
198 );
199 
200 void
201 PHY_SetRFEReg8814A(
202 		PADAPTER		Adapter,
203 		BOOLEAN		bInit,
204 		u8		Band
205 );
206 
207 
208 s32
209 PHY_SwitchWirelessBand8814A(
210 		PADAPTER		 Adapter,
211 		u8		Band
212 );
213 
214 void
215 PHY_SetIO_8814A(
216 	PADAPTER		pAdapter
217 );
218 
219 void
220 PHY_SetSwChnlBWMode8814(
221 		PADAPTER			Adapter,
222 		u8					channel,
223 		enum channel_width	Bandwidth,
224 		u8					Offset40,
225 		u8					Offset80
226 );
227 
228 s32 PHY_MACConfig8814(PADAPTER Adapter);
229 int PHY_BBConfig8814(PADAPTER	Adapter);
230 void PHY_Set_SecCCATH_by_RXANT_8814A(PADAPTER	pAdapter, u32 ulAntennaRx);
231 
232 
233 
234 /*--------------------------Exported Function prototype---------------------*/
235 
236 /*--------------------------Exported Function prototype---------------------*/
237 #endif /* __INC_HAL8192CPHYCFG_H */
238