Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright(c) 2012  Realtek Corporation.*/
0003 
0004 #ifndef _HAL8723B_2_ANT
0005 #define _HAL8723B_2_ANT
0006 
0007 /************************************************************************
0008  * The following is for 8723B 2Ant BT Co-exist definition
0009  ************************************************************************/
0010 #define BT_INFO_8723B_2ANT_B_FTP            BIT7
0011 #define BT_INFO_8723B_2ANT_B_A2DP           BIT6
0012 #define BT_INFO_8723B_2ANT_B_HID            BIT5
0013 #define BT_INFO_8723B_2ANT_B_SCO_BUSY           BIT4
0014 #define BT_INFO_8723B_2ANT_B_ACL_BUSY           BIT3
0015 #define BT_INFO_8723B_2ANT_B_INQ_PAGE           BIT2
0016 #define BT_INFO_8723B_2ANT_B_SCO_ESCO           BIT1
0017 #define BT_INFO_8723B_2ANT_B_CONNECTION         BIT0
0018 
0019 #define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT     2
0020 
0021 /* WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
0022 #define BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES    42
0023 /* BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
0024 #define BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES      46
0025 
0026 enum BT_INFO_SRC_8723B_2ANT {
0027     BT_INFO_SRC_8723B_2ANT_WIFI_FW          = 0x0,
0028     BT_INFO_SRC_8723B_2ANT_BT_RSP           = 0x1,
0029     BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND       = 0x2,
0030     BT_INFO_SRC_8723B_2ANT_MAX
0031 };
0032 
0033 enum BT_8723B_2ANT_BT_STATUS {
0034     BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE  = 0x0,
0035     BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE      = 0x1,
0036     BT_8723B_2ANT_BT_STATUS_INQ_PAGE        = 0x2,
0037     BT_8723B_2ANT_BT_STATUS_ACL_BUSY        = 0x3,
0038     BT_8723B_2ANT_BT_STATUS_SCO_BUSY        = 0x4,
0039     BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY        = 0x5,
0040     BT_8723B_2ANT_BT_STATUS_MAX
0041 };
0042 
0043 enum BT_8723B_2ANT_COEX_ALGO {
0044     BT_8723B_2ANT_COEX_ALGO_UNDEFINED       = 0x0,
0045     BT_8723B_2ANT_COEX_ALGO_SCO         = 0x1,
0046     BT_8723B_2ANT_COEX_ALGO_HID         = 0x2,
0047     BT_8723B_2ANT_COEX_ALGO_A2DP            = 0x3,
0048     BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS      = 0x4,
0049     BT_8723B_2ANT_COEX_ALGO_PANEDR          = 0x5,
0050     BT_8723B_2ANT_COEX_ALGO_PANHS           = 0x6,
0051     BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP     = 0x7,
0052     BT_8723B_2ANT_COEX_ALGO_PANEDR_HID      = 0x8,
0053     BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR     = 0x9,
0054     BT_8723B_2ANT_COEX_ALGO_HID_A2DP        = 0xa,
0055     BT_8723B_2ANT_COEX_ALGO_MAX         = 0xb,
0056 };
0057 
0058 struct coex_dm_8723b_2ant {
0059     /* fw mechanism */
0060     bool pre_dec_bt_pwr_lvl;
0061     bool cur_dec_bt_pwr_lvl;
0062     u8 pre_fw_dac_swing_lvl;
0063     u8 cur_fw_dac_swing_lvl;
0064     bool cur_ignore_wlan_act;
0065     bool pre_ignore_wlan_act;
0066     u8 pre_ps_tdma;
0067     u8 cur_ps_tdma;
0068     u8 ps_tdma_para[5];
0069     u8 ps_tdma_du_adj_type;
0070     bool reset_tdma_adjust;
0071     bool auto_tdma_adjust;
0072     bool pre_ps_tdma_on;
0073     bool cur_ps_tdma_on;
0074     bool pre_bt_auto_report;
0075     bool cur_bt_auto_report;
0076 
0077     /* sw mechanism */
0078     bool pre_rf_rx_lpf_shrink;
0079     bool cur_rf_rx_lpf_shrink;
0080     u32 bt_rf0x1e_backup;
0081     bool pre_low_penalty_ra;
0082     bool cur_low_penalty_ra;
0083     bool pre_dac_swing_on;
0084     u32 pre_dac_swing_lvl;
0085     bool cur_dac_swing_on;
0086     u32 cur_dac_swing_lvl;
0087     bool pre_adc_back_off;
0088     bool cur_adc_back_off;
0089     bool pre_agc_table_en;
0090     bool cur_agc_table_en;
0091     u32 pre_val0x6c0;
0092     u32 cur_val0x6c0;
0093     u32 pre_val0x6c4;
0094     u32 cur_val0x6c4;
0095     u32 pre_val0x6c8;
0096     u32 cur_val0x6c8;
0097     u8 pre_val0x6cc;
0098     u8 cur_val0x6cc;
0099     bool limited_dig;
0100 
0101     /* algorithm related */
0102     u8 pre_algorithm;
0103     u8 cur_algorithm;
0104     u8 bt_status;
0105     u8 wifi_chnl_info[3];
0106 
0107     u8 pre_lps;
0108     u8 cur_lps;
0109     u8 pre_rpwm;
0110     u8 cur_rpwm;
0111 
0112     bool is_switch_to_1dot5_ant;
0113     u8 switch_thres_offset;
0114 };
0115 
0116 struct coex_sta_8723b_2ant {
0117     bool bt_link_exist;
0118     bool sco_exist;
0119     bool a2dp_exist;
0120     bool hid_exist;
0121     bool pan_exist;
0122     bool bt_abnormal_scan;
0123 
0124     bool under_lps;
0125     bool under_ips;
0126     u32 high_priority_tx;
0127     u32 high_priority_rx;
0128     u32 low_priority_tx;
0129     u32 low_priority_rx;
0130     u8 bt_rssi;
0131     bool bt_tx_rx_mask;
0132     u8 pre_bt_rssi_state;
0133     u8 pre_wifi_rssi_state[4];
0134     bool c2h_bt_info_req_sent;
0135     u8 bt_info_c2h[BT_INFO_SRC_8723B_2ANT_MAX][10];
0136     u32 bt_info_c2h_cnt[BT_INFO_SRC_8723B_2ANT_MAX];
0137     bool c2h_bt_inquiry_page;
0138     bool c2h_bt_remote_name_req;
0139     u8 bt_retry_cnt;
0140     u8 bt_info_ext;
0141     u32 pop_event_cnt;
0142     u8 scan_ap_num;
0143 
0144     u32 crc_ok_cck;
0145     u32 crc_ok_11g;
0146     u32 crc_ok_11n;
0147     u32 crc_ok_11n_agg;
0148 
0149     u32 crc_err_cck;
0150     u32 crc_err_11g;
0151     u32 crc_err_11n;
0152     u32 crc_err_11n_agg;
0153     bool force_lps_on;
0154 
0155     u8 dis_ver_info_cnt;
0156 
0157     u8 a2dp_bit_pool;
0158 };
0159 
0160 /*********************************************************************
0161  * The following is interface which will notify coex module.
0162  *********************************************************************/
0163 void ex_btc8723b2ant_init_hwconfig(struct btc_coexist *btcoexist);
0164 void ex_btc8723b2ant_init_coex_dm(struct btc_coexist *btcoexist);
0165 void ex_btc8723b2ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
0166 void ex_btc8723b2ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
0167 void ex_btc8723b2ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
0168 void ex_btc8723b2ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
0169 void ex_btc8723b2ant_media_status_notify(struct btc_coexist *btcoexist,
0170                      u8 type);
0171 void ex_btc8723b2ant_special_packet_notify(struct btc_coexist *btcoexist,
0172                        u8 type);
0173 void ex_btc8723b2ant_bt_info_notify(struct btc_coexist *btcoexist,
0174                     u8 *tmpbuf, u8 length);
0175 void ex_btc8723b2ant_halt_notify(struct btc_coexist *btcoexist);
0176 void ex_btc8723b2ant_periodical(struct btc_coexist *btcoexist);
0177 void ex_btc8723b2ant_display_coex_info(struct btc_coexist *btcoexist,
0178                        struct seq_file *m);
0179 void ex_btc8723b2ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state);
0180 void ex_btc8723b2ant_pre_load_firmware(struct btc_coexist *btcoexist);
0181 void ex_btc8723b2ant_power_on_setting(struct btc_coexist *btcoexist);
0182 
0183 #endif