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 8723B 1ANT BT Co-exist definition
0006  **********************************************************************/
0007 #define BT_INFO_8723B_1ANT_B_FTP            BIT7
0008 #define BT_INFO_8723B_1ANT_B_A2DP           BIT6
0009 #define BT_INFO_8723B_1ANT_B_HID            BIT5
0010 #define BT_INFO_8723B_1ANT_B_SCO_BUSY           BIT4
0011 #define BT_INFO_8723B_1ANT_B_ACL_BUSY           BIT3
0012 #define BT_INFO_8723B_1ANT_B_INQ_PAGE           BIT2
0013 #define BT_INFO_8723B_1ANT_B_SCO_ESCO           BIT1
0014 #define BT_INFO_8723B_1ANT_B_CONNECTION         BIT0
0015 
0016 #define BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_)   \
0017         (((_BT_INFO_EXT_&BIT0)) ? true : false)
0018 
0019 #define BTC_RSSI_COEX_THRESH_TOL_8723B_1ANT     2
0020 
0021 #define BT_8723B_1ANT_WIFI_NOISY_THRESH         50
0022 
0023 enum _BT_INFO_SRC_8723B_1ANT {
0024     BT_INFO_SRC_8723B_1ANT_WIFI_FW          = 0x0,
0025     BT_INFO_SRC_8723B_1ANT_BT_RSP           = 0x1,
0026     BT_INFO_SRC_8723B_1ANT_BT_ACTIVE_SEND       = 0x2,
0027     BT_INFO_SRC_8723B_1ANT_MAX
0028 };
0029 
0030 enum _BT_8723B_1ANT_BT_STATUS {
0031     BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE  = 0x0,
0032     BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE      = 0x1,
0033     BT_8723B_1ANT_BT_STATUS_INQ_PAGE        = 0x2,
0034     BT_8723B_1ANT_BT_STATUS_ACL_BUSY        = 0x3,
0035     BT_8723B_1ANT_BT_STATUS_SCO_BUSY        = 0x4,
0036     BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY        = 0x5,
0037     BT_8723B_1ANT_BT_STATUS_MAX
0038 };
0039 
0040 enum _BT_8723B_1ANT_WIFI_STATUS {
0041     BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE            = 0x0,
0042     BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN      = 0x1,
0043     BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN            = 0x2,
0044     BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT         = 0x3,
0045     BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE            = 0x4,
0046     BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY            = 0x5,
0047     BT_8723B_1ANT_WIFI_STATUS_MAX
0048 };
0049 
0050 enum _BT_8723B_1ANT_COEX_ALGO {
0051     BT_8723B_1ANT_COEX_ALGO_UNDEFINED       = 0x0,
0052     BT_8723B_1ANT_COEX_ALGO_SCO         = 0x1,
0053     BT_8723B_1ANT_COEX_ALGO_HID         = 0x2,
0054     BT_8723B_1ANT_COEX_ALGO_A2DP            = 0x3,
0055     BT_8723B_1ANT_COEX_ALGO_A2DP_PANHS      = 0x4,
0056     BT_8723B_1ANT_COEX_ALGO_PANEDR          = 0x5,
0057     BT_8723B_1ANT_COEX_ALGO_PANHS           = 0x6,
0058     BT_8723B_1ANT_COEX_ALGO_PANEDR_A2DP     = 0x7,
0059     BT_8723B_1ANT_COEX_ALGO_PANEDR_HID      = 0x8,
0060     BT_8723B_1ANT_COEX_ALGO_HID_A2DP_PANEDR     = 0x9,
0061     BT_8723B_1ANT_COEX_ALGO_HID_A2DP        = 0xa,
0062     BT_8723B_1ANT_COEX_ALGO_MAX         = 0xb,
0063 };
0064 
0065 struct coex_dm_8723b_1ant {
0066     /* hw setting */
0067     u8 pre_ant_pos_type;
0068     u8 cur_ant_pos_type;
0069     /* fw mechanism */
0070     bool cur_ignore_wlan_act;
0071     bool pre_ignore_wlan_act;
0072     u8 pre_ps_tdma;
0073     u8 cur_ps_tdma;
0074     u8 ps_tdma_para[5];
0075     u8 ps_tdma_du_adj_type;
0076     bool auto_tdma_adjust;
0077     bool pre_ps_tdma_on;
0078     bool cur_ps_tdma_on;
0079     bool pre_bt_auto_report;
0080     bool cur_bt_auto_report;
0081     u8 pre_lps;
0082     u8 cur_lps;
0083     u8 pre_rpwm;
0084     u8 cur_rpwm;
0085 
0086     /* sw mechanism */
0087     bool pre_low_penalty_ra;
0088     bool cur_low_penalty_ra;
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     u32 backup_arfr_cnt1;   /* Auto Rate Fallback Retry cnt */
0100     u32 backup_arfr_cnt2;   /* Auto Rate Fallback Retry cnt */
0101     u16 backup_retry_limit;
0102     u8 backup_ampdu_max_time;
0103 
0104     /* algorithm related */
0105     u8 pre_algorithm;
0106     u8 cur_algorithm;
0107     u8 bt_status;
0108     u8 wifi_chnl_info[3];
0109 
0110     u32 prera_mask;
0111     u32 curra_mask;
0112     u8 pre_arfr_type;
0113     u8 cur_arfr_type;
0114     u8 pre_retry_limit_type;
0115     u8 cur_retry_limit_type;
0116     u8 pre_ampdu_time_type;
0117     u8 cur_ampdu_time_type;
0118     u32 arp_cnt;
0119 
0120     u8 error_condition;
0121 };
0122 
0123 struct coex_sta_8723b_1ant {
0124     bool bt_disabled;
0125     bool bt_link_exist;
0126     bool sco_exist;
0127     bool a2dp_exist;
0128     bool hid_exist;
0129     bool pan_exist;
0130     bool bt_hi_pri_link_exist;
0131     u8 num_of_profile;
0132     bool bt_abnormal_scan;
0133 
0134     bool under_lps;
0135     bool under_ips;
0136     u32 special_pkt_period_cnt;
0137     u32 high_priority_tx;
0138     u32 high_priority_rx;
0139     u32 low_priority_tx;
0140     u32 low_priority_rx;
0141     u8 bt_rssi;
0142     u8 pre_bt_rssi_state;
0143     u8 pre_wifi_rssi_state[4];
0144     bool bt_tx_rx_mask;
0145     bool c2h_bt_info_req_sent;
0146     u8 bt_info_c2h[BT_INFO_SRC_8723B_1ANT_MAX][10];
0147     u32 bt_info_c2h_cnt[BT_INFO_SRC_8723B_1ANT_MAX];
0148     bool bt_whck_test;
0149     bool c2h_bt_inquiry_page;
0150     bool c2h_bt_remote_name_req;
0151     bool wifi_is_high_pri_task;
0152     u8 bt_retry_cnt;
0153     u8 bt_info_ext;
0154     u8 scan_ap_num;
0155     bool cck_ever_lock;
0156     u8 coex_table_type;
0157     bool force_lps_on;
0158     u32 pop_event_cnt;
0159 
0160     u32 crc_ok_cck;
0161     u32 crc_ok_11g;
0162     u32 crc_ok_11n;
0163     u32 crc_ok_11n_agg;
0164 
0165     u32 crc_err_cck;
0166     u32 crc_err_11g;
0167     u32 crc_err_11n;
0168     u32 crc_err_11n_agg;
0169 
0170     bool cck_lock;
0171     bool pre_ccklock;
0172 
0173     u32 wrong_profile_notification;
0174 
0175     u8 a2dp_bit_pool;
0176     u8 cut_version;
0177 };
0178 
0179 /*************************************************************************
0180  * The following is interface which will notify coex module.
0181  *************************************************************************/
0182 void ex_btc8723b1ant_power_on_setting(struct btc_coexist *btcoexist);
0183 void ex_btc8723b1ant_init_hwconfig(struct btc_coexist *btcoexist,
0184                    bool wifi_only);
0185 void ex_btc8723b1ant_init_coex_dm(struct btc_coexist *btcoexist);
0186 void ex_btc8723b1ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
0187 void ex_btc8723b1ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
0188 void ex_btc8723b1ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
0189 void ex_btc8723b1ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
0190 void ex_btc8723b1ant_media_status_notify(struct btc_coexist *btcoexist,
0191                      u8 type);
0192 void ex_btc8723b1ant_special_packet_notify(struct btc_coexist *btcoexist,
0193                        u8 type);
0194 void ex_btc8723b1ant_bt_info_notify(struct btc_coexist *btcoexist,
0195                     u8 *tmpbuf, u8 length);
0196 void ex_btc8723b1ant_rf_status_notify(struct btc_coexist *btcoexist,
0197                       u8 type);
0198 void ex_btc8723b1ant_halt_notify(struct btc_coexist *btcoexist);
0199 void ex_btc8723b1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnpstate);
0200 void ex_btc8723b1ant_coex_dm_reset(struct btc_coexist *btcoexist);
0201 void ex_btc8723b1ant_periodical(struct btc_coexist *btcoexist);
0202 void ex_btc8723b1ant_display_coex_info(struct btc_coexist *btcoexist,
0203                        struct seq_file *m);
0204 void ex_btc8723b1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state);