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 #ifndef _HAL8723B_2_ANT 26 #define _HAL8723B_2_ANT 27 28 /************************************************************************ 29 * The following is for 8723B 2Ant BT Co-exist definition 30 ************************************************************************/ 31 #define BT_AUTO_REPORT_ONLY_8723B_2ANT 1 32 33 #define BT_INFO_8723B_2ANT_B_FTP BIT7 34 #define BT_INFO_8723B_2ANT_B_A2DP BIT6 35 #define BT_INFO_8723B_2ANT_B_HID BIT5 36 #define BT_INFO_8723B_2ANT_B_SCO_BUSY BIT4 37 #define BT_INFO_8723B_2ANT_B_ACL_BUSY BIT3 38 #define BT_INFO_8723B_2ANT_B_INQ_PAGE BIT2 39 #define BT_INFO_8723B_2ANT_B_SCO_ESCO BIT1 40 #define BT_INFO_8723B_2ANT_B_CONNECTION BIT0 41 42 #define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT 2 43 44 /* WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */ 45 #define BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES 42 46 /* BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */ 47 #define BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES 46 48 49 enum BT_INFO_SRC_8723B_2ANT { 50 BT_INFO_SRC_8723B_2ANT_WIFI_FW = 0x0, 51 BT_INFO_SRC_8723B_2ANT_BT_RSP = 0x1, 52 BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2, 53 BT_INFO_SRC_8723B_2ANT_MAX 54 }; 55 56 enum BT_8723B_2ANT_BT_STATUS { 57 BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, 58 BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1, 59 BT_8723B_2ANT_BT_STATUS_INQ_PAGE = 0x2, 60 BT_8723B_2ANT_BT_STATUS_ACL_BUSY = 0x3, 61 BT_8723B_2ANT_BT_STATUS_SCO_BUSY = 0x4, 62 BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5, 63 BT_8723B_2ANT_BT_STATUS_MAX 64 }; 65 66 enum BT_8723B_2ANT_COEX_ALGO { 67 BT_8723B_2ANT_COEX_ALGO_UNDEFINED = 0x0, 68 BT_8723B_2ANT_COEX_ALGO_SCO = 0x1, 69 BT_8723B_2ANT_COEX_ALGO_HID = 0x2, 70 BT_8723B_2ANT_COEX_ALGO_A2DP = 0x3, 71 BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4, 72 BT_8723B_2ANT_COEX_ALGO_PANEDR = 0x5, 73 BT_8723B_2ANT_COEX_ALGO_PANHS = 0x6, 74 BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7, 75 BT_8723B_2ANT_COEX_ALGO_PANEDR_HID = 0x8, 76 BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9, 77 BT_8723B_2ANT_COEX_ALGO_HID_A2DP = 0xa, 78 BT_8723B_2ANT_COEX_ALGO_MAX = 0xb, 79 }; 80 81 struct coex_dm_8723b_2ant { 82 /* fw mechanism */ 83 bool pre_dec_bt_pwr_lvl; 84 bool cur_dec_bt_pwr_lvl; 85 u8 pre_fw_dac_swing_lvl; 86 u8 cur_fw_dac_swing_lvl; 87 bool cur_ignore_wlan_act; 88 bool pre_ignore_wlan_act; 89 u8 pre_ps_tdma; 90 u8 cur_ps_tdma; 91 u8 ps_tdma_para[5]; 92 u8 ps_tdma_du_adj_type; 93 bool reset_tdma_adjust; 94 bool auto_tdma_adjust; 95 bool pre_ps_tdma_on; 96 bool cur_ps_tdma_on; 97 bool pre_bt_auto_report; 98 bool cur_bt_auto_report; 99 100 /* sw mechanism */ 101 bool pre_rf_rx_lpf_shrink; 102 bool cur_rf_rx_lpf_shrink; 103 u32 bt_rf0x1e_backup; 104 bool pre_low_penalty_ra; 105 bool cur_low_penalty_ra; 106 bool pre_dac_swing_on; 107 u32 pre_dac_swing_lvl; 108 bool cur_dac_swing_on; 109 u32 cur_dac_swing_lvl; 110 bool pre_adc_back_off; 111 bool cur_adc_back_off; 112 bool pre_agc_table_en; 113 bool cur_agc_table_en; 114 u32 pre_val0x6c0; 115 u32 cur_val0x6c0; 116 u32 pre_val0x6c4; 117 u32 cur_val0x6c4; 118 u32 pre_val0x6c8; 119 u32 cur_val0x6c8; 120 u8 pre_val0x6cc; 121 u8 cur_val0x6cc; 122 bool limited_dig; 123 124 /* algorithm related */ 125 u8 pre_algorithm; 126 u8 cur_algorithm; 127 u8 bt_status; 128 u8 wifi_chnl_info[3]; 129 130 u8 pre_lps; 131 u8 cur_lps; 132 u8 pre_rpwm; 133 u8 cur_rpwm; 134 135 bool is_switch_to_1dot5_ant; 136 u8 switch_thres_offset; 137 }; 138 139 struct coex_sta_8723b_2ant { 140 bool bt_link_exist; 141 bool sco_exist; 142 bool a2dp_exist; 143 bool hid_exist; 144 bool pan_exist; 145 bool bt_abnormal_scan; 146 147 bool under_lps; 148 bool under_ips; 149 u32 high_priority_tx; 150 u32 high_priority_rx; 151 u32 low_priority_tx; 152 u32 low_priority_rx; 153 u8 bt_rssi; 154 bool bt_tx_rx_mask; 155 u8 pre_bt_rssi_state; 156 u8 pre_wifi_rssi_state[4]; 157 bool c2h_bt_info_req_sent; 158 u8 bt_info_c2h[BT_INFO_SRC_8723B_2ANT_MAX][10]; 159 u32 bt_info_c2h_cnt[BT_INFO_SRC_8723B_2ANT_MAX]; 160 bool c2h_bt_inquiry_page; 161 bool c2h_bt_remote_name_req; 162 u8 bt_retry_cnt; 163 u8 bt_info_ext; 164 u32 pop_event_cnt; 165 u8 scan_ap_num; 166 167 u32 crc_ok_cck; 168 u32 crc_ok_11g; 169 u32 crc_ok_11n; 170 u32 crc_ok_11n_agg; 171 172 u32 crc_err_cck; 173 u32 crc_err_11g; 174 u32 crc_err_11n; 175 u32 crc_err_11n_agg; 176 bool force_lps_on; 177 178 u8 dis_ver_info_cnt; 179 180 u8 a2dp_bit_pool; 181 }; 182 183 /********************************************************************* 184 * The following is interface which will notify coex module. 185 *********************************************************************/ 186 void ex_btc8723b2ant_init_hwconfig(struct btc_coexist *btcoexist); 187 void ex_btc8723b2ant_init_coex_dm(struct btc_coexist *btcoexist); 188 void ex_btc8723b2ant_ips_notify(struct btc_coexist *btcoexist, u8 type); 189 void ex_btc8723b2ant_lps_notify(struct btc_coexist *btcoexist, u8 type); 190 void ex_btc8723b2ant_scan_notify(struct btc_coexist *btcoexist, u8 type); 191 void ex_btc8723b2ant_connect_notify(struct btc_coexist *btcoexist, u8 type); 192 void ex_btc8723b2ant_media_status_notify(struct btc_coexist *btcoexist, 193 u8 type); 194 void ex_btc8723b2ant_special_packet_notify(struct btc_coexist *btcoexist, 195 u8 type); 196 void ex_btc8723b2ant_bt_info_notify(struct btc_coexist *btcoexist, 197 u8 *tmpbuf, u8 length); 198 void ex_btc8723b2ant_halt_notify(struct btc_coexist *btcoexist); 199 void ex_btc8723b2ant_periodical(struct btc_coexist *btcoexist); 200 void ex_btc8723b2ant_display_coex_info(struct btc_coexist *btcoexist); 201 202 #endif 203