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 1ANT BT Co-exist definition
0006  *===========================================
0007  */
0008 #define BT_INFO_8821A_1ANT_B_FTP    BIT7
0009 #define BT_INFO_8821A_1ANT_B_A2DP   BIT6
0010 #define BT_INFO_8821A_1ANT_B_HID    BIT5
0011 #define BT_INFO_8821A_1ANT_B_SCO_BUSY   BIT4
0012 #define BT_INFO_8821A_1ANT_B_ACL_BUSY   BIT3
0013 #define BT_INFO_8821A_1ANT_B_INQ_PAGE   BIT2
0014 #define BT_INFO_8821A_1ANT_B_SCO_ESCO   BIT1
0015 #define BT_INFO_8821A_1ANT_B_CONNECTION BIT0
0016 
0017 #define BT_INFO_8821A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_)   \
0018         (((_BT_INFO_EXT_&BIT0)) ? true : false)
0019 
0020 #define BTC_RSSI_COEX_THRESH_TOL_8821A_1ANT     2
0021 
0022 enum _BT_INFO_SRC_8821A_1ANT {
0023     BT_INFO_SRC_8821A_1ANT_WIFI_FW          = 0x0,
0024     BT_INFO_SRC_8821A_1ANT_BT_RSP           = 0x1,
0025     BT_INFO_SRC_8821A_1ANT_BT_ACTIVE_SEND       = 0x2,
0026     BT_INFO_SRC_8821A_1ANT_MAX
0027 };
0028 
0029 enum _BT_8821A_1ANT_BT_STATUS {
0030     BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE      = 0x0,
0031     BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE          = 0x1,
0032     BT_8821A_1ANT_BT_STATUS_INQ_PAGE            = 0x2,
0033     BT_8821A_1ANT_BT_STATUS_ACL_BUSY            = 0x3,
0034     BT_8821A_1ANT_BT_STATUS_SCO_BUSY            = 0x4,
0035     BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY            = 0x5,
0036     BT_8821A_1ANT_BT_STATUS_MAX
0037 };
0038 
0039 enum _BT_8821A_1ANT_WIFI_STATUS {
0040     BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE        = 0x0,
0041     BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN  = 0x1,
0042     BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SCAN        = 0x2,
0043     BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT     = 0x3,
0044     BT_8821A_1ANT_WIFI_STATUS_CONNECTED_IDLE        = 0x4,
0045     BT_8821A_1ANT_WIFI_STATUS_CONNECTED_BUSY        = 0x5,
0046     BT_8821A_1ANT_WIFI_STATUS_MAX
0047 };
0048 
0049 enum BT_8821A_1ANT_COEX_ALGO {
0050     BT_8821A_1ANT_COEX_ALGO_UNDEFINED       = 0x0,
0051     BT_8821A_1ANT_COEX_ALGO_SCO         = 0x1,
0052     BT_8821A_1ANT_COEX_ALGO_HID         = 0x2,
0053     BT_8821A_1ANT_COEX_ALGO_A2DP            = 0x3,
0054     BT_8821A_1ANT_COEX_ALGO_A2DP_PANHS      = 0x4,
0055     BT_8821A_1ANT_COEX_ALGO_PANEDR          = 0x5,
0056     BT_8821A_1ANT_COEX_ALGO_PANHS           = 0x6,
0057     BT_8821A_1ANT_COEX_ALGO_PANEDR_A2DP     = 0x7,
0058     BT_8821A_1ANT_COEX_ALGO_PANEDR_HID      = 0x8,
0059     BT_8821A_1ANT_COEX_ALGO_HID_A2DP_PANEDR     = 0x9,
0060     BT_8821A_1ANT_COEX_ALGO_HID_A2DP        = 0xa,
0061     BT_8821A_1ANT_COEX_ALGO_MAX         = 0xb,
0062 };
0063 
0064 struct coex_dm_8821a_1ant {
0065     /* fw mechanism */
0066     bool    cur_ignore_wlan_act;
0067     bool    pre_ignore_wlan_act;
0068     u8  pre_ps_tdma;
0069     u8  cur_ps_tdma;
0070     u8  ps_tdma_para[5];
0071     u8  tdma_adj_type;
0072     bool    auto_tdma_adjust;
0073     bool    pre_ps_tdma_on;
0074     bool    cur_ps_tdma_on;
0075     bool    pre_bt_auto_report;
0076     bool    cur_bt_auto_report;
0077     u8  pre_lps;
0078     u8  cur_lps;
0079     u8  pre_rpwm;
0080     u8  cur_rpwm;
0081 
0082     /* sw mechanism */
0083     bool    pre_low_penalty_ra;
0084     bool    cur_low_penalty_ra;
0085     u32 pre_val_0x6c0;
0086     u32 cur_val_0x6c0;
0087     u32 pre_val_0x6c4;
0088     u32 cur_val_0x6c4;
0089     u32 pre_val_0x6c8;
0090     u32 cur_val_0x6c8;
0091     u8  pre_val_0x6cc;
0092     u8  cur_val_0x6cc;
0093     /* Auto Rate Fallback Retry cnt */
0094     u32 backup_arfr_cnt1;
0095     /* Auto Rate Fallback Retry cnt */
0096     u32 backup_arfr_cnt2;
0097     u16 backup_retry_limit;
0098     u8  backup_ampdu_max_time;
0099 
0100     /* algorithm related */
0101     u8  pre_algorithm;
0102     u8  cur_algorithm;
0103     u8  bt_status;
0104     u8  wifi_chnl_info[3];
0105 
0106     u32 pre_ra_mask;
0107     u32 cur_ra_mask;
0108     u8  pre_arfr_type;
0109     u8  cur_arfr_type;
0110     u8  pre_retry_limit_type;
0111     u8  cur_retry_limit_type;
0112     u8  pre_ampdu_time_type;
0113     u8  cur_ampdu_time_type;
0114     u32 arp_cnt;
0115 
0116     u8  error_condition;
0117 };
0118 
0119 struct coex_sta_8821a_1ant {
0120     bool    bt_disabled;
0121     bool    bt_link_exist;
0122     bool    sco_exist;
0123     bool    a2dp_exist;
0124     bool    hid_exist;
0125     bool    pan_exist;
0126 
0127     bool    under_lps;
0128     bool    under_ips;
0129     u32 special_pkt_period_cnt;
0130     u32 high_priority_tx;
0131     u32 high_priority_rx;
0132     u32 low_priority_tx;
0133     u32 low_priority_rx;
0134     u8  bt_rssi;
0135     bool    bt_tx_rx_mask;
0136     u8  pre_bt_rssi_state;
0137     u8  pre_wifi_rssi_state[4];
0138     bool    c2h_bt_info_req_sent;
0139     u8  bt_info_c2h[BT_INFO_SRC_8821A_1ANT_MAX][10];
0140     u32 bt_info_c2h_cnt[BT_INFO_SRC_8821A_1ANT_MAX];
0141     bool    c2h_bt_inquiry_page;
0142     bool    wifi_is_high_pri_task;
0143     u8  bt_retry_cnt;
0144     u8  bt_info_ext;
0145 };
0146 
0147 /*===========================================
0148  * The following is interface which will notify coex module.
0149  *===========================================
0150  */
0151 void ex_btc8821a1ant_init_hwconfig(struct btc_coexist *btcoexist,
0152                    bool wifi_only);
0153 void ex_btc8821a1ant_init_coex_dm(struct btc_coexist *btcoexist);
0154 void ex_btc8821a1ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
0155 void ex_btc8821a1ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
0156 void ex_btc8821a1ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
0157 void ex_btc8821a1ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
0158 void ex_btc8821a1ant_media_status_notify(struct btc_coexist *btcoexist,
0159                      u8 type);
0160 void ex_btc8821a1ant_special_packet_notify(struct btc_coexist *btcoexist,
0161                        u8 type);
0162 void ex_btc8821a1ant_bt_info_notify(struct btc_coexist *btcoexist,
0163                     u8 *tmpbuf, u8 length);
0164 void ex_btc8821a1ant_halt_notify(struct btc_coexist *btcoexist);
0165 void ex_btc8821a1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnpstate);
0166 void ex_btc8821a1ant_periodical(struct btc_coexist *btcoexist);
0167 void ex_btc8821a1ant_display_coex_info(struct btc_coexist *btcoexist,
0168                        struct seq_file *m);
0169 void ex_btc8821a1ant_dbg_control(struct btc_coexist *btcoexist, u8 op_code,
0170                  u8 op_len, u8 *data);
0171 void ex_btc8821a1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state);