Linux-libre 3.17.4-gnu
[librecmc/linux-libre.git] / drivers / net / wireless / rtlwifi / rtl8723ae / hal_btc.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2009-2012  Realtek Corporation.
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  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  * The full GNU General Public License is included in this distribution in the
19  * file called LICENSE.
20  *
21  * Contact Information:
22  * wlanfae <wlanfae@realtek.com>
23  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24  * Hsinchu 300, Taiwan.
25  * Larry Finger <Larry.Finger@lwfinger.net>
26  *
27  ****************************************************************************
28  */
29
30 #ifndef __RTL8723E_HAL_BTC_H__
31 #define __RTL8723E_HAL_BTC_H__
32
33 #include "../wifi.h"
34 #include "btc.h"
35 #include "hal_bt_coexist.h"
36
37 #define BT_TXRX_CNT_THRES_1             1200
38 #define BT_TXRX_CNT_THRES_2             1400
39 #define BT_TXRX_CNT_THRES_3             3000
40 #define BT_TXRX_CNT_LEVEL_0             0       /* < 1200 */
41 #define BT_TXRX_CNT_LEVEL_1             1       /* >= 1200 && < 1400 */
42 #define BT_TXRX_CNT_LEVEL_2             2       /* >= 1400 */
43 #define BT_TXRX_CNT_LEVEL_3             3
44
45 /* TDMA mode definition */
46 #define TDMA_2ANT               0
47 #define TDMA_1ANT               1
48 #define TDMA_NAV_OFF            0
49 #define TDMA_NAV_ON             1
50 #define TDMA_DAC_SWING_OFF      0
51 #define TDMA_DAC_SWING_ON       1
52
53 /* PTA mode related definition */
54 #define BT_PTA_MODE_OFF         0
55 #define BT_PTA_MODE_ON          1
56
57 /* Penalty Tx Rate Adaptive */
58 #define BT_TX_RATE_ADAPTIVE_NORMAL      0
59 #define BT_TX_RATE_ADAPTIVE_LOW_PENALTY 1
60
61 /* RF Corner */
62 #define BT_RF_RX_LPF_CORNER_RESUME      0
63 #define BT_RF_RX_LPF_CORNER_SHRINK      1
64
65 #define C2H_EVT_HOST_CLOSE              0x00
66 #define C2H_EVT_FW_CLOSE                0xFF
67
68 enum bt_traffic_mode {
69         BT_MOTOR_EXT_BE = 0x00,
70         BT_MOTOR_EXT_GUL = 0x01,
71         BT_MOTOR_EXT_GUB = 0x02,
72         BT_MOTOR_EXT_GULB = 0x03
73 };
74
75 enum bt_traffic_mode_profile {
76         BT_PROFILE_NONE,
77         BT_PROFILE_A2DP,
78         BT_PROFILE_PAN,
79         BT_PROFILE_HID,
80         BT_PROFILE_SCO
81 };
82
83 enum hci_ext_bt_operation {
84         HCI_BT_OP_NONE = 0x0,
85         HCI_BT_OP_INQUIRE_START = 0x1,
86         HCI_BT_OP_INQUIRE_FINISH = 0x2,
87         HCI_BT_OP_PAGING_START = 0x3,
88         HCI_BT_OP_PAGING_SUCCESS = 0x4,
89         HCI_BT_OP_PAGING_UNSUCCESS = 0x5,
90         HCI_BT_OP_PAIRING_START = 0x6,
91         HCI_BT_OP_PAIRING_FINISH = 0x7,
92         HCI_BT_OP_BT_DEV_ENABLE = 0x8,
93         HCI_BT_OP_BT_DEV_DISABLE = 0x9,
94         HCI_BT_OP_MAX,
95 };
96
97 enum bt_spec {
98         BT_SPEC_1_0_b = 0x00,
99         BT_SPEC_1_1 = 0x01,
100         BT_SPEC_1_2 = 0x02,
101         BT_SPEC_2_0_EDR = 0x03,
102         BT_SPEC_2_1_EDR = 0x04,
103         BT_SPEC_3_0_HS = 0x05,
104         BT_SPEC_4_0 = 0x06
105 };
106
107 struct c2h_evt_hdr {
108         u8 cmd_id;
109         u8 cmd_len;
110         u8 cmd_seq;
111 };
112
113 enum bt_state {
114         BT_INFO_STATE_DISABLED = 0,
115         BT_INFO_STATE_NO_CONNECTION = 1,
116         BT_INFO_STATE_CONNECT_IDLE = 2,
117         BT_INFO_STATE_INQ_OR_PAG = 3,
118         BT_INFO_STATE_ACL_ONLY_BUSY = 4,
119         BT_INFO_STATE_SCO_ONLY_BUSY = 5,
120         BT_INFO_STATE_ACL_SCO_BUSY = 6,
121         BT_INFO_STATE_HID_BUSY = 7,
122         BT_INFO_STATE_HID_SCO_BUSY = 8,
123         BT_INFO_STATE_MAX = 7
124 };
125
126 enum rtl8723ae_c2h_evt {
127         C2H_DBG = 0,
128         C2H_TSF = 1,
129         C2H_AP_RPT_RSP = 2,
130         C2H_CCX_TX_RPT = 3,     /* The FW notify the report of the specific */
131                                 /* tx packet. */
132         C2H_BT_RSSI = 4,
133         C2H_BT_OP_MODE = 5,
134         C2H_HW_INFO_EXCH = 10,
135         C2H_C2H_H2C_TEST = 11,
136         BT_INFO = 12,
137         MAX_C2HEVENT
138 };
139
140 void rtl8723ae_dm_bt_fw_coex_all_off_8723a(struct ieee80211_hw *hw);
141 void rtl8723ae_dm_bt_sw_coex_all_off_8723a(struct ieee80211_hw *hw);
142 void rtl8723ae_dm_bt_hw_coex_all_off_8723a(struct ieee80211_hw *hw);
143 void rtl8723ae_dm_bt_coexist_8723(struct ieee80211_hw *hw);
144 void rtl8723ae_dm_bt_set_bt_dm(struct ieee80211_hw *hw,
145                               struct btdm_8723 *p_btdm);
146 void rtl_8723e_c2h_command_handle(struct ieee80211_hw *hw);
147 void rtl_8723e_bt_wifi_media_status_notify(struct ieee80211_hw *hw,
148                                            bool mstatus);
149 void rtl8723ae_bt_coex_off_before_lps(struct ieee80211_hw *hw);
150
151 #endif