Commit | Line | Data |
---|---|---|
2187e9a2 LF |
1 | /****************************************************************************** |
2 | * | |
3 | * Copyright(c) 2012 Realtek Corporation. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms of version 2 of the GNU General Public License as | |
7 | * published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | * more details. | |
13 | * | |
14 | * The full GNU General Public License is included in this distribution in the | |
15 | * file called LICENSE. | |
16 | * | |
17 | * Contact Information: | |
18 | * wlanfae <wlanfae@realtek.com> | |
19 | * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, | |
20 | * Hsinchu 300, Taiwan. | |
21 | * | |
22 | * Larry Finger <Larry.Finger@lwfinger.net> | |
23 | * | |
24 | *****************************************************************************/ | |
25 | /***************************************************************** | |
26 | * The following is for 8192E 2Ant BT Co-exist definition | |
27 | *****************************************************************/ | |
28 | #define BT_AUTO_REPORT_ONLY_8192E_2ANT 0 | |
29 | ||
30 | #define BT_INFO_8192E_2ANT_B_FTP BIT7 | |
31 | #define BT_INFO_8192E_2ANT_B_A2DP BIT6 | |
32 | #define BT_INFO_8192E_2ANT_B_HID BIT5 | |
33 | #define BT_INFO_8192E_2ANT_B_SCO_BUSY BIT4 | |
34 | #define BT_INFO_8192E_2ANT_B_ACL_BUSY BIT3 | |
35 | #define BT_INFO_8192E_2ANT_B_INQ_PAGE BIT2 | |
36 | #define BT_INFO_8192E_2ANT_B_SCO_ESCO BIT1 | |
37 | #define BT_INFO_8192E_2ANT_B_CONNECTION BIT0 | |
38 | ||
39 | #define BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT 2 | |
40 | ||
41 | enum bt_info_src_8192e_2ant { | |
42 | BT_INFO_SRC_8192E_2ANT_WIFI_FW = 0x0, | |
43 | BT_INFO_SRC_8192E_2ANT_BT_RSP = 0x1, | |
44 | BT_INFO_SRC_8192E_2ANT_BT_ACTIVE_SEND = 0x2, | |
45 | BT_INFO_SRC_8192E_2ANT_MAX | |
46 | }; | |
47 | ||
48 | enum bt_8192e_2ant_bt_status { | |
49 | BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, | |
50 | BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1, | |
51 | BT_8192E_2ANT_BT_STATUS_INQ_PAGE = 0x2, | |
52 | BT_8192E_2ANT_BT_STATUS_ACL_BUSY = 0x3, | |
53 | BT_8192E_2ANT_BT_STATUS_SCO_BUSY = 0x4, | |
54 | BT_8192E_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5, | |
55 | BT_8192E_2ANT_BT_STATUS_MAX | |
56 | }; | |
57 | ||
58 | enum bt_8192e_2ant_coex_algo { | |
59 | BT_8192E_2ANT_COEX_ALGO_UNDEFINED = 0x0, | |
60 | BT_8192E_2ANT_COEX_ALGO_SCO = 0x1, | |
61 | BT_8192E_2ANT_COEX_ALGO_SCO_PAN = 0x2, | |
62 | BT_8192E_2ANT_COEX_ALGO_HID = 0x3, | |
63 | BT_8192E_2ANT_COEX_ALGO_A2DP = 0x4, | |
64 | BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS = 0x5, | |
65 | BT_8192E_2ANT_COEX_ALGO_PANEDR = 0x6, | |
66 | BT_8192E_2ANT_COEX_ALGO_PANHS = 0x7, | |
67 | BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8, | |
68 | BT_8192E_2ANT_COEX_ALGO_PANEDR_HID = 0x9, | |
69 | BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa, | |
70 | BT_8192E_2ANT_COEX_ALGO_HID_A2DP = 0xb, | |
71 | BT_8192E_2ANT_COEX_ALGO_MAX = 0xc | |
72 | }; | |
73 | ||
74 | struct coex_dm_8192e_2ant { | |
75 | /* fw mechanism */ | |
76 | u8 pre_dec_bt_pwr; | |
77 | u8 cur_dec_bt_pwr; | |
78 | u8 pre_fw_dac_swing_lvl; | |
79 | u8 cur_fw_dac_swing_lvl; | |
80 | bool cur_ignore_wlan_act; | |
81 | bool pre_ignore_wlan_act; | |
82 | u8 pre_ps_tdma; | |
83 | u8 cur_ps_tdma; | |
84 | u8 ps_tdma_para[5]; | |
85 | u8 tdma_adj_type; | |
86 | bool reset_tdma_adjust; | |
87 | bool auto_tdma_adjust; | |
88 | bool pre_ps_tdma_on; | |
89 | bool cur_ps_tdma_on; | |
90 | bool pre_bt_auto_report; | |
91 | bool cur_bt_auto_report; | |
92 | ||
93 | /* sw mechanism */ | |
94 | bool pre_rf_rx_lpf_shrink; | |
95 | bool cur_rf_rx_lpf_shrink; | |
96 | u32 bt_rf0x1e_backup; | |
97 | bool pre_low_penalty_ra; | |
98 | bool cur_low_penalty_ra; | |
99 | bool pre_dac_swing_on; | |
100 | u32 pre_dac_swing_lvl; | |
101 | bool cur_dac_swing_on; | |
102 | u32 cur_dac_swing_lvl; | |
103 | bool pre_adc_back_off; | |
104 | bool cur_adc_back_off; | |
105 | bool pre_agc_table_en; | |
106 | bool cur_agc_table_en; | |
107 | u32 pre_val0x6c0; | |
108 | u32 cur_val0x6c0; | |
109 | u32 pre_val0x6c4; | |
110 | u32 cur_val0x6c4; | |
111 | u32 pre_val0x6c8; | |
112 | u32 cur_val0x6c8; | |
113 | u8 pre_val0x6cc; | |
114 | u8 cur_val0x6cc; | |
115 | bool limited_dig; | |
116 | ||
117 | u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */ | |
118 | u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */ | |
119 | u16 backup_retrylimit; | |
120 | u8 backup_ampdu_maxtime; | |
121 | ||
122 | /* algorithm related */ | |
123 | u8 pre_algorithm; | |
124 | u8 cur_algorithm; | |
125 | u8 bt_status; | |
126 | u8 wifi_chnl_info[3]; | |
127 | ||
128 | u8 pre_sstype; | |
129 | u8 cur_sstype; | |
130 | ||
131 | u32 prera_mask; | |
132 | u32 curra_mask; | |
133 | u8 curra_masktype; | |
134 | u8 pre_arfrtype; | |
135 | u8 cur_arfrtype; | |
136 | u8 pre_retrylimit_type; | |
137 | u8 cur_retrylimit_type; | |
138 | u8 pre_ampdutime_type; | |
139 | u8 cur_ampdutime_type; | |
140 | }; | |
141 | ||
142 | struct coex_sta_8192e_2ant { | |
143 | bool bt_link_exist; | |
144 | bool sco_exist; | |
145 | bool a2dp_exist; | |
146 | bool hid_exist; | |
147 | bool pan_exist; | |
148 | ||
149 | bool under_lps; | |
150 | bool under_ips; | |
151 | u32 high_priority_tx; | |
152 | u32 high_priority_rx; | |
153 | u32 low_priority_tx; | |
154 | u32 low_priority_rx; | |
155 | u8 bt_rssi; | |
156 | u8 pre_bt_rssi_state; | |
157 | u8 pre_wifi_rssi_state[4]; | |
158 | bool c2h_bt_info_req_sent; | |
159 | u8 bt_info_c2h[BT_INFO_SRC_8192E_2ANT_MAX][10]; | |
160 | u32 bt_info_c2h_cnt[BT_INFO_SRC_8192E_2ANT_MAX]; | |
161 | bool c2h_bt_inquiry_page; | |
162 | u8 bt_retry_cnt; | |
163 | u8 bt_info_ext; | |
164 | }; | |
165 | ||
166 | /**************************************************************** | |
167 | * The following is interface which will notify coex module. | |
168 | ****************************************************************/ | |
169 | void ex_halbtc8192e2ant_init_hwconfig(struct btc_coexist *btcoexist); | |
170 | void ex_halbtc8192e2ant_init_coex_dm(struct btc_coexist *btcoexist); | |
171 | void ex_halbtc8192e2ant_ips_notify(struct btc_coexist *btcoexist, u8 type); | |
172 | void ex_halbtc8192e2ant_lps_notify(struct btc_coexist *btcoexist, u8 type); | |
173 | void ex_halbtc8192e2ant_scan_notify(struct btc_coexist *btcoexist, u8 type); | |
174 | void ex_halbtc8192e2ant_connect_notify(struct btc_coexist *btcoexist, u8 type); | |
175 | void ex_halbtc8192e2ant_media_status_notify(struct btc_coexist *btcoexist, | |
176 | u8 type); | |
177 | void ex_halbtc8192e2ant_special_packet_notify(struct btc_coexist *btcoexist, | |
178 | u8 type); | |
179 | void ex_halbtc8192e2ant_bt_info_notify(struct btc_coexist *btcoexist, | |
180 | u8 *tmpbuf, u8 length); | |
181 | void ex_halbtc8192e2ant_stack_operation_notify(struct btc_coexist *btcoexist, | |
182 | u8 type); | |
183 | void ex_halbtc8192e2ant_halt_notify(struct btc_coexist *btcoexist); | |
184 | void ex_halbtc8192e2ant_periodical(struct btc_coexist *btcoexist); | |
185 | void ex_halbtc8192e2ant_display_coex_info(struct btc_coexist *btcoexist); |