Merge remote-tracking branches 'asoc/topic/sigmadsp', 'asoc/topic/sirf', 'asoc/topic...
[cascardo/linux.git] / drivers / staging / rtl8192ee / btcoexist / halbtc8192e2ant.h
1 /*****************************************************************
2  *   The following is for 8192E 2Ant BT Co-exist definition
3  *****************************************************************/
4 #define BT_AUTO_REPORT_ONLY_8192E_2ANT                  0
5
6 #define BT_INFO_8192E_2ANT_B_FTP                        BIT(7)
7 #define BT_INFO_8192E_2ANT_B_A2DP                       BIT(6)
8 #define BT_INFO_8192E_2ANT_B_HID                        BIT(5)
9 #define BT_INFO_8192E_2ANT_B_SCO_BUSY                   BIT(4)
10 #define BT_INFO_8192E_2ANT_B_ACL_BUSY                   BIT(3)
11 #define BT_INFO_8192E_2ANT_B_INQ_PAGE                   BIT(2)
12 #define BT_INFO_8192E_2ANT_B_SCO_ESCO                   BIT(1)
13 #define BT_INFO_8192E_2ANT_B_CONNECTION                 BIT(0)
14
15 #define BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT             2
16
17 enum bt_info_src_8192e_2ant {
18         BT_INFO_SRC_8192E_2ANT_WIFI_FW                  = 0x0,
19         BT_INFO_SRC_8192E_2ANT_BT_RSP                   = 0x1,
20         BT_INFO_SRC_8192E_2ANT_BT_ACTIVE_SEND           = 0x2,
21         BT_INFO_SRC_8192E_2ANT_MAX
22 };
23
24 enum bt_8192e_2ant_bt_status {
25         BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE      = 0x0,
26         BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE          = 0x1,
27         BT_8192E_2ANT_BT_STATUS_INQ_PAGE                = 0x2,
28         BT_8192E_2ANT_BT_STATUS_ACL_BUSY                = 0x3,
29         BT_8192E_2ANT_BT_STATUS_SCO_BUSY                = 0x4,
30         BT_8192E_2ANT_BT_STATUS_ACL_SCO_BUSY            = 0x5,
31         BT_8192E_2ANT_BT_STATUS_MAX
32 };
33
34 enum bt_8192e_2ant_coex_algo {
35         BT_8192E_2ANT_COEX_ALGO_UNDEFINED               = 0x0,
36         BT_8192E_2ANT_COEX_ALGO_SCO                     = 0x1,
37         BT_8192E_2ANT_COEX_ALGO_SCO_PAN                 = 0x2,
38         BT_8192E_2ANT_COEX_ALGO_HID                     = 0x3,
39         BT_8192E_2ANT_COEX_ALGO_A2DP                    = 0x4,
40         BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS              = 0x5,
41         BT_8192E_2ANT_COEX_ALGO_PANEDR                  = 0x6,
42         BT_8192E_2ANT_COEX_ALGO_PANHS                   = 0x7,
43         BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP             = 0x8,
44         BT_8192E_2ANT_COEX_ALGO_PANEDR_HID              = 0x9,
45         BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR         = 0xa,
46         BT_8192E_2ANT_COEX_ALGO_HID_A2DP                = 0xb,
47         BT_8192E_2ANT_COEX_ALGO_MAX                     = 0xc
48 };
49
50 struct coex_dm_8192e_2ant {
51         /* fw mechanism */
52         u8 pre_dec_bt_pwr;
53         u8 cur_dec_bt_pwr;
54         u8 pre_fw_dac_swing_lvl;
55         u8 cur_fw_dac_swing_lvl;
56         bool cur_ignore_wlan_act;
57         bool pre_ignore_wlan_act;
58         u8 pre_ps_tdma;
59         u8 cur_ps_tdma;
60         u8 ps_tdma_para[5];
61         u8 ps_tdma_du_adj_type;
62         bool reset_tdma_adjust;
63         bool auto_tdma_adjust;
64         bool pre_ps_tdma_on;
65         bool cur_ps_tdma_on;
66         bool pre_bt_auto_report;
67         bool cur_bt_auto_report;
68
69         /* sw mechanism */
70         bool pre_rf_rx_lpf_shrink;
71         bool cur_rf_rx_lpf_shrink;
72         u32 bt_rf0x1e_backup;
73         bool pre_low_penalty_ra;
74         bool cur_low_penalty_ra;
75         bool pre_dac_swing_on;
76         u32 pre_dac_swing_lvl;
77         bool cur_dac_swing_on;
78         u32 cur_dac_swing_lvl;
79         bool pre_adc_back_off;
80         bool cur_adc_back_off;
81         bool pre_agc_table_en;
82         bool cur_agc_table_en;
83         u32 pre_val0x6c0;
84         u32 cur_val0x6c0;
85         u32 pre_val0x6c4;
86         u32 cur_val0x6c4;
87         u32 pre_val0x6c8;
88         u32 cur_val0x6c8;
89         u8 pre_val0x6cc;
90         u8 cur_val0x6cc;
91         bool limited_dig;
92
93         u32 backup_arfr_cnt1;   /* Auto Rate Fallback Retry cnt */
94         u32 backup_arfr_cnt2;   /* Auto Rate Fallback Retry cnt */
95         u16 backup_retrylimit;
96         u8 backup_ampdu_maxtime;
97
98         /* algorithm related */
99         u8 pre_algorithm;
100         u8 cur_algorithm;
101         u8 bt_status;
102         u8 wifi_chnl_info[3];
103
104         u8 pre_sstype;
105         u8 cur_sstype;
106
107         u32 prera_mask;
108         u32 curra_mask;
109         u8 curra_masktype;
110         u8 pre_arfrtype;
111         u8 cur_arfrtype;
112         u8 pre_retrylimit_type;
113         u8 cur_retrylimit_type;
114         u8 pre_ampdutime_type;
115         u8 cur_ampdutime_type;
116 };
117
118 struct coex_sta_8192e_2ant {
119         bool bt_link_exist;
120         bool sco_exist;
121         bool a2dp_exist;
122         bool hid_exist;
123         bool pan_exist;
124
125         bool under_lps;
126         bool under_ips;
127         u32 high_priority_tx;
128         u32 high_priority_rx;
129         u32 low_priority_tx;
130         u32 low_priority_rx;
131         u8 bt_rssi;
132         u8 pre_bt_rssi_state;
133         u8 pre_wifi_rssi_state[4];
134         bool c2h_bt_info_req_sent;
135         u8 bt_info_c2h[BT_INFO_SRC_8192E_2ANT_MAX][10];
136         u32 bt_info_c2h_cnt[BT_INFO_SRC_8192E_2ANT_MAX];
137         bool c2h_bt_inquiry_page;
138         u8 bt_retry_cnt;
139         u8 bt_info_ext;
140 };
141
142 /****************************************************************
143  *    The following is interface which will notify coex module.
144  ****************************************************************/
145 void ex_halbtc8192e2ant_init_hwconfig(struct btc_coexist *btcoexist);
146 void ex_halbtc8192e2ant_init_coex_dm(struct btc_coexist *btcoexist);
147 void ex_halbtc8192e2ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
148 void ex_halbtc8192e2ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
149 void ex_halbtc8192e2ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
150 void ex_halbtc8192e2ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
151 void ex_halbtc8192e2ant_media_status_notify(struct btc_coexist *btcoexist,
152                                             u8 type);
153 void ex_halbtc8192e2ant_special_packet_notify(struct btc_coexist *btcoexist,
154                                               u8 type);
155 void ex_halbtc8192e2ant_bt_info_notify(struct btc_coexist *btcoexist,
156                                        u8 *tmpbuf, u8 length);
157 void ex_halbtc8192e2ant_stack_operation_notify(struct btc_coexist *btcoexist,
158                                                u8 type);
159 void ex_halbtc8192e2ant_halt_notify(struct btc_coexist *btcoexist);
160 void ex_halbtc8192e2ant_periodical(struct btc_coexist *btcoexist);
161 void ex_halbtc8192e2ant_display_coex_info(struct btc_coexist *btcoexist);