xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852bs/phl/phl_btc_def.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2019 - 2020 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  *****************************************************************************/
15 #ifndef __PHL_BTC_DEF_H__
16 #define __PHL_BTC_DEF_H__
17 
18 #define RTW_PHL_BTC_CTRL_BUF 40
19 #define RTW_PHL_BTC_FWINFO_BUF 1280
20 
21 
22 /*****************************************
23  * Please contact the member of BTC submodule if you
24  * need to revise this section
25  *****************************************/
26 #define RTW_BTINFO_MAXLEN 10
27 #define RTW_SCBD_MAXLEN 10
28 
29 #define BTC_C2H_CAT 2 /* C2H Category for OutSrc */
30 #define BTC_CLASS_MIN 0x10
31 #define BTC_CLASS_FEV 0x12
32 #define BTC_CLASS_MAX 0x17
33 
34 enum {
35 	BTC_FEV_REPORT = 0,
36 	BTC_FEV_BT_INFO = 1,
37 	BTC_FEV_BT_SCBD = 2,
38 	BTC_FEV_BT_REG = 3
39 };
40 /*****************************************/
41 
42 enum {
43 	BTC_HMSG_TMR_EN = 0x0,
44 	BTC_HMSG_BT_REG_READBACK = 0x1,
45 	BTC_HMSG_SET_BT_REQ_SLOT = 0x2,
46 	BTC_HMSG_FW_EV = 0x3,
47 	BTC_HMSG_BT_LINK_CHG = 0x4,
48 	BTC_HMSG_MAX
49 };
50 
51 enum {
52 	BTC_CTRL_TYPE_MANUAL,
53 	BTC_CTRL_TYPE_EN_REPORT,
54 	BTC_CTRL_TYPE_SET_SLOTS,
55 	BTC_CTRL_TYPE_SET_MREGS,
56 	BTC_CTRL_TYPE_SET_TDMA,
57 	BTC_CTRL_TYPE_SET_1SLOT,
58 	BTC_CTRL_TYPE_SET_POLICY,
59 	BTC_CTRL_TYPE_SET_GPIO_DBG,
60 	BTC_CTRL_TYPE_SEND_HUB_MSG,
61 	BTC_CTRL_TYPE_TEST,
62 	BTC_CTRL_TYPE_MAX
63 };
64 
65 enum {
66 	BTC_TIMER_PERIODIC,
67 	BTC_TIMER_WL_SPECPKT,
68 	BTC_TIMER_WL_RFKTO,
69 	BTC_TIMER_BT_A2DPPLAY,
70 	BTC_TIMER_MAX
71 };
72 
73 enum RTW_PHL_BTC_CTRL_TYPE {
74 	PHL_BTC_CTRL_MANUAL,
75 	PHL_BTC_CTRL_MAX
76 };
77 
78 enum {
79 	PHL_BTC_CNTFY_BTINFO,
80 	PHL_BTC_CNTFY_MAX
81 };
82 
83 enum PHL_BTC_NTFY_REASON {
84 	PHL_BTC_NTFY_RSN_PERIOTIC
85 };
86 
87 enum RTW_PHL_BTC_NOTIFY {
88 	PHL_BTC_NTFY_SCAN_START,
89 	PHL_BTC_NTFY_SCAN_STOP,
90 	PHL_BTC_NTFY_COEX_INFO,
91 	PHL_BTC_NTFY_ROLE_INFO,
92 	PHL_BTC_NTFY_CTRL,
93 	PHL_BTC_NTFY_FWINFO,
94 	PHL_BTC_NTFY_RADIO_STATE,
95 	PHL_BTC_NTFY_WLSTA,
96 	PHL_BTC_NTFY_PACKET_EVT,
97 	PHL_BTC_NTFY_TIMER,
98 	PHL_BTC_NTFY_MAX
99 };
100 
101 enum {
102 	BTC_MODE_NORMAL,
103 	BTC_MODE_WL,
104 	BTC_MODE_BT,
105 	BTC_MODE_WLOFF,
106 	BTC_MODE_MAX
107 };
108 
109 enum {
110 	BTC_RFCTRL_WL_OFF,
111 	BTC_RFCTRL_WL_ON,
112 	BTC_RFCTRL_LPS_WL_ON,
113 	BTC_RFCTRL_FW_CTRL,
114 	BTC_RFCTRL_MAX
115 };
116 
117 struct rtw_phl_btc_ops {
118 	void (*print)(const char *msg);
119 };
120 
121 struct rtw_phl_btc_coex_info_param {
122 	u8 query_type;
123 };
124 
125 struct rtw_phl_btc_role_info_param {
126 	u8 role_id;
127 	enum role_state rstate;
128 };
129 
130 struct rtw_phl_btc_wl_sta_param {
131 	u8 role_id;
132 	u16 mac_id;
133 	u8 reason;
134 };
135 
136 struct rtw_phl_btc_pkt_param {
137 	u8 role_id;
138 	u8 pkt_evt_type;
139 };
140 
141 struct rtw_phl_btc_ctrl_param {
142 	u8 type;
143 	u16 len;
144 	u8 buf[RTW_PHL_BTC_CTRL_BUF];
145 };
146 
147 struct rtw_phl_btc_fwinfo_param {
148 	u8 c2h_class;
149 	u8 c2h_func;
150 };
151 
152 struct rtw_phl_btc_radio_state_param {
153 	u8 rf_on;
154 };
155 
156 struct rtw_phl_btc_tmr_param {
157 	void *timer;
158 };
159 
160 struct rtw_phl_btc_ntfy {
161 	enum RTW_PHL_BTC_NOTIFY notify;
162 	struct rtw_phl_btc_ops *ops;
163 
164 	/* real parameter for different notifications */
165 	union {
166 		struct rtw_phl_btc_coex_info_param cinfo;
167 		struct rtw_phl_btc_role_info_param rinfo;
168 		struct rtw_phl_btc_ctrl_param ctrl;
169 		struct rtw_phl_btc_radio_state_param rfst;
170 		struct rtw_phl_btc_fwinfo_param finfo;
171 		struct rtw_phl_btc_wl_sta_param wsta;
172 		struct rtw_phl_btc_pkt_param pkt;
173 		struct rtw_phl_btc_tmr_param tmr;
174 	} u;
175 
176 	void *priv;
177 	int (*ntfy_cb)(void *priv, enum RTW_PHL_BTC_NOTIFY ntfy,
178 		struct rtw_phl_btc_ntfy *info);
179 };
180 
181 #endif /* __PHL_BTC_DEF_H__ */
182