xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8189es/hal/btc/HalBtc8812a1Ant.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 //===========================================
3 // The following is for 8812A 1ANT BT Co-exist definition
4 //===========================================
5 #define	BT_AUTO_REPORT_ONLY_8812A_1ANT				1
6 
7 #define	BT_INFO_8812A_1ANT_B_FTP						BIT7
8 #define	BT_INFO_8812A_1ANT_B_A2DP					BIT6
9 #define	BT_INFO_8812A_1ANT_B_HID						BIT5
10 #define	BT_INFO_8812A_1ANT_B_SCO_BUSY				BIT4
11 #define	BT_INFO_8812A_1ANT_B_ACL_BUSY				BIT3
12 #define	BT_INFO_8812A_1ANT_B_INQ_PAGE				BIT2
13 #define	BT_INFO_8812A_1ANT_B_SCO_ESCO				BIT1
14 #define	BT_INFO_8812A_1ANT_B_CONNECTION				BIT0
15 
16 #define	BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_)	\
17 		(((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
18 
19 #define	BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT		2
20 
21 #define  BT_8812A_1ANT_WIFI_NOISY_THRESH								30   //max: 255
22 
23 typedef enum _BT_INFO_SRC_8812A_1ANT{
24 	BT_INFO_SRC_8812A_1ANT_WIFI_FW			= 0x0,
25 	BT_INFO_SRC_8812A_1ANT_BT_RSP				= 0x1,
26 	BT_INFO_SRC_8812A_1ANT_BT_ACTIVE_SEND		= 0x2,
27 	BT_INFO_SRC_8812A_1ANT_MAX
28 }BT_INFO_SRC_8812A_1ANT,*PBT_INFO_SRC_8812A_1ANT;
29 
30 typedef enum _BT_8812A_1ANT_BT_STATUS{
31 	BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE	= 0x0,
32 	BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE		= 0x1,
33 	BT_8812A_1ANT_BT_STATUS_INQ_PAGE				= 0x2,
34 	BT_8812A_1ANT_BT_STATUS_ACL_BUSY				= 0x3,
35 	BT_8812A_1ANT_BT_STATUS_SCO_BUSY				= 0x4,
36 	BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY			= 0x5,
37 	BT_8812A_1ANT_BT_STATUS_MAX
38 }BT_8812A_1ANT_BT_STATUS,*PBT_8812A_1ANT_BT_STATUS;
39 
40 typedef enum _BT_8812A_1ANT_WIFI_STATUS{
41 	BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE				= 0x0,
42 	BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN		= 0x1,
43 	BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN					= 0x2,
44 	BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT				= 0x3,
45 	BT_8812A_1ANT_WIFI_STATUS_CONNECTED_IDLE					= 0x4,
46 	BT_8812A_1ANT_WIFI_STATUS_CONNECTED_BUSY					= 0x5,
47 	BT_8812A_1ANT_WIFI_STATUS_MAX
48 }BT_8812A_1ANT_WIFI_STATUS,*PBT_8812A_1ANT_WIFI_STATUS;
49 
50 typedef enum _BT_8812A_1ANT_COEX_ALGO{
51 	BT_8812A_1ANT_COEX_ALGO_UNDEFINED			= 0x0,
52 	BT_8812A_1ANT_COEX_ALGO_SCO				= 0x1,
53 	BT_8812A_1ANT_COEX_ALGO_HID				= 0x2,
54 	BT_8812A_1ANT_COEX_ALGO_A2DP				= 0x3,
55 	BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS		= 0x4,
56 	BT_8812A_1ANT_COEX_ALGO_PANEDR			= 0x5,
57 	BT_8812A_1ANT_COEX_ALGO_PANHS			= 0x6,
58 	BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP		= 0x7,
59 	BT_8812A_1ANT_COEX_ALGO_PANEDR_HID		= 0x8,
60 	BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR	= 0x9,
61 	BT_8812A_1ANT_COEX_ALGO_HID_A2DP			= 0xa,
62 	BT_8812A_1ANT_COEX_ALGO_MAX				= 0xb,
63 }BT_8812A_1ANT_COEX_ALGO,*PBT_8812A_1ANT_COEX_ALGO;
64 
65 typedef struct _COEX_DM_8812A_1ANT{
66 	// hw setting
67 	u1Byte		preAntPosType;
68 	u1Byte		curAntPosType;
69 	// fw mechanism
70 	BOOLEAN		bCurIgnoreWlanAct;
71 	BOOLEAN		bPreIgnoreWlanAct;
72 	u1Byte		prePsTdma;
73 	u1Byte		curPsTdma;
74 	u1Byte		psTdmaPara[5];
75 	u1Byte		psTdmaDuAdjType;
76 	BOOLEAN		bAutoTdmaAdjust;
77 	BOOLEAN		bPrePsTdmaOn;
78 	BOOLEAN		bCurPsTdmaOn;
79 	BOOLEAN		bPreBtAutoReport;
80 	BOOLEAN		bCurBtAutoReport;
81 	u1Byte		preLps;
82 	u1Byte		curLps;
83 	u1Byte		preRpwm;
84 	u1Byte		curRpwm;
85 
86 	// sw mechanism
87 	BOOLEAN 	bPreLowPenaltyRa;
88 	BOOLEAN		bCurLowPenaltyRa;
89 	u4Byte		preVal0x6c0;
90 	u4Byte		curVal0x6c0;
91 	u4Byte		preVal0x6c4;
92 	u4Byte		curVal0x6c4;
93 	u4Byte		preVal0x6c8;
94 	u4Byte		curVal0x6c8;
95 	u1Byte		preVal0x6cc;
96 	u1Byte		curVal0x6cc;
97 	BOOLEAN		bLimitedDig;
98 
99 	u4Byte		backupArfrCnt1;	// Auto Rate Fallback Retry cnt
100 	u4Byte		backupArfrCnt2;	// Auto Rate Fallback Retry cnt
101 	u2Byte		backupRetryLimit;
102 	u1Byte		backupAmpduMaxTime;
103 
104 	// algorithm related
105 	u1Byte		preAlgorithm;
106 	u1Byte		curAlgorithm;
107 	u1Byte		btStatus;
108 	u1Byte		wifiChnlInfo[3];
109 
110 	u4Byte		preRaMask;
111 	u4Byte		curRaMask;
112 	u1Byte		preArfrType;
113 	u1Byte		curArfrType;
114 	u1Byte		preRetryLimitType;
115 	u1Byte		curRetryLimitType;
116 	u1Byte		preAmpduTimeType;
117 	u1Byte		curAmpduTimeType;
118 	u4Byte		nArpCnt;
119 
120 	u1Byte		errorCondition;
121 } COEX_DM_8812A_1ANT, *PCOEX_DM_8812A_1ANT;
122 
123 typedef struct _COEX_STA_8812A_1ANT{
124 	BOOLEAN					bBtLinkExist;
125 	BOOLEAN					bScoExist;
126 	BOOLEAN					bA2dpExist;
127 	BOOLEAN					bHidExist;
128 	BOOLEAN					bPanExist;
129 
130 	BOOLEAN					bUnderLps;
131 	BOOLEAN					bUnderIps;
132 	u4Byte					specialPktPeriodCnt;
133 	u4Byte					highPriorityTx;
134 	u4Byte					highPriorityRx;
135 	u4Byte					lowPriorityTx;
136 	u4Byte					lowPriorityRx;
137 	s1Byte					btRssi;
138 	BOOLEAN					bBtTxRxMask;
139 	u1Byte					preBtRssiState;
140 	u1Byte					preWifiRssiState[4];
141 	BOOLEAN					bC2hBtInfoReqSent;
142 	u1Byte					btInfoC2h[BT_INFO_SRC_8812A_1ANT_MAX][10];
143 	u4Byte					btInfoC2hCnt[BT_INFO_SRC_8812A_1ANT_MAX];
144 	u4Byte					btInfoQueryCnt;
145 	BOOLEAN					bC2hBtInquiryPage;
146 	BOOLEAN					bC2hBtPage;				//Add for win8.1 page out issue
147 	BOOLEAN					bWiFiIsHighPriTask;		//Add for win8.1 page out issue
148 	u1Byte					btRetryCnt;
149 	u1Byte					btInfoExt;
150 	u4Byte					popEventCnt;
151 	u1Byte					nScanAPNum;
152 
153 	u4Byte					nCRCOK_CCK;
154 	u4Byte					nCRCOK_11g;
155 	u4Byte					nCRCOK_11n;
156 	u4Byte					nCRCOK_11nAgg;
157 
158 	u4Byte					nCRCErr_CCK;
159 	u4Byte					nCRCErr_11g;
160 	u4Byte					nCRCErr_11n;
161 	u4Byte					nCRCErr_11nAgg;
162 
163 	BOOLEAN					bCCKLock;
164 	BOOLEAN					bPreCCKLock;
165 	u1Byte					nCoexTableType;
166 
167 	BOOLEAN					bForceLpsOn;
168 }COEX_STA_8812A_1ANT, *PCOEX_STA_8812A_1ANT;
169 
170 //===========================================
171 // The following is interface which will notify coex module.
172 //===========================================
173 VOID
174 EXhalbtc8812a1ant_PowerOnSetting(
175 	IN	PBTC_COEXIST		pBtCoexist
176 	);
177 VOID
178 EXhalbtc8812a1ant_PreLoadFirmware(
179 	IN	PBTC_COEXIST		pBtCoexist
180 	);
181 VOID
182 EXhalbtc8812a1ant_InitHwConfig(
183 	IN	PBTC_COEXIST		pBtCoexist,
184 	IN	BOOLEAN				bWifiOnly
185 	);
186 VOID
187 EXhalbtc8812a1ant_InitCoexDm(
188 	IN	PBTC_COEXIST		pBtCoexist
189 	);
190 VOID
191 EXhalbtc8812a1ant_IpsNotify(
192 	IN	PBTC_COEXIST		pBtCoexist,
193 	IN	u1Byte			type
194 	);
195 VOID
196 EXhalbtc8812a1ant_LpsNotify(
197 	IN	PBTC_COEXIST		pBtCoexist,
198 	IN	u1Byte			type
199 	);
200 VOID
201 EXhalbtc8812a1ant_ScanNotify(
202 	IN	PBTC_COEXIST		pBtCoexist,
203 	IN	u1Byte			type
204 	);
205 VOID
206 EXhalbtc8812a1ant_ConnectNotify(
207 	IN	PBTC_COEXIST		pBtCoexist,
208 	IN	u1Byte			type
209 	);
210 VOID
211 EXhalbtc8812a1ant_MediaStatusNotify(
212 	IN	PBTC_COEXIST			pBtCoexist,
213 	IN	u1Byte				type
214 	);
215 VOID
216 EXhalbtc8812a1ant_SpecialPacketNotify(
217 	IN	PBTC_COEXIST			pBtCoexist,
218 	IN	u1Byte				type
219 	);
220 VOID
221 EXhalbtc8812a1ant_BtInfoNotify(
222 	IN	PBTC_COEXIST		pBtCoexist,
223 	IN	pu1Byte			tmpBuf,
224 	IN	u1Byte			length
225 	);
226 VOID
227 EXhalbtc8812a1ant_RfStatusNotify(
228 	IN	PBTC_COEXIST			pBtCoexist,
229 	IN	u1Byte					type
230 	);
231 VOID
232 EXhalbtc8812a1ant_HaltNotify(
233 	IN	PBTC_COEXIST			pBtCoexist
234 	);
235 VOID
236 EXhalbtc8812a1ant_PnpNotify(
237 	IN	PBTC_COEXIST			pBtCoexist,
238 	IN	u1Byte				pnpState
239 	);
240 VOID
241 EXhalbtc8812a1ant_CoexDmReset(
242 	IN	PBTC_COEXIST			pBtCoexist
243 	);
244 VOID
245 EXhalbtc8812a1ant_Periodical(
246 	IN	PBTC_COEXIST			pBtCoexist
247 	);
248 VOID
249 EXhalbtc8812a1ant_DbgControl(
250 	IN	PBTC_COEXIST			pBtCoexist,
251 	IN	u1Byte				opCode,
252 	IN	u1Byte				opLen,
253 	IN	pu1Byte				pData
254 	);
255 VOID
256 EXhalbtc8812a1ant_DisplayCoexInfo(
257 	IN	PBTC_COEXIST		pBtCoexist
258 	);
259 
260