1 /* SPDX-License-Identifier: GPL-2.0 */ 2 //=========================================== 3 // The following is for 8723B 1ANT BT Co-exist definition 4 //=========================================== 5 #define BT_AUTO_REPORT_ONLY_8723B_1ANT 1 6 7 #define BT_INFO_8723B_1ANT_B_FTP BIT7 8 #define BT_INFO_8723B_1ANT_B_A2DP BIT6 9 #define BT_INFO_8723B_1ANT_B_HID BIT5 10 #define BT_INFO_8723B_1ANT_B_SCO_BUSY BIT4 11 #define BT_INFO_8723B_1ANT_B_ACL_BUSY BIT3 12 #define BT_INFO_8723B_1ANT_B_INQ_PAGE BIT2 13 #define BT_INFO_8723B_1ANT_B_SCO_ESCO BIT1 14 #define BT_INFO_8723B_1ANT_B_CONNECTION BIT0 15 16 #define BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \ 17 (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE) 18 19 #define BTC_RSSI_COEX_THRESH_TOL_8723B_1ANT 2 20 21 #define BT_8723B_1ANT_WIFI_NOISY_THRESH 50 //30 //max: 255 22 23 //for Antenna detection 24 #define BT_8723B_1ANT_ANTDET_PSDTHRES_BACKGROUND 50 25 #define BT_8723B_1ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70 26 #define BT_8723B_1ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 55 27 #define BT_8723B_1ANT_ANTDET_PSDTHRES_1ANT 35 28 #define BT_8723B_1ANT_ANTDET_RETRY_INTERVAL 10 //retry timer if ant det is fail, unit: second 29 #define BT_8723B_1ANT_ANTDET_ENABLE 0 30 #define BT_8723B_1ANT_ANTDET_COEXMECHANISMSWITCH_ENABLE 0 31 32 typedef enum _BT_INFO_SRC_8723B_1ANT{ 33 BT_INFO_SRC_8723B_1ANT_WIFI_FW = 0x0, 34 BT_INFO_SRC_8723B_1ANT_BT_RSP = 0x1, 35 BT_INFO_SRC_8723B_1ANT_BT_ACTIVE_SEND = 0x2, 36 BT_INFO_SRC_8723B_1ANT_MAX 37 }BT_INFO_SRC_8723B_1ANT,*PBT_INFO_SRC_8723B_1ANT; 38 39 typedef enum _BT_8723B_1ANT_BT_STATUS{ 40 BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, 41 BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1, 42 BT_8723B_1ANT_BT_STATUS_INQ_PAGE = 0x2, 43 BT_8723B_1ANT_BT_STATUS_ACL_BUSY = 0x3, 44 BT_8723B_1ANT_BT_STATUS_SCO_BUSY = 0x4, 45 BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5, 46 BT_8723B_1ANT_BT_STATUS_MAX 47 }BT_8723B_1ANT_BT_STATUS,*PBT_8723B_1ANT_BT_STATUS; 48 49 typedef enum _BT_8723B_1ANT_WIFI_STATUS{ 50 BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0, 51 BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1, 52 BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2, 53 BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3, 54 BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4, 55 BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5, 56 BT_8723B_1ANT_WIFI_STATUS_MAX 57 }BT_8723B_1ANT_WIFI_STATUS,*PBT_8723B_1ANT_WIFI_STATUS; 58 59 typedef enum _BT_8723B_1ANT_COEX_ALGO{ 60 BT_8723B_1ANT_COEX_ALGO_UNDEFINED = 0x0, 61 BT_8723B_1ANT_COEX_ALGO_SCO = 0x1, 62 BT_8723B_1ANT_COEX_ALGO_HID = 0x2, 63 BT_8723B_1ANT_COEX_ALGO_A2DP = 0x3, 64 BT_8723B_1ANT_COEX_ALGO_A2DP_PANHS = 0x4, 65 BT_8723B_1ANT_COEX_ALGO_PANEDR = 0x5, 66 BT_8723B_1ANT_COEX_ALGO_PANHS = 0x6, 67 BT_8723B_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7, 68 BT_8723B_1ANT_COEX_ALGO_PANEDR_HID = 0x8, 69 BT_8723B_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9, 70 BT_8723B_1ANT_COEX_ALGO_HID_A2DP = 0xa, 71 BT_8723B_1ANT_COEX_ALGO_MAX = 0xb, 72 }BT_8723B_1ANT_COEX_ALGO,*PBT_8723B_1ANT_COEX_ALGO; 73 74 typedef struct _COEX_DM_8723B_1ANT{ 75 // hw setting 76 u1Byte preAntPosType; 77 u1Byte curAntPosType; 78 // fw mechanism 79 BOOLEAN bCurIgnoreWlanAct; 80 BOOLEAN bPreIgnoreWlanAct; 81 u1Byte prePsTdma; 82 u1Byte curPsTdma; 83 u1Byte psTdmaPara[5]; 84 u1Byte psTdmaDuAdjType; 85 BOOLEAN bAutoTdmaAdjust; 86 BOOLEAN bPrePsTdmaOn; 87 BOOLEAN bCurPsTdmaOn; 88 BOOLEAN bPreBtAutoReport; 89 BOOLEAN bCurBtAutoReport; 90 u1Byte preLps; 91 u1Byte curLps; 92 u1Byte preRpwm; 93 u1Byte curRpwm; 94 95 // sw mechanism 96 BOOLEAN bPreLowPenaltyRa; 97 BOOLEAN bCurLowPenaltyRa; 98 u4Byte preVal0x6c0; 99 u4Byte curVal0x6c0; 100 u4Byte preVal0x6c4; 101 u4Byte curVal0x6c4; 102 u4Byte preVal0x6c8; 103 u4Byte curVal0x6c8; 104 u1Byte preVal0x6cc; 105 u1Byte curVal0x6cc; 106 BOOLEAN bLimitedDig; 107 108 u4Byte backupArfrCnt1; // Auto Rate Fallback Retry cnt 109 u4Byte backupArfrCnt2; // Auto Rate Fallback Retry cnt 110 u2Byte backupRetryLimit; 111 u1Byte backupAmpduMaxTime; 112 113 // algorithm related 114 u1Byte preAlgorithm; 115 u1Byte curAlgorithm; 116 u1Byte btStatus; 117 u1Byte wifiChnlInfo[3]; 118 119 u4Byte preRaMask; 120 u4Byte curRaMask; 121 u1Byte preArfrType; 122 u1Byte curArfrType; 123 u1Byte preRetryLimitType; 124 u1Byte curRetryLimitType; 125 u1Byte preAmpduTimeType; 126 u1Byte curAmpduTimeType; 127 u4Byte nArpCnt; 128 129 u1Byte errorCondition; 130 } COEX_DM_8723B_1ANT, *PCOEX_DM_8723B_1ANT; 131 132 typedef struct _COEX_STA_8723B_1ANT{ 133 BOOLEAN bBtLinkExist; 134 BOOLEAN bScoExist; 135 BOOLEAN bA2dpExist; 136 BOOLEAN bHidExist; 137 BOOLEAN bPanExist; 138 BOOLEAN bBtHiPriLinkExist; 139 u1Byte nNumOfProfile; 140 141 BOOLEAN bUnderLps; 142 BOOLEAN bUnderIps; 143 u4Byte specialPktPeriodCnt; 144 u4Byte highPriorityTx; 145 u4Byte highPriorityRx; 146 u4Byte lowPriorityTx; 147 u4Byte lowPriorityRx; 148 s1Byte btRssi; 149 BOOLEAN bBtTxRxMask; 150 u1Byte preBtRssiState; 151 u1Byte preWifiRssiState[4]; 152 BOOLEAN bC2hBtInfoReqSent; 153 u1Byte btInfoC2h[BT_INFO_SRC_8723B_1ANT_MAX][10]; 154 u4Byte btInfoC2hCnt[BT_INFO_SRC_8723B_1ANT_MAX]; 155 BOOLEAN bBtWhckTest; 156 BOOLEAN bC2hBtInquiryPage; 157 BOOLEAN bC2hBtRemoteNameReq; 158 BOOLEAN bWiFiIsHighPriTask; //Add for win8.1 page out issue 159 u1Byte btRetryCnt; 160 u1Byte btInfoExt; 161 u4Byte popEventCnt; 162 u1Byte nScanAPNum; 163 164 u4Byte nCRCOK_CCK; 165 u4Byte nCRCOK_11g; 166 u4Byte nCRCOK_11n; 167 u4Byte nCRCOK_11nAgg; 168 169 u4Byte nCRCErr_CCK; 170 u4Byte nCRCErr_11g; 171 u4Byte nCRCErr_11n; 172 u4Byte nCRCErr_11nAgg; 173 174 BOOLEAN bCCKLock; 175 BOOLEAN bPreCCKLock; 176 BOOLEAN bCCKEverLock; 177 u1Byte nCoexTableType; 178 179 BOOLEAN bForceLpsOn; 180 u4Byte wrongProfileNotification; 181 182 u1Byte nA2DPBitPool; 183 u1Byte nCutVersion; 184 }COEX_STA_8723B_1ANT, *PCOEX_STA_8723B_1ANT; 185 186 #define BT_8723B_1ANT_ANTDET_PSD_POINTS 256 //MAX:1024 187 #define BT_8723B_1ANT_ANTDET_PSD_AVGNUM 1 //MAX:3 188 #define BT_8723B_1ANT_ANTDET_BUF_LEN 16 189 190 typedef struct _PSDSCAN_STA_8723B_1ANT{ 191 192 u4Byte nAntDet_BTLEChannel; //BT LE Channel ex:2412 193 u4Byte nAntDet_BTTxTime; 194 u4Byte nAntDet_PrePSDScanPeakVal; 195 BOOLEAN nAntDet_IsAntDetAvailable; 196 u4Byte nAntDet_PSDScanPeakVal; 197 BOOLEAN nAntDet_IsBTReplyAvailable; 198 u4Byte nAntDet_PSDScanPeakFreq; 199 200 u1Byte nAntDet_Result; 201 u1Byte nAntDet_PeakVal[BT_8723B_1ANT_ANTDET_BUF_LEN]; 202 u1Byte nAntDet_PeakFreq[BT_8723B_1ANT_ANTDET_BUF_LEN]; 203 u4Byte bAntDet_TryCount; 204 u4Byte bAntDet_FailCount; 205 u4Byte nAntDet_IntevalCount; 206 u4Byte nAntDet_ThresOffset; 207 208 u4Byte nRealCentFreq; 209 s4Byte nRealOffset; 210 u4Byte nRealSpan; 211 212 u4Byte nPSDBandWidth; //unit: Hz 213 u4Byte nPSDPoint; //128/256/512/1024 214 u4Byte nPSDReport[1024]; //unit:dB (20logx), 0~255 215 u4Byte nPSDReport_MaxHold[1024]; //unit:dB (20logx), 0~255 216 u4Byte nPSDStartPoint; 217 u4Byte nPSDStopPoint; 218 u4Byte nPSDMaxValuePoint; 219 u4Byte nPSDMaxValue; 220 u4Byte nPSDStartBase; 221 u4Byte nPSDAvgNum; // 1/8/16/32 222 u4Byte nPSDGenCount; 223 BOOLEAN bIsPSDRunning; 224 BOOLEAN bIsPSDShowMaxOnly; 225 } PSDSCAN_STA_8723B_1ANT, *PPSDSCAN_STA_8723B_1ANT; 226 227 //=========================================== 228 // The following is interface which will notify coex module. 229 //=========================================== 230 VOID 231 EXhalbtc8723b1ant_PowerOnSetting( 232 IN PBTC_COEXIST pBtCoexist 233 ); 234 VOID 235 EXhalbtc8723b1ant_PreLoadFirmware( 236 IN PBTC_COEXIST pBtCoexist 237 ); 238 VOID 239 EXhalbtc8723b1ant_InitHwConfig( 240 IN PBTC_COEXIST pBtCoexist, 241 IN BOOLEAN bWifiOnly 242 ); 243 VOID 244 EXhalbtc8723b1ant_InitCoexDm( 245 IN PBTC_COEXIST pBtCoexist 246 ); 247 VOID 248 EXhalbtc8723b1ant_IpsNotify( 249 IN PBTC_COEXIST pBtCoexist, 250 IN u1Byte type 251 ); 252 VOID 253 EXhalbtc8723b1ant_LpsNotify( 254 IN PBTC_COEXIST pBtCoexist, 255 IN u1Byte type 256 ); 257 VOID 258 EXhalbtc8723b1ant_ScanNotify( 259 IN PBTC_COEXIST pBtCoexist, 260 IN u1Byte type 261 ); 262 VOID 263 EXhalbtc8723b1ant_ConnectNotify( 264 IN PBTC_COEXIST pBtCoexist, 265 IN u1Byte type 266 ); 267 VOID 268 EXhalbtc8723b1ant_MediaStatusNotify( 269 IN PBTC_COEXIST pBtCoexist, 270 IN u1Byte type 271 ); 272 VOID 273 EXhalbtc8723b1ant_SpecialPacketNotify( 274 IN PBTC_COEXIST pBtCoexist, 275 IN u1Byte type 276 ); 277 VOID 278 EXhalbtc8723b1ant_BtInfoNotify( 279 IN PBTC_COEXIST pBtCoexist, 280 IN pu1Byte tmpBuf, 281 IN u1Byte length 282 ); 283 VOID 284 EXhalbtc8723b1ant_RfStatusNotify( 285 IN PBTC_COEXIST pBtCoexist, 286 IN u1Byte type 287 ); 288 VOID 289 EXhalbtc8723b1ant_HaltNotify( 290 IN PBTC_COEXIST pBtCoexist 291 ); 292 VOID 293 EXhalbtc8723b1ant_PnpNotify( 294 IN PBTC_COEXIST pBtCoexist, 295 IN u1Byte pnpState 296 ); 297 VOID 298 EXhalbtc8723b1ant_CoexDmReset( 299 IN PBTC_COEXIST pBtCoexist 300 ); 301 VOID 302 EXhalbtc8723b1ant_Periodical( 303 IN PBTC_COEXIST pBtCoexist 304 ); 305 VOID 306 EXhalbtc8723b1ant_DisplayCoexInfo( 307 IN PBTC_COEXIST pBtCoexist 308 ); 309 VOID 310 EXhalbtc8723b1ant_AntennaDetection( 311 IN PBTC_COEXIST pBtCoexist, 312 IN u4Byte centFreq, 313 IN u4Byte offset, 314 IN u4Byte span, 315 IN u4Byte seconds 316 ); 317 VOID 318 EXhalbtc8723b1ant_AntennaIsolation( 319 IN PBTC_COEXIST pBtCoexist, 320 IN u4Byte centFreq, 321 IN u4Byte offset, 322 IN u4Byte span, 323 IN u4Byte seconds 324 ); 325 326 VOID 327 EXhalbtc8723b1ant_PSDScan( 328 IN PBTC_COEXIST pBtCoexist, 329 IN u4Byte centFreq, 330 IN u4Byte offset, 331 IN u4Byte span, 332 IN u4Byte seconds 333 ); 334 VOID 335 EXhalbtc8723b1ant_DisplayAntDetection( 336 IN PBTC_COEXIST pBtCoexist 337 ); 338 339