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 1ANT BT Co-exist definition */
0008 #define BT_INFO_8723B_1ANT_B_FTP        BIT7
0009 #define BT_INFO_8723B_1ANT_B_A2DP       BIT6
0010 #define BT_INFO_8723B_1ANT_B_HID        BIT5
0011 #define BT_INFO_8723B_1ANT_B_SCO_BUSY       BIT4
0012 #define BT_INFO_8723B_1ANT_B_ACL_BUSY       BIT3
0013 #define BT_INFO_8723B_1ANT_B_INQ_PAGE       BIT2
0014 #define BT_INFO_8723B_1ANT_B_SCO_ESCO       BIT1
0015 #define BT_INFO_8723B_1ANT_B_CONNECTION     BIT0
0016 
0017 #define BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_)   \
0018         (((_BT_INFO_EXT_ & BIT0)) ? true : false)
0019 
0020 #define BTC_RSSI_COEX_THRESH_TOL_8723B_1ANT 2
0021 
0022 #define  BT_8723B_1ANT_WIFI_NOISY_THRESH 30   /* max: 255 */
0023 
0024 enum {
0025     BT_INFO_SRC_8723B_1ANT_WIFI_FW          = 0x0,
0026     BT_INFO_SRC_8723B_1ANT_BT_RSP               = 0x1,
0027     BT_INFO_SRC_8723B_1ANT_BT_ACTIVE_SEND       = 0x2,
0028     BT_INFO_SRC_8723B_1ANT_MAX
0029 };
0030 
0031 enum {
0032     BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE  = 0x0,
0033     BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE      = 0x1,
0034     BT_8723B_1ANT_BT_STATUS_INQ_PAGE                = 0x2,
0035     BT_8723B_1ANT_BT_STATUS_ACL_BUSY                = 0x3,
0036     BT_8723B_1ANT_BT_STATUS_SCO_BUSY                = 0x4,
0037     BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY            = 0x5,
0038     BT_8723B_1ANT_BT_STATUS_MAX
0039 };
0040 
0041 enum {
0042     BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE           = 0x0,
0043     BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
0044     BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN               = 0x2,
0045     BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT        = 0x3,
0046     BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE               = 0x4,
0047     BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY               = 0x5,
0048     BT_8723B_1ANT_WIFI_STATUS_MAX
0049 };
0050 
0051 enum {
0052     BT_8723B_1ANT_COEX_ALGO_UNDEFINED       = 0x0,
0053     BT_8723B_1ANT_COEX_ALGO_SCO             = 0x1,
0054     BT_8723B_1ANT_COEX_ALGO_HID             = 0x2,
0055     BT_8723B_1ANT_COEX_ALGO_A2DP            = 0x3,
0056     BT_8723B_1ANT_COEX_ALGO_A2DP_PANHS      = 0x4,
0057     BT_8723B_1ANT_COEX_ALGO_PANEDR          = 0x5,
0058     BT_8723B_1ANT_COEX_ALGO_PANHS           = 0x6,
0059     BT_8723B_1ANT_COEX_ALGO_PANEDR_A2DP     = 0x7,
0060     BT_8723B_1ANT_COEX_ALGO_PANEDR_HID      = 0x8,
0061     BT_8723B_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
0062     BT_8723B_1ANT_COEX_ALGO_HID_A2DP        = 0xa,
0063     BT_8723B_1ANT_COEX_ALGO_MAX             = 0xb,
0064 };
0065 
0066 struct coex_dm_8723b_1ant {
0067     /*  fw mechanism */
0068     bool bCurIgnoreWlanAct;
0069     bool bPreIgnoreWlanAct;
0070     u8 prePsTdma;
0071     u8 curPsTdma;
0072     u8 psTdmaPara[5];
0073     u8 psTdmaDuAdjType;
0074     bool bAutoTdmaAdjust;
0075     bool bPrePsTdmaOn;
0076     bool bCurPsTdmaOn;
0077     bool bPreBtAutoReport;
0078     bool bCurBtAutoReport;
0079     u8 preLps;
0080     u8 curLps;
0081     u8 preRpwm;
0082     u8 curRpwm;
0083 
0084     /*  sw mechanism */
0085     bool bPreLowPenaltyRa;
0086     bool bCurLowPenaltyRa;
0087     u32 preVal0x6c0;
0088     u32 curVal0x6c0;
0089     u32 preVal0x6c4;
0090     u32 curVal0x6c4;
0091     u32 preVal0x6c8;
0092     u32 curVal0x6c8;
0093     u8 preVal0x6cc;
0094     u8 curVal0x6cc;
0095     bool bLimitedDig;
0096 
0097     u32 backupArfrCnt1; /*  Auto Rate Fallback Retry cnt */
0098     u32 backupArfrCnt2; /*  Auto Rate Fallback Retry cnt */
0099     u16 backupRetryLimit;
0100     u8 backupAmpduMaxTime;
0101 
0102     /*  algorithm related */
0103     u8 preAlgorithm;
0104     u8 curAlgorithm;
0105     u8 btStatus;
0106     u8 wifiChnlInfo[3];
0107 
0108     u32 preRaMask;
0109     u32 curRaMask;
0110     u8 preArfrType;
0111     u8 curArfrType;
0112     u8 preRetryLimitType;
0113     u8 curRetryLimitType;
0114     u8 preAmpduTimeType;
0115     u8 curAmpduTimeType;
0116     u32 nArpCnt;
0117 
0118     u8 errorCondition;
0119 };
0120 
0121 struct coex_sta_8723b_1ant {
0122     bool bBtLinkExist;
0123     bool bScoExist;
0124     bool bA2dpExist;
0125     bool bHidExist;
0126     bool bPanExist;
0127 
0128     bool bUnderLps;
0129     bool bUnderIps;
0130     u32 specialPktPeriodCnt;
0131     u32 highPriorityTx;
0132     u32 highPriorityRx;
0133     u32 lowPriorityTx;
0134     u32 lowPriorityRx;
0135     s8 btRssi;
0136     bool bBtTxRxMask;
0137     u8 preBtRssiState;
0138     u8 preWifiRssiState[4];
0139     bool bC2hBtInfoReqSent;
0140     u8 btInfoC2h[BT_INFO_SRC_8723B_1ANT_MAX][10];
0141     u32 btInfoC2hCnt[BT_INFO_SRC_8723B_1ANT_MAX];
0142     bool bC2hBtInquiryPage;
0143     bool bC2hBtPage; /* Add for win8.1 page out issue */
0144     bool bWiFiIsHighPriTask; /* Add for win8.1 page out issue */
0145     u8 btRetryCnt;
0146     u8 btInfoExt;
0147     u32 popEventCnt;
0148     u8 nScanAPNum;
0149 
0150     u32 nCRCOK_CCK;
0151     u32 nCRCOK_11g;
0152     u32 nCRCOK_11n;
0153     u32 nCRCOK_11nAgg;
0154 
0155     u32 nCRCErr_CCK;
0156     u32 nCRCErr_11g;
0157     u32 nCRCErr_11n;
0158     u32 nCRCErr_11nAgg;
0159 
0160     bool bCCKLock;
0161     bool bPreCCKLock;
0162     u8 nCoexTableType;
0163 
0164     bool bForceLpsOn;
0165 };
0166 
0167 /*  */
0168 /*  The following is interface which will notify coex module. */
0169 /*  */
0170 void EXhalbtc8723b1ant_PowerOnSetting(struct btc_coexist *pBtCoexist);
0171 void EXhalbtc8723b1ant_InitHwConfig(struct btc_coexist *pBtCoexist, bool bWifiOnly);
0172 void EXhalbtc8723b1ant_InitCoexDm(struct btc_coexist *pBtCoexist);
0173 void EXhalbtc8723b1ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type);
0174 void EXhalbtc8723b1ant_LpsNotify(struct btc_coexist *pBtCoexist, u8 type);
0175 void EXhalbtc8723b1ant_ScanNotify(struct btc_coexist *pBtCoexist, u8 type);
0176 void EXhalbtc8723b1ant_ConnectNotify(struct btc_coexist *pBtCoexist, u8 type);
0177 void EXhalbtc8723b1ant_MediaStatusNotify(struct btc_coexist *pBtCoexist, u8 type);
0178 void EXhalbtc8723b1ant_SpecialPacketNotify(struct btc_coexist *pBtCoexist, u8 type);
0179 void EXhalbtc8723b1ant_BtInfoNotify(
0180     struct btc_coexist *pBtCoexist, u8 *tmpBuf, u8 length
0181 );
0182 void EXhalbtc8723b1ant_HaltNotify(struct btc_coexist *pBtCoexist);
0183 void EXhalbtc8723b1ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState);
0184 void EXhalbtc8723b1ant_Periodical(struct btc_coexist *pBtCoexist);