xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8189es/hal/btc/HalBtc8821a2Ant.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 //===========================================
3 // The following is for 8821A 2Ant BT Co-exist definition
4 //===========================================
5 #define	BT_AUTO_REPORT_ONLY_8821A_2ANT				1
6 
7 
8 #define	BT_INFO_8821A_2ANT_B_FTP						BIT7
9 #define	BT_INFO_8821A_2ANT_B_A2DP					BIT6
10 #define	BT_INFO_8821A_2ANT_B_HID						BIT5
11 #define	BT_INFO_8821A_2ANT_B_SCO_BUSY				BIT4
12 #define	BT_INFO_8821A_2ANT_B_ACL_BUSY				BIT3
13 #define	BT_INFO_8821A_2ANT_B_INQ_PAGE				BIT2
14 #define	BT_INFO_8821A_2ANT_B_SCO_ESCO				BIT1
15 #define	BT_INFO_8821A_2ANT_B_CONNECTION				BIT0
16 
17 #define		BTC_RSSI_COEX_THRESH_TOL_8821A_2ANT		2
18 
19 
20 #define	BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES				42  //WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation
21 #define	BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES				46 //BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation
22 
23 typedef enum _BT_INFO_SRC_8821A_2ANT{
24 	BT_INFO_SRC_8821A_2ANT_WIFI_FW			= 0x0,
25 	BT_INFO_SRC_8821A_2ANT_BT_RSP				= 0x1,
26 	BT_INFO_SRC_8821A_2ANT_BT_ACTIVE_SEND		= 0x2,
27 	BT_INFO_SRC_8821A_2ANT_MAX
28 }BT_INFO_SRC_8821A_2ANT,*PBT_INFO_SRC_8821A_2ANT;
29 
30 typedef enum _BT_8821A_2ANT_BT_STATUS{
31 	BT_8821A_2ANT_BT_STATUS_NON_CONNECTED_IDLE	= 0x0,
32 	BT_8821A_2ANT_BT_STATUS_CONNECTED_IDLE		= 0x1,
33 	BT_8821A_2ANT_BT_STATUS_INQ_PAGE				= 0x2,
34 	BT_8821A_2ANT_BT_STATUS_ACL_BUSY				= 0x3,
35 	BT_8821A_2ANT_BT_STATUS_SCO_BUSY				= 0x4,
36 	BT_8821A_2ANT_BT_STATUS_ACL_SCO_BUSY			= 0x5,
37 	BT_8821A_2ANT_BT_STATUS_MAX
38 }BT_8821A_2ANT_BT_STATUS,*PBT_8821A_2ANT_BT_STATUS;
39 
40 typedef enum _BT_8821A_2ANT_COEX_ALGO{
41 	BT_8821A_2ANT_COEX_ALGO_UNDEFINED			= 0x0,
42 	BT_8821A_2ANT_COEX_ALGO_SCO				= 0x1,
43 	BT_8821A_2ANT_COEX_ALGO_HID				= 0x2,
44 	BT_8821A_2ANT_COEX_ALGO_A2DP				= 0x3,
45 	BT_8821A_2ANT_COEX_ALGO_A2DP_PANHS		= 0x4,
46 	BT_8821A_2ANT_COEX_ALGO_PANEDR			= 0x5,
47 	BT_8821A_2ANT_COEX_ALGO_PANHS			= 0x6,
48 	BT_8821A_2ANT_COEX_ALGO_PANEDR_A2DP		= 0x7,
49 	BT_8821A_2ANT_COEX_ALGO_PANEDR_HID		= 0x8,
50 	BT_8821A_2ANT_COEX_ALGO_HID_A2DP_PANEDR	= 0x9,
51 	BT_8821A_2ANT_COEX_ALGO_HID_A2DP			= 0xa,
52 	BT_8821A_2ANT_COEX_ALGO_MAX				= 0xb,
53 }BT_8821A_2ANT_COEX_ALGO,*PBT_8821A_2ANT_COEX_ALGO;
54 
55 typedef struct _COEX_DM_8821A_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		bPrePsTdmaOn;
70 	BOOLEAN		bCurPsTdmaOn;
71 	BOOLEAN		bPreBtAutoReport;
72 	BOOLEAN		bCurBtAutoReport;
73 
74 	// sw mechanism
75 	BOOLEAN		bPreRfRxLpfShrink;
76 	BOOLEAN		bCurRfRxLpfShrink;
77 	u4Byte		btRf0x1eBackup;
78 	BOOLEAN 	bPreLowPenaltyRa;
79 	BOOLEAN		bCurLowPenaltyRa;
80 	BOOLEAN		bPreDacSwingOn;
81 	u4Byte		preDacSwingLvl;
82 	BOOLEAN		bCurDacSwingOn;
83 	u4Byte		curDacSwingLvl;
84 	BOOLEAN		bPreAdcBackOff;
85 	BOOLEAN		bCurAdcBackOff;
86 	BOOLEAN 	bPreAgcTableEn;
87 	BOOLEAN		bCurAgcTableEn;
88 	u4Byte		preVal0x6c0;
89 	u4Byte		curVal0x6c0;
90 	u4Byte		preVal0x6c4;
91 	u4Byte		curVal0x6c4;
92 	u4Byte		preVal0x6c8;
93 	u4Byte		curVal0x6c8;
94 	u1Byte		preVal0x6cc;
95 	u1Byte		curVal0x6cc;
96 	BOOLEAN		bLimitedDig;
97 
98 	// algorithm related
99 	u1Byte		preAlgorithm;
100 	u1Byte		curAlgorithm;
101 	u1Byte		btStatus;
102 	u1Byte		wifiChnlInfo[3];
103 
104 	BOOLEAN		bNeedRecover0x948;
105 	u4Byte		backup0x948;
106 
107 	u1Byte		preLps;
108 	u1Byte		curLps;
109 	u1Byte		preRpwm;
110 	u1Byte		curRpwm;
111 } COEX_DM_8821A_2ANT, *PCOEX_DM_8821A_2ANT;
112 
113 typedef struct _COEX_STA_8821A_2ANT{
114 	BOOLEAN					bBtLinkExist;
115 	BOOLEAN					bScoExist;
116 	BOOLEAN					bA2dpExist;
117 	BOOLEAN					bHidExist;
118 	BOOLEAN					bPanExist;
119 
120 	BOOLEAN					bUnderLps;
121 	BOOLEAN					bUnderIps;
122 	u4Byte					highPriorityTx;
123 	u4Byte					highPriorityRx;
124 	u4Byte					lowPriorityTx;
125 	u4Byte					lowPriorityRx;
126 	u1Byte					btRssi;
127 	BOOLEAN					bBtTxRxMask;
128 	u1Byte					preBtRssiState;
129 	u1Byte					preWifiRssiState[4];
130 	BOOLEAN					bC2hBtInfoReqSent;
131 	u1Byte					btInfoC2h[BT_INFO_SRC_8821A_2ANT_MAX][10];
132 	u4Byte					btInfoC2hCnt[BT_INFO_SRC_8821A_2ANT_MAX];
133 	BOOLEAN 				bBtWhckTest;
134 	BOOLEAN					bC2hBtInquiryPage;
135 	u1Byte					btRetryCnt;
136 	u1Byte					btInfoExt;
137 
138 	u4Byte					nCRCOK_CCK;
139 	u4Byte					nCRCOK_11g;
140 	u4Byte					nCRCOK_11n;
141 	u4Byte					nCRCOK_11nAgg;
142 
143 	u4Byte					nCRCErr_CCK;
144 	u4Byte					nCRCErr_11g;
145 	u4Byte					nCRCErr_11n;
146 	u4Byte					nCRCErr_11nAgg;
147 
148 	u1Byte					nCoexTableType;
149 	BOOLEAN					bForceLpsOn;
150 
151 	u1Byte					disVerInfoCnt;
152 }COEX_STA_8821A_2ANT, *PCOEX_STA_8821A_2ANT;
153 
154 //===========================================
155 // The following is interface which will notify coex module.
156 //===========================================
157 VOID
158 EXhalbtc8821a2ant_PowerOnSetting(
159 	IN	PBTC_COEXIST		pBtCoexist
160 	);
161 VOID
162 EXhalbtc8821a2ant_PreLoadFirmware(
163 	IN	PBTC_COEXIST		pBtCoexist
164 	);
165 VOID
166 EXhalbtc8821a2ant_InitHwConfig(
167 	IN	PBTC_COEXIST		pBtCoexist,
168 	IN	BOOLEAN				bWifiOnly
169 	);
170 VOID
171 EXhalbtc8821a2ant_InitCoexDm(
172 	IN	PBTC_COEXIST		pBtCoexist
173 	);
174 VOID
175 EXhalbtc8821a2ant_IpsNotify(
176 	IN	PBTC_COEXIST		pBtCoexist,
177 	IN	u1Byte			type
178 	);
179 VOID
180 EXhalbtc8821a2ant_LpsNotify(
181 	IN	PBTC_COEXIST		pBtCoexist,
182 	IN	u1Byte			type
183 	);
184 VOID
185 EXhalbtc8821a2ant_ScanNotify(
186 	IN	PBTC_COEXIST		pBtCoexist,
187 	IN	u1Byte			type
188 	);
189 VOID
190 EXhalbtc8821a2ant_ConnectNotify(
191 	IN	PBTC_COEXIST		pBtCoexist,
192 	IN	u1Byte			type
193 	);
194 VOID
195 EXhalbtc8821a2ant_MediaStatusNotify(
196 	IN	PBTC_COEXIST			pBtCoexist,
197 	IN	u1Byte				type
198 	);
199 VOID
200 EXhalbtc8821a2ant_SpecialPacketNotify(
201 	IN	PBTC_COEXIST			pBtCoexist,
202 	IN	u1Byte				type
203 	);
204 VOID
205 EXhalbtc8821a2ant_BtInfoNotify(
206 	IN	PBTC_COEXIST		pBtCoexist,
207 	IN	pu1Byte			tmpBuf,
208 	IN	u1Byte			length
209 	);
210 VOID
211 EXhalbtc8821a2ant_HaltNotify(
212 	IN	PBTC_COEXIST			pBtCoexist
213 	);
214 VOID
215 EXhalbtc8821a2ant_PnpNotify(
216 	IN	PBTC_COEXIST			pBtCoexist,
217 	IN	u1Byte				pnpState
218 	);
219 VOID
220 EXhalbtc8821a2ant_Periodical(
221 	IN	PBTC_COEXIST			pBtCoexist
222 	);
223 VOID
224 EXhalbtc8821a2ant_DisplayCoexInfo(
225 	IN	PBTC_COEXIST		pBtCoexist
226 	);
227 
228