linux/drivers/staging/rtl8192ee/btcoexist/halbtc8821a1ant.h
<<
>>
Prefs
   1/*  */
   2/*  The following is for 8821A 1ANT BT Co-exist definition */
   3/*  */
   4#define BT_AUTO_REPORT_ONLY_8821A_1ANT                          0
   5
   6#define BT_INFO_8821A_1ANT_B_FTP                                BIT(7)
   7#define BT_INFO_8821A_1ANT_B_A2DP                               BIT(6)
   8#define BT_INFO_8821A_1ANT_B_HID                                BIT(5)
   9#define BT_INFO_8821A_1ANT_B_SCO_BUSY                           BIT(4)
  10#define BT_INFO_8821A_1ANT_B_ACL_BUSY                           BIT(3)
  11#define BT_INFO_8821A_1ANT_B_INQ_PAGE                           BIT(2)
  12#define BT_INFO_8821A_1ANT_B_SCO_ESCO                           BIT(1)
  13#define BT_INFO_8821A_1ANT_B_CONNECTION                         BIT(0)
  14
  15#define BT_INFO_8821A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_)       \
  16                (((_BT_INFO_EXT_&BIT(0))) ? true : false)
  17
  18#define BTC_RSSI_COEX_THRESH_TOL_8821A_1ANT             2
  19
  20enum BT_INFO_SRC_8821A_1ANT {
  21        BT_INFO_SRC_8821A_1ANT_WIFI_FW                  = 0x0,
  22        BT_INFO_SRC_8821A_1ANT_BT_RSP                   = 0x1,
  23        BT_INFO_SRC_8821A_1ANT_BT_ACTIVE_SEND           = 0x2,
  24        BT_INFO_SRC_8821A_1ANT_MAX
  25};
  26
  27enum BT_8821A_1ANT_BT_STATUS {
  28        BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE      = 0x0,
  29        BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE          = 0x1,
  30        BT_8821A_1ANT_BT_STATUS_INQ_PAGE                = 0x2,
  31        BT_8821A_1ANT_BT_STATUS_ACL_BUSY                = 0x3,
  32        BT_8821A_1ANT_BT_STATUS_SCO_BUSY                = 0x4,
  33        BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY            = 0x5,
  34        BT_8821A_1ANT_BT_STATUS_MAX
  35};
  36
  37enum BT_8821A_1ANT_WIFI_STATUS {
  38        BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE                    = 0x0,
  39        BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN          = 0x1,
  40        BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SCAN                        = 0x2,
  41        BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT                 = 0x3,
  42        BT_8821A_1ANT_WIFI_STATUS_CONNECTED_IDLE                        = 0x4,
  43        BT_8821A_1ANT_WIFI_STATUS_CONNECTED_BUSY                        = 0x5,
  44        BT_8821A_1ANT_WIFI_STATUS_MAX
  45};
  46
  47enum BT_8821A_1ANT_COEX_ALGO {
  48        BT_8821A_1ANT_COEX_ALGO_UNDEFINED               = 0x0,
  49        BT_8821A_1ANT_COEX_ALGO_SCO                     = 0x1,
  50        BT_8821A_1ANT_COEX_ALGO_HID                     = 0x2,
  51        BT_8821A_1ANT_COEX_ALGO_A2DP                    = 0x3,
  52        BT_8821A_1ANT_COEX_ALGO_A2DP_PANHS              = 0x4,
  53        BT_8821A_1ANT_COEX_ALGO_PANEDR                  = 0x5,
  54        BT_8821A_1ANT_COEX_ALGO_PANHS                   = 0x6,
  55        BT_8821A_1ANT_COEX_ALGO_PANEDR_A2DP             = 0x7,
  56        BT_8821A_1ANT_COEX_ALGO_PANEDR_HID              = 0x8,
  57        BT_8821A_1ANT_COEX_ALGO_HID_A2DP_PANEDR         = 0x9,
  58        BT_8821A_1ANT_COEX_ALGO_HID_A2DP                = 0xa,
  59        BT_8821A_1ANT_COEX_ALGO_MAX                     = 0xb,
  60};
  61
  62struct coex_dm_8821a_1ant {
  63        /*  fw mechanism */
  64        bool            cur_ignore_wlan_act;
  65        bool            pre_ignore_wlan_act;
  66        u8              pre_ps_tdma;
  67        u8              cur_ps_tdma;
  68        u8              ps_tdma_para[5];
  69        u8              ps_tdma_du_adj_type;
  70        bool            auto_tdma_adjust;
  71        bool            pre_ps_tdma_on;
  72        bool            cur_ps_tdma_on;
  73        bool            pre_bt_auto_report;
  74        bool            cur_bt_auto_report;
  75        u8              pre_lps;
  76        u8              cur_lps;
  77        u8              pre_rpwm;
  78        u8              cur_rpwm;
  79
  80        /*  sw mechanism */
  81        bool    pre_low_penalty_ra;
  82        bool            cur_low_penalty_ra;
  83        u32             pre_val_0x6c0;
  84        u32             cur_val_0x6c0;
  85        u32             pre_val_0x6c4;
  86        u32             cur_val_0x6c4;
  87        u32             pre_val_0x6c8;
  88        u32             cur_val_0x6c8;
  89        u8              pre_val_0x6cc;
  90        u8              cur_val_0x6cc;
  91
  92        u32             backup_arfr_cnt1; /*  Auto Rate Fallback Retry cnt */
  93        u32             backup_arfr_cnt2; /*  Auto Rate Fallback Retry cnt */
  94        u16             backup_retry_limit;
  95        u8              backup_ampdu_max_time;
  96
  97        /*  algorithm related */
  98        u8              pre_algorithm;
  99        u8              cur_algorithm;
 100        u8              bt_status;
 101        u8              wifi_chnl_info[3];
 102
 103        u32             pre_ra_mask;
 104        u32             cur_ra_mask;
 105        u8              pre_arfr_type;
 106        u8              cur_arfr_type;
 107        u8              pre_retry_limit_type;
 108        u8              cur_retry_limit_type;
 109        u8              pre_ampdu_time_type;
 110        u8              cur_ampdu_time_type;
 111
 112        u8              error_condition;
 113};
 114
 115struct coex_sta_8821a_1ant {
 116        bool            bt_link_exist;
 117        bool            sco_exist;
 118        bool            a2dp_exist;
 119        bool            hid_exist;
 120        bool            pan_exist;
 121
 122        bool            under_lps;
 123        bool            under_ips;
 124        u32             special_pkt_period_cnt;
 125        u32             high_priority_tx;
 126        u32             high_priority_rx;
 127        u32             low_priority_tx;
 128        u32             low_priority_rx;
 129        u8              bt_rssi;
 130        u8              pre_bt_rssi_state;
 131        u8              pre_wifi_rssi_state[4];
 132        bool            c2h_bt_info_req_sent;
 133        u8              bt_info_c2h[BT_INFO_SRC_8821A_1ANT_MAX][10];
 134        u32             bt_info_c2h_cnt[BT_INFO_SRC_8821A_1ANT_MAX];
 135        bool            c2h_bt_inquiry_page;
 136        u8              bt_retry_cnt;
 137        u8              bt_info_ext;
 138};
 139
 140/*  The following is interface which will notify coex module. */
 141void ex_halbtc8821a1ant_init_hwconfig(struct btc_coexist *btcoexist);
 142void ex_halbtc8821a1ant_init_coex_dm(struct btc_coexist *btcoexist);
 143void ex_halbtc8821a1ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
 144void ex_halbtc8821a1ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
 145void ex_halbtc8821a1ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
 146void ex_halbtc8821a1ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
 147void ex_halbtc8821a1ant_media_status_notify(struct btc_coexist *btcoexist,
 148                                            u8 type);
 149void ex_halbtc8821a1ant_special_packet_notify(struct btc_coexist *btcoexist,
 150                                              u8 type);
 151void ex_halbtc8821a1ant_bt_info_notify(struct btc_coexist *btcoexist,
 152                                       u8 *tmpbuf, u8 length);
 153void ex_halbtc8821a1ant_halt_notify(struct btc_coexist *btcoexist);
 154void ex_halbtc8821a1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnpstate);
 155void ex_halbtc8821a1ant_periodical(struct btc_coexist *btcoexist);
 156void ex_halbtc8821a1ant_display_coex_info(struct btc_coexist *btcoexist);
 157void ex_halbtc8821a1ant_dbg_control(struct btc_coexist *btcoexist, u8 op_code,
 158                                    u8 op_len, u8 *data);
 159