1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /****************************************************************************** 3 * 4 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. 5 * 6 ******************************************************************************/ 7 /* The following is for 8723B 2Ant BT Co-exist definition */ 8 #define BT_INFO_8723B_2ANT_B_FTP BIT7 9 #define BT_INFO_8723B_2ANT_B_A2DP BIT6 10 #define BT_INFO_8723B_2ANT_B_HID BIT5 11 #define BT_INFO_8723B_2ANT_B_SCO_BUSY BIT4 12 #define BT_INFO_8723B_2ANT_B_ACL_BUSY BIT3 13 #define BT_INFO_8723B_2ANT_B_INQ_PAGE BIT2 14 #define BT_INFO_8723B_2ANT_B_SCO_ESCO BIT1 15 #define BT_INFO_8723B_2ANT_B_CONNECTION BIT0 16 17 #define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT 2 18 19 enum { 20 BT_INFO_SRC_8723B_2ANT_WIFI_FW = 0x0, 21 BT_INFO_SRC_8723B_2ANT_BT_RSP = 0x1, 22 BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2, 23 BT_INFO_SRC_8723B_2ANT_MAX 24 }; 25 26 enum { 27 BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, 28 BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1, 29 BT_8723B_2ANT_BT_STATUS_INQ_PAGE = 0x2, 30 BT_8723B_2ANT_BT_STATUS_ACL_BUSY = 0x3, 31 BT_8723B_2ANT_BT_STATUS_SCO_BUSY = 0x4, 32 BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5, 33 BT_8723B_2ANT_BT_STATUS_MAX 34 }; 35 36 enum { 37 BT_8723B_2ANT_COEX_ALGO_UNDEFINED = 0x0, 38 BT_8723B_2ANT_COEX_ALGO_SCO = 0x1, 39 BT_8723B_2ANT_COEX_ALGO_HID = 0x2, 40 BT_8723B_2ANT_COEX_ALGO_A2DP = 0x3, 41 BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4, 42 BT_8723B_2ANT_COEX_ALGO_PANEDR = 0x5, 43 BT_8723B_2ANT_COEX_ALGO_PANHS = 0x6, 44 BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7, 45 BT_8723B_2ANT_COEX_ALGO_PANEDR_HID = 0x8, 46 BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9, 47 BT_8723B_2ANT_COEX_ALGO_HID_A2DP = 0xa, 48 BT_8723B_2ANT_COEX_ALGO_MAX = 0xb, 49 }; 50 51 struct coex_dm_8723b_2ant { 52 /* fw mechanism */ 53 u8 preBtDecPwrLvl; 54 u8 curBtDecPwrLvl; 55 u8 preFwDacSwingLvl; 56 u8 curFwDacSwingLvl; 57 bool bCurIgnoreWlanAct; 58 bool bPreIgnoreWlanAct; 59 u8 prePsTdma; 60 u8 curPsTdma; 61 u8 psTdmaPara[5]; 62 u8 psTdmaDuAdjType; 63 bool bResetTdmaAdjust; 64 bool bAutoTdmaAdjust; 65 bool bPrePsTdmaOn; 66 bool bCurPsTdmaOn; 67 bool bPreBtAutoReport; 68 bool bCurBtAutoReport; 69 70 /* sw mechanism */ 71 bool bPreRfRxLpfShrink; 72 bool bCurRfRxLpfShrink; 73 u32 btRf0x1eBackup; 74 bool bPreLowPenaltyRa; 75 bool bCurLowPenaltyRa; 76 bool bPreDacSwingOn; 77 u32 preDacSwingLvl; 78 bool bCurDacSwingOn; 79 u32 curDacSwingLvl; 80 bool bPreAdcBackOff; 81 bool bCurAdcBackOff; 82 bool bPreAgcTableEn; 83 bool bCurAgcTableEn; 84 u32 preVal0x6c0; 85 u32 curVal0x6c0; 86 u32 preVal0x6c4; 87 u32 curVal0x6c4; 88 u32 preVal0x6c8; 89 u32 curVal0x6c8; 90 u8 preVal0x6cc; 91 u8 curVal0x6cc; 92 bool bLimitedDig; 93 94 /* algorithm related */ 95 u8 preAlgorithm; 96 u8 curAlgorithm; 97 u8 btStatus; 98 u8 wifiChnlInfo[3]; 99 100 bool bNeedRecover0x948; 101 u32 backup0x948; 102 }; 103 104 struct coex_sta_8723b_2ant { 105 bool bBtLinkExist; 106 bool bScoExist; 107 bool bA2dpExist; 108 bool bHidExist; 109 bool bPanExist; 110 111 bool bUnderLps; 112 bool bUnderIps; 113 u32 highPriorityTx; 114 u32 highPriorityRx; 115 u32 lowPriorityTx; 116 u32 lowPriorityRx; 117 u8 btRssi; 118 bool bBtTxRxMask; 119 u8 preBtRssiState; 120 u8 preWifiRssiState[4]; 121 bool bC2hBtInfoReqSent; 122 u8 btInfoC2h[BT_INFO_SRC_8723B_2ANT_MAX][10]; 123 u32 btInfoC2hCnt[BT_INFO_SRC_8723B_2ANT_MAX]; 124 bool bC2hBtInquiryPage; 125 u8 btRetryCnt; 126 u8 btInfoExt; 127 }; 128 129 /* */ 130 /* The following is interface which will notify coex module. */ 131 /* */ 132 void EXhalbtc8723b2ant_PowerOnSetting(struct btc_coexist *pBtCoexist); 133 void EXhalbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOnly); 134 void EXhalbtc8723b2ant_InitCoexDm(struct btc_coexist *pBtCoexist); 135 void EXhalbtc8723b2ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type); 136 void EXhalbtc8723b2ant_LpsNotify(struct btc_coexist *pBtCoexist, u8 type); 137 void EXhalbtc8723b2ant_ScanNotify(struct btc_coexist *pBtCoexist, u8 type); 138 void EXhalbtc8723b2ant_ConnectNotify(struct btc_coexist *pBtCoexist, u8 type); 139 void EXhalbtc8723b2ant_MediaStatusNotify(struct btc_coexist *pBtCoexist, u8 type); 140 void EXhalbtc8723b2ant_SpecialPacketNotify(struct btc_coexist *pBtCoexist, u8 type); 141 void EXhalbtc8723b2ant_BtInfoNotify( 142 struct btc_coexist *pBtCoexist, u8 *tmpBuf, u8 length 143 ); 144 void EXhalbtc8723b2ant_HaltNotify(struct btc_coexist *pBtCoexist); 145 void EXhalbtc8723b2ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState); 146 void EXhalbtc8723b2ant_Periodical(struct btc_coexist *pBtCoexist); 147