xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8189es/hal/btc/HalBtc8192e1Ant.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 //===========================================
3 // The following is for 8192E 1ANT BT Co-exist definition
4 //===========================================
5 #define	BT_AUTO_REPORT_ONLY_8192E_1ANT				1
6 
7 #define	BT_INFO_8192E_1ANT_B_FTP						BIT7
8 #define	BT_INFO_8192E_1ANT_B_A2DP					BIT6
9 #define	BT_INFO_8192E_1ANT_B_HID						BIT5
10 #define	BT_INFO_8192E_1ANT_B_SCO_BUSY				BIT4
11 #define	BT_INFO_8192E_1ANT_B_ACL_BUSY				BIT3
12 #define	BT_INFO_8192E_1ANT_B_INQ_PAGE				BIT2
13 #define	BT_INFO_8192E_1ANT_B_SCO_ESCO				BIT1
14 #define	BT_INFO_8192E_1ANT_B_CONNECTION				BIT0
15 
16 #define	BT_INFO_8192E_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_)	\
17 		(((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
18 
19 #define	BTC_RSSI_COEX_THRESH_TOL_8192E_1ANT		2
20 
21 #define  BT_8192E_1ANT_WIFI_NOISY_THRESH								30   //max: 255
22 
23 typedef enum _BT_INFO_SRC_8192E_1ANT{
24 	BT_INFO_SRC_8192E_1ANT_WIFI_FW			= 0x0,
25 	BT_INFO_SRC_8192E_1ANT_BT_RSP				= 0x1,
26 	BT_INFO_SRC_8192E_1ANT_BT_ACTIVE_SEND		= 0x2,
27 	BT_INFO_SRC_8192E_1ANT_MAX
28 }BT_INFO_SRC_8192E_1ANT,*PBT_INFO_SRC_8192E_1ANT;
29 
30 typedef enum _BT_8192E_1ANT_BT_STATUS{
31 	BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE	= 0x0,
32 	BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE		= 0x1,
33 	BT_8192E_1ANT_BT_STATUS_INQ_PAGE				= 0x2,
34 	BT_8192E_1ANT_BT_STATUS_ACL_BUSY				= 0x3,
35 	BT_8192E_1ANT_BT_STATUS_SCO_BUSY				= 0x4,
36 	BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY			= 0x5,
37 	BT_8192E_1ANT_BT_STATUS_MAX
38 }BT_8192E_1ANT_BT_STATUS,*PBT_8192E_1ANT_BT_STATUS;
39 
40 typedef enum _BT_8192E_1ANT_WIFI_STATUS{
41 	BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE				= 0x0,
42 	BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN		= 0x1,
43 	BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN					= 0x2,
44 	BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT				= 0x3,
45 	BT_8192E_1ANT_WIFI_STATUS_CONNECTED_IDLE					= 0x4,
46 	BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY					= 0x5,
47 	BT_8192E_1ANT_WIFI_STATUS_MAX
48 }BT_8192E_1ANT_WIFI_STATUS,*PBT_8192E_1ANT_WIFI_STATUS;
49 
50 typedef enum _BT_8192E_1ANT_COEX_ALGO{
51 	BT_8192E_1ANT_COEX_ALGO_UNDEFINED			= 0x0,
52 	BT_8192E_1ANT_COEX_ALGO_SCO				= 0x1,
53 	BT_8192E_1ANT_COEX_ALGO_HID				= 0x2,
54 	BT_8192E_1ANT_COEX_ALGO_A2DP				= 0x3,
55 	BT_8192E_1ANT_COEX_ALGO_A2DP_PANHS		= 0x4,
56 	BT_8192E_1ANT_COEX_ALGO_PANEDR			= 0x5,
57 	BT_8192E_1ANT_COEX_ALGO_PANHS			= 0x6,
58 	BT_8192E_1ANT_COEX_ALGO_PANEDR_A2DP		= 0x7,
59 	BT_8192E_1ANT_COEX_ALGO_PANEDR_HID		= 0x8,
60 	BT_8192E_1ANT_COEX_ALGO_HID_A2DP_PANEDR	= 0x9,
61 	BT_8192E_1ANT_COEX_ALGO_HID_A2DP			= 0xa,
62 	BT_8192E_1ANT_COEX_ALGO_MAX				= 0xb,
63 }BT_8192E_1ANT_COEX_ALGO,*PBT_8192E_1ANT_COEX_ALGO;
64 
65 typedef struct _COEX_DM_8192E_1ANT{
66 	// fw mechanism
67 	BOOLEAN		bCurIgnoreWlanAct;
68 	BOOLEAN		bPreIgnoreWlanAct;
69 	u1Byte		prePsTdma;
70 	u1Byte		curPsTdma;
71 	u1Byte		psTdmaPara[5];
72 	u1Byte		psTdmaDuAdjType;
73 	BOOLEAN		bAutoTdmaAdjust;
74 	BOOLEAN		bPrePsTdmaOn;
75 	BOOLEAN		bCurPsTdmaOn;
76 	BOOLEAN		bPreBtAutoReport;
77 	BOOLEAN		bCurBtAutoReport;
78 	u1Byte		preLps;
79 	u1Byte		curLps;
80 	u1Byte		preRpwm;
81 	u1Byte		curRpwm;
82 
83 	// sw mechanism
84 	BOOLEAN 	bPreLowPenaltyRa;
85 	BOOLEAN		bCurLowPenaltyRa;
86 	u4Byte		preVal0x6c0;
87 	u4Byte		curVal0x6c0;
88 	u4Byte		preVal0x6c4;
89 	u4Byte		curVal0x6c4;
90 	u4Byte		preVal0x6c8;
91 	u4Byte		curVal0x6c8;
92 	u1Byte		preVal0x6cc;
93 	u1Byte		curVal0x6cc;
94 	BOOLEAN		bLimitedDig;
95 
96 	u4Byte		backupArfrCnt1;	// Auto Rate Fallback Retry cnt
97 	u4Byte		backupArfrCnt2;	// Auto Rate Fallback Retry cnt
98 	u2Byte		backupRetryLimit;
99 	u1Byte		backupAmpduMaxTime;
100 
101 	// algorithm related
102 	u1Byte		preAlgorithm;
103 	u1Byte		curAlgorithm;
104 	u1Byte		btStatus;
105 	u1Byte		wifiChnlInfo[3];
106 
107 	u4Byte		preRaMask;
108 	u4Byte		curRaMask;
109 	u1Byte		preArfrType;
110 	u1Byte		curArfrType;
111 	u1Byte		preRetryLimitType;
112 	u1Byte		curRetryLimitType;
113 	u1Byte		preAmpduTimeType;
114 	u1Byte		curAmpduTimeType;
115 	u4Byte		nArpCnt;
116 
117 	u1Byte		errorCondition;
118 } COEX_DM_8192E_1ANT, *PCOEX_DM_8192E_1ANT;
119 
120 typedef struct _COEX_STA_8192E_1ANT{
121 	BOOLEAN					bBtLinkExist;
122 	BOOLEAN					bScoExist;
123 	BOOLEAN					bA2dpExist;
124 	BOOLEAN					bHidExist;
125 	BOOLEAN					bPanExist;
126 
127 	BOOLEAN					bUnderLps;
128 	BOOLEAN					bUnderIps;
129 	u4Byte					specialPktPeriodCnt;
130 	u4Byte					highPriorityTx;
131 	u4Byte					highPriorityRx;
132 	u4Byte					lowPriorityTx;
133 	u4Byte					lowPriorityRx;
134 	s1Byte					btRssi;
135 	BOOLEAN					bBtTxRxMask;
136 	u1Byte					preBtRssiState;
137 	u1Byte					preWifiRssiState[4];
138 	BOOLEAN					bC2hBtInfoReqSent;
139 	u1Byte					btInfoC2h[BT_INFO_SRC_8192E_1ANT_MAX][10];
140 	u4Byte					btInfoC2hCnt[BT_INFO_SRC_8192E_1ANT_MAX];
141 	BOOLEAN					bC2hBtInquiryPage;
142 	BOOLEAN					bC2hBtPage;				//Add for win8.1 page out issue
143 	BOOLEAN					bWiFiIsHighPriTask;		//Add for win8.1 page out issue
144 	u1Byte					btRetryCnt;
145 	u1Byte					btInfoExt;
146 	u4Byte					popEventCnt;
147 	u1Byte					nScanAPNum;
148 
149 	u4Byte					nCRCOK_CCK;
150 	u4Byte					nCRCOK_11g;
151 	u4Byte					nCRCOK_11n;
152 	u4Byte					nCRCOK_11nAgg;
153 
154 	u4Byte					nCRCErr_CCK;
155 	u4Byte					nCRCErr_11g;
156 	u4Byte					nCRCErr_11n;
157 	u4Byte					nCRCErr_11nAgg;
158 
159 	BOOLEAN					bCCKLock;
160 	BOOLEAN					bPreCCKLock;
161 	u1Byte					nCoexTableType;
162 
163 	BOOLEAN					bForceLpsOn;
164 }COEX_STA_8192E_1ANT, *PCOEX_STA_8192E_1ANT;
165 
166 //===========================================
167 // The following is interface which will notify coex module.
168 //===========================================
169 VOID
170 EXhalbtc8192e1ant_PowerOnSetting(
171 	IN	PBTC_COEXIST		pBtCoexist
172 	);
173 VOID
174 EXhalbtc8192e1ant_PreLoadFirmware(
175 	IN	PBTC_COEXIST		pBtCoexist
176 	);
177 VOID
178 EXhalbtc8192e1ant_InitHwConfig(
179 	IN	PBTC_COEXIST		pBtCoexist,
180 	IN	BOOLEAN				bWifiOnly
181 	);
182 VOID
183 EXhalbtc8192e1ant_InitCoexDm(
184 	IN	PBTC_COEXIST		pBtCoexist
185 	);
186 VOID
187 EXhalbtc8192e1ant_IpsNotify(
188 	IN	PBTC_COEXIST		pBtCoexist,
189 	IN	u1Byte			type
190 	);
191 VOID
192 EXhalbtc8192e1ant_LpsNotify(
193 	IN	PBTC_COEXIST		pBtCoexist,
194 	IN	u1Byte			type
195 	);
196 VOID
197 EXhalbtc8192e1ant_ScanNotify(
198 	IN	PBTC_COEXIST		pBtCoexist,
199 	IN	u1Byte			type
200 	);
201 VOID
202 EXhalbtc8192e1ant_ConnectNotify(
203 	IN	PBTC_COEXIST		pBtCoexist,
204 	IN	u1Byte			type
205 	);
206 VOID
207 EXhalbtc8192e1ant_MediaStatusNotify(
208 	IN	PBTC_COEXIST			pBtCoexist,
209 	IN	u1Byte				type
210 	);
211 VOID
212 EXhalbtc8192e1ant_SpecialPacketNotify(
213 	IN	PBTC_COEXIST			pBtCoexist,
214 	IN	u1Byte				type
215 	);
216 VOID
217 EXhalbtc8192e1ant_BtInfoNotify(
218 	IN	PBTC_COEXIST		pBtCoexist,
219 	IN	pu1Byte			tmpBuf,
220 	IN	u1Byte			length
221 	);
222 VOID
223 EXhalbtc8192e1ant_RfStatusNotify(
224 	IN	PBTC_COEXIST			pBtCoexist,
225 	IN	u1Byte					type
226 	);
227 VOID
228 EXhalbtc8192e1ant_HaltNotify(
229 	IN	PBTC_COEXIST			pBtCoexist
230 	);
231 VOID
232 EXhalbtc8192e1ant_PnpNotify(
233 	IN	PBTC_COEXIST			pBtCoexist,
234 	IN	u1Byte				pnpState
235 	);
236 VOID
237 EXhalbtc8192e1ant_CoexDmReset(
238 	IN	PBTC_COEXIST			pBtCoexist
239 	);
240 VOID
241 EXhalbtc8192e1ant_Periodical(
242 	IN	PBTC_COEXIST			pBtCoexist
243 	);
244 VOID
245 EXhalbtc8192e1ant_DisplayCoexInfo(
246 	IN	PBTC_COEXIST		pBtCoexist
247 	);
248 VOID
249 EXhalbtc8192e1ant_DbgControl(
250 	IN	PBTC_COEXIST			pBtCoexist,
251 	IN	u1Byte				opCode,
252 	IN	u1Byte				opLen,
253 	IN	pu1Byte 			pData
254 	);
255 
256