1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
4  * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
5  */
6 
7 #ifndef __ICNSS_QMI_H__
8 #define __ICNSS_QMI_H__
9 
10 #include "device_management_service_v01.h"
11 #include "ip_multimedia_subsystem_private_service_v01.h"
12 
13 #define QDSS_TRACE_SEG_LEN_MAX 32
14 #define QDSS_TRACE_FILE_NAME_MAX 16
15 #define M3_SEGMENTS_SIZE_MAX 10
16 #define M3_SEGMENT_NAME_LEN_MAX 16
17 
18 struct icnss_mem_seg {
19 	u64 addr;
20 	u32 size;
21 };
22 
23 struct icnss_qmi_event_qdss_trace_save_data {
24 	u32 total_size;
25 	u32 mem_seg_len;
26 	struct icnss_mem_seg mem_seg[QDSS_TRACE_SEG_LEN_MAX];
27 	char file_name[QDSS_TRACE_FILE_NAME_MAX + 1];
28 };
29 
30 struct icnss_m3_segment {
31 	u32 type;
32 	u64 addr;
33 	u64 size;
34 	char name[M3_SEGMENT_NAME_LEN_MAX + 1];
35 };
36 
37 struct icnss_m3_upload_segments_req_data {
38 	u32 pdev_id;
39 	u32 no_of_valid_segments;
40 	struct icnss_m3_segment m3_segment[M3_SEGMENTS_SIZE_MAX];
41 };
42 
43 struct icnss_qmi_event_qdss_trace_req_data {
44 	u32 total_size;
45 	char file_name[QDSS_TRACE_FILE_NAME_MAX + 1];
46 };
47 
48 #ifndef CONFIG_ICNSS2_QMI
49 
wlfw_ind_register_send_sync_msg(struct icnss_priv * priv)50 static inline int wlfw_ind_register_send_sync_msg(struct icnss_priv *priv)
51 {
52 	return 0;
53 }
icnss_connect_to_fw_server(struct icnss_priv * priv,void * data)54 static inline int icnss_connect_to_fw_server(struct icnss_priv *priv,
55 					     void *data)
56 {
57 	return 0;
58 }
wlfw_msa_mem_info_send_sync_msg(struct icnss_priv * priv)59 static inline int wlfw_msa_mem_info_send_sync_msg(struct icnss_priv *priv)
60 {
61 	return 0;
62 }
wlfw_msa_ready_send_sync_msg(struct icnss_priv * priv)63 static inline int wlfw_msa_ready_send_sync_msg(struct icnss_priv *priv)
64 {
65 	return 0;
66 }
wlfw_cap_send_sync_msg(struct icnss_priv * priv)67 static inline int wlfw_cap_send_sync_msg(struct icnss_priv *priv)
68 {
69 	return 0;
70 }
wlfw_dynamic_feature_mask_send_sync_msg(struct icnss_priv * priv,uint64_t dynamic_feature_mask)71 static inline int wlfw_dynamic_feature_mask_send_sync_msg(
72 		struct icnss_priv *priv, uint64_t dynamic_feature_mask)
73 {
74 	return 0;
75 }
icnss_clear_server(struct icnss_priv * priv)76 static inline int icnss_clear_server(struct icnss_priv *priv)
77 {
78 	return 0;
79 }
wlfw_rejuvenate_ack_send_sync_msg(struct icnss_priv * priv)80 static inline int wlfw_rejuvenate_ack_send_sync_msg(struct icnss_priv *priv)
81 {
82 	return 0;
83 }
icnss_ignore_fw_timeout(bool ignore)84 static inline void icnss_ignore_fw_timeout(bool ignore) {}
wlfw_send_modem_shutdown_msg(struct icnss_priv * priv)85 static int wlfw_send_modem_shutdown_msg(struct icnss_priv *priv)
86 {
87 	return 0;
88 }
wlfw_ini_send_sync_msg(struct icnss_priv * priv,uint8_t fw_log_mode)89 static inline int wlfw_ini_send_sync_msg(struct icnss_priv *priv,
90 		uint8_t fw_log_mode)
91 {
92 	return 0;
93 }
wlfw_athdiag_read_send_sync_msg(struct icnss_priv * priv,uint32_t offset,uint32_t mem_type,uint32_t data_len,uint8_t * data)94 static inline int wlfw_athdiag_read_send_sync_msg(struct icnss_priv *priv,
95 					   uint32_t offset, uint32_t mem_type,
96 					   uint32_t data_len, uint8_t *data)
97 {
98 	return 0;
99 }
wlfw_athdiag_write_send_sync_msg(struct icnss_priv * priv,uint32_t offset,uint32_t mem_type,uint32_t data_len,uint8_t * data)100 static inline int wlfw_athdiag_write_send_sync_msg(struct icnss_priv *priv,
101 					    uint32_t offset, uint32_t mem_type,
102 					    uint32_t data_len, uint8_t *data)
103 {
104 	return 0;
105 }
wlfw_wlan_mode_send_sync_msg(struct icnss_priv * priv,enum icnss_driver_mode mode)106 static inline int wlfw_wlan_mode_send_sync_msg(struct icnss_priv *priv,
107 		enum icnss_driver_mode mode)
108 {
109 	return 0;
110 }
wlfw_host_cap_send_sync(struct icnss_priv * priv)111 static int wlfw_host_cap_send_sync(struct icnss_priv *priv)
112 {
113 	return 0;
114 }
icnss_send_wlan_enable_to_fw(struct icnss_priv * priv,struct icnss_wlan_enable_cfg * config,enum icnss_driver_mode mode,const char * host_version)115 static inline int icnss_send_wlan_enable_to_fw(struct icnss_priv *priv,
116 		struct icnss_wlan_enable_cfg *config,
117 		enum icnss_driver_mode mode,
118 		const char *host_version)
119 {
120 	return 0;
121 }
icnss_send_wlan_disable_to_fw(struct icnss_priv * priv)122 static inline int icnss_send_wlan_disable_to_fw(struct icnss_priv *priv)
123 {
124 	return 0;
125 }
icnss_register_fw_service(struct icnss_priv * priv)126 static inline int icnss_register_fw_service(struct icnss_priv *priv)
127 {
128 	return 0;
129 }
icnss_unregister_fw_service(struct icnss_priv * priv)130 static inline void icnss_unregister_fw_service(struct icnss_priv *priv) {}
wlfw_device_info_send_msg(struct icnss_priv * priv)131 static inline int wlfw_device_info_send_msg(struct icnss_priv *priv)
132 {
133 	return 0;
134 }
wlfw_wlan_mode_send_sync_msg(struct icnss_priv * priv,enum wlfw_driver_mode_enum_v01 mode)135 int wlfw_wlan_mode_send_sync_msg(struct icnss_priv *priv,
136 				 enum wlfw_driver_mode_enum_v01 mode)
137 {
138 	return 0;
139 }
icnss_wlfw_bdf_dnld_send_sync(struct icnss_priv * priv,u32 bdf_type)140 int icnss_wlfw_bdf_dnld_send_sync(struct icnss_priv *priv, u32 bdf_type)
141 {
142 	return 0;
143 }
144 
wlfw_qdss_trace_mem_info_send_sync(struct icnss_priv * priv)145 int wlfw_qdss_trace_mem_info_send_sync(struct icnss_priv *priv)
146 {
147 	return 0;
148 }
149 
wlfw_power_save_send_msg(struct icnss_priv * priv,enum wlfw_power_save_mode_v01 mode)150 int wlfw_power_save_send_msg(struct icnss_priv *priv,
151 			     enum wlfw_power_save_mode_v01 mode)
152 {
153 	return 0;
154 }
155 
icnss_wlfw_get_info_send_sync(struct icnss_priv * priv,int type,void * cmd,int cmd_len)156 int icnss_wlfw_get_info_send_sync(struct icnss_priv *priv, int type,
157 				  void *cmd, int cmd_len)
158 {
159 	return 0;
160 }
161 
wlfw_send_soc_wake_msg(struct icnss_priv * priv,enum wlfw_soc_wake_enum_v01 type)162 int wlfw_send_soc_wake_msg(struct icnss_priv *priv,
163 			   enum wlfw_soc_wake_enum_v01 type)
164 {
165 	return 0;
166 }
167 
icnss_wlfw_m3_dump_upload_done_send_sync(struct icnss_priv * priv,u32 pdev_id,int status)168 int icnss_wlfw_m3_dump_upload_done_send_sync(struct icnss_priv *priv,
169 					     u32 pdev_id, int status)
170 {
171 	return 0;
172 }
173 
icnss_qmi_get_dms_mac(struct icnss_priv * priv)174 int icnss_qmi_get_dms_mac(struct icnss_priv *priv)
175 {
176 	return 0;
177 }
178 
icnss_wlfw_wlan_mac_req_send_sync(struct icnss_priv * priv,u8 * mac,u32 mac_len)179 int icnss_wlfw_wlan_mac_req_send_sync(struct icnss_priv *priv,
180 				      u8 *mac, u32 mac_len)
181 {
182 	return 0;
183 }
184 
icnss_dms_init(struct icns_priv * priv)185 int icnss_dms_init(struct icns_priv *priv)
186 {
187 	return 0;
188 }
189 
icnss_dms_deinit(struct icnss_priv * priv)190 void icnss_dms_deinit(struct icnss_priv *priv)
191 {
192 }
193 
194 static inline
icnss_process_wfc_call_ind_event(struct icnss_priv * priv,void * data)195 int icnss_process_wfc_call_ind_event(struct icnss_priv *priv,
196 				     void *data)
197 {
198 	return 0;
199 }
200 
201 static inline
icnss_process_twt_cfg_ind_event(struct icnss_priv * priv,void * data)202 int icnss_process_twt_cfg_ind_event(struct icnss_priv *priv,
203 				    void *data)
204 {
205 	return 0;
206 }
207 
208 static inline
icnss_register_ims_service(struct icnss_priv * priv)209 int icnss_register_ims_service(struct icnss_priv *priv)
210 {
211 	return 0;
212 }
213 
214 static inline
icnss_unregister_ims_service(struct icnss_priv * priv)215 void icnss_unregister_ims_service(struct icnss_priv *priv) {}
216 
wlfw_subsys_restart_level_msg(struct icnss_priv * penv,uint8_t restart_level)217 int wlfw_subsys_restart_level_msg(struct icnss_priv *penv, uint8_t restart_level)
218 {
219 	return 0;
220 }
221 
wlfw_cal_report_req(struct icnss_priv * priv)222 static inline int wlfw_cal_report_req(struct icnss_priv *priv)
223 {
224 	return 0;
225 }
226 
icnss_send_vbatt_update(struct icnss_priv * priv,uint64_t voltage_uv)227 int icnss_send_vbatt_update(struct icnss_priv *priv, uint64_t voltage_uv)
228 {
229 	return 0;
230 }
231 
wlfw_wlan_hw_init_cfg_msg(struct icnss_priv * penv,enum wlfw_wlan_rf_subtype_v01 type)232 int wlfw_wlan_hw_init_cfg_msg(struct icnss_priv *penv,
233 			      enum wlfw_wlan_rf_subtype_v01 type)
234 {
235 	return 0;
236 }
237 #else
238 int wlfw_ind_register_send_sync_msg(struct icnss_priv *priv);
239 int icnss_connect_to_fw_server(struct icnss_priv *priv, void *data);
240 int wlfw_msa_mem_info_send_sync_msg(struct icnss_priv *priv);
241 int wlfw_msa_ready_send_sync_msg(struct icnss_priv *priv);
242 int wlfw_cap_send_sync_msg(struct icnss_priv *priv);
243 int icnss_qmi_pin_connect_result_ind(struct icnss_priv *priv,
244 					void *msg, unsigned int msg_len);
245 int wlfw_dynamic_feature_mask_send_sync_msg(struct icnss_priv *priv,
246 					   uint64_t dynamic_feature_mask);
247 int icnss_clear_server(struct icnss_priv *priv);
248 int wlfw_rejuvenate_ack_send_sync_msg(struct icnss_priv *priv);
249 void icnss_ignore_fw_timeout(bool ignore);
250 int wlfw_send_modem_shutdown_msg(struct icnss_priv *priv);
251 int wlfw_ini_send_sync_msg(struct icnss_priv *priv, uint8_t fw_log_mode);
252 int wlfw_athdiag_read_send_sync_msg(struct icnss_priv *priv,
253 					   uint32_t offset, uint32_t mem_type,
254 					   uint32_t data_len, uint8_t *data);
255 int wlfw_athdiag_write_send_sync_msg(struct icnss_priv *priv,
256 					    uint32_t offset, uint32_t mem_type,
257 					    uint32_t data_len, uint8_t *data);
258 int icnss_send_wlan_enable_to_fw(struct icnss_priv *priv,
259 		struct icnss_wlan_enable_cfg *config,
260 		enum icnss_driver_mode mode,
261 		const char *host_version);
262 int icnss_send_wlan_disable_to_fw(struct icnss_priv *priv);
263 int icnss_register_fw_service(struct icnss_priv *priv);
264 void icnss_unregister_fw_service(struct icnss_priv *priv);
265 int wlfw_host_cap_send_sync(struct icnss_priv *priv);
266 int wlfw_device_info_send_msg(struct icnss_priv *priv);
267 int wlfw_wlan_mode_send_sync_msg(struct icnss_priv *priv,
268 				 enum wlfw_driver_mode_enum_v01 mode);
269 int icnss_wlfw_bdf_dnld_send_sync(struct icnss_priv *priv, u32 bdf_type);
270 int icnss_wlfw_qdss_dnld_send_sync(struct icnss_priv *priv);
271 int icnss_wlfw_qdss_data_send_sync(struct icnss_priv *priv, char *file_name,
272 				   u32 total_size);
273 int wlfw_qdss_trace_start(struct icnss_priv *priv);
274 int wlfw_qdss_trace_stop(struct icnss_priv *priv, unsigned long long option);
275 int wlfw_qdss_trace_mem_info_send_sync(struct icnss_priv *priv);
276 int wlfw_power_save_send_msg(struct icnss_priv *priv,
277 			     enum wlfw_power_save_mode_v01 mode);
278 int icnss_wlfw_get_info_send_sync(struct icnss_priv *priv, int type,
279 				  void *cmd, int cmd_len);
280 int wlfw_send_soc_wake_msg(struct icnss_priv *priv,
281 			   enum wlfw_soc_wake_enum_v01 type);
282 int icnss_wlfw_m3_dump_upload_done_send_sync(struct icnss_priv *priv,
283 					     u32 pdev_id, int status);
284 int icnss_qmi_get_dms_mac(struct icnss_priv *priv);
285 int icnss_wlfw_wlan_mac_req_send_sync(struct icnss_priv *priv,
286 				      u8 *mac, u32 mac_len);
287 int icnss_process_wfc_call_ind_event(struct icnss_priv *priv,
288 				     void *data);
289 int icnss_process_twt_cfg_ind_event(struct icnss_priv *priv,
290 				    void *data);
291 int icnss_register_ims_service(struct icnss_priv *priv);
292 void icnss_unregister_ims_service(struct icnss_priv *priv);
293 int icnss_dms_init(struct icnss_priv *priv);
294 void icnss_dms_deinit(struct icnss_priv *priv);
295 int wlfw_subsys_restart_level_msg(struct icnss_priv *penv, uint8_t restart_level);
296 int wlfw_cal_report_req(struct icnss_priv *priv);
297 int icnss_send_vbatt_update(struct icnss_priv *priv, uint64_t voltage_uv);
298 int wlfw_wlan_hw_init_cfg_msg(struct icnss_priv *penv,
299 			      enum wlfw_wlan_rf_subtype_v01 type);
300 #endif
301 
302 #endif /* __ICNSS_QMI_H__*/
303