1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2012 Realtek Corporation.*/
4 /*===========================================
5 * The following is for 8821A 2Ant BT Co-exist definition
6 *===========================================
8 #define BT_INFO_8821A_2ANT_B_FTP BIT7
9 #define BT_INFO_8821A_2ANT_B_A2DP BIT6
10 #define BT_INFO_8821A_2ANT_B_HID BIT5
11 #define BT_INFO_8821A_2ANT_B_SCO_BUSY BIT4
12 #define BT_INFO_8821A_2ANT_B_ACL_BUSY BIT3
13 #define BT_INFO_8821A_2ANT_B_INQ_PAGE BIT2
14 #define BT_INFO_8821A_2ANT_B_SCO_ESCO BIT1
15 #define BT_INFO_8821A_2ANT_B_CONNECTION BIT0
17 #define BTC_RSSI_COEX_THRESH_TOL_8821A_2ANT 2
19 /* WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
20 #define BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES 42
21 /* BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
22 #define BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES 46
24 enum _BT_INFO_SRC_8821A_2ANT
{
25 BT_INFO_SRC_8821A_2ANT_WIFI_FW
= 0x0,
26 BT_INFO_SRC_8821A_2ANT_BT_RSP
= 0x1,
27 BT_INFO_SRC_8821A_2ANT_BT_ACTIVE_SEND
= 0x2,
28 BT_INFO_SRC_8821A_2ANT_MAX
31 enum _BT_8821A_2ANT_BT_STATUS
{
32 BT_8821A_2ANT_BT_STATUS_IDLE
= 0x0,
33 BT_8821A_2ANT_BT_STATUS_CON_IDLE
= 0x1,
34 BT_8821A_2ANT_BT_STATUS_NON_IDLE
= 0x2,
35 BT_8821A_2ANT_BT_STATUS_ACL_BUSY
= 0x3,
36 BT_8821A_2ANT_BT_STATUS_SCO_BUSY
= 0x4,
37 BT_8821A_2ANT_BT_STATUS_ACL_SCO_BUSY
= 0x5,
38 BT_8821A_2ANT_BT_STATUS_MAX
41 enum _BT_8821A_2ANT_COEX_ALGO
{
42 BT_8821A_2ANT_COEX_ALGO_UNDEFINED
= 0x0,
43 BT_8821A_2ANT_COEX_ALGO_SCO
= 0x1,
44 BT_8821A_2ANT_COEX_ALGO_HID
= 0x2,
45 BT_8821A_2ANT_COEX_ALGO_A2DP
= 0x3,
46 BT_8821A_2ANT_COEX_ALGO_A2DP_PANHS
= 0x4,
47 BT_8821A_2ANT_COEX_ALGO_PANEDR
= 0x5,
48 BT_8821A_2ANT_COEX_ALGO_PANHS
= 0x6,
49 BT_8821A_2ANT_COEX_ALGO_PANEDR_A2DP
= 0x7,
50 BT_8821A_2ANT_COEX_ALGO_PANEDR_HID
= 0x8,
51 BT_8821A_2ANT_COEX_ALGO_HID_A2DP_PANEDR
= 0x9,
52 BT_8821A_2ANT_COEX_ALGO_HID_A2DP
= 0xa,
53 BT_8821A_2ANT_COEX_ALGO_MAX
= 0xb,
56 struct coex_dm_8821a_2ant
{
58 bool pre_dec_bt_pwr_lvl
;
59 bool cur_dec_bt_pwr_lvl
;
60 u8 pre_fw_dac_swing_lvl
;
61 u8 cur_fw_dac_swing_lvl
;
62 bool cur_ignore_wlan_act
;
63 bool pre_ignore_wlan_act
;
67 u8 ps_tdma_du_adj_type
;
68 bool reset_tdma_adjust
;
69 bool auto_tdma_adjust
;
72 bool pre_bt_auto_report
;
73 bool cur_bt_auto_report
;
76 bool pre_rf_rx_lpf_shrink
;
77 bool cur_rf_rx_lpf_shrink
;
79 bool pre_low_penalty_ra
;
80 bool cur_low_penalty_ra
;
81 bool pre_dac_swing_on
;
82 u32 pre_dac_swing_lvl
;
83 bool cur_dac_swing_on
;
84 u32 cur_dac_swing_lvl
;
85 bool pre_adc_back_off
;
86 bool cur_adc_back_off
;
87 bool pre_agc_table_en
;
88 bool cur_agc_table_en
;
99 /* algorithm related */
103 u8 wifi_chnl_info
[3];
110 struct coex_sta_8821a_2ant
{
118 u32 high_priority_tx
;
119 u32 high_priority_rx
;
124 u8 pre_bt_rssi_state
;
125 u8 pre_wifi_rssi_state
[4];
126 bool c2h_bt_info_req_sent
;
127 u8 bt_info_c2h
[BT_INFO_SRC_8821A_2ANT_MAX
][10];
128 u32 bt_info_c2h_cnt
[BT_INFO_SRC_8821A_2ANT_MAX
];
129 bool c2h_bt_inquiry_page
;
149 /*===========================================
150 * The following is interface which will notify coex module.
151 *===========================================
154 ex_btc8821a2ant_init_hwconfig(
155 struct btc_coexist
*btcoexist
158 ex_btc8821a2ant_init_coex_dm(
159 struct btc_coexist
*btcoexist
162 ex_btc8821a2ant_ips_notify(
163 struct btc_coexist
*btcoexist
,
167 ex_btc8821a2ant_lps_notify(
168 struct btc_coexist
*btcoexist
,
172 ex_btc8821a2ant_scan_notify(
173 struct btc_coexist
*btcoexist
,
177 ex_btc8821a2ant_connect_notify(
178 struct btc_coexist
*btcoexist
,
182 ex_btc8821a2ant_media_status_notify(
183 struct btc_coexist
*btcoexist
,
187 ex_btc8821a2ant_special_packet_notify(
188 struct btc_coexist
*btcoexist
,
192 ex_btc8821a2ant_bt_info_notify(
193 struct btc_coexist
*btcoexist
,
198 ex_btc8821a2ant_halt_notify(
199 struct btc_coexist
*btcoexist
202 ex_btc8821a2ant_periodical(
203 struct btc_coexist
*btcoexist
206 ex_btc8821a2ant_display_coex_info(
207 struct btc_coexist
*btcoexist
,
210 void ex_btc8821a2ant_pnp_notify(struct btc_coexist
*btcoexist
, u8 pnp_state
);
211 void ex_btc8821a2ant_pre_load_firmware(struct btc_coexist
*btcoexist
);