Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright(c) 2012  Realtek Corporation.*/
0003 
0004 /*===========================================
0005  * The following is for 8821A 2Ant BT Co-exist definition
0006  *===========================================
0007 */
0008 #define BT_INFO_8821A_2ANT_B_FTP        BIT7
0009 #define BT_INFO_8821A_2ANT_B_A2DP       BIT6
0010 #define BT_INFO_8821A_2ANT_B_HID        BIT5
0011 #define BT_INFO_8821A_2ANT_B_SCO_BUSY       BIT4
0012 #define BT_INFO_8821A_2ANT_B_ACL_BUSY       BIT3
0013 #define BT_INFO_8821A_2ANT_B_INQ_PAGE       BIT2
0014 #define BT_INFO_8821A_2ANT_B_SCO_ESCO       BIT1
0015 #define BT_INFO_8821A_2ANT_B_CONNECTION     BIT0
0016 
0017 #define BTC_RSSI_COEX_THRESH_TOL_8821A_2ANT 2
0018 
0019 /* WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
0020 #define BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES 42
0021 /* BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
0022 #define BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES  46
0023 
0024 enum _BT_INFO_SRC_8821A_2ANT {
0025     BT_INFO_SRC_8821A_2ANT_WIFI_FW      = 0x0,
0026     BT_INFO_SRC_8821A_2ANT_BT_RSP       = 0x1,
0027     BT_INFO_SRC_8821A_2ANT_BT_ACTIVE_SEND   = 0x2,
0028     BT_INFO_SRC_8821A_2ANT_MAX
0029 };
0030 
0031 enum _BT_8821A_2ANT_BT_STATUS {
0032     BT_8821A_2ANT_BT_STATUS_IDLE        = 0x0,
0033     BT_8821A_2ANT_BT_STATUS_CON_IDLE    = 0x1,
0034     BT_8821A_2ANT_BT_STATUS_NON_IDLE    = 0x2,
0035     BT_8821A_2ANT_BT_STATUS_ACL_BUSY    = 0x3,
0036     BT_8821A_2ANT_BT_STATUS_SCO_BUSY    = 0x4,
0037     BT_8821A_2ANT_BT_STATUS_ACL_SCO_BUSY    = 0x5,
0038     BT_8821A_2ANT_BT_STATUS_MAX
0039 };
0040 
0041 enum _BT_8821A_2ANT_COEX_ALGO {
0042     BT_8821A_2ANT_COEX_ALGO_UNDEFINED       = 0x0,
0043     BT_8821A_2ANT_COEX_ALGO_SCO         = 0x1,
0044     BT_8821A_2ANT_COEX_ALGO_HID         = 0x2,
0045     BT_8821A_2ANT_COEX_ALGO_A2DP            = 0x3,
0046     BT_8821A_2ANT_COEX_ALGO_A2DP_PANHS      = 0x4,
0047     BT_8821A_2ANT_COEX_ALGO_PANEDR          = 0x5,
0048     BT_8821A_2ANT_COEX_ALGO_PANHS           = 0x6,
0049     BT_8821A_2ANT_COEX_ALGO_PANEDR_A2DP     = 0x7,
0050     BT_8821A_2ANT_COEX_ALGO_PANEDR_HID      = 0x8,
0051     BT_8821A_2ANT_COEX_ALGO_HID_A2DP_PANEDR     = 0x9,
0052     BT_8821A_2ANT_COEX_ALGO_HID_A2DP        = 0xa,
0053     BT_8821A_2ANT_COEX_ALGO_MAX         = 0xb,
0054 };
0055 
0056 struct coex_dm_8821a_2ant {
0057     /* fw mechanism */
0058     bool        pre_dec_bt_pwr_lvl;
0059     bool        cur_dec_bt_pwr_lvl;
0060     u8      pre_fw_dac_swing_lvl;
0061     u8      cur_fw_dac_swing_lvl;
0062     bool        cur_ignore_wlan_act;
0063     bool        pre_ignore_wlan_act;
0064     u8      pre_ps_tdma;
0065     u8      cur_ps_tdma;
0066     u8      ps_tdma_para[5];
0067     u8      ps_tdma_du_adj_type;
0068     bool        reset_tdma_adjust;
0069     bool        auto_tdma_adjust;
0070     bool        pre_ps_tdma_on;
0071     bool        cur_ps_tdma_on;
0072     bool        pre_bt_auto_report;
0073     bool        cur_bt_auto_report;
0074 
0075     /* sw mechanism */
0076     bool        pre_rf_rx_lpf_shrink;
0077     bool        cur_rf_rx_lpf_shrink;
0078     u32     bt_rf0x1e_backup;
0079     bool        pre_low_penalty_ra;
0080     bool        cur_low_penalty_ra;
0081     bool        pre_dac_swing_on;
0082     u32     pre_dac_swing_lvl;
0083     bool        cur_dac_swing_on;
0084     u32     cur_dac_swing_lvl;
0085     bool        pre_adc_back_off;
0086     bool        cur_adc_back_off;
0087     bool        pre_agc_table_en;
0088     bool        cur_agc_table_en;
0089     u32     pre_val0x6c0;
0090     u32     cur_val0x6c0;
0091     u32     pre_val0x6c4;
0092     u32     cur_val0x6c4;
0093     u32     pre_val0x6c8;
0094     u32     cur_val0x6c8;
0095     u8      pre_val0x6cc;
0096     u8      cur_val0x6cc;
0097     bool        limited_dig;
0098 
0099     /* algorithm related */
0100     u8      pre_algorithm;
0101     u8      cur_algorithm;
0102     u8      bt_status;
0103     u8      wifi_chnl_info[3];
0104     u8      pre_lps;
0105     u8      cur_lps;
0106     u8      pre_rpwm;
0107     u8      cur_rpwm;
0108 };
0109 
0110 struct coex_sta_8821a_2ant {
0111     bool    bt_link_exist;
0112     bool    sco_exist;
0113     bool    a2dp_exist;
0114     bool    hid_exist;
0115     bool    pan_exist;
0116     bool    under_lps;
0117     bool    under_ips;
0118     u32 high_priority_tx;
0119     u32 high_priority_rx;
0120     u32 low_priority_tx;
0121     u32 low_priority_rx;
0122     u8  bt_rssi;
0123     bool    bt_tx_rx_mask;
0124     u8  pre_bt_rssi_state;
0125     u8  pre_wifi_rssi_state[4];
0126     bool    c2h_bt_info_req_sent;
0127     u8  bt_info_c2h[BT_INFO_SRC_8821A_2ANT_MAX][10];
0128     u32 bt_info_c2h_cnt[BT_INFO_SRC_8821A_2ANT_MAX];
0129     bool    c2h_bt_inquiry_page;
0130     u8  bt_retry_cnt;
0131     u8  bt_info_ext;
0132 
0133     u32 crc_ok_cck;
0134     u32 crc_ok_11g;
0135     u32 crc_ok_11n;
0136     u32 crc_ok_11n_agg;
0137 
0138     u32 crc_err_cck;
0139     u32 crc_err_11g;
0140     u32 crc_err_11n;
0141     u32 crc_err_11n_agg;
0142 
0143     u8  coex_table_type;
0144     bool    force_lps_on;
0145 
0146     u8  dis_ver_info_cnt;
0147 };
0148 
0149 /*===========================================
0150  *  The following is interface which will notify coex module.
0151  *===========================================
0152  */
0153 void
0154 ex_btc8821a2ant_init_hwconfig(
0155     struct btc_coexist *btcoexist
0156     );
0157 void
0158 ex_btc8821a2ant_init_coex_dm(
0159     struct btc_coexist *btcoexist
0160     );
0161 void
0162 ex_btc8821a2ant_ips_notify(
0163     struct btc_coexist *btcoexist,
0164     u8 type
0165     );
0166 void
0167 ex_btc8821a2ant_lps_notify(
0168     struct btc_coexist *btcoexist,
0169     u8 type
0170     );
0171 void
0172 ex_btc8821a2ant_scan_notify(
0173     struct btc_coexist *btcoexist,
0174     u8 type
0175     );
0176 void
0177 ex_btc8821a2ant_connect_notify(
0178     struct btc_coexist *btcoexist,
0179     u8 type
0180     );
0181 void
0182 ex_btc8821a2ant_media_status_notify(
0183     struct btc_coexist *btcoexist,
0184     u8 type
0185     );
0186 void
0187 ex_btc8821a2ant_special_packet_notify(
0188     struct btc_coexist *btcoexist,
0189     u8 type
0190     );
0191 void
0192 ex_btc8821a2ant_bt_info_notify(
0193     struct btc_coexist *btcoexist,
0194     u8 *tmp_buf,
0195     u8 length
0196     );
0197 void
0198 ex_btc8821a2ant_halt_notify(
0199     struct btc_coexist *btcoexist
0200     );
0201 void
0202 ex_btc8821a2ant_periodical(
0203     struct btc_coexist *btcoexist
0204     );
0205 void
0206 ex_btc8821a2ant_display_coex_info(
0207     struct btc_coexist *btcoexist,
0208     struct seq_file *m
0209     );
0210 void ex_btc8821a2ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state);
0211 void ex_btc8821a2ant_pre_load_firmware(struct btc_coexist *btcoexist);