xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8189es/hal/btc/HalBtc8703b2Ant.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 //===========================================
3 // The following is for 8703B 2Ant BT Co-exist definition
4 //===========================================
5 #define	BT_AUTO_REPORT_ONLY_8703B_2ANT				1
6 
7 
8 #define	BT_INFO_8703B_2ANT_B_FTP						BIT7
9 #define	BT_INFO_8703B_2ANT_B_A2DP					BIT6
10 #define	BT_INFO_8703B_2ANT_B_HID						BIT5
11 #define	BT_INFO_8703B_2ANT_B_SCO_BUSY				BIT4
12 #define	BT_INFO_8703B_2ANT_B_ACL_BUSY				BIT3
13 #define	BT_INFO_8703B_2ANT_B_INQ_PAGE				BIT2
14 #define	BT_INFO_8703B_2ANT_B_SCO_ESCO				BIT1
15 #define	BT_INFO_8703B_2ANT_B_CONNECTION				BIT0
16 
17 #define		BTC_RSSI_COEX_THRESH_TOL_8703B_2ANT		2
18 
19 
20 #define	BT_8703B_2ANT_WIFI_RSSI_COEXSWITCH_THRES				42  //WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation
21 #define	BT_8703B_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_8703B_2ANT{
24 	BT_INFO_SRC_8703B_2ANT_WIFI_FW			= 0x0,
25 	BT_INFO_SRC_8703B_2ANT_BT_RSP				= 0x1,
26 	BT_INFO_SRC_8703B_2ANT_BT_ACTIVE_SEND		= 0x2,
27 	BT_INFO_SRC_8703B_2ANT_MAX
28 }BT_INFO_SRC_8703B_2ANT,*PBT_INFO_SRC_8703B_2ANT;
29 
30 typedef enum _BT_8703B_2ANT_BT_STATUS{
31 	BT_8703B_2ANT_BT_STATUS_NON_CONNECTED_IDLE	= 0x0,
32 	BT_8703B_2ANT_BT_STATUS_CONNECTED_IDLE		= 0x1,
33 	BT_8703B_2ANT_BT_STATUS_INQ_PAGE				= 0x2,
34 	BT_8703B_2ANT_BT_STATUS_ACL_BUSY				= 0x3,
35 	BT_8703B_2ANT_BT_STATUS_SCO_BUSY				= 0x4,
36 	BT_8703B_2ANT_BT_STATUS_ACL_SCO_BUSY			= 0x5,
37 	BT_8703B_2ANT_BT_STATUS_MAX
38 }BT_8703B_2ANT_BT_STATUS,*PBT_8703B_2ANT_BT_STATUS;
39 
40 typedef enum _BT_8703B_2ANT_COEX_ALGO{
41 	BT_8703B_2ANT_COEX_ALGO_UNDEFINED			= 0x0,
42 	BT_8703B_2ANT_COEX_ALGO_SCO				= 0x1,
43 	BT_8703B_2ANT_COEX_ALGO_HID				= 0x2,
44 	BT_8703B_2ANT_COEX_ALGO_A2DP				= 0x3,
45 	BT_8703B_2ANT_COEX_ALGO_A2DP_PANHS		= 0x4,
46 	BT_8703B_2ANT_COEX_ALGO_PANEDR			= 0x5,
47 	BT_8703B_2ANT_COEX_ALGO_PANHS			= 0x6,
48 	BT_8703B_2ANT_COEX_ALGO_PANEDR_A2DP		= 0x7,
49 	BT_8703B_2ANT_COEX_ALGO_PANEDR_HID		= 0x8,
50 	BT_8703B_2ANT_COEX_ALGO_HID_A2DP_PANEDR	= 0x9,
51 	BT_8703B_2ANT_COEX_ALGO_HID_A2DP			= 0xa,
52 	BT_8703B_2ANT_COEX_ALGO_MAX				= 0xb,
53 }BT_8703B_2ANT_COEX_ALGO,*PBT_8703B_2ANT_COEX_ALGO;
54 
55 typedef struct _COEX_DM_8703B_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 
112 	BOOLEAN		bIsSwitchTo1dot5Ant;
113 } COEX_DM_8703B_2ANT, *PCOEX_DM_8703B_2ANT;
114 
115 typedef struct _COEX_STA_8703B_2ANT{
116 	BOOLEAN					bBtLinkExist;
117 	BOOLEAN					bScoExist;
118 	BOOLEAN					bA2dpExist;
119 	BOOLEAN					bHidExist;
120 	BOOLEAN					bPanExist;
121 
122 	BOOLEAN					bUnderLps;
123 	BOOLEAN					bUnderIps;
124 	u4Byte					highPriorityTx;
125 	u4Byte					highPriorityRx;
126 	u4Byte					lowPriorityTx;
127 	u4Byte					lowPriorityRx;
128 	u1Byte					btRssi;
129 	BOOLEAN				bBtTxRxMask;
130 	u1Byte					preBtRssiState;
131 	u1Byte					preWifiRssiState[4];
132 	BOOLEAN					bC2hBtInfoReqSent;
133 	u1Byte					btInfoC2h[BT_INFO_SRC_8703B_2ANT_MAX][10];
134 	u4Byte					btInfoC2hCnt[BT_INFO_SRC_8703B_2ANT_MAX];
135 	BOOLEAN 				bBtWhckTest;
136 	BOOLEAN					bC2hBtInquiryPage;
137 	u1Byte					btRetryCnt;
138 	u1Byte					btInfoExt;
139 
140 	u4Byte					nCRCOK_CCK;
141 	u4Byte					nCRCOK_11g;
142 	u4Byte					nCRCOK_11n;
143 	u4Byte					nCRCOK_11nAgg;
144 
145 	u4Byte					nCRCErr_CCK;
146 	u4Byte					nCRCErr_11g;
147 	u4Byte					nCRCErr_11n;
148 	u4Byte					nCRCErr_11nAgg;
149 
150 	u1Byte					nCoexTableType;
151 	BOOLEAN					bForceLpsOn;
152 
153 	u1Byte					disVerInfoCnt;
154 }COEX_STA_8703B_2ANT, *PCOEX_STA_8703B_2ANT;
155 
156 //===========================================
157 // The following is interface which will notify coex module.
158 //===========================================
159 VOID
160 EXhalbtc8703b2ant_PowerOnSetting(
161 	IN	PBTC_COEXIST		pBtCoexist
162 	);
163 VOID
164 EXhalbtc8703b2ant_PreLoadFirmware(
165 	IN	PBTC_COEXIST		pBtCoexist
166 	);
167 VOID
168 EXhalbtc8703b2ant_InitHwConfig(
169 	IN	PBTC_COEXIST		pBtCoexist,
170 	IN	BOOLEAN				bWifiOnly
171 	);
172 VOID
173 EXhalbtc8703b2ant_InitCoexDm(
174 	IN	PBTC_COEXIST		pBtCoexist
175 	);
176 VOID
177 EXhalbtc8703b2ant_IpsNotify(
178 	IN	PBTC_COEXIST		pBtCoexist,
179 	IN	u1Byte			type
180 	);
181 VOID
182 EXhalbtc8703b2ant_LpsNotify(
183 	IN	PBTC_COEXIST		pBtCoexist,
184 	IN	u1Byte			type
185 	);
186 VOID
187 EXhalbtc8703b2ant_ScanNotify(
188 	IN	PBTC_COEXIST		pBtCoexist,
189 	IN	u1Byte			type
190 	);
191 VOID
192 EXhalbtc8703b2ant_ConnectNotify(
193 	IN	PBTC_COEXIST		pBtCoexist,
194 	IN	u1Byte			type
195 	);
196 VOID
197 EXhalbtc8703b2ant_MediaStatusNotify(
198 	IN	PBTC_COEXIST			pBtCoexist,
199 	IN	u1Byte				type
200 	);
201 VOID
202 EXhalbtc8703b2ant_SpecialPacketNotify(
203 	IN	PBTC_COEXIST			pBtCoexist,
204 	IN	u1Byte				type
205 	);
206 VOID
207 EXhalbtc8703b2ant_BtInfoNotify(
208 	IN	PBTC_COEXIST		pBtCoexist,
209 	IN	pu1Byte			tmpBuf,
210 	IN	u1Byte			length
211 	);
212 VOID
213 EXhalbtc8703b2ant_HaltNotify(
214 	IN	PBTC_COEXIST			pBtCoexist
215 	);
216 VOID
217 EXhalbtc8703b2ant_PnpNotify(
218 	IN	PBTC_COEXIST			pBtCoexist,
219 	IN	u1Byte				pnpState
220 	);
221 VOID
222 EXhalbtc8703b2ant_Periodical(
223 	IN	PBTC_COEXIST			pBtCoexist
224 	);
225 VOID
226 EXhalbtc8703b2ant_DisplayCoexInfo(
227 	IN	PBTC_COEXIST		pBtCoexist
228 	);
229 
230