xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8189es/hal/btc/HalBtc8812a2Ant.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 //===========================================
3 // The following is for 8812A 2Ant BT Co-exist definition
4 //===========================================
5 #define	BT_AUTO_REPORT_ONLY_8812A_2ANT				0
6 
7 #define	BT_INFO_8812A_2ANT_B_FTP						BIT7
8 #define	BT_INFO_8812A_2ANT_B_A2DP					BIT6
9 #define	BT_INFO_8812A_2ANT_B_HID						BIT5
10 #define	BT_INFO_8812A_2ANT_B_SCO_BUSY				BIT4
11 #define	BT_INFO_8812A_2ANT_B_ACL_BUSY				BIT3
12 #define	BT_INFO_8812A_2ANT_B_INQ_PAGE				BIT2
13 #define	BT_INFO_8812A_2ANT_B_SCO_ESCO				BIT1
14 #define	BT_INFO_8812A_2ANT_B_CONNECTION				BIT0
15 
16 #define	BT_INFO_8812A_2ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_)	\
17 		(((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
18 
19 #define		BTC_RSSI_COEX_THRESH_TOL_8812A_2ANT		2
20 #define 	NOISY_AP_NUM_THRESH_8812A						50
21 
22 
23 typedef enum _BT_INFO_SRC_8812A_2ANT{
24 	BT_INFO_SRC_8812A_2ANT_WIFI_FW			= 0x0,
25 	BT_INFO_SRC_8812A_2ANT_BT_RSP				= 0x1,
26 	BT_INFO_SRC_8812A_2ANT_BT_ACTIVE_SEND		= 0x2,
27 	BT_INFO_SRC_8812A_2ANT_MAX
28 }BT_INFO_SRC_8812A_2ANT,*PBT_INFO_SRC_8812A_2ANT;
29 
30 typedef enum _BT_8812A_2ANT_BT_STATUS{
31 	BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE	= 0x0,
32 	BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE		= 0x1,
33 	BT_8812A_2ANT_BT_STATUS_INQ_PAGE				= 0x2,
34 	BT_8812A_2ANT_BT_STATUS_ACL_BUSY				= 0x3,
35 	BT_8812A_2ANT_BT_STATUS_SCO_BUSY				= 0x4,
36 	BT_8812A_2ANT_BT_STATUS_ACL_SCO_BUSY			= 0x5,
37 	BT_8812A_2ANT_BT_STATUS_MAX
38 }BT_8812A_2ANT_BT_STATUS,*PBT_8812A_2ANT_BT_STATUS;
39 
40 typedef enum _BT_8812A_2ANT_COEX_ALGO{
41 	BT_8812A_2ANT_COEX_ALGO_UNDEFINED		= 0x0,
42 	BT_8812A_2ANT_COEX_ALGO_SCO				= 0x1,
43 	BT_8812A_2ANT_COEX_ALGO_SCO_HID 		= 0x2,
44 	BT_8812A_2ANT_COEX_ALGO_HID				= 0x3,
45 	BT_8812A_2ANT_COEX_ALGO_A2DP			= 0x4,
46 	BT_8812A_2ANT_COEX_ALGO_A2DP_PANHS		= 0x5,
47 	BT_8812A_2ANT_COEX_ALGO_PANEDR			= 0x6,
48 	BT_8812A_2ANT_COEX_ALGO_PANHS			= 0x7,
49 	BT_8812A_2ANT_COEX_ALGO_PANEDR_A2DP		= 0x8,
50 	BT_8812A_2ANT_COEX_ALGO_PANEDR_HID		= 0x9,
51 	BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANEDR	= 0xa,
52 	BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANHS	= 0xb,
53 	BT_8812A_2ANT_COEX_ALGO_HID_A2DP		= 0xc,
54 	BT_8812A_2ANT_COEX_ALGO_MAX				= 0xd
55 }BT_8812A_2ANT_COEX_ALGO,*PBT_8812A_2ANT_COEX_ALGO;
56 
57 typedef struct _COEX_DM_8812A_2ANT{
58 	// fw mechanism
59 	u1Byte		preBtDecPwrLvl;
60 	u1Byte		curBtDecPwrLvl;
61 	u1Byte		preFwDacSwingLvl;
62 	u1Byte		curFwDacSwingLvl;
63 	BOOLEAN		bCurIgnoreWlanAct;
64 	BOOLEAN		bPreIgnoreWlanAct;
65 	u1Byte		prePsTdma;
66 	u1Byte		curPsTdma;
67 	u1Byte		psTdmaPara[5];
68 	u1Byte		psTdmaDuAdjType;
69 	BOOLEAN		bAutoTdmaAdjust;
70 	BOOLEAN		bAutoTdmaAdjustLowRssi;
71 	BOOLEAN		bPrePsTdmaOn;
72 	BOOLEAN		bCurPsTdmaOn;
73 	BOOLEAN		bPreBtAutoReport;
74 	BOOLEAN		bCurBtAutoReport;
75 	u1Byte		preLps;
76 	u1Byte		curLps;
77 	u1Byte		preRpwm;
78 	u1Byte		curRpwm;
79 	BOOLEAN		bPreEnablePTA;
80 	BOOLEAN		bCurEnablePTA;
81 
82 
83 	// sw mechanism
84 	BOOLEAN		bPreRfRxLpfShrink;
85 	BOOLEAN		bCurRfRxLpfShrink;
86 	u4Byte		btRf0x1eBackup;
87 	BOOLEAN 	bPreLowPenaltyRa;
88 	BOOLEAN		bCurLowPenaltyRa;
89 	BOOLEAN		bPreDacSwingOn;
90 	u4Byte		preDacSwingLvl;
91 	BOOLEAN		bCurDacSwingOn;
92 	u4Byte		curDacSwingLvl;
93 	BOOLEAN		bPreAdcBackOff;
94 	BOOLEAN		bCurAdcBackOff;
95 	BOOLEAN 	bPreAgcTableEn;
96 	BOOLEAN		bCurAgcTableEn;
97 	u4Byte		preVal0x6c0;
98 	u4Byte		curVal0x6c0;
99 	u4Byte		preVal0x6c4;
100 	u4Byte		curVal0x6c4;
101 	u4Byte		preVal0x6c8;
102 	u4Byte		curVal0x6c8;
103 	u1Byte		preVal0x6cc;
104 	u1Byte		curVal0x6cc;
105 	BOOLEAN		bLimitedDig;
106 	u4Byte		backupArfrCnt1;	// Auto Rate Fallback Retry cnt
107 	u4Byte		backupArfrCnt2;	// Auto Rate Fallback Retry cnt
108 	u2Byte		backupRetryLimit;
109 	u1Byte		backupAmpduMaxTime;
110 
111 	// algorithm related
112 	u1Byte		preAlgorithm;
113 	u1Byte		curAlgorithm;
114 	u1Byte		btStatus;
115 	u1Byte		wifiChnlInfo[3];
116 
117 	u4Byte		preRaMask;
118 	u4Byte		curRaMask;
119 	u1Byte		curRaMaskType;
120 	u1Byte		preArfrType;
121 	u1Byte		curArfrType;
122 	u1Byte		preRetryLimitType;
123 	u1Byte		curRetryLimitType;
124 	u1Byte		preAmpduTimeType;
125 	u1Byte		curAmpduTimeType;
126 } COEX_DM_8812A_2ANT, *PCOEX_DM_8812A_2ANT;
127 
128 typedef struct _COEX_STA_8812A_2ANT{
129 	BOOLEAN					bBtLinkExist;
130 	BOOLEAN					bScoExist;
131 	BOOLEAN					bA2dpExist;
132 	BOOLEAN					bHidExist;
133 	BOOLEAN					bPanExist;
134 	BOOLEAN					bAclBusy;
135 
136 	BOOLEAN					bUnderLps;
137 	BOOLEAN					bUnderIps;
138 	u4Byte					highPriorityTx;
139 	u4Byte					highPriorityRx;
140 	u4Byte					lowPriorityTx;
141 	u4Byte					lowPriorityRx;
142 	u1Byte					btRssi;
143 	u1Byte					preBtRssiState;
144 	u1Byte					preBtDisabled;
145 	u1Byte					preWifiRssiState[4];
146 	BOOLEAN					bC2hBtInfoReqSent;
147 	u1Byte					btInfoC2h[BT_INFO_SRC_8812A_2ANT_MAX][10];
148 	u4Byte					btInfoC2hCnt[BT_INFO_SRC_8812A_2ANT_MAX];
149 	u4Byte					prebtInfoC2hCnt_BT_RSP;
150 	u4Byte					prebtInfoC2hCnt_BT_SEND;
151 	u4Byte					btInfoQueryCnt;
152 	BOOLEAN					bC2hBtInquiryPage;
153 	u1Byte					btRetryCnt;
154 	u1Byte					btInfoExt;
155 	u1Byte					nScanAPNum;
156 
157 	u4Byte					nCRCOK_CCK;
158 	u4Byte					nCRCOK_11g;
159 	u4Byte					nCRCOK_11n;
160 	u4Byte					nCRCOK_11nAgg;
161 
162 	u4Byte					nCRCErr_CCK;
163 	u4Byte					nCRCErr_11g;
164 	u4Byte					nCRCErr_11n;
165 	u4Byte					nCRCErr_11nAgg;
166 
167 	u1Byte					nCoexTableType;
168 	BOOLEAN					bForceLpsOn;
169 
170 	u1Byte					disVerInfoCnt;
171 
172 }COEX_STA_8812A_2ANT, *PCOEX_STA_8812A_2ANT;
173 
174 //===========================================
175 // The following is interface which will notify coex module.
176 //===========================================
177 VOID
178 EXhalbtc8812a2ant_PowerOnSetting(
179 	IN	PBTC_COEXIST		pBtCoexist
180 	);
181 VOID
182 EXhalbtc8812a2ant_InitHwConfig(
183 	IN	PBTC_COEXIST		pBtCoexist,
184 	IN	BOOLEAN				bWifiOnly
185 	);
186 VOID
187 EXhalbtc8812a2ant_InitCoexDm(
188 	IN	PBTC_COEXIST		pBtCoexist
189 	);
190 VOID
191 EXhalbtc8812a2ant_IpsNotify(
192 	IN	PBTC_COEXIST		pBtCoexist,
193 	IN	u1Byte			type
194 	);
195 VOID
196 EXhalbtc8812a2ant_LpsNotify(
197 	IN	PBTC_COEXIST		pBtCoexist,
198 	IN	u1Byte			type
199 	);
200 VOID
201 EXhalbtc8812a2ant_ScanNotify(
202 	IN	PBTC_COEXIST		pBtCoexist,
203 	IN	u1Byte			type
204 	);
205 VOID
206 EXhalbtc8812a2ant_ConnectNotify(
207 	IN	PBTC_COEXIST		pBtCoexist,
208 	IN	u1Byte			type
209 	);
210 VOID
211 EXhalbtc8812a2ant_MediaStatusNotify(
212 	IN	PBTC_COEXIST			pBtCoexist,
213 	IN	u1Byte				type
214 	);
215 VOID
216 EXhalbtc8812a2ant_SpecialPacketNotify(
217 	IN	PBTC_COEXIST			pBtCoexist,
218 	IN	u1Byte				type
219 	);
220 VOID
221 EXhalbtc8812a2ant_BtInfoNotify(
222 	IN	PBTC_COEXIST		pBtCoexist,
223 	IN	pu1Byte			tmpBuf,
224 	IN	u1Byte			length
225 	);
226 VOID
227 EXhalbtc8812a2ant_HaltNotify(
228 	IN	PBTC_COEXIST			pBtCoexist
229 	);
230 VOID
231 EXhalbtc8812a2ant_Periodical(
232 	IN	PBTC_COEXIST			pBtCoexist
233 	);
234 VOID
235 EXhalbtc8812a2ant_DisplayCoexInfo(
236 	IN	PBTC_COEXIST		pBtCoexist
237 	);
238 VOID
239 EXhalbtc8812a2ant_DbgControl(
240 	IN	PBTC_COEXIST			pBtCoexist,
241 	IN	u1Byte				opCode,
242 	IN	u1Byte				opLen,
243 	IN	pu1Byte 			pData
244 	);
245 VOID
246 EXhalbtc8812a2ant_BTOffOnNotify(
247 	IN	PBTC_COEXIST			pBtCoexist,
248 	IN	u1Byte			BTstatus
249 	);
250 
251