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 *****************************************************************************/
25 #ifndef _HAL8723B_2_ANT
26 #define _HAL8723B_2_ANT
28 /************************************************************************
29 * The following is for 8723B 2Ant BT Co-exist definition
30 ************************************************************************/
31 #define BT_INFO_8723B_2ANT_B_FTP BIT7
32 #define BT_INFO_8723B_2ANT_B_A2DP BIT6
33 #define BT_INFO_8723B_2ANT_B_HID BIT5
34 #define BT_INFO_8723B_2ANT_B_SCO_BUSY BIT4
35 #define BT_INFO_8723B_2ANT_B_ACL_BUSY BIT3
36 #define BT_INFO_8723B_2ANT_B_INQ_PAGE BIT2
37 #define BT_INFO_8723B_2ANT_B_SCO_ESCO BIT1
38 #define BT_INFO_8723B_2ANT_B_CONNECTION BIT0
40 #define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT 2
42 /* WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
43 #define BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES 42
44 /* BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
45 #define BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES 46
47 enum BT_INFO_SRC_8723B_2ANT {
48 BT_INFO_SRC_8723B_2ANT_WIFI_FW = 0x0,
49 BT_INFO_SRC_8723B_2ANT_BT_RSP = 0x1,
50 BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2,
51 BT_INFO_SRC_8723B_2ANT_MAX
54 enum BT_8723B_2ANT_BT_STATUS {
55 BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
56 BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
57 BT_8723B_2ANT_BT_STATUS_INQ_PAGE = 0x2,
58 BT_8723B_2ANT_BT_STATUS_ACL_BUSY = 0x3,
59 BT_8723B_2ANT_BT_STATUS_SCO_BUSY = 0x4,
60 BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
61 BT_8723B_2ANT_BT_STATUS_MAX
64 enum BT_8723B_2ANT_COEX_ALGO {
65 BT_8723B_2ANT_COEX_ALGO_UNDEFINED = 0x0,
66 BT_8723B_2ANT_COEX_ALGO_SCO = 0x1,
67 BT_8723B_2ANT_COEX_ALGO_HID = 0x2,
68 BT_8723B_2ANT_COEX_ALGO_A2DP = 0x3,
69 BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
70 BT_8723B_2ANT_COEX_ALGO_PANEDR = 0x5,
71 BT_8723B_2ANT_COEX_ALGO_PANHS = 0x6,
72 BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
73 BT_8723B_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
74 BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
75 BT_8723B_2ANT_COEX_ALGO_HID_A2DP = 0xa,
76 BT_8723B_2ANT_COEX_ALGO_MAX = 0xb,
79 struct coex_dm_8723b_2ant {
81 bool pre_dec_bt_pwr_lvl;
82 bool cur_dec_bt_pwr_lvl;
83 u8 pre_fw_dac_swing_lvl;
84 u8 cur_fw_dac_swing_lvl;
85 bool cur_ignore_wlan_act;
86 bool pre_ignore_wlan_act;
90 u8 ps_tdma_du_adj_type;
91 bool reset_tdma_adjust;
92 bool auto_tdma_adjust;
95 bool pre_bt_auto_report;
96 bool cur_bt_auto_report;
99 bool pre_rf_rx_lpf_shrink;
100 bool cur_rf_rx_lpf_shrink;
101 u32 bt_rf0x1e_backup;
102 bool pre_low_penalty_ra;
103 bool cur_low_penalty_ra;
104 bool pre_dac_swing_on;
105 u32 pre_dac_swing_lvl;
106 bool cur_dac_swing_on;
107 u32 cur_dac_swing_lvl;
108 bool pre_adc_back_off;
109 bool cur_adc_back_off;
110 bool pre_agc_table_en;
111 bool cur_agc_table_en;
122 /* algorithm related */
126 u8 wifi_chnl_info[3];
133 bool is_switch_to_1dot5_ant;
134 u8 switch_thres_offset;
137 struct coex_sta_8723b_2ant {
143 bool bt_abnormal_scan;
147 u32 high_priority_tx;
148 u32 high_priority_rx;
153 u8 pre_bt_rssi_state;
154 u8 pre_wifi_rssi_state[4];
155 bool c2h_bt_info_req_sent;
156 u8 bt_info_c2h[BT_INFO_SRC_8723B_2ANT_MAX][10];
157 u32 bt_info_c2h_cnt[BT_INFO_SRC_8723B_2ANT_MAX];
158 bool c2h_bt_inquiry_page;
159 bool c2h_bt_remote_name_req;
181 /*********************************************************************
182 * The following is interface which will notify coex module.
183 *********************************************************************/
184 void ex_btc8723b2ant_init_hwconfig(struct btc_coexist *btcoexist);
185 void ex_btc8723b2ant_init_coex_dm(struct btc_coexist *btcoexist);
186 void ex_btc8723b2ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
187 void ex_btc8723b2ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
188 void ex_btc8723b2ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
189 void ex_btc8723b2ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
190 void ex_btc8723b2ant_media_status_notify(struct btc_coexist *btcoexist,
192 void ex_btc8723b2ant_special_packet_notify(struct btc_coexist *btcoexist,
194 void ex_btc8723b2ant_bt_info_notify(struct btc_coexist *btcoexist,
195 u8 *tmpbuf, u8 length);
196 void ex_btc8723b2ant_halt_notify(struct btc_coexist *btcoexist);
197 void ex_btc8723b2ant_periodical(struct btc_coexist *btcoexist);
198 void ex_btc8723b2ant_display_coex_info(struct btc_coexist *btcoexist,
200 void ex_btc8723b2ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state);
201 void ex_btc8723b2ant_pre_load_firmware(struct btc_coexist *btcoexist);
202 void ex_btc8723b2ant_power_on_setting(struct btc_coexist *btcoexist);