Linux-libre 4.14.12-gnu
[librecmc/linux-libre.git] / drivers / staging / rtl8723bs / hal / HalBtc8723b2Ant.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  ******************************************************************************/
15 /*  The following is for 8723B 2Ant BT Co-exist definition */
16 #define BT_INFO_8723B_2ANT_B_FTP                BIT7
17 #define BT_INFO_8723B_2ANT_B_A2DP               BIT6
18 #define BT_INFO_8723B_2ANT_B_HID                BIT5
19 #define BT_INFO_8723B_2ANT_B_SCO_BUSY           BIT4
20 #define BT_INFO_8723B_2ANT_B_ACL_BUSY           BIT3
21 #define BT_INFO_8723B_2ANT_B_INQ_PAGE           BIT2
22 #define BT_INFO_8723B_2ANT_B_SCO_ESCO           BIT1
23 #define BT_INFO_8723B_2ANT_B_CONNECTION         BIT0
24
25 #define         BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT             2
26
27 typedef enum _BT_INFO_SRC_8723B_2ANT {
28         BT_INFO_SRC_8723B_2ANT_WIFI_FW        = 0x0,
29         BT_INFO_SRC_8723B_2ANT_BT_RSP         = 0x1,
30         BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2,
31         BT_INFO_SRC_8723B_2ANT_MAX
32 } BT_INFO_SRC_8723B_2ANT, *PBT_INFO_SRC_8723B_2ANT;
33
34 typedef enum _BT_8723B_2ANT_BT_STATUS {
35         BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
36         BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE     = 0x1,
37         BT_8723B_2ANT_BT_STATUS_INQ_PAGE           = 0x2,
38         BT_8723B_2ANT_BT_STATUS_ACL_BUSY           = 0x3,
39         BT_8723B_2ANT_BT_STATUS_SCO_BUSY           = 0x4,
40         BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY       = 0x5,
41         BT_8723B_2ANT_BT_STATUS_MAX
42 } BT_8723B_2ANT_BT_STATUS, *PBT_8723B_2ANT_BT_STATUS;
43
44 typedef enum _BT_8723B_2ANT_COEX_ALGO {
45         BT_8723B_2ANT_COEX_ALGO_UNDEFINED       = 0x0,
46         BT_8723B_2ANT_COEX_ALGO_SCO             = 0x1,
47         BT_8723B_2ANT_COEX_ALGO_HID             = 0x2,
48         BT_8723B_2ANT_COEX_ALGO_A2DP            = 0x3,
49         BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS      = 0x4,
50         BT_8723B_2ANT_COEX_ALGO_PANEDR          = 0x5,
51         BT_8723B_2ANT_COEX_ALGO_PANHS           = 0x6,
52         BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP     = 0x7,
53         BT_8723B_2ANT_COEX_ALGO_PANEDR_HID      = 0x8,
54         BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
55         BT_8723B_2ANT_COEX_ALGO_HID_A2DP        = 0xa,
56         BT_8723B_2ANT_COEX_ALGO_MAX             = 0xb,
57 } BT_8723B_2ANT_COEX_ALGO, *PBT_8723B_2ANT_COEX_ALGO;
58
59 typedef struct _COEX_DM_8723B_2ANT {
60         /*  fw mechanism */
61         u8 preBtDecPwrLvl;
62         u8 curBtDecPwrLvl;
63         u8 preFwDacSwingLvl;
64         u8 curFwDacSwingLvl;
65         bool bCurIgnoreWlanAct;
66         bool bPreIgnoreWlanAct;
67         u8 prePsTdma;
68         u8 curPsTdma;
69         u8 psTdmaPara[5];
70         u8 psTdmaDuAdjType;
71         bool bResetTdmaAdjust;
72         bool bAutoTdmaAdjust;
73         bool bPrePsTdmaOn;
74         bool bCurPsTdmaOn;
75         bool bPreBtAutoReport;
76         bool bCurBtAutoReport;
77
78         /*  sw mechanism */
79         bool bPreRfRxLpfShrink;
80         bool bCurRfRxLpfShrink;
81         u32 btRf0x1eBackup;
82         bool bPreLowPenaltyRa;
83         bool bCurLowPenaltyRa;
84         bool bPreDacSwingOn;
85         u32  preDacSwingLvl;
86         bool bCurDacSwingOn;
87         u32  curDacSwingLvl;
88         bool bPreAdcBackOff;
89         bool bCurAdcBackOff;
90         bool bPreAgcTableEn;
91         bool bCurAgcTableEn;
92         u32 preVal0x6c0;
93         u32 curVal0x6c0;
94         u32 preVal0x6c4;
95         u32 curVal0x6c4;
96         u32 preVal0x6c8;
97         u32 curVal0x6c8;
98         u8 preVal0x6cc;
99         u8 curVal0x6cc;
100         bool bLimitedDig;
101
102         /*  algorithm related */
103         u8 preAlgorithm;
104         u8 curAlgorithm;
105         u8 btStatus;
106         u8 wifiChnlInfo[3];
107
108         bool bNeedRecover0x948;
109         u32 backup0x948;
110 } COEX_DM_8723B_2ANT, *PCOEX_DM_8723B_2ANT;
111
112 typedef struct _COEX_STA_8723B_2ANT {
113         bool bBtLinkExist;
114         bool bScoExist;
115         bool bA2dpExist;
116         bool bHidExist;
117         bool bPanExist;
118
119         bool bUnderLps;
120         bool bUnderIps;
121         u32 highPriorityTx;
122         u32 highPriorityRx;
123         u32 lowPriorityTx;
124         u32 lowPriorityRx;
125         u8 btRssi;
126         bool bBtTxRxMask;
127         u8 preBtRssiState;
128         u8 preWifiRssiState[4];
129         bool bC2hBtInfoReqSent;
130         u8 btInfoC2h[BT_INFO_SRC_8723B_2ANT_MAX][10];
131         u32 btInfoC2hCnt[BT_INFO_SRC_8723B_2ANT_MAX];
132         bool bC2hBtInquiryPage;
133         u8 btRetryCnt;
134         u8 btInfoExt;
135 } COEX_STA_8723B_2ANT, *PCOEX_STA_8723B_2ANT;
136
137 /*  */
138 /*  The following is interface which will notify coex module. */
139 /*  */
140 void EXhalbtc8723b2ant_PowerOnSetting(PBTC_COEXIST pBtCoexist);
141 void EXhalbtc8723b2ant_InitHwConfig(PBTC_COEXIST pBtCoexist, bool bWifiOnly);
142 void EXhalbtc8723b2ant_InitCoexDm(PBTC_COEXIST pBtCoexist);
143 void EXhalbtc8723b2ant_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type);
144 void EXhalbtc8723b2ant_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type);
145 void EXhalbtc8723b2ant_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type);
146 void EXhalbtc8723b2ant_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 type);
147 void EXhalbtc8723b2ant_MediaStatusNotify(PBTC_COEXIST pBtCoexist, u8 type);
148 void EXhalbtc8723b2ant_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 type);
149 void EXhalbtc8723b2ant_BtInfoNotify(
150         PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length
151 );
152 void EXhalbtc8723b2ant_HaltNotify(PBTC_COEXIST pBtCoexist);
153 void EXhalbtc8723b2ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState);
154 void EXhalbtc8723b2ant_Periodical(PBTC_COEXIST pBtCoexist);
155 void EXhalbtc8723b2ant_DisplayCoexInfo(PBTC_COEXIST pBtCoexist);