xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8189es/hal/btc/HalBtc8192e2Ant.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 //===========================================
3 // The following is for 8192E 2Ant BT Co-exist definition
4 //===========================================
5 #define	BT_AUTO_REPORT_ONLY_8192E_2ANT				0
6 
7 #define	BT_INFO_8192E_2ANT_B_FTP						BIT7
8 #define	BT_INFO_8192E_2ANT_B_A2DP					BIT6
9 #define	BT_INFO_8192E_2ANT_B_HID						BIT5
10 #define	BT_INFO_8192E_2ANT_B_SCO_BUSY				BIT4
11 #define	BT_INFO_8192E_2ANT_B_ACL_BUSY				BIT3
12 #define	BT_INFO_8192E_2ANT_B_INQ_PAGE				BIT2
13 #define	BT_INFO_8192E_2ANT_B_SCO_ESCO				BIT1
14 #define	BT_INFO_8192E_2ANT_B_CONNECTION				BIT0
15 
16 #define	BT_INFO_8192E_2ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_)	\
17 		(((_BT_INFO_EXT_&BIT0))? TRUE:FALSE)
18 
19 #define		BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT		2
20 #define 	NOISY_AP_NUM_THRESH						5
21 
22 typedef enum _BT_INFO_SRC_8192E_2ANT{
23 	BT_INFO_SRC_8192E_2ANT_WIFI_FW			= 0x0,
24 	BT_INFO_SRC_8192E_2ANT_BT_RSP				= 0x1,
25 	BT_INFO_SRC_8192E_2ANT_BT_ACTIVE_SEND		= 0x2,
26 	BT_INFO_SRC_8192E_2ANT_MAX
27 }BT_INFO_SRC_8192E_2ANT,*PBT_INFO_SRC_8192E_2ANT;
28 
29 typedef enum _BT_8192E_2ANT_BT_STATUS{
30 	BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE	= 0x0,
31 	BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE		= 0x1,
32 	BT_8192E_2ANT_BT_STATUS_INQ_PAGE				= 0x2,
33 	BT_8192E_2ANT_BT_STATUS_ACL_BUSY				= 0x3,
34 	BT_8192E_2ANT_BT_STATUS_SCO_BUSY				= 0x4,
35 	BT_8192E_2ANT_BT_STATUS_ACL_SCO_BUSY			= 0x5,
36 	BT_8192E_2ANT_BT_STATUS_MAX
37 }BT_8192E_2ANT_BT_STATUS,*PBT_8192E_2ANT_BT_STATUS;
38 
39 typedef enum _BT_8192E_2ANT_COEX_ALGO{
40 	BT_8192E_2ANT_COEX_ALGO_UNDEFINED		= 0x0,
41 	BT_8192E_2ANT_COEX_ALGO_SCO				= 0x1,
42 	BT_8192E_2ANT_COEX_ALGO_SCO_PAN			= 0x2,
43 	BT_8192E_2ANT_COEX_ALGO_HID				= 0x3,
44 	BT_8192E_2ANT_COEX_ALGO_A2DP			= 0x4,
45 	BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS		= 0x5,
46 	BT_8192E_2ANT_COEX_ALGO_PANEDR			= 0x6,
47 	BT_8192E_2ANT_COEX_ALGO_PANHS			= 0x7,
48 	BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP		= 0x8,
49 	BT_8192E_2ANT_COEX_ALGO_PANEDR_HID		= 0x9,
50 	BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR	= 0xa,
51 	BT_8192E_2ANT_COEX_ALGO_HID_A2DP		= 0xb,
52 	BT_8192E_2ANT_COEX_ALGO_MAX				= 0xc
53 }BT_8192E_2ANT_COEX_ALGO,*PBT_8192E_2ANT_COEX_ALGO;
54 
55 typedef struct _COEX_DM_8192E_2ANT{
56 	// fw mechanism
57 	u1Byte		preBtDecPwrLvl;
58 	u1Byte		curBtDecPwrLvl;
59 	u1Byte		preFwDacSwingLvl;
60 	u1Byte		curFwDacSwingLvl;
61 	BOOLEAN		bCurIgnoreWlanAct;
62 	BOOLEAN		bPreIgnoreWlanAct;
63 	u1Byte		prePsTdma;
64 	u1Byte		curPsTdma;
65 	u1Byte		psTdmaPara[5];
66 	u1Byte		psTdmaDuAdjType;
67 	BOOLEAN		bResetTdmaAdjust;
68 	BOOLEAN		bAutoTdmaAdjust;
69 	BOOLEAN		bAutoTdmaAdjustLowRssi;
70 	BOOLEAN		bPrePsTdmaOn;
71 	BOOLEAN		bCurPsTdmaOn;
72 	BOOLEAN		bPreBtAutoReport;
73 	BOOLEAN		bCurBtAutoReport;
74 	u1Byte		preLps;
75 	u1Byte		curLps;
76 	u1Byte		preRpwm;
77 	u1Byte		curRpwm;
78 
79 	// sw mechanism
80 	BOOLEAN		bPreRfRxLpfShrink;
81 	BOOLEAN		bCurRfRxLpfShrink;
82 	u4Byte		btRf0x1eBackup;
83 	BOOLEAN 	bPreLowPenaltyRa;
84 	BOOLEAN		bCurLowPenaltyRa;
85 	BOOLEAN		bPreDacSwingOn;
86 	u4Byte		preDacSwingLvl;
87 	BOOLEAN		bCurDacSwingOn;
88 	u4Byte		curDacSwingLvl;
89 	BOOLEAN		bPreAdcBackOff;
90 	BOOLEAN		bCurAdcBackOff;
91 	BOOLEAN 	bPreAgcTableEn;
92 	BOOLEAN		bCurAgcTableEn;
93 	u4Byte		preVal0x6c0;
94 	u4Byte		curVal0x6c0;
95 	u4Byte		preVal0x6c4;
96 	u4Byte		curVal0x6c4;
97 	u4Byte		preVal0x6c8;
98 	u4Byte		curVal0x6c8;
99 	u1Byte		preVal0x6cc;
100 	u1Byte		curVal0x6cc;
101 	BOOLEAN		bLimitedDig;
102 
103 	u4Byte		backupArfrCnt1;	// Auto Rate Fallback Retry cnt
104 	u4Byte		backupArfrCnt2;	// Auto Rate Fallback Retry cnt
105 	u2Byte		backupRetryLimit;
106 	u1Byte		backupAmpduMaxTime;
107 
108 	// algorithm related
109 	u1Byte		preAlgorithm;
110 	u1Byte		curAlgorithm;
111 	u1Byte		btStatus;
112 	u1Byte		wifiChnlInfo[3];
113 
114 	u1Byte		preSsType;
115 	u1Byte		curSsType;
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_8192E_2ANT, *PCOEX_DM_8192E_2ANT;
127 
128 typedef struct _COEX_STA_8192E_2ANT{
129 	BOOLEAN					bBtLinkExist;
130 	BOOLEAN					bScoExist;
131 	BOOLEAN					bA2dpExist;
132 	BOOLEAN					bHidExist;
133 	BOOLEAN					bPanExist;
134 
135 	BOOLEAN					bUnderLps;
136 	BOOLEAN					bUnderIps;
137 	u4Byte					highPriorityTx;
138 	u4Byte					highPriorityRx;
139 	u4Byte					lowPriorityTx;
140 	u4Byte					lowPriorityRx;
141 	u1Byte					btRssi;
142 	u1Byte					preBtRssiState;
143 	u1Byte					preWifiRssiState[4];
144 	BOOLEAN					bC2hBtInfoReqSent;
145 	u1Byte					btInfoC2h[BT_INFO_SRC_8192E_2ANT_MAX][10];
146 	u4Byte					btInfoC2hCnt[BT_INFO_SRC_8192E_2ANT_MAX];
147 	BOOLEAN					bC2hBtInquiryPage;
148 	u1Byte					btRetryCnt;
149 	u1Byte					btInfoExt;
150 	u1Byte					nScanAPNum;
151 
152 	u4Byte					nCRCOK_CCK;
153 	u4Byte					nCRCOK_11g;
154 	u4Byte					nCRCOK_11n;
155 	u4Byte					nCRCOK_11nAgg;
156 
157 	u4Byte					nCRCErr_CCK;
158 	u4Byte					nCRCErr_11g;
159 	u4Byte					nCRCErr_11n;
160 	u4Byte					nCRCErr_11nAgg;
161 
162 	u1Byte					nCoexTableType;
163 	BOOLEAN					bForceLpsOn;
164 
165 	u1Byte					disVerInfoCnt;
166 }COEX_STA_8192E_2ANT, *PCOEX_STA_8192E_2ANT;
167 
168 //===========================================
169 // The following is interface which will notify coex module.
170 //===========================================
171 VOID
172 EXhalbtc8192e2ant_PowerOnSetting(
173 	IN	PBTC_COEXIST		pBtCoexist
174 	);
175 VOID
176 EXhalbtc8192e2ant_InitHwConfig(
177 	IN	PBTC_COEXIST		pBtCoexist,
178 	IN	BOOLEAN				bWifiOnly
179 	);
180 VOID
181 EXhalbtc8192e2ant_InitCoexDm(
182 	IN	PBTC_COEXIST		pBtCoexist
183 	);
184 VOID
185 EXhalbtc8192e2ant_IpsNotify(
186 	IN	PBTC_COEXIST		pBtCoexist,
187 	IN	u1Byte			type
188 	);
189 VOID
190 EXhalbtc8192e2ant_LpsNotify(
191 	IN	PBTC_COEXIST		pBtCoexist,
192 	IN	u1Byte			type
193 	);
194 VOID
195 EXhalbtc8192e2ant_ScanNotify(
196 	IN	PBTC_COEXIST		pBtCoexist,
197 	IN	u1Byte			type
198 	);
199 VOID
200 EXhalbtc8192e2ant_ConnectNotify(
201 	IN	PBTC_COEXIST		pBtCoexist,
202 	IN	u1Byte			type
203 	);
204 VOID
205 EXhalbtc8192e2ant_MediaStatusNotify(
206 	IN	PBTC_COEXIST			pBtCoexist,
207 	IN	u1Byte				type
208 	);
209 VOID
210 EXhalbtc8192e2ant_SpecialPacketNotify(
211 	IN	PBTC_COEXIST			pBtCoexist,
212 	IN	u1Byte				type
213 	);
214 VOID
215 EXhalbtc8192e2ant_BtInfoNotify(
216 	IN	PBTC_COEXIST		pBtCoexist,
217 	IN	pu1Byte			tmpBuf,
218 	IN	u1Byte			length
219 	);
220 VOID
221 EXhalbtc8192e2ant_HaltNotify(
222 	IN	PBTC_COEXIST			pBtCoexist
223 	);
224 VOID
225 EXhalbtc8192e2ant_Periodical(
226 	IN	PBTC_COEXIST			pBtCoexist
227 	);
228 VOID
229 EXhalbtc8192e2ant_DisplayCoexInfo(
230 	IN	PBTC_COEXIST		pBtCoexist
231 	);
232 
233