xref: /wlan-driver/qcacld-3.0/components/qmi/dispatcher/src/wlan_qmi_wfds_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: wlan_qmi_wfds_api.c
19  *
20  * QMI component north bound interface definitions
21  */
22 
23 #include "wlan_qmi_wfds_api.h"
24 #include "wlan_qmi_objmgr.h"
25 #include "wlan_qmi_priv.h"
26 #include "wlan_qmi_main.h"
27 
wlan_qmi_wfds_init(struct wlan_objmgr_psoc * psoc)28 QDF_STATUS wlan_qmi_wfds_init(struct wlan_objmgr_psoc *psoc)
29 {
30 	struct wlan_qmi_psoc_context *qmi_ctx = qmi_psoc_get_priv(psoc);
31 
32 	if (!qmi_ctx) {
33 		qmi_err("QMI context is NULL");
34 		return QDF_STATUS_E_INVAL;
35 	}
36 
37 	if (qmi_ctx->qmi_cbs.qmi_wfds_init)
38 		return qmi_ctx->qmi_cbs.qmi_wfds_init();
39 
40 	return QDF_STATUS_E_FAILURE;
41 }
42 
wlan_qmi_wfds_deinit(struct wlan_objmgr_psoc * psoc)43 void wlan_qmi_wfds_deinit(struct wlan_objmgr_psoc *psoc)
44 {
45 	struct wlan_qmi_psoc_context *qmi_ctx = qmi_psoc_get_priv(psoc);
46 
47 	if (!qmi_ctx) {
48 		qmi_err("QMI context is NULL");
49 		return;
50 	}
51 
52 	if (qmi_ctx->qmi_cbs.qmi_wfds_deinit)
53 		qmi_ctx->qmi_cbs.qmi_wfds_deinit();
54 }
55 
56 QDF_STATUS
wlan_qmi_wfds_send_config_msg(struct wlan_objmgr_psoc * psoc,struct wlan_qmi_wfds_config_req_msg * src_info)57 wlan_qmi_wfds_send_config_msg(struct wlan_objmgr_psoc *psoc,
58 			      struct wlan_qmi_wfds_config_req_msg *src_info)
59 {
60 	struct wlan_qmi_psoc_context *qmi_ctx = qmi_psoc_get_priv(psoc);
61 
62 	if (!qmi_ctx) {
63 		qmi_err("QMI context is NULL");
64 		return  QDF_STATUS_E_INVAL;
65 	}
66 
67 	if (qmi_ctx->qmi_cbs.qmi_wfds_send_config_msg)
68 		return qmi_ctx->qmi_cbs.qmi_wfds_send_config_msg(src_info);
69 
70 	return QDF_STATUS_E_FAILURE;
71 }
72 
73 QDF_STATUS
wlan_qmi_wfds_send_req_mem_msg(struct wlan_objmgr_psoc * psoc,struct wlan_qmi_wfds_mem_req_msg * src_info)74 wlan_qmi_wfds_send_req_mem_msg(struct wlan_objmgr_psoc *psoc,
75 			       struct wlan_qmi_wfds_mem_req_msg *src_info)
76 {
77 	struct wlan_qmi_psoc_context *qmi_ctx = qmi_psoc_get_priv(psoc);
78 
79 	if (!qmi_ctx) {
80 		qmi_err("QMI context is NULL");
81 		return  QDF_STATUS_E_INVAL;
82 	}
83 
84 	if (qmi_ctx->qmi_cbs.qmi_wfds_send_req_mem_msg)
85 		return qmi_ctx->qmi_cbs.qmi_wfds_send_req_mem_msg(src_info);
86 
87 	return QDF_STATUS_E_FAILURE;
88 }
89 
90 QDF_STATUS
wlan_qmi_wfds_ipcc_map_n_cfg_msg(struct wlan_objmgr_psoc * psoc,struct wlan_qmi_wfds_ipcc_map_n_cfg_req_msg * src_info)91 wlan_qmi_wfds_ipcc_map_n_cfg_msg(struct wlan_objmgr_psoc *psoc,
92 			struct wlan_qmi_wfds_ipcc_map_n_cfg_req_msg *src_info)
93 {
94 	struct wlan_qmi_psoc_context *qmi_ctx = qmi_psoc_get_priv(psoc);
95 
96 	if (!qmi_ctx) {
97 		qmi_err("QMI context is NULL");
98 		return QDF_STATUS_E_INVAL;
99 	}
100 
101 	if (qmi_ctx->qmi_cbs.qmi_wfds_send_ipcc_map_n_cfg_msg)
102 		return qmi_ctx->qmi_cbs.qmi_wfds_send_ipcc_map_n_cfg_msg(src_info);
103 
104 	return QDF_STATUS_E_FAILURE;
105 }
106 
107 QDF_STATUS
wlan_qmi_wfds_send_misc_req_msg(struct wlan_objmgr_psoc * psoc,bool is_ssr)108 wlan_qmi_wfds_send_misc_req_msg(struct wlan_objmgr_psoc *psoc, bool is_ssr)
109 {
110 	struct wlan_qmi_psoc_context *qmi_ctx = qmi_psoc_get_priv(psoc);
111 
112 	if (!qmi_ctx) {
113 		qmi_err("QMI context is NULL");
114 		return QDF_STATUS_E_INVAL;
115 	}
116 
117 	if (qmi_ctx->qmi_cbs.qmi_wfds_send_misc_req_msg)
118 		return qmi_ctx->qmi_cbs.qmi_wfds_send_misc_req_msg(is_ssr);
119 
120 	return QDF_STATUS_E_FAILURE;
121 }
122