Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /******************************************************************************
0003  *
0004  * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
0005  *
0006  ******************************************************************************/
0007 /*  The following is for 8723B 2Ant BT Co-exist definition */
0008 #define BT_INFO_8723B_2ANT_B_FTP        BIT7
0009 #define BT_INFO_8723B_2ANT_B_A2DP       BIT6
0010 #define BT_INFO_8723B_2ANT_B_HID        BIT5
0011 #define BT_INFO_8723B_2ANT_B_SCO_BUSY       BIT4
0012 #define BT_INFO_8723B_2ANT_B_ACL_BUSY       BIT3
0013 #define BT_INFO_8723B_2ANT_B_INQ_PAGE       BIT2
0014 #define BT_INFO_8723B_2ANT_B_SCO_ESCO       BIT1
0015 #define BT_INFO_8723B_2ANT_B_CONNECTION     BIT0
0016 
0017 #define     BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT     2
0018 
0019 enum {
0020     BT_INFO_SRC_8723B_2ANT_WIFI_FW        = 0x0,
0021     BT_INFO_SRC_8723B_2ANT_BT_RSP         = 0x1,
0022     BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2,
0023     BT_INFO_SRC_8723B_2ANT_MAX
0024 };
0025 
0026 enum {
0027     BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
0028     BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE     = 0x1,
0029     BT_8723B_2ANT_BT_STATUS_INQ_PAGE           = 0x2,
0030     BT_8723B_2ANT_BT_STATUS_ACL_BUSY           = 0x3,
0031     BT_8723B_2ANT_BT_STATUS_SCO_BUSY           = 0x4,
0032     BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY       = 0x5,
0033     BT_8723B_2ANT_BT_STATUS_MAX
0034 };
0035 
0036 enum {
0037     BT_8723B_2ANT_COEX_ALGO_UNDEFINED       = 0x0,
0038     BT_8723B_2ANT_COEX_ALGO_SCO             = 0x1,
0039     BT_8723B_2ANT_COEX_ALGO_HID             = 0x2,
0040     BT_8723B_2ANT_COEX_ALGO_A2DP            = 0x3,
0041     BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS      = 0x4,
0042     BT_8723B_2ANT_COEX_ALGO_PANEDR          = 0x5,
0043     BT_8723B_2ANT_COEX_ALGO_PANHS           = 0x6,
0044     BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP     = 0x7,
0045     BT_8723B_2ANT_COEX_ALGO_PANEDR_HID      = 0x8,
0046     BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
0047     BT_8723B_2ANT_COEX_ALGO_HID_A2DP        = 0xa,
0048     BT_8723B_2ANT_COEX_ALGO_MAX             = 0xb,
0049 };
0050 
0051 struct coex_dm_8723b_2ant {
0052     /*  fw mechanism */
0053     u8 preBtDecPwrLvl;
0054     u8 curBtDecPwrLvl;
0055     u8 preFwDacSwingLvl;
0056     u8 curFwDacSwingLvl;
0057     bool bCurIgnoreWlanAct;
0058     bool bPreIgnoreWlanAct;
0059     u8 prePsTdma;
0060     u8 curPsTdma;
0061     u8 psTdmaPara[5];
0062     u8 psTdmaDuAdjType;
0063     bool bResetTdmaAdjust;
0064     bool bAutoTdmaAdjust;
0065     bool bPrePsTdmaOn;
0066     bool bCurPsTdmaOn;
0067     bool bPreBtAutoReport;
0068     bool bCurBtAutoReport;
0069 
0070     /*  sw mechanism */
0071     bool bPreRfRxLpfShrink;
0072     bool bCurRfRxLpfShrink;
0073     u32 btRf0x1eBackup;
0074     bool bPreLowPenaltyRa;
0075     bool bCurLowPenaltyRa;
0076     bool bPreDacSwingOn;
0077     u32  preDacSwingLvl;
0078     bool bCurDacSwingOn;
0079     u32  curDacSwingLvl;
0080     bool bPreAdcBackOff;
0081     bool bCurAdcBackOff;
0082     bool bPreAgcTableEn;
0083     bool bCurAgcTableEn;
0084     u32 preVal0x6c0;
0085     u32 curVal0x6c0;
0086     u32 preVal0x6c4;
0087     u32 curVal0x6c4;
0088     u32 preVal0x6c8;
0089     u32 curVal0x6c8;
0090     u8 preVal0x6cc;
0091     u8 curVal0x6cc;
0092     bool bLimitedDig;
0093 
0094     /*  algorithm related */
0095     u8 preAlgorithm;
0096     u8 curAlgorithm;
0097     u8 btStatus;
0098     u8 wifiChnlInfo[3];
0099 
0100     bool bNeedRecover0x948;
0101     u32 backup0x948;
0102 };
0103 
0104 struct coex_sta_8723b_2ant {
0105     bool bBtLinkExist;
0106     bool bScoExist;
0107     bool bA2dpExist;
0108     bool bHidExist;
0109     bool bPanExist;
0110 
0111     bool bUnderLps;
0112     bool bUnderIps;
0113     u32 highPriorityTx;
0114     u32 highPriorityRx;
0115     u32 lowPriorityTx;
0116     u32 lowPriorityRx;
0117     u8 btRssi;
0118     bool bBtTxRxMask;
0119     u8 preBtRssiState;
0120     u8 preWifiRssiState[4];
0121     bool bC2hBtInfoReqSent;
0122     u8 btInfoC2h[BT_INFO_SRC_8723B_2ANT_MAX][10];
0123     u32 btInfoC2hCnt[BT_INFO_SRC_8723B_2ANT_MAX];
0124     bool bC2hBtInquiryPage;
0125     u8 btRetryCnt;
0126     u8 btInfoExt;
0127 };
0128 
0129 /*  */
0130 /*  The following is interface which will notify coex module. */
0131 /*  */
0132 void EXhalbtc8723b2ant_PowerOnSetting(struct btc_coexist *pBtCoexist);
0133 void EXhalbtc8723b2ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOnly);
0134 void EXhalbtc8723b2ant_InitCoexDm(struct btc_coexist *pBtCoexist);
0135 void EXhalbtc8723b2ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type);
0136 void EXhalbtc8723b2ant_LpsNotify(struct btc_coexist *pBtCoexist, u8 type);
0137 void EXhalbtc8723b2ant_ScanNotify(struct btc_coexist *pBtCoexist, u8 type);
0138 void EXhalbtc8723b2ant_ConnectNotify(struct btc_coexist *pBtCoexist, u8 type);
0139 void EXhalbtc8723b2ant_MediaStatusNotify(struct btc_coexist *pBtCoexist, u8 type);
0140 void EXhalbtc8723b2ant_SpecialPacketNotify(struct btc_coexist *pBtCoexist, u8 type);
0141 void EXhalbtc8723b2ant_BtInfoNotify(
0142     struct btc_coexist *pBtCoexist, u8 *tmpBuf, u8 length
0143 );
0144 void EXhalbtc8723b2ant_HaltNotify(struct btc_coexist *pBtCoexist);
0145 void EXhalbtc8723b2ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState);
0146 void EXhalbtc8723b2ant_Periodical(struct btc_coexist *pBtCoexist);