Merge tag 'nfs-for-3.14-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / staging / rtl8821ae / rtl8821ae / hal_btc.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2009-2010  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 #ifndef __RTL8821AE_HAL_BTC_H__
30 #define __RTL8821AE_HAL_BTC_H__
31
32 #include "../wifi.h"
33 #include "btc.h"
34 #include "hal_bt_coexist.h"
35
36 #define BT_TXRX_CNT_THRES_1                             1200
37 #define BT_TXRX_CNT_THRES_2                             1400
38 #define BT_TXRX_CNT_THRES_3                             3000
39 #define BT_TXRX_CNT_LEVEL_0                             0       // < 1200
40 #define BT_TXRX_CNT_LEVEL_1                             1       // >= 1200 && < 1400
41 #define BT_TXRX_CNT_LEVEL_2                             2       // >= 1400
42 #define BT_TXRX_CNT_LEVEL_3                             3
43
44
45
46 #define BT_COEX_DISABLE         0
47 #define BT_Q_PKT_OFF            0
48 #define BT_Q_PKT_ON                     1
49
50 #define BT_TX_PWR_OFF           0
51 #define BT_TX_PWR_ON            1
52
53 /* TDMA mode definition */
54 #define TDMA_2ANT                       0
55 #define TDMA_1ANT                       1
56 #define TDMA_NAV_OFF            0
57 #define TDMA_NAV_ON                     1
58 #define TDMA_DAC_SWING_OFF      0
59 #define TDMA_DAC_SWING_ON       1
60
61 /* PTA mode related definition */
62 #define BT_PTA_MODE_OFF         0
63 #define BT_PTA_MODE_ON          1
64
65 /* Penalty Tx Rate Adaptive */
66 #define BT_TX_RATE_ADAPTIVE_NORMAL      0
67 #define BT_TX_RATE_ADAPTIVE_LOW_PENALTY 1
68
69 /* RF Corner */
70 #define BT_RF_RX_LPF_CORNER_RESUME      0
71 #define BT_RF_RX_LPF_CORNER_SHRINK      1
72
73 #define C2H_EVT_HOST_CLOSE              0x00
74 #define C2H_EVT_FW_CLOSE                0xFF
75
76 enum bt_traffic_mode {
77         BT_MOTOR_EXT_BE = 0x00,
78         BT_MOTOR_EXT_GUL = 0x01,
79         BT_MOTOR_EXT_GUB = 0x02,
80         BT_MOTOR_EXT_GULB = 0x03
81 };
82
83 enum bt_traffic_mode_profile {
84         BT_PROFILE_NONE,
85         BT_PROFILE_A2DP,
86         BT_PROFILE_PAN,
87         BT_PROFILE_HID,
88         BT_PROFILE_SCO
89 };
90
91 enum hci_ext_bt_operation {
92         HCI_BT_OP_NONE = 0x0,
93         HCI_BT_OP_INQUIRE_START = 0x1,
94         HCI_BT_OP_INQUIRE_FINISH = 0x2,
95         HCI_BT_OP_PAGING_START = 0x3,
96         HCI_BT_OP_PAGING_SUCCESS = 0x4,
97         HCI_BT_OP_PAGING_UNSUCCESS = 0x5,
98         HCI_BT_OP_PAIRING_START = 0x6,
99         HCI_BT_OP_PAIRING_FINISH = 0x7,
100         HCI_BT_OP_BT_DEV_ENABLE = 0x8,
101         HCI_BT_OP_BT_DEV_DISABLE = 0x9,
102         HCI_BT_OP_MAX,
103 };
104
105 enum bt_spec {
106         BT_SPEC_1_0_b = 0x00,
107         BT_SPEC_1_1 = 0x01,
108         BT_SPEC_1_2 = 0x02,
109         BT_SPEC_2_0_EDR = 0x03,
110         BT_SPEC_2_1_EDR = 0x04,
111         BT_SPEC_3_0_HS = 0x05,
112         BT_SPEC_4_0 = 0x06
113 };
114
115 struct c2h_evt_hdr {
116         u8 cmd_id;
117         u8 cmd_len;
118         u8 cmd_seq;
119 };
120
121 enum bt_state{
122         BT_INFO_STATE_DISABLED = 0,
123         BT_INFO_STATE_NO_CONNECTION = 1,
124         BT_INFO_STATE_CONNECT_IDLE = 2,
125         BT_INFO_STATE_INQ_OR_PAG = 3,
126         BT_INFO_STATE_ACL_ONLY_BUSY = 4,
127         BT_INFO_STATE_SCO_ONLY_BUSY = 5,
128         BT_INFO_STATE_ACL_SCO_BUSY = 6,
129         BT_INFO_STATE_HID_BUSY = 7,
130         BT_INFO_STATE_HID_SCO_BUSY = 8,
131         BT_INFO_STATE_MAX = 7
132 };
133
134 enum rtl8723be_c2h_evt {
135         C2H_DBG = 0,
136         C2H_TSF = 1,
137         C2H_AP_RPT_RSP = 2,
138         C2H_CCX_TX_RPT = 3,     // The FW notify the report of the specific tx packet.
139         C2H_BT_RSSI = 4,
140         C2H_BT_OP_MODE = 5,
141         C2H_HW_INFO_EXCH = 10,
142         C2H_C2H_H2C_TEST = 11,
143         BT_INFO = 9,
144         MAX_C2HEVENT
145 };
146
147
148
149 void rtl8821ae_dm_bt_fw_coex_all_off_8723a(struct ieee80211_hw *hw);
150 void rtl8821ae_dm_bt_sw_coex_all_off_8723a(struct ieee80211_hw *hw);
151 void rtl8821ae_dm_bt_hw_coex_all_off_8723a(struct ieee80211_hw *hw);
152 void rtl8821ae_dm_bt_coexist(struct ieee80211_hw *hw);
153 void rtl8821ae_dm_bt_set_bt_dm(struct ieee80211_hw *hw, struct btdm_8821ae *p_btdm);
154 void rtl_8821ae_c2h_command_handle(struct ieee80211_hw * hw);
155 void rtl_8821ae_bt_wifi_media_status_notify(struct ieee80211_hw * hw, bool mstatus);
156 void rtl8821ae_dm_bt_turn_off_bt_coexist_before_enter_lps(struct ieee80211_hw *hw);
157
158
159
160 #endif