Merge tag 'nfs-for-3.14-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / staging / rtl8821ae / btcoexist / halbtc8723b2ant.h
1 /************************************************************************
2  * The following is for 8723B 2Ant BT Co-exist definition
3  ************************************************************************/
4 #define BT_AUTO_REPORT_ONLY_8723B_2ANT                  1
5
6
7 #define BT_INFO_8723B_2ANT_B_FTP                        BIT7
8 #define BT_INFO_8723B_2ANT_B_A2DP                       BIT6
9 #define BT_INFO_8723B_2ANT_B_HID                        BIT5
10 #define BT_INFO_8723B_2ANT_B_SCO_BUSY                   BIT4
11 #define BT_INFO_8723B_2ANT_B_ACL_BUSY                   BIT3
12 #define BT_INFO_8723B_2ANT_B_INQ_PAGE                   BIT2
13 #define BT_INFO_8723B_2ANT_B_SCO_ESCO                   BIT1
14 #define BT_INFO_8723B_2ANT_B_CONNECTION                 BIT0
15
16 #define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT             2
17
18 typedef enum _BT_INFO_SRC_8723B_2ANT{
19         BT_INFO_SRC_8723B_2ANT_WIFI_FW                  = 0x0,
20         BT_INFO_SRC_8723B_2ANT_BT_RSP                   = 0x1,
21         BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND           = 0x2,
22         BT_INFO_SRC_8723B_2ANT_MAX
23 }BT_INFO_SRC_8723B_2ANT,*PBT_INFO_SRC_8723B_2ANT;
24
25 typedef enum _BT_8723B_2ANT_BT_STATUS{
26         BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE      = 0x0,
27         BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE          = 0x1,
28         BT_8723B_2ANT_BT_STATUS_INQ_PAGE                = 0x2,
29         BT_8723B_2ANT_BT_STATUS_ACL_BUSY                = 0x3,
30         BT_8723B_2ANT_BT_STATUS_SCO_BUSY                = 0x4,
31         BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY            = 0x5,
32         BT_8723B_2ANT_BT_STATUS_MAX
33 }BT_8723B_2ANT_BT_STATUS,*PBT_8723B_2ANT_BT_STATUS;
34
35 typedef enum _BT_8723B_2ANT_COEX_ALGO{
36         BT_8723B_2ANT_COEX_ALGO_UNDEFINED               = 0x0,
37         BT_8723B_2ANT_COEX_ALGO_SCO                     = 0x1,
38         BT_8723B_2ANT_COEX_ALGO_HID                     = 0x2,
39         BT_8723B_2ANT_COEX_ALGO_A2DP                    = 0x3,
40         BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS              = 0x4,
41         BT_8723B_2ANT_COEX_ALGO_PANEDR                  = 0x5,
42         BT_8723B_2ANT_COEX_ALGO_PANHS                   = 0x6,
43         BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP             = 0x7,
44         BT_8723B_2ANT_COEX_ALGO_PANEDR_HID              = 0x8,
45         BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR         = 0x9,
46         BT_8723B_2ANT_COEX_ALGO_HID_A2DP                = 0xa,
47         BT_8723B_2ANT_COEX_ALGO_MAX                     = 0xb,
48 }BT_8723B_2ANT_COEX_ALGO,*PBT_8723B_2ANT_COEX_ALGO;
49
50 struct coex_dm_8723b_2ant{
51         /* fw mechanism */
52         bool pre_dec_bt_pwr;
53         bool 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         /* algorithm related */
94         u8 pre_algorithm;
95         u8 cur_algorithm;
96         u8 bt_status;
97         u8 wifi_chnl_info[3];
98
99         bool need_recover_0x948;
100         u16 backup_0x948;
101 };
102
103 struct coex_sta_8723b_2ant{
104         bool bt_link_exist;
105         bool sco_exist;
106         bool a2dp_exist;
107         bool hid_exist;
108         bool pan_exist;
109
110         bool under_lps;
111         bool under_ips;
112         u32 high_priority_tx;
113         u32 high_priority_rx;
114         u32 low_priority_tx;
115         u32 low_priority_rx;
116         u8 bt_rssi;
117         u8 pre_bt_rssi_state;
118         u8 pre_wifi_rssi_state[4];
119         bool c2h_bt_info_req_sent;
120         u8 bt_info_c2h[BT_INFO_SRC_8723B_2ANT_MAX][10];
121         u32 bt_info_c2h_cnt[BT_INFO_SRC_8723B_2ANT_MAX];
122         bool c2h_bt_inquiry_page;
123         u8 bt_retry_cnt;
124         u8 bt_info_ext;
125 };
126
127 /*********************************************************************
128  * The following is interface which will notify coex module.
129  *********************************************************************/
130 void ex_halbtc8723b2ant_init_hwconfig(struct btc_coexist *btcoexist);
131 void ex_halbtc8723b2ant_init_coex_dm(struct btc_coexist *btcoexist);
132 void ex_halbtc8723b2ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
133 void ex_halbtc8723b2ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
134 void ex_halbtc8723b2ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
135 void ex_halbtc8723b2ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
136 void ex_halbtc8723b2ant_media_status_notify(struct btc_coexist *btcoexist,
137                                             u8 type);
138 void ex_halbtc8723b2ant_special_packet_notify(struct btc_coexist *btcoexist,
139                                               u8 type);
140 void ex_halbtc8723b2ant_bt_info_notify(struct btc_coexist *btcoexist,
141                                        u8 *tmpbuf, u8 length);
142 void ex_halbtc8723b2ant_halt_notify(struct btc_coexist *btcoexist);
143 void ex_halbtc8723b2ant_periodical(struct btc_coexist * btcoexist);
144 void ex_halbtc8723b2ant_display_coex_info(struct btc_coexist *btcoexist);
145