1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
4 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
5 */
6
7
8 #ifndef _CNSS_QMI_H
9 #define _CNSS_QMI_H
10
11 #include "wlan_firmware_service_v01.h"
12
13 struct cnss_plat_data;
14
15 struct cnss_qmi_event_server_arrive_data {
16 unsigned int node;
17 unsigned int port;
18 };
19
20 struct cnss_mem_seg {
21 u64 addr;
22 u32 size;
23 };
24
25 struct cnss_qmi_event_fw_mem_file_save_data {
26 u32 total_size;
27 u32 mem_seg_len;
28 enum wlfw_mem_type_enum_v01 mem_type;
29 struct cnss_mem_seg mem_seg[QMI_WLFW_MAX_NUM_MEM_SEG_V01];
30 char file_name[QMI_WLFW_MAX_STR_LEN_V01 + 1];
31 };
32
33 #ifdef CONFIG_CNSS2_QMI
34 #include "coexistence_service_v01.h"
35 #include "ip_multimedia_subsystem_private_service_v01.h"
36 #include "device_management_service_v01.h"
37
38 int cnss_qmi_init(struct cnss_plat_data *plat_priv);
39 void cnss_qmi_deinit(struct cnss_plat_data *plat_priv);
40 unsigned int cnss_get_qmi_timeout(struct cnss_plat_data *plat_priv);
41 int cnss_wlfw_server_arrive(struct cnss_plat_data *plat_priv, void *data);
42 int cnss_wlfw_server_exit(struct cnss_plat_data *plat_priv);
43 int cnss_wlfw_respond_mem_send_sync(struct cnss_plat_data *plat_priv);
44 int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv);
45 int cnss_wlfw_bdf_dnld_send_sync(struct cnss_plat_data *plat_priv,
46 u32 bdf_type);
47 int cnss_wlfw_tme_patch_dnld_send_sync(struct cnss_plat_data *plat_priv,
48 enum wlfw_tme_lite_file_type_v01 file);
49 int cnss_wlfw_m3_dnld_send_sync(struct cnss_plat_data *plat_priv);
50 int cnss_wlfw_aux_dnld_send_sync(struct cnss_plat_data *plat_priv);
51 int cnss_wlfw_wlan_mode_send_sync(struct cnss_plat_data *plat_priv,
52 enum cnss_driver_mode mode);
53 int cnss_wlfw_wlan_cfg_send_sync(struct cnss_plat_data *plat_priv,
54 struct cnss_wlan_enable_cfg *config,
55 const char *host_version);
56 int cnss_wlfw_athdiag_read_send_sync(struct cnss_plat_data *plat_priv,
57 u32 offset, u32 mem_type,
58 u32 data_len, u8 *data);
59 int cnss_wlfw_athdiag_write_send_sync(struct cnss_plat_data *plat_priv,
60 u32 offset, u32 mem_type,
61 u32 data_len, u8 *data);
62 int cnss_wlfw_ini_send_sync(struct cnss_plat_data *plat_priv,
63 u8 fw_log_mode);
64 int cnss_wlfw_antenna_switch_send_sync(struct cnss_plat_data *plat_priv);
65 int cnss_wlfw_antenna_grant_send_sync(struct cnss_plat_data *plat_priv);
66 int cnss_wlfw_dynamic_feature_mask_send_sync(struct cnss_plat_data *plat_priv);
67 int cnss_wlfw_get_info_send_sync(struct cnss_plat_data *plat_priv, int type,
68 void *cmd, int cmd_len);
69 int cnss_process_wfc_call_ind_event(struct cnss_plat_data *plat_priv,
70 void *data);
71 int cnss_process_twt_cfg_ind_event(struct cnss_plat_data *plat_priv,
72 void *data);
73 int cnss_register_coex_service(struct cnss_plat_data *plat_priv);
74 void cnss_unregister_coex_service(struct cnss_plat_data *plat_priv);
75 int coex_antenna_switch_to_wlan_send_sync_msg(struct cnss_plat_data *plat_priv);
76 int coex_antenna_switch_to_mdm_send_sync_msg(struct cnss_plat_data *plat_priv);
77 int cnss_wlfw_qdss_trace_mem_info_send_sync(struct cnss_plat_data *plat_priv);
78 int cnss_register_ims_service(struct cnss_plat_data *plat_priv);
79 void cnss_unregister_ims_service(struct cnss_plat_data *plat_priv);
80 int cnss_wlfw_send_pcie_gen_speed_sync(struct cnss_plat_data *plat_priv);
81 void cnss_ignore_qmi_failure(bool ignore);
82 int cnss_qmi_get_dms_mac(struct cnss_plat_data *plat_priv);
83 int cnss_wlfw_wlan_mac_req_send_sync(struct cnss_plat_data *plat_priv,
84 u8 *mac, u32 mac_len);
85 int cnss_dms_init(struct cnss_plat_data *plat_priv);
86 void cnss_dms_deinit(struct cnss_plat_data *plat_priv);
87 int cnss_wlfw_qdss_dnld_send_sync(struct cnss_plat_data *plat_priv);
88 int cnss_wlfw_qdss_data_send_sync(struct cnss_plat_data *plat_priv, char *file_name,
89 u32 total_size);
90 int cnss_wlfw_tme_opt_file_dnld_send_sync(struct cnss_plat_data *plat_priv,
91 enum wlfw_tme_lite_file_type_v01 file);
92 int wlfw_qdss_trace_start(struct cnss_plat_data *plat_priv);
93 int wlfw_qdss_trace_stop(struct cnss_plat_data *plat_priv, unsigned long long option);
94 int cnss_wlfw_cal_report_req_send_sync(struct cnss_plat_data *plat_priv,
95 u32 cal_file_download_size);
96 int cnss_send_subsys_restart_level_msg(struct cnss_plat_data *plat_priv);
97 int cnss_wlfw_send_host_wfc_call_status(struct cnss_plat_data *plat_priv,
98 struct cnss_wfc_cfg cfg);
99 void cnss_cancel_dms_work(void);
100 #else
101 #define QMI_WLFW_TIMEOUT_MS 10000
102
cnss_qmi_init(struct cnss_plat_data * plat_priv)103 static inline int cnss_qmi_init(struct cnss_plat_data *plat_priv)
104 {
105 return 0;
106 }
107
cnss_qmi_deinit(struct cnss_plat_data * plat_priv)108 static inline void cnss_qmi_deinit(struct cnss_plat_data *plat_priv)
109 {
110 }
111
112 static inline
cnss_get_qmi_timeout(struct cnss_plat_data * plat_priv)113 unsigned int cnss_get_qmi_timeout(struct cnss_plat_data *plat_priv)
114 {
115 return QMI_WLFW_TIMEOUT_MS;
116 }
117
cnss_wlfw_server_arrive(struct cnss_plat_data * plat_priv,void * data)118 static inline int cnss_wlfw_server_arrive(struct cnss_plat_data *plat_priv,
119 void *data)
120 {
121 return 0;
122 }
123
cnss_wlfw_server_exit(struct cnss_plat_data * plat_priv)124 static inline int cnss_wlfw_server_exit(struct cnss_plat_data *plat_priv)
125 {
126 return 0;
127 }
128
129 static inline
cnss_wlfw_respond_mem_send_sync(struct cnss_plat_data * plat_priv)130 int cnss_wlfw_respond_mem_send_sync(struct cnss_plat_data *plat_priv)
131 {
132 return 0;
133 }
134
cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data * plat_priv)135 static inline int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv)
136 {
137 return 0;
138 }
139
cnss_wlfw_bdf_dnld_send_sync(struct cnss_plat_data * plat_priv,u32 bdf_type)140 static inline int cnss_wlfw_bdf_dnld_send_sync(struct cnss_plat_data *plat_priv,
141 u32 bdf_type)
142 {
143 return 0;
144 }
145
cnss_wlfw_m3_dnld_send_sync(struct cnss_plat_data * plat_priv)146 static inline int cnss_wlfw_m3_dnld_send_sync(struct cnss_plat_data *plat_priv)
147 {
148 return 0;
149 }
150
cnss_wlfw_aux_dnld_send_sync(struct cnss_plat_data * plat_priv)151 static inline int cnss_wlfw_aux_dnld_send_sync(struct cnss_plat_data *plat_priv)
152 {
153 return 0;
154 }
155
156 static inline
cnss_wlfw_wlan_mode_send_sync(struct cnss_plat_data * plat_priv,enum cnss_driver_mode mode)157 int cnss_wlfw_wlan_mode_send_sync(struct cnss_plat_data *plat_priv,
158 enum cnss_driver_mode mode)
159 {
160 return 0;
161 }
162
163 static inline
cnss_wlfw_wlan_cfg_send_sync(struct cnss_plat_data * plat_priv,struct cnss_wlan_enable_cfg * config,const char * host_version)164 int cnss_wlfw_wlan_cfg_send_sync(struct cnss_plat_data *plat_priv,
165 struct cnss_wlan_enable_cfg *config,
166 const char *host_version)
167 {
168 return 0;
169 }
170
171 static inline
cnss_wlfw_athdiag_read_send_sync(struct cnss_plat_data * plat_priv,u32 offset,u32 mem_type,u32 data_len,u8 * data)172 int cnss_wlfw_athdiag_read_send_sync(struct cnss_plat_data *plat_priv,
173 u32 offset, u32 mem_type,
174 u32 data_len, u8 *data)
175 {
176 return 0;
177 }
178
179 static inline
cnss_wlfw_athdiag_write_send_sync(struct cnss_plat_data * plat_priv,u32 offset,u32 mem_type,u32 data_len,u8 * data)180 int cnss_wlfw_athdiag_write_send_sync(struct cnss_plat_data *plat_priv,
181 u32 offset, u32 mem_type,
182 u32 data_len, u8 *data)
183 {
184 return 0;
185 }
186
187 static inline
cnss_wlfw_ini_send_sync(struct cnss_plat_data * plat_priv,u8 fw_log_mode)188 int cnss_wlfw_ini_send_sync(struct cnss_plat_data *plat_priv,
189 u8 fw_log_mode)
190 {
191 return 0;
192 }
193
194 static inline
cnss_wlfw_antenna_switch_send_sync(struct cnss_plat_data * plat_priv)195 int cnss_wlfw_antenna_switch_send_sync(struct cnss_plat_data *plat_priv)
196 {
197 return 0;
198 }
199
200 static inline
cnss_wlfw_antenna_grant_send_sync(struct cnss_plat_data * plat_priv)201 int cnss_wlfw_antenna_grant_send_sync(struct cnss_plat_data *plat_priv)
202 {
203 return 0;
204 }
205
206 static inline
cnss_wlfw_dynamic_feature_mask_send_sync(struct cnss_plat_data * plat_priv)207 int cnss_wlfw_dynamic_feature_mask_send_sync(struct cnss_plat_data *plat_priv)
208 {
209 return 0;
210 }
211
212 static inline
cnss_wlfw_get_info_send_sync(struct cnss_plat_data * plat_priv,int type,void * cmd,int cmd_len)213 int cnss_wlfw_get_info_send_sync(struct cnss_plat_data *plat_priv, int type,
214 void *cmd, int cmd_len)
215 {
216 return 0;
217 }
218
219 static inline
cnss_process_wfc_call_ind_event(struct cnss_plat_data * plat_priv,void * data)220 int cnss_process_wfc_call_ind_event(struct cnss_plat_data *plat_priv,
221 void *data)
222 {
223 return 0;
224 }
225
226 static inline
cnss_process_twt_cfg_ind_event(struct cnss_plat_data * plat_priv,void * data)227 int cnss_process_twt_cfg_ind_event(struct cnss_plat_data *plat_priv,
228 void *data)
229 {
230 return 0;
231 }
232
233 static inline
cnss_register_coex_service(struct cnss_plat_data * plat_priv)234 int cnss_register_coex_service(struct cnss_plat_data *plat_priv)
235 {
236 return 0;
237 }
238
239 static inline
cnss_unregister_coex_service(struct cnss_plat_data * plat_priv)240 void cnss_unregister_coex_service(struct cnss_plat_data *plat_priv) {}
241
242 static inline
coex_antenna_switch_to_wlan_send_sync_msg(struct cnss_plat_data * plat_priv)243 int coex_antenna_switch_to_wlan_send_sync_msg(struct cnss_plat_data *plat_priv)
244 {
245 return 0;
246 }
247
248 static inline
coex_antenna_switch_to_mdm_send_sync_msg(struct cnss_plat_data * plat_priv)249 int coex_antenna_switch_to_mdm_send_sync_msg(struct cnss_plat_data *plat_priv)
250 {
251 return 0;
252 }
253
254 static inline
cnss_wlfw_qdss_trace_mem_info_send_sync(struct cnss_plat_data * plat_priv)255 int cnss_wlfw_qdss_trace_mem_info_send_sync(struct cnss_plat_data *plat_priv)
256 {
257 return 0;
258 }
259
260 static inline
cnss_register_ims_service(struct cnss_plat_data * plat_priv)261 int cnss_register_ims_service(struct cnss_plat_data *plat_priv)
262 {
263 return 0;
264 }
265
266 static inline
cnss_unregister_ims_service(struct cnss_plat_data * plat_priv)267 void cnss_unregister_ims_service(struct cnss_plat_data *plat_priv) {}
268
269 static inline
cnss_wlfw_send_pcie_gen_speed_sync(struct cnss_plat_data * plat_priv)270 int cnss_wlfw_send_pcie_gen_speed_sync(struct cnss_plat_data *plat_priv)
271 {
272 return 0;
273 }
cnss_ignore_qmi_failure(bool ignore)274 void cnss_ignore_qmi_failure(bool ignore) {};
cnss_qmi_get_dms_mac(struct cnss_plat_data * plat_priv)275 static inline int cnss_qmi_get_dms_mac(struct cnss_plat_data *plat_priv)
276 {
277 return 0;
278 }
279
cnss_wlfw_wlan_mac_req_send_sync(struct cnss_plat_data * plat_priv,u8 * mac,u32 mac_len)280 int cnss_wlfw_wlan_mac_req_send_sync(struct cnss_plat_data *plat_priv,
281 u8 *mac, u32 mac_len)
282 {
283 return 0;
284 }
285
cnss_dms_init(struct cnss_plat_data * plat_priv)286 static inline int cnss_dms_init(struct cnss_plat_data *plat_priv)
287 {
288 return 0;
289 }
290
cnss_wlfw_qdss_dnld_send_sync(struct cnss_plat_data * plat_priv)291 int cnss_wlfw_qdss_dnld_send_sync(struct cnss_plat_data *plat_priv)
292 {
293 return 0;
294 }
295
cnss_wlfw_qdss_data_send_sync(struct cnss_plat_data * plat_priv,char * file_name,u32 total_size)296 int cnss_wlfw_qdss_data_send_sync(struct cnss_plat_data *plat_priv, char *file_name,
297 u32 total_size)
298 {
299 return 0;
300 }
301
cnss_wlfw_tme_opt_file_dnld_send_sync(struct cnss_plat_data * plat_priv,enum wlfw_tme_lite_file_type_v01 file)302 int cnss_wlfw_tme_opt_file_dnld_send_sync(struct cnss_plat_data *plat_priv,
303 enum wlfw_tme_lite_file_type_v01 file)
304 {
305 return 0;
306 }
307
cnss_dms_deinit(struct cnss_plat_data * plat_priv)308 static inline void cnss_dms_deinit(struct cnss_plat_data *plat_priv) {}
309
wlfw_qdss_trace_start(struct cnss_plat_data * plat_priv)310 int wlfw_qdss_trace_start(struct cnss_plat_data *plat_priv)
311 {
312 return 0;
313 }
314
wlfw_qdss_trace_stop(struct cnss_plat_data * plat_priv,unsigned long long option)315 int wlfw_qdss_trace_stop(struct cnss_plat_data *plat_priv, unsigned long long option)
316 {
317 return 0;
318 }
319
320 static inline
cnss_wlfw_cal_report_req_send_sync(struct cnss_plat_data * plat_priv,u32 cal_file_download_size)321 int cnss_wlfw_cal_report_req_send_sync(struct cnss_plat_data *plat_priv,
322 u32 cal_file_download_size)
323 {
324 return 0;
325 }
326
327 static inline
cnss_send_subsys_restart_level_msg(struct cnss_plat_data * plat_priv)328 int cnss_send_subsys_restart_level_msg(struct cnss_plat_data *plat_priv)
329 {
330 return 0;
331 }
332
cnss_cancel_dms_work(void)333 static void cnss_cancel_dms_work(void)
334 {
335 }
336
cnss_wlfw_send_host_wfc_call_status(struct cnss_plat_data * plat_priv,struct cnss_wfc_cfg cfg)337 int cnss_wlfw_send_host_wfc_call_status(struct cnss_plat_data *plat_priv,
338 struct cnss_wfc_cfg cfg)
339 {
340 return 0;
341 }
342 #endif /* CONFIG_CNSS2_QMI */
343
344 #ifdef CONFIG_CNSS2_DEBUG
cnss_get_host_build_type(void)345 static inline u32 cnss_get_host_build_type(void)
346 {
347 return QMI_HOST_BUILD_TYPE_PRIMARY_V01;
348 }
349 #else
cnss_get_host_build_type(void)350 static inline u32 cnss_get_host_build_type(void)
351 {
352 return QMI_HOST_BUILD_TYPE_SECONDARY_V01;
353 }
354 #endif
355
356 #endif /* _CNSS_QMI_H */
357