1 /******************************************************************************
3 * Copyright(c) 2012 Realtek Corporation.
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.
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
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
22 * Larry Finger <Larry.Finger@lwfinger.net>
24 *****************************************************************************/
26 /*===========================================
27 * The following is for 8821A 2Ant BT Co-exist definition
28 *===========================================
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
39 #define BTC_RSSI_COEX_THRESH_TOL_8821A_2ANT 2
41 /* WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
42 #define BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES 42
43 /* BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
44 #define BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES 46
46 enum _BT_INFO_SRC_8821A_2ANT {
47 BT_INFO_SRC_8821A_2ANT_WIFI_FW = 0x0,
48 BT_INFO_SRC_8821A_2ANT_BT_RSP = 0x1,
49 BT_INFO_SRC_8821A_2ANT_BT_ACTIVE_SEND = 0x2,
50 BT_INFO_SRC_8821A_2ANT_MAX
53 enum _BT_8821A_2ANT_BT_STATUS {
54 BT_8821A_2ANT_BT_STATUS_IDLE = 0x0,
55 BT_8821A_2ANT_BT_STATUS_CON_IDLE = 0x1,
56 BT_8821A_2ANT_BT_STATUS_NON_IDLE = 0x2,
57 BT_8821A_2ANT_BT_STATUS_ACL_BUSY = 0x3,
58 BT_8821A_2ANT_BT_STATUS_SCO_BUSY = 0x4,
59 BT_8821A_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
60 BT_8821A_2ANT_BT_STATUS_MAX
63 enum _BT_8821A_2ANT_COEX_ALGO {
64 BT_8821A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
65 BT_8821A_2ANT_COEX_ALGO_SCO = 0x1,
66 BT_8821A_2ANT_COEX_ALGO_HID = 0x2,
67 BT_8821A_2ANT_COEX_ALGO_A2DP = 0x3,
68 BT_8821A_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
69 BT_8821A_2ANT_COEX_ALGO_PANEDR = 0x5,
70 BT_8821A_2ANT_COEX_ALGO_PANHS = 0x6,
71 BT_8821A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
72 BT_8821A_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
73 BT_8821A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
74 BT_8821A_2ANT_COEX_ALGO_HID_A2DP = 0xa,
75 BT_8821A_2ANT_COEX_ALGO_MAX = 0xb,
78 struct coex_dm_8821a_2ant {
80 bool pre_dec_bt_pwr_lvl;
81 bool cur_dec_bt_pwr_lvl;
82 u8 pre_fw_dac_swing_lvl;
83 u8 cur_fw_dac_swing_lvl;
84 bool cur_ignore_wlan_act;
85 bool pre_ignore_wlan_act;
89 u8 ps_tdma_du_adj_type;
90 bool reset_tdma_adjust;
91 bool auto_tdma_adjust;
94 bool pre_bt_auto_report;
95 bool cur_bt_auto_report;
98 bool pre_rf_rx_lpf_shrink;
99 bool cur_rf_rx_lpf_shrink;
100 u32 bt_rf0x1e_backup;
101 bool pre_low_penalty_ra;
102 bool cur_low_penalty_ra;
103 bool pre_dac_swing_on;
104 u32 pre_dac_swing_lvl;
105 bool cur_dac_swing_on;
106 u32 cur_dac_swing_lvl;
107 bool pre_adc_back_off;
108 bool cur_adc_back_off;
109 bool pre_agc_table_en;
110 bool cur_agc_table_en;
121 /* algorithm related */
125 u8 wifi_chnl_info[3];
132 struct coex_sta_8821a_2ant {
140 u32 high_priority_tx;
141 u32 high_priority_rx;
146 u8 pre_bt_rssi_state;
147 u8 pre_wifi_rssi_state[4];
148 bool c2h_bt_info_req_sent;
149 u8 bt_info_c2h[BT_INFO_SRC_8821A_2ANT_MAX][10];
150 u32 bt_info_c2h_cnt[BT_INFO_SRC_8821A_2ANT_MAX];
151 bool c2h_bt_inquiry_page;
171 /*===========================================
172 * The following is interface which will notify coex module.
173 *===========================================
176 ex_btc8821a2ant_init_hwconfig(
177 struct btc_coexist *btcoexist
180 ex_btc8821a2ant_init_coex_dm(
181 struct btc_coexist *btcoexist
184 ex_btc8821a2ant_ips_notify(
185 struct btc_coexist *btcoexist,
189 ex_btc8821a2ant_lps_notify(
190 struct btc_coexist *btcoexist,
194 ex_btc8821a2ant_scan_notify(
195 struct btc_coexist *btcoexist,
199 ex_btc8821a2ant_connect_notify(
200 struct btc_coexist *btcoexist,
204 ex_btc8821a2ant_media_status_notify(
205 struct btc_coexist *btcoexist,
209 ex_btc8821a2ant_special_packet_notify(
210 struct btc_coexist *btcoexist,
214 ex_btc8821a2ant_bt_info_notify(
215 struct btc_coexist *btcoexist,
220 ex_btc8821a2ant_halt_notify(
221 struct btc_coexist *btcoexist
224 ex_btc8821a2ant_periodical(
225 struct btc_coexist *btcoexist
228 ex_btc8821a2ant_display_coex_info(
229 struct btc_coexist *btcoexist
231 void ex_btc8821a2ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state);
232 void ex_btc8821a2ant_pre_load_firmware(struct btc_coexist *btcoexist);