xref: /wlan-dirver/qca-wifi-host-cmn/target_if/init_deinit/inc/service_ready_util.h (revision a86b23ee68a2491aede2e03991f3fb37046f4e41)
1 /*
2  * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 /**
19  * DOC: service_ready_util.h
20  *
21  * Public APIs to access (ext)service ready data from psoc object
22  */
23 #ifndef _SERVICE_READY_UTIL_H_
24 #define _SERVICE_READY_UTIL_H_
25 
26 #include "wlan_objmgr_psoc_obj.h"
27 #include "service_ready_param.h"
28 #include "target_if.h"
29 
30 /**
31  * init_deinit_chainmask_table_alloc()
32  *	- allocate chainmask table capability list.
33  * @service_ext_param: pointer to server ext param.
34  *
35  * Allocates capability list based on num_valid_chainmasks for that table.
36  *
37  * Return: QDF Status.
38  */
39 QDF_STATUS init_deinit_chainmask_table_alloc(
40 		struct wlan_psoc_host_service_ext_param *service_ext_param);
41 
42 /**
43  * init_deinit_chainmask_table_free()
44  *	-free chainmask table capability list.
45  * @service_ext_param: pointer to server ext param.
46  *
47  * free capability list based on num_valid_chainmasks for that table.
48  *
49  * Return: QDF Status.
50  */
51 QDF_STATUS init_deinit_chainmask_table_free(
52 		struct wlan_psoc_host_service_ext_param *service_ext_param);
53 
54 /**
55  * init_deinit_populate_service_bitmap() - populate service bitmap
56  * @wmi_handle: wmi handle
57  * @event: event buffer received from FW
58  * @service_bitmap: service bitmap information
59  *
60  * API to populate service bit map
61  *
62  * Return: zero on successful population of service bitmap or failure flag
63  */
64 int init_deinit_populate_service_bitmap(
65 		wmi_unified_t wmi_handle, uint8_t *event,
66 		uint32_t *service_bitmap);
67 
68 /**
69  * init_deinit_populate_fw_version_cmd() - populate FW version
70  * @wmi_handle: wmi handle
71  * @event: event buffer received from FW
72  *
73  * API to populate FW version
74  *
75  * Return: zero on successful population of fw_version command or failure flag
76  */
77 int
78 init_deinit_populate_fw_version_cmd(wmi_unified_t wmi_handle, uint8_t *event);
79 
80 /**
81  * init_deinit_populate_target_cap() - populate target cap
82  * @wmi_handle: wmi handle
83  * @event: event buffer received from FW
84  * @cap: target capability info object
85  *
86  * API to populate target cap
87  *
88  * Return: zero on successful population of target cap or failure flag
89  */
90 int init_deinit_populate_target_cap(
91 		wmi_unified_t wmi_handle, uint8_t *event,
92 		struct wlan_psoc_target_capability_info *cap);
93 
94 /**
95  * init_deinit_populate_service_ready_ext_param() - populate service ready ext
96  *                                                  parameter
97  * @handle: WMI handle pointer
98  * @evt: event buffer received from FW
99  * @param: service ext param object
100  *
101  * API to populate service ready ext param
102  *
103  * Return: zero on successful parsing of service ready ext parameter or failure
104  */
105 int init_deinit_populate_service_ready_ext_param(
106 		wmi_unified_t handle, uint8_t *evt,
107 		struct wlan_psoc_host_service_ext_param *param);
108 
109 /**
110  * init_deinit_populate_service_ready_ext2_param() - populate service ready ext2
111  *                                                   parameter
112  * @handle: WMI handle pointer
113  * @evt: event buffer received from FW
114  * @info: Target info handle
115  *
116  * API to populate service ready ext2 param
117  *
118  * Return: zero on successful parsing of service ready ext parameter or failure
119  */
120 int init_deinit_populate_service_ready_ext2_param(
121 		wmi_unified_t handle, uint8_t *evt,
122 		struct tgt_info *info);
123 
124 /**
125  * init_deinit_populate_chainmask_tables() - populate chainmaks tables
126  * @handle: WMI handle pointer
127  * @evt: event buffer received from FW
128  * @param: chainmaks_table object
129  *
130  * API to populate chainmaks tables
131  *
132  * Return: zero on successful parsing of chainmaks tables or failure flag
133  */
134 int init_deinit_populate_chainmask_tables(
135 		wmi_unified_t handle, uint8_t *evt,
136 		struct wlan_psoc_host_chainmask_table *param);
137 
138 /**
139  * init_deinit_populate_mac_phy_capability() - populate mac phy capability
140  * @handle: WMI handle pointer
141  * @evt: event buffer received from FW
142  * @hw_cap: hw_mode_caps object
143  * @info: tgt_info object
144  *
145  * API to populate mac phy capability
146  *
147  * Return: zero on successful population of mac physical capability or failure
148  */
149 int init_deinit_populate_mac_phy_capability(
150 	wmi_unified_t handle, uint8_t *evt,
151 	struct wlan_psoc_host_hw_mode_caps *hw_cap, struct tgt_info *info);
152 
153 /**
154  * init_deinit_populate_hw_mode_capability() - populate hw mode capability
155  * @wmi_handle: WMI handle pointer
156  * @event: event buffer received from FW
157  * @tgt_hdl: target_psoc_info object
158  *
159  * API to populate hw mode capability
160  *
161  * Return: zero on successful parsing of hw mode capability or failure
162  */
163 int init_deinit_populate_hw_mode_capability(
164 		wmi_unified_t wmi_handle,
165 		uint8_t *event, struct target_psoc_info *tgt_hdl);
166 
167 /**
168  * init_deinit_populate_dbr_ring_cap() - populate dbr ring capability
169  * @psoc: PSOC object
170  * @handle: WMI handle pointer
171  * @event: event buffer received from FW
172  * @info: tgt_info object
173  *
174  * API to populate dbr ring capability
175  *
176  * Return: zero on successful parsing of dbr ring capability or failure
177  */
178 int init_deinit_populate_dbr_ring_cap(struct wlan_objmgr_psoc *psoc,
179 				      wmi_unified_t handle, uint8_t *event,
180 				      struct tgt_info *info);
181 
182 /**
183  * init_deinit_populate_dbr_ring_cap_ext2() - populate dbr ring capability
184  *                                            from ext2 event
185  * @psoc: PSOC object
186  * @handle: WMI handle pointer
187  * @event: event buffer received from FW
188  * @info: tgt_info object
189  *
190  * API to populate dbr ring capability
191  *
192  * Return: zero on successful parsing of dbr ring capability or failure
193  */
194 int init_deinit_populate_dbr_ring_cap_ext2(struct wlan_objmgr_psoc *psoc,
195 					   wmi_unified_t handle, uint8_t *event,
196 					   struct tgt_info *info);
197 
198 /**
199  * init_deinit_populate_spectral_bin_scale_params() - populate Spectral scaling
200  * @psoc: PSOC object
201  * @handle: WMI handle pointer
202  * @event: event buffer received from FW
203  * @info: tgt_info object
204  *
205  * API to populate Spectral bin scaling parameters
206  *
207  * Return: zero on successful parsing of scaling params or failure
208  */
209 int init_deinit_populate_spectral_bin_scale_params(
210 				struct wlan_objmgr_psoc *psoc,
211 				wmi_unified_t handle, uint8_t *event,
212 				struct tgt_info *info);
213 
214 /**
215  * init_deinit_dbr_ring_cap_free() - free dbr ring capability
216  * @tgt_psoc_info: target psoc info object
217  *
218  * API to free dbr ring capability
219  *
220  * Return: QDF_STATUS
221  */
222 QDF_STATUS init_deinit_dbr_ring_cap_free(
223 				struct target_psoc_info *tgt_psoc_info);
224 
225 /**
226  * init_deinit_spectral_scaling_params_free() - free Spectral scaling params
227  * @tgt_psoc_info: target psoc info object
228  *
229  * API to free Spectral scaling params
230  *
231  * Return: QDF_STATUS
232  */
233 QDF_STATUS init_deinit_spectral_scaling_params_free(
234 				struct target_psoc_info *tgt_psoc_info);
235 
236 /**
237  * init_deinit_populate_phy_reg_cap() - populate phy reg capability
238  * @psoc: PSOC object
239  * @wmi_handle: WMI handle pointer
240  * @event: event buffer received from FW
241  * @info: tgt_info object
242  * @service_ready: service ready determiner
243  *
244  * API to populate phy reg capability
245  *
246  * Return: zero on successful parsing of physical reg capability or failure flag
247  */
248 int init_deinit_populate_phy_reg_cap(struct wlan_objmgr_psoc *psoc,
249 				     wmi_unified_t wmi_handle, uint8_t *event,
250 				     struct tgt_info *info,
251 				     bool service_ready);
252 
253 /**
254  * init_deinit_populate_hal_reg_cap_ext2() - Populate HAL reg capabilities from
255  * service ready ext2 event.
256  * @handle: WMI handle pointer
257  * @event: event buffer received from FW
258  * @info: tgt_info object
259  *
260  * API to populate HAL reg capabilities from service ready ext2 event.
261  *
262  * Return: zero on successful parsing of physical reg capability or failure flag
263  */
264 int init_deinit_populate_hal_reg_cap_ext2(wmi_unified_t handle, uint8_t *event,
265 					  struct tgt_info *info);
266 
267 /**
268  * init_deinit_populate_mac_phy_cap_ext2() - populate mac phy capabilities from
269  * service ready ext2 event
270  * @handle: WMI handle pointer
271  * @event: event buffer received from FW
272  * @info: tgt_info object
273  *
274  * API to populate mac phy capability from service ready ext2 event.
275  *
276  * Return: zero on successful population of mac physical capability or failure
277  */
278 int init_deinit_populate_mac_phy_cap_ext2(wmi_unified_t handle, uint8_t *event,
279 					  struct tgt_info *info);
280 
281 /**
282  * init_deinit_validate_160_80p80_fw_caps() - validate 160 80p80 fw caps
283  * @psoc: PSOC object
284  * @tgt_info: target_psoc_info object
285  *
286  * API to validate 160 80p80 fw caps
287  *
288  * Return: SUCCESS on successful validation of 160 80p80 forward caps or Failure
289  */
290 QDF_STATUS init_deinit_validate_160_80p80_fw_caps(
291 		 struct wlan_objmgr_psoc *psoc,
292 		 struct target_psoc_info *tgt_info);
293 
294 /**
295  * init_deinit_chainmask_config() - config chainmask
296  * @psoc: PSOC object
297  * @tgt_info: target_psoc_info object
298  *
299  * API to config chainmask
300  *
301  * Return: none
302  */
303 void init_deinit_chainmask_config(
304 		 struct wlan_objmgr_psoc *psoc,
305 		 struct target_psoc_info *tgt_info);
306 
307 /**
308  * init_deinit_is_service_ext_msg() - check service ext message
309  * @psoc: PSOC object
310  * @tgt_info: target_psoc_info object
311  *
312  * API to check whether service ext message is enabled
313  *
314  * Return: SUCCESS on successful check of service_ext message or Failure
315  */
316 QDF_STATUS init_deinit_is_service_ext_msg(
317 		 struct wlan_objmgr_psoc *psoc,
318 		 struct target_psoc_info *tgt_info);
319 /**
320  * init_deinit_is_preferred_hw_mode_supported() - check support of preferred
321  *                                                hw mode
322  * @psoc: PSOC object
323  * @tgt_info: target_psoc_info object
324  *
325  * API to check whether preferred hardware mode is enabled
326  *
327  * Return: True on support of preferred hardware support or False
328  */
329 bool init_deinit_is_preferred_hw_mode_supported(
330 		 struct wlan_objmgr_psoc *psoc,
331 		 struct target_psoc_info *tgt_info);
332 
333 /**
334  * init_deinit_wakeup_host_wait() - wakeup host wait
335  * @psoc: PSOC object
336  * @tgt_info: target_psoc_info object
337  *
338  * API to wakeup FW ready wait queue
339  *
340  * Return: None
341  */
342 void init_deinit_wakeup_host_wait(
343 		 struct wlan_objmgr_psoc *psoc,
344 		 struct target_psoc_info *tgt_info);
345 
346 #endif /* _SERVICE_READY_UTIL_H_*/
347