1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright(c) 2012 Realtek Corporation.*/ 3 4 /***************************************************************** 5 * The following is for 8192E 2Ant BT Co-exist definition 6 *****************************************************************/ 7 #define BT_INFO_8192E_2ANT_B_FTP BIT7 8 #define BT_INFO_8192E_2ANT_B_A2DP BIT6 9 #define BT_INFO_8192E_2ANT_B_HID BIT5 10 #define BT_INFO_8192E_2ANT_B_SCO_BUSY BIT4 11 #define BT_INFO_8192E_2ANT_B_ACL_BUSY BIT3 12 #define BT_INFO_8192E_2ANT_B_INQ_PAGE BIT2 13 #define BT_INFO_8192E_2ANT_B_SCO_ESCO BIT1 14 #define BT_INFO_8192E_2ANT_B_CONNECTION BIT0 15 16 #define BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT 2 17 18 enum bt_info_src_8192e_2ant { 19 BT_INFO_SRC_8192E_2ANT_WIFI_FW = 0x0, 20 BT_INFO_SRC_8192E_2ANT_BT_RSP = 0x1, 21 BT_INFO_SRC_8192E_2ANT_BT_ACTIVE_SEND = 0x2, 22 BT_INFO_SRC_8192E_2ANT_MAX 23 }; 24 25 enum bt_8192e_2ant_bt_status { 26 BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, 27 BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1, 28 BT_8192E_2ANT_BT_STATUS_INQ_PAGE = 0x2, 29 BT_8192E_2ANT_BT_STATUS_ACL_BUSY = 0x3, 30 BT_8192E_2ANT_BT_STATUS_SCO_BUSY = 0x4, 31 BT_8192E_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5, 32 BT_8192E_2ANT_BT_STATUS_MAX 33 }; 34 35 enum bt_8192e_2ant_coex_algo { 36 BT_8192E_2ANT_COEX_ALGO_UNDEFINED = 0x0, 37 BT_8192E_2ANT_COEX_ALGO_SCO = 0x1, 38 BT_8192E_2ANT_COEX_ALGO_SCO_PAN = 0x2, 39 BT_8192E_2ANT_COEX_ALGO_HID = 0x3, 40 BT_8192E_2ANT_COEX_ALGO_A2DP = 0x4, 41 BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS = 0x5, 42 BT_8192E_2ANT_COEX_ALGO_PANEDR = 0x6, 43 BT_8192E_2ANT_COEX_ALGO_PANHS = 0x7, 44 BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8, 45 BT_8192E_2ANT_COEX_ALGO_PANEDR_HID = 0x9, 46 BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa, 47 BT_8192E_2ANT_COEX_ALGO_HID_A2DP = 0xb, 48 BT_8192E_2ANT_COEX_ALGO_MAX = 0xc 49 }; 50 51 struct coex_dm_8192e_2ant { 52 /* fw mechanism */ 53 u8 pre_dec_bt_pwr; 54 u8 cur_dec_bt_pwr; 55 u8 pre_fw_dac_swing_lvl; 56 u8 cur_fw_dac_swing_lvl; 57 bool cur_ignore_wlan_act; 58 bool pre_ignore_wlan_act; 59 u8 pre_ps_tdma; 60 u8 cur_ps_tdma; 61 u8 ps_tdma_para[5]; 62 u8 tdma_adj_type; 63 bool reset_tdma_adjust; 64 bool auto_tdma_adjust; 65 bool pre_ps_tdma_on; 66 bool cur_ps_tdma_on; 67 bool pre_bt_auto_report; 68 bool cur_bt_auto_report; 69 70 /* sw mechanism */ 71 bool pre_rf_rx_lpf_shrink; 72 bool cur_rf_rx_lpf_shrink; 73 u32 bt_rf0x1e_backup; 74 bool pre_low_penalty_ra; 75 bool cur_low_penalty_ra; 76 bool pre_dac_swing_on; 77 u32 pre_dac_swing_lvl; 78 bool cur_dac_swing_on; 79 u32 cur_dac_swing_lvl; 80 bool pre_adc_back_off; 81 bool cur_adc_back_off; 82 bool pre_agc_table_en; 83 bool cur_agc_table_en; 84 u32 pre_val0x6c0; 85 u32 cur_val0x6c0; 86 u32 pre_val0x6c4; 87 u32 cur_val0x6c4; 88 u32 pre_val0x6c8; 89 u32 cur_val0x6c8; 90 u8 pre_val0x6cc; 91 u8 cur_val0x6cc; 92 bool limited_dig; 93 94 u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */ 95 u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */ 96 u16 backup_retry_limit; 97 u8 backup_ampdu_maxtime; 98 99 /* algorithm related */ 100 u8 pre_algorithm; 101 u8 cur_algorithm; 102 u8 bt_status; 103 u8 wifi_chnl_info[3]; 104 105 u8 pre_ss_type; 106 u8 cur_ss_type; 107 108 u32 pre_ra_mask; 109 u32 cur_ra_mask; 110 u8 cur_ra_mask_type; 111 u8 pre_arfr_type; 112 u8 cur_arfr_type; 113 u8 pre_retry_limit_type; 114 u8 cur_retry_limit_type; 115 u8 pre_ampdu_time_type; 116 u8 cur_ampdu_time_type; 117 }; 118 119 struct coex_sta_8192e_2ant { 120 bool bt_link_exist; 121 bool sco_exist; 122 bool a2dp_exist; 123 bool hid_exist; 124 bool pan_exist; 125 126 bool under_lps; 127 bool under_ips; 128 u32 high_priority_tx; 129 u32 high_priority_rx; 130 u32 low_priority_tx; 131 u32 low_priority_rx; 132 u8 bt_rssi; 133 u8 pre_bt_rssi_state; 134 u8 pre_wifi_rssi_state[4]; 135 bool c2h_bt_info_req_sent; 136 u8 bt_info_c2h[BT_INFO_SRC_8192E_2ANT_MAX][10]; 137 u32 bt_info_c2h_cnt[BT_INFO_SRC_8192E_2ANT_MAX]; 138 bool c2h_bt_inquiry_page; 139 u8 bt_retry_cnt; 140 u8 bt_info_ext; 141 }; 142 143 /**************************************************************** 144 * The following is interface which will notify coex module. 145 ****************************************************************/ 146 void ex_btc8192e2ant_init_hwconfig(struct btc_coexist *btcoexist); 147 void ex_btc8192e2ant_init_coex_dm(struct btc_coexist *btcoexist); 148 void ex_btc8192e2ant_ips_notify(struct btc_coexist *btcoexist, u8 type); 149 void ex_btc8192e2ant_lps_notify(struct btc_coexist *btcoexist, u8 type); 150 void ex_btc8192e2ant_scan_notify(struct btc_coexist *btcoexist, u8 type); 151 void ex_btc8192e2ant_connect_notify(struct btc_coexist *btcoexist, u8 type); 152 void ex_btc8192e2ant_media_status_notify(struct btc_coexist *btcoexist, 153 u8 type); 154 void ex_btc8192e2ant_special_packet_notify(struct btc_coexist *btcoexist, 155 u8 type); 156 void ex_btc8192e2ant_bt_info_notify(struct btc_coexist *btcoexist, 157 u8 *tmpbuf, u8 length); 158 void ex_btc8192e2ant_stack_operation_notify(struct btc_coexist *btcoexist, 159 u8 type); 160 void ex_btc8192e2ant_halt_notify(struct btc_coexist *btcoexist); 161 void ex_btc8192e2ant_periodical(struct btc_coexist *btcoexist); 162 void ex_btc8192e2ant_display_coex_info(struct btc_coexist *btcoexist, 163 struct seq_file *m); 164