xref: /wlan-driver/qcacld-3.0/core/hdd/src/wlan_hdd_debugfs_coex.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2019 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: wlan_hdd_debugfs_coex.c
22  *
23  * This file currently supports the following debugfs:
24  * Get the following information coex information
25  * COEX STATE
26  * COEX DPWB STATE
27  * COEX TDM STATE
28  * COEX IDRX STATE
29  * COEX ANTENNA SHARING STATE
30  *
31  * Example to read the COEX STATE logging:
32  * sm6150:/ # cat /sys/kernel/debug/wlan/mws_coex_state
33  */
34 
35 #include <wlan_hdd_includes.h>
36 #include <wlan_osif_request_manager.h>
37 #include <wlan_hdd_debugfs_coex.h>
38 #include "wmi_unified.h"
39 #include "wmi_unified_param.h"
40 #include "osif_sync.h"
41 
42 #define MWS_DEBUGFS_PERMS	(QDF_FILE_USR_READ |	\
43 				 QDF_FILE_GRP_READ |	\
44 				 QDF_FILE_OTH_READ)
45 
46 /* wait time for mws coex info in milliseconds */
47 #define WLAN_WAIT_TIME_MWS_COEX_INFO 800
48 
49 struct mws_coex_state_priv {
50 	struct mws_coex_state coex_state;
51 };
52 
53 struct mws_coex_dpwb_state_priv {
54 	struct mws_coex_dpwb_state dpwb_state;
55 };
56 
57 struct mws_coex_tdm_state_priv {
58 	struct mws_coex_tdm_state tdm_state;
59 };
60 
61 struct mws_coex_idrx_state_priv {
62 	struct mws_coex_idrx_state idrx_state;
63 };
64 
65 struct mws_antenna_sharing_info_priv {
66 	struct mws_antenna_sharing_info antenna_sharing;
67 };
68 
hdd_debugfs_mws_coex_info_cb(void * coex_info_data,void * context,wmi_mws_coex_cmd_id cmd_id)69 static void hdd_debugfs_mws_coex_info_cb(void *coex_info_data, void *context,
70 					 wmi_mws_coex_cmd_id cmd_id)
71 {
72 	struct osif_request *request = NULL;
73 	struct mws_coex_state_priv *coex_priv;
74 	struct mws_coex_dpwb_state_priv *dpwb_priv;
75 	struct mws_coex_tdm_state_priv *tdm_priv;
76 	struct mws_coex_idrx_state_priv *idrx_priv;
77 	struct mws_antenna_sharing_info_priv *antenna_priv;
78 
79 	if (!coex_info_data) {
80 		hdd_err("data is null");
81 		return;
82 	}
83 
84 	request = osif_request_get(context);
85 	if (!request) {
86 		hdd_err("obsolete request");
87 		return;
88 	}
89 
90 	switch (cmd_id) {
91 	case WMI_MWS_COEX_STATE:
92 		coex_priv = osif_request_priv(request);
93 		qdf_mem_copy(&coex_priv->coex_state, coex_info_data,
94 			     sizeof(struct mws_coex_state));
95 		break;
96 	case WMI_MWS_COEX_DPWB_STATE:
97 		dpwb_priv = osif_request_priv(request);
98 		qdf_mem_copy(&dpwb_priv->dpwb_state, coex_info_data,
99 			     sizeof(struct mws_coex_dpwb_state));
100 		break;
101 	case WMI_MWS_COEX_TDM_STATE:
102 		tdm_priv = osif_request_priv(request);
103 		qdf_mem_copy(&tdm_priv->tdm_state, coex_info_data,
104 			     sizeof(struct mws_coex_tdm_state));
105 		break;
106 	case WMI_MWS_COEX_IDRX_STATE:
107 		idrx_priv = osif_request_priv(request);
108 		qdf_mem_copy(&idrx_priv->idrx_state, coex_info_data,
109 			     sizeof(struct mws_coex_idrx_state));
110 		break;
111 	case WMI_MWS_COEX_ANTENNA_SHARING_STATE:
112 		antenna_priv = osif_request_priv(request);
113 		qdf_mem_copy(&antenna_priv->antenna_sharing, coex_info_data,
114 			     sizeof(struct mws_antenna_sharing_info));
115 		break;
116 	}
117 
118 	osif_request_complete(request);
119 	osif_request_put(request);
120 }
121 
__hdd_debugfs_mws_coex_state_read(struct hdd_context * hdd_ctx,qdf_debugfs_file_t file)122 static QDF_STATUS __hdd_debugfs_mws_coex_state_read(struct hdd_context *hdd_ctx,
123 						    qdf_debugfs_file_t file)
124 {
125 	struct hdd_adapter *adapter;
126 	QDF_STATUS status;
127 	int rc;
128 	struct osif_request *request;
129 	struct mws_coex_state *coex_state;
130 	struct mws_coex_state_priv *priv;
131 	static const struct osif_request_params params = {
132 		.priv_size = sizeof(*priv),
133 		.timeout_ms = WLAN_WAIT_TIME_MWS_COEX_INFO,
134 	};
135 	void *cookie;
136 
137 	adapter = hdd_get_first_valid_adapter(hdd_ctx);
138 	if (!adapter) {
139 		hdd_err("Failed to get adapter");
140 		return QDF_STATUS_E_INVAL;
141 	}
142 
143 	if (!test_bit(DEVICE_IFACE_OPENED, &adapter->event_flags)) {
144 		hdd_err("Interface is not enabled");
145 		return QDF_STATUS_E_INVAL;
146 	}
147 
148 	if (file->index > 0)
149 		return QDF_STATUS_SUCCESS;
150 
151 	request = osif_request_alloc(&params);
152 	if (!request) {
153 		hdd_err("Request allocation failure");
154 		return QDF_STATUS_E_NOMEM;
155 	}
156 
157 	cookie = osif_request_cookie(request);
158 
159 	status = sme_get_mws_coex_info(hdd_ctx->mac_handle,
160 				       adapter->deflink->vdev_id,
161 				       WMI_MWS_COEX_STATE,
162 				       hdd_debugfs_mws_coex_info_cb, cookie);
163 
164 	if (QDF_IS_STATUS_ERROR(status)) {
165 		rc = qdf_status_to_os_return(status);
166 		goto exit;
167 	}
168 
169 	rc = osif_request_wait_for_response(request);
170 	if (rc) {
171 		qdf_debugfs_printf(file, "Timedout while retrieving MWS coex state");
172 		rc = -ETIMEDOUT;
173 		goto exit;
174 	}
175 
176 	priv = osif_request_priv(request);
177 	coex_state = &priv->coex_state;
178 
179 	qdf_debugfs_printf(file, "vdev_id = %u\n"
180 				 "coex_scheme_bitmap = %u\n"
181 				 "active_conflict_count = %u\n"
182 				 "potential_conflict_count = %u\n"
183 				 "chavd_group0_bitmap = %u\n"
184 				 "chavd_group1_bitmap = %u\n"
185 				 "chavd_group2_bitmap = %u\n"
186 				 "chavd_group3_bitmap = %u\n",
187 			   coex_state->vdev_id,
188 			   coex_state->coex_scheme_bitmap,
189 			   coex_state->active_conflict_count,
190 			   coex_state->potential_conflict_count,
191 			   coex_state->chavd_group0_bitmap,
192 			   coex_state->chavd_group1_bitmap,
193 			   coex_state->chavd_group2_bitmap,
194 			   coex_state->chavd_group3_bitmap);
195 
196 exit:
197 	osif_request_put(request);
198 	return qdf_status_from_os_return(rc);
199  }
200 
hdd_debugfs_mws_coex_state_read(qdf_debugfs_file_t file,void * arg)201 static QDF_STATUS hdd_debugfs_mws_coex_state_read(qdf_debugfs_file_t file,
202 						  void *arg)
203 {
204 	struct osif_psoc_sync *psoc_sync;
205 	struct hdd_context *hdd_ctx = arg;
206 	int ret;
207 	QDF_STATUS status;
208 
209 	ret = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy), &psoc_sync);
210 	if (ret)
211 		return qdf_status_from_os_return(ret);
212 
213 	status = __hdd_debugfs_mws_coex_state_read(hdd_ctx, file);
214 
215 	osif_psoc_sync_op_stop(psoc_sync);
216 	return qdf_status_from_os_return(ret);
217 }
218 
__hdd_debugfs_mws_coex_dpwb_read(struct hdd_context * hdd_ctx,qdf_debugfs_file_t file)219 static QDF_STATUS __hdd_debugfs_mws_coex_dpwb_read(struct hdd_context *hdd_ctx,
220 						   qdf_debugfs_file_t file)
221  {
222 	struct hdd_adapter *adapter;
223 	QDF_STATUS status;
224 	int rc;
225 	struct osif_request *request;
226 	struct mws_coex_dpwb_state *dpwb_state;
227 	struct mws_coex_dpwb_state_priv *dpwb_priv;
228 	static const struct osif_request_params params = {
229 		.priv_size = sizeof(*dpwb_priv),
230 		.timeout_ms = WLAN_WAIT_TIME_MWS_COEX_INFO,
231 	};
232 	void *cookie;
233 
234 	adapter = hdd_get_first_valid_adapter(hdd_ctx);
235 	if (!adapter) {
236 		hdd_err("Failed to get adapter");
237 		return QDF_STATUS_E_INVAL;
238 	}
239 
240 	if (!test_bit(DEVICE_IFACE_OPENED, &adapter->event_flags)) {
241 		hdd_err("Interface is not enabled");
242 		return QDF_STATUS_E_INVAL;
243 	}
244 
245 	if (file->index > 0)
246 		return QDF_STATUS_SUCCESS;
247 
248 	request = osif_request_alloc(&params);
249 	if (!request) {
250 		hdd_err("Request allocation failure");
251 		return QDF_STATUS_E_NOMEM;
252 	}
253 
254 	cookie = osif_request_cookie(request);
255 
256 	status = sme_get_mws_coex_info(hdd_ctx->mac_handle,
257 				       adapter->deflink->vdev_id,
258 				       WMI_MWS_COEX_DPWB_STATE,
259 				       hdd_debugfs_mws_coex_info_cb, cookie);
260 
261 	if (QDF_IS_STATUS_ERROR(status)) {
262 		rc = qdf_status_to_os_return(status);
263 		goto exit;
264 	}
265 
266 	rc = osif_request_wait_for_response(request);
267 	if (rc) {
268 		qdf_debugfs_printf(file, "Timedout while retrieving MWS coex dpwb state");
269 		rc = -ETIMEDOUT;
270 		goto exit;
271 	}
272 
273 	dpwb_priv = osif_request_priv(request);
274 	dpwb_state = &dpwb_priv->dpwb_state;
275 	qdf_debugfs_printf(file, "vdev_id = %u\n"
276 				 "current_dpwb_state = %d\n"
277 				 "pnp1_value = %d\n"
278 				 "lte_dutycycle = %d\n"
279 				 "sinr_wlan_on = %d\n"
280 				 "bler_count = %u\n"
281 				 "block_count = %u\n"
282 				 "wlan_rssi_level = %u\n"
283 				 "wlan_rssi = %d\n"
284 				 "is_tdm_running = %u\n",
285 			   dpwb_state->vdev_id,
286 			   dpwb_state->current_dpwb_state,
287 			   dpwb_state->pnp1_value,
288 			   dpwb_state->lte_dutycycle,
289 			   dpwb_state->sinr_wlan_on,
290 			   dpwb_state->sinr_wlan_off,
291 			   dpwb_state->bler_count,
292 			   dpwb_state->block_count,
293 			   dpwb_state->wlan_rssi_level,
294 			   dpwb_state->wlan_rssi,
295 			   dpwb_state->is_tdm_running);
296 
297 exit:
298 	osif_request_put(request);
299 	return qdf_status_from_os_return(rc);
300 }
301 
hdd_debugfs_mws_coex_dpwb_read(qdf_debugfs_file_t file,void * arg)302 static QDF_STATUS hdd_debugfs_mws_coex_dpwb_read(qdf_debugfs_file_t file,
303 						 void *arg)
304 {
305 	struct osif_psoc_sync *psoc_sync;
306 	struct hdd_context *hdd_ctx = arg;
307 	int ret;
308 	QDF_STATUS status;
309 
310 	ret = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy), &psoc_sync);
311 	if (ret)
312 		return qdf_status_from_os_return(ret);
313 
314 	status = __hdd_debugfs_mws_coex_dpwb_read(hdd_ctx, file);
315 
316 	osif_psoc_sync_op_stop(psoc_sync);
317 	return qdf_status_from_os_return(ret);
318 }
319 
__hdd_debugfs_mws_tdm_state_read(struct hdd_context * hdd_ctx,qdf_debugfs_file_t file)320 static QDF_STATUS __hdd_debugfs_mws_tdm_state_read(struct hdd_context *hdd_ctx,
321 						   qdf_debugfs_file_t file)
322 {
323 	struct hdd_adapter *adapter;
324 	QDF_STATUS status;
325 	int rc;
326 	struct mws_coex_tdm_state *tdm_state;
327 	struct mws_coex_tdm_state_priv *tdm_priv;
328 	struct osif_request *request;
329 	static const struct osif_request_params params = {
330 		.priv_size = sizeof(*tdm_priv),
331 		.timeout_ms = WLAN_WAIT_TIME_MWS_COEX_INFO,
332 	};
333 	void *cookie;
334 
335 	adapter = hdd_get_first_valid_adapter(hdd_ctx);
336 	if (!adapter) {
337 		hdd_err("Failed to get adapter");
338 		return QDF_STATUS_E_INVAL;
339 	}
340 
341 	if (!test_bit(DEVICE_IFACE_OPENED, &adapter->event_flags)) {
342 		hdd_err("Interface is not enabled");
343 		return QDF_STATUS_E_INVAL;
344 	}
345 
346 	if (file->index > 0)
347 		return QDF_STATUS_SUCCESS;
348 
349 	request = osif_request_alloc(&params);
350 	if (!request) {
351 		hdd_err("Request allocation failure");
352 		return QDF_STATUS_E_NOMEM;
353 	}
354 
355 	cookie = osif_request_cookie(request);
356 
357 	status = sme_get_mws_coex_info(hdd_ctx->mac_handle,
358 				       adapter->deflink->vdev_id,
359 				       WMI_MWS_COEX_TDM_STATE,
360 				       hdd_debugfs_mws_coex_info_cb, cookie);
361 
362 	if (QDF_IS_STATUS_ERROR(status)) {
363 		rc = qdf_status_to_os_return(status);
364 		goto exit;
365 	}
366 
367 	rc = osif_request_wait_for_response(request);
368 	if (rc) {
369 		qdf_debugfs_printf(file, "Timedout while retrieving MWS coex tdm state");
370 		rc = -ETIMEDOUT;
371 		goto exit;
372 	}
373 
374 	tdm_priv = osif_request_priv(request);
375 	tdm_state = &tdm_priv->tdm_state;
376 
377 	qdf_debugfs_printf(file, "vdev_id = %u\n"
378 				 "tdm_policy_bitmap = %u\n"
379 				 "tdm_sf_bitmap = %u\n",
380 			   tdm_state->vdev_id,
381 			   tdm_state->tdm_policy_bitmap,
382 			   tdm_state->tdm_sf_bitmap);
383 
384 exit:
385 	osif_request_put(request);
386 	return qdf_status_from_os_return(rc);
387 }
388 
hdd_debugfs_mws_tdm_state_read(qdf_debugfs_file_t file,void * arg)389 static QDF_STATUS hdd_debugfs_mws_tdm_state_read(qdf_debugfs_file_t file,
390 						 void *arg)
391 {
392 	struct osif_psoc_sync *psoc_sync;
393 	struct hdd_context *hdd_ctx = arg;
394 	int ret;
395 	QDF_STATUS status;
396 
397 	ret = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy), &psoc_sync);
398 	if (ret)
399 		return qdf_status_from_os_return(ret);
400 
401 	status = __hdd_debugfs_mws_tdm_state_read(hdd_ctx, file);
402 
403 	osif_psoc_sync_op_stop(psoc_sync);
404 	return qdf_status_from_os_return(ret);
405 }
406 
__hdd_debugfs_mws_coex_idrx_read(struct hdd_context * hdd_ctx,qdf_debugfs_file_t file)407 static QDF_STATUS __hdd_debugfs_mws_coex_idrx_read(struct hdd_context *hdd_ctx,
408 						   qdf_debugfs_file_t file)
409 {
410 	struct hdd_adapter *adapter;
411 	QDF_STATUS status;
412 	int rc;
413 	struct osif_request *request;
414 	struct mws_coex_idrx_state_priv *idrx_priv;
415 	struct mws_coex_idrx_state *idrx_state;
416 	static const struct osif_request_params params = {
417 		.priv_size = sizeof(*idrx_priv),
418 		.timeout_ms = WLAN_WAIT_TIME_MWS_COEX_INFO,
419 	};
420 	void *cookie;
421 
422 	adapter = hdd_get_first_valid_adapter(hdd_ctx);
423 	if (!adapter) {
424 		hdd_err("Failed to get adapter");
425 		return QDF_STATUS_E_INVAL;
426 	}
427 
428 	if (!test_bit(DEVICE_IFACE_OPENED, &adapter->event_flags)) {
429 		hdd_err("Interface is not enabled");
430 		return QDF_STATUS_E_INVAL;
431 	}
432 
433 	if (file->index > 0)
434 		return QDF_STATUS_SUCCESS;
435 
436 	request = osif_request_alloc(&params);
437 	if (!request) {
438 		hdd_err("Request allocation failure");
439 		return QDF_STATUS_E_NOMEM;
440 	}
441 
442 	cookie = osif_request_cookie(request);
443 
444 	status = sme_get_mws_coex_info(hdd_ctx->mac_handle,
445 				       adapter->deflink->vdev_id,
446 				       WMI_MWS_COEX_IDRX_STATE,
447 				       hdd_debugfs_mws_coex_info_cb, cookie);
448 
449 	if (QDF_IS_STATUS_ERROR(status)) {
450 		rc = qdf_status_to_os_return(status);
451 		goto exit;
452 	}
453 
454 	rc = osif_request_wait_for_response(request);
455 	if (rc) {
456 		qdf_debugfs_printf(file, "Timedout while retrieving MWS coex idrx state");
457 		rc = -ETIMEDOUT;
458 		goto exit;
459 	}
460 
461 	idrx_priv = osif_request_priv(request);
462 	idrx_state = &idrx_priv->idrx_state;
463 	qdf_debugfs_printf(file, "vdev_id = %u\n"
464 				 "sub0_techid = %u\n"
465 				 "sub0_policy = %u\n"
466 				 "sub0_is_link_critical = %u\n"
467 				 "sub0_static_power = %u\n"
468 				 "sub0_rssi = %d\n"
469 				 "sub1_techid = %d\n"
470 				 "sub1_policy = %d\n"
471 				 "sub1_is_link_critical = %d\n"
472 				 "sub1_static_power = %u\n"
473 				 "sub1_rssi = %d\n",
474 			   idrx_state->vdev_id,
475 			   idrx_state->sub0_techid,
476 			   idrx_state->sub0_policy,
477 			   idrx_state->sub0_is_link_critical,
478 			   idrx_state->sub0_static_power,
479 			   idrx_state->sub0_rssi,
480 			   idrx_state->sub1_techid,
481 			   idrx_state->sub1_policy,
482 			   idrx_state->sub1_is_link_critical,
483 			   idrx_state->sub1_static_power,
484 			   idrx_state->sub1_rssi);
485 
486 exit:
487 	osif_request_put(request);
488 	return qdf_status_from_os_return(rc);
489 }
490 
hdd_debugfs_mws_coex_idrx_read(qdf_debugfs_file_t file,void * arg)491 static QDF_STATUS hdd_debugfs_mws_coex_idrx_read(qdf_debugfs_file_t file,
492 						 void *arg)
493 {
494 	struct osif_psoc_sync *psoc_sync;
495 	struct hdd_context *hdd_ctx = arg;
496 	int ret;
497 	QDF_STATUS status;
498 
499 	ret = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy), &psoc_sync);
500 	if (ret)
501 		return qdf_status_from_os_return(ret);
502 
503 	status = __hdd_debugfs_mws_coex_idrx_read(hdd_ctx, file);
504 
505 	osif_psoc_sync_op_stop(psoc_sync);
506 	return qdf_status_from_os_return(ret);
507 }
508 
__hdd_debugfs_mws_antenna_sharing_read(struct hdd_context * hdd_ctx,qdf_debugfs_file_t file)509 static QDF_STATUS __hdd_debugfs_mws_antenna_sharing_read(struct hdd_context
510 							 *hdd_ctx,
511 							 qdf_debugfs_file_t
512 							 file)
513 {
514 	struct hdd_adapter *adapter;
515 	QDF_STATUS status;
516 	int rc;
517 	struct mws_antenna_sharing_info *antenna_sharing;
518 	struct mws_antenna_sharing_info_priv *antenna_priv;
519 	struct osif_request *request;
520 	static const struct osif_request_params params = {
521 		.priv_size = sizeof(*antenna_priv),
522 		.timeout_ms = WLAN_WAIT_TIME_MWS_COEX_INFO,
523 	};
524 	void *cookie;
525 
526 	adapter = hdd_get_first_valid_adapter(hdd_ctx);
527 	if (!adapter) {
528 		hdd_err("Failed to get adapter");
529 		return QDF_STATUS_E_INVAL;
530 	}
531 
532 	if (!test_bit(DEVICE_IFACE_OPENED, &adapter->event_flags)) {
533 		hdd_err("Interface is not enabled");
534 		return QDF_STATUS_E_INVAL;
535 	}
536 
537 	if (file->index > 0)
538 		return QDF_STATUS_SUCCESS;
539 
540 	request = osif_request_alloc(&params);
541 	if (!request) {
542 		hdd_err("Request allocation failure");
543 		return QDF_STATUS_E_NOMEM;
544 	}
545 
546 	cookie = osif_request_cookie(request);
547 
548 	status = sme_get_mws_coex_info(hdd_ctx->mac_handle,
549 				       adapter->deflink->vdev_id,
550 				       WMI_MWS_COEX_ANTENNA_SHARING_STATE,
551 				       hdd_debugfs_mws_coex_info_cb, cookie);
552 
553 	if (QDF_IS_STATUS_ERROR(status)) {
554 		rc = qdf_status_to_os_return(status);
555 		goto exit;
556 	}
557 
558 	rc = osif_request_wait_for_response(request);
559 	if (rc) {
560 		qdf_debugfs_printf(file, "Timedout while retrieving MWS coex antenna sharing state");
561 		rc = -ETIMEDOUT;
562 		goto exit;
563 	}
564 
565 	antenna_priv = osif_request_priv(request);
566 	antenna_sharing = &antenna_priv->antenna_sharing;
567 	qdf_debugfs_printf(file, "vdev_id = %u\n"
568 				 "coex_flags = %u\n"
569 				 "coex_config = %u\n"
570 				 "tx_chain_mask = %u\n"
571 				 "rx_chain_mask = %u\n"
572 				 "rx_nss = %u\n"
573 				 "force_mrc = %u\n"
574 				 "rssi_type = %u\n"
575 				 "chain0_rssi = %d\n"
576 				 "chain1_rssi = %d\n"
577 				 "combined_rssi = %d\n"
578 				 "imbalance = %u\n"
579 				 "mrc_threshold = %d\n"
580 				 "grant_duration = %u\n",
581 			   antenna_sharing->vdev_id,
582 			   antenna_sharing->coex_flags,
583 			   antenna_sharing->coex_config,
584 			   antenna_sharing->tx_chain_mask,
585 			   antenna_sharing->rx_chain_mask,
586 			   antenna_sharing->rx_nss,
587 			   antenna_sharing->force_mrc,
588 			   antenna_sharing->rssi_type,
589 			   antenna_sharing->chain0_rssi,
590 			   antenna_sharing->chain1_rssi,
591 			   antenna_sharing->combined_rssi,
592 			   antenna_sharing->imbalance,
593 			   antenna_sharing->mrc_threshold,
594 			   antenna_sharing->grant_duration);
595 
596 exit:
597 	osif_request_put(request);
598 	return qdf_status_from_os_return(rc);
599 }
600 
hdd_debugfs_mws_antenna_sharing_read(qdf_debugfs_file_t file,void * arg)601 static QDF_STATUS hdd_debugfs_mws_antenna_sharing_read(qdf_debugfs_file_t file,
602 						       void *arg)
603 {
604 	struct osif_psoc_sync *psoc_sync;
605 	struct hdd_context *hdd_ctx = arg;
606 	int ret;
607 	QDF_STATUS status;
608 
609 	ret = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy), &psoc_sync);
610 	if (ret)
611 		return qdf_status_from_os_return(ret);
612 
613 	status = __hdd_debugfs_mws_antenna_sharing_read(hdd_ctx, file);
614 
615 	osif_psoc_sync_op_stop(psoc_sync);
616 	return qdf_status_from_os_return(ret);
617 }
618 
619 static struct qdf_debugfs_fops hdd_mws_debugfs_coex_state_fops = {
620 	.show  = hdd_debugfs_mws_coex_state_read,
621 };
622 
623 static struct qdf_debugfs_fops hdd_mws_debugfs_fops_coex_dpwb_fops = {
624 	.show  = hdd_debugfs_mws_coex_dpwb_read,
625 };
626 
627 static struct qdf_debugfs_fops hdd_mws_debugfs_tdm_state_fpos = {
628 	.show  = hdd_debugfs_mws_tdm_state_read,
629 };
630 
631 static struct qdf_debugfs_fops hdd_mws_debugfs_idrx_state_fpos = {
632 	.show  = hdd_debugfs_mws_coex_idrx_read,
633 };
634 
635 static struct qdf_debugfs_fops hdd_mws_debugfs_antenna_sharing_fpos = {
636 	.show  = hdd_debugfs_mws_antenna_sharing_read,
637 };
638 
hdd_debugfs_mws_coex_info_init(struct hdd_context * hdd_ctx)639 void hdd_debugfs_mws_coex_info_init(struct hdd_context *hdd_ctx)
640 {
641 	hdd_mws_debugfs_coex_state_fops.priv = hdd_ctx;
642 	hdd_mws_debugfs_fops_coex_dpwb_fops.priv = hdd_ctx;
643 	hdd_mws_debugfs_tdm_state_fpos.priv = hdd_ctx;
644 	hdd_mws_debugfs_idrx_state_fpos.priv = hdd_ctx;
645 	hdd_mws_debugfs_antenna_sharing_fpos.priv = hdd_ctx;
646 	if (!qdf_debugfs_create_file("mws_coex_state", MWS_DEBUGFS_PERMS,
647 				     NULL, &hdd_mws_debugfs_coex_state_fops))
648 		hdd_err("Failed to create the mws coex state file");
649 	if (!qdf_debugfs_create_file("mws_coex_dpwb_state", MWS_DEBUGFS_PERMS,
650 				     NULL,
651 				     &hdd_mws_debugfs_fops_coex_dpwb_fops))
652 		hdd_err("Failed to create the mws coex dpwb file");
653 	if (!qdf_debugfs_create_file("mws_coex_tdm_state", MWS_DEBUGFS_PERMS,
654 				     NULL, &hdd_mws_debugfs_tdm_state_fpos))
655 		hdd_err("Failed to create the mws coex tdm file");
656 	if (!qdf_debugfs_create_file("mws_coex_idrx", MWS_DEBUGFS_PERMS,
657 				     NULL, &hdd_mws_debugfs_idrx_state_fpos))
658 		hdd_err("Failed to create the mws coex idrx file");
659 	if (!qdf_debugfs_create_file("mws_coex_antenna_sharing",
660 				     MWS_DEBUGFS_PERMS,
661 				     NULL,
662 				     &hdd_mws_debugfs_antenna_sharing_fpos))
663 		hdd_err("Failed to create the mws coex antenna sharing file");
664 }
665 
hdd_debugfs_mws_coex_info_deinit(struct hdd_context * hdd_ctx)666 void hdd_debugfs_mws_coex_info_deinit(struct hdd_context *hdd_ctx)
667 {
668 	/**
669 	 * Coex info doesn't have a directory it is removed as part of qdf remove
670 	 */
671 }
672