]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
[karo-tx-linux.git] / drivers / net / wireless / realtek / rtlwifi / btcoexist / halbtc8821a2ant.h
1 /******************************************************************************
2  *
3  * Copyright(c) 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  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  * wlanfae <wlanfae@realtek.com>
19  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20  * Hsinchu 300, Taiwan.
21  *
22  * Larry Finger <Larry.Finger@lwfinger.net>
23  *
24  *****************************************************************************/
25
26 /*===========================================
27  * The following is for 8821A 2Ant BT Co-exist definition
28  *===========================================
29 */
30 #define BT_INFO_8821A_2ANT_B_FTP                BIT7
31 #define BT_INFO_8821A_2ANT_B_A2DP               BIT6
32 #define BT_INFO_8821A_2ANT_B_HID                BIT5
33 #define BT_INFO_8821A_2ANT_B_SCO_BUSY           BIT4
34 #define BT_INFO_8821A_2ANT_B_ACL_BUSY           BIT3
35 #define BT_INFO_8821A_2ANT_B_INQ_PAGE           BIT2
36 #define BT_INFO_8821A_2ANT_B_SCO_ESCO           BIT1
37 #define BT_INFO_8821A_2ANT_B_CONNECTION         BIT0
38
39 #define BTC_RSSI_COEX_THRESH_TOL_8821A_2ANT     2
40
41 enum _BT_INFO_SRC_8821A_2ANT {
42         BT_INFO_SRC_8821A_2ANT_WIFI_FW          = 0x0,
43         BT_INFO_SRC_8821A_2ANT_BT_RSP           = 0x1,
44         BT_INFO_SRC_8821A_2ANT_BT_ACTIVE_SEND   = 0x2,
45         BT_INFO_SRC_8821A_2ANT_MAX
46 };
47
48 enum _BT_8821A_2ANT_BT_STATUS {
49         BT_8821A_2ANT_BT_STATUS_IDLE            = 0x0,
50         BT_8821A_2ANT_BT_STATUS_CON_IDLE        = 0x1,
51         BT_8821A_2ANT_BT_STATUS_NON_IDLE        = 0x2,
52         BT_8821A_2ANT_BT_STATUS_MAX
53 };
54
55 enum _BT_8821A_2ANT_COEX_ALGO {
56         BT_8821A_2ANT_COEX_ALGO_UNDEFINED               = 0x0,
57         BT_8821A_2ANT_COEX_ALGO_SCO                     = 0x1,
58         BT_8821A_2ANT_COEX_ALGO_HID                     = 0x2,
59         BT_8821A_2ANT_COEX_ALGO_A2DP                    = 0x3,
60         BT_8821A_2ANT_COEX_ALGO_A2DP_PANHS              = 0x4,
61         BT_8821A_2ANT_COEX_ALGO_PANEDR                  = 0x5,
62         BT_8821A_2ANT_COEX_ALGO_PANHS                   = 0x6,
63         BT_8821A_2ANT_COEX_ALGO_PANEDR_A2DP             = 0x7,
64         BT_8821A_2ANT_COEX_ALGO_PANEDR_HID              = 0x8,
65         BT_8821A_2ANT_COEX_ALGO_HID_A2DP_PANEDR         = 0x9,
66         BT_8821A_2ANT_COEX_ALGO_HID_A2DP                = 0xa,
67         BT_8821A_2ANT_COEX_ALGO_MAX                     = 0xb,
68 };
69
70 struct coex_dm_8821a_2ant {
71         /* fw mechanism */
72         bool            pre_dec_bt_pwr;
73         bool            cur_dec_bt_pwr;
74         bool            pre_bt_lna_constrain;
75         bool            cur_bt_lna_constrain;
76         u8              pre_bt_psd_mode;
77         u8              cur_bt_psd_mode;
78         u8              pre_fw_dac_swing_lvl;
79         u8              cur_fw_dac_swing_lvl;
80         bool            cur_ignore_wlan_act;
81         bool            pre_ignore_wlan_act;
82         u8              pre_ps_tdma;
83         u8              cur_ps_tdma;
84         u8              ps_tdma_para[5];
85         u8              tdma_adj_type;
86         bool            reset_tdma_adjust;
87         bool            pre_ps_tdma_on;
88         bool            cur_ps_tdma_on;
89         bool            pre_bt_auto_report;
90         bool            cur_bt_auto_report;
91
92         /* sw mechanism */
93         bool            pre_rf_rx_lpf_shrink;
94         bool            cur_rf_rx_lpf_shrink;
95         u32             bt_rf0x1e_backup;
96         bool            pre_low_penalty_ra;
97         bool            cur_low_penalty_ra;
98         bool            pre_dac_swing_on;
99         u32             pre_dac_swing_lvl;
100         bool            cur_dac_swing_on;
101         u32             cur_dac_swing_lvl;
102         bool            pre_adc_back_off;
103         bool            cur_adc_back_off;
104         bool            pre_agc_table_en;
105         bool            cur_agc_table_en;
106         u32             pre_val0x6c0;
107         u32             cur_val0x6c0;
108         u32             pre_val0x6c4;
109         u32             cur_val0x6c4;
110         u32             pre_val0x6c8;
111         u32             cur_val0x6c8;
112         u8              pre_val0x6cc;
113         u8              cur_val0x6cc;
114         bool            limited_dig;
115
116         /* algorithm related */
117         u8              pre_algorithm;
118         u8              cur_algorithm;
119         u8              bt_status;
120         u8              wifi_chnl_info[3];
121 };
122
123 struct coex_sta_8821a_2ant {
124         bool    bt_link_exist;
125         bool    sco_exist;
126         bool    a2dp_exist;
127         bool    hid_exist;
128         bool    pan_exist;
129         bool    under_lps;
130         bool    under_ips;
131         u32     high_priority_tx;
132         u32     high_priority_rx;
133         u32     low_priority_tx;
134         u32     low_priority_rx;
135         u8      bt_rssi;
136         u8      pre_bt_rssi_state;
137         u8      pre_wifi_rssi_state[4];
138         bool    c2h_bt_info_req_sent;
139         u8      bt_info_c2h[BT_INFO_SRC_8821A_2ANT_MAX][10];
140         u32     bt_info_c2h_cnt[BT_INFO_SRC_8821A_2ANT_MAX];
141         bool    c2h_bt_inquiry_page;
142         u8      bt_retry_cnt;
143         u8      bt_info_ext;
144 };
145
146 /*===========================================
147  *      The following is interface which will notify coex module.
148  *===========================================
149  */
150 void
151 ex_halbtc8821a2ant_init_hwconfig(
152         struct btc_coexist *btcoexist
153         );
154 void
155 ex_halbtc8821a2ant_init_coex_dm(
156         struct btc_coexist *btcoexist
157         );
158 void
159 ex_halbtc8821a2ant_ips_notify(
160         struct btc_coexist *btcoexist,
161         u8 type
162         );
163 void
164 ex_halbtc8821a2ant_lps_notify(
165         struct btc_coexist *btcoexist,
166         u8 type
167         );
168 void
169 ex_halbtc8821a2ant_scan_notify(
170         struct btc_coexist *btcoexist,
171         u8 type
172         );
173 void
174 ex_halbtc8821a2ant_connect_notify(
175         struct btc_coexist *btcoexist,
176         u8 type
177         );
178 void
179 ex_halbtc8821a2ant_media_status_notify(
180         struct btc_coexist *btcoexist,
181         u8 type
182         );
183 void
184 ex_halbtc8821a2ant_special_packet_notify(
185         struct btc_coexist *btcoexist,
186         u8 type
187         );
188 void
189 ex_halbtc8821a2ant_bt_info_notify(
190         struct btc_coexist *btcoexist,
191         u8 *tmp_buf,
192         u8 length
193         );
194 void
195 ex_halbtc8821a2ant_halt_notify(
196         struct btc_coexist *btcoexist
197         );
198 void
199 ex_halbtc8821a2ant_periodical(
200         struct btc_coexist *btcoexist
201         );
202 void
203 ex_halbtc8821a2ant_display_coex_info(
204         struct btc_coexist *btcoexist
205         );