xref: /wlan-driver/qca-wifi-host-cmn/wmi/src/wmi_unified_reg_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 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: Implement API's specific to Regulatory component.
22  */
23 
24 #include <qdf_status.h>
25 #include <qdf_module.h>
26 #include <wmi_unified_api.h>
27 #include <wmi_unified_priv.h>
28 #include <wmi_unified_reg_api.h>
29 
wmi_extract_reg_chan_list_update_event(wmi_unified_t wmi_handle,uint8_t * evt_buf,struct cur_regulatory_info * reg_info,uint32_t len)30 QDF_STATUS wmi_extract_reg_chan_list_update_event(
31 		wmi_unified_t wmi_handle,
32 		uint8_t *evt_buf,
33 		struct cur_regulatory_info *reg_info,
34 		uint32_t len)
35 {
36 	if (wmi_handle && wmi_handle->ops->extract_reg_chan_list_update_event)
37 		return wmi_handle->ops->extract_reg_chan_list_update_event
38 			(wmi_handle,
39 			 evt_buf, reg_info, len);
40 
41 	return QDF_STATUS_E_FAILURE;
42 }
43 qdf_export_symbol(wmi_extract_reg_chan_list_update_event);
44 
45 #ifdef CONFIG_BAND_6GHZ
wmi_extract_reg_chan_list_ext_update_event(wmi_unified_t wmi_handle,uint8_t * evt_buf,struct cur_regulatory_info * reg_info,uint32_t len)46 QDF_STATUS wmi_extract_reg_chan_list_ext_update_event(
47 		wmi_unified_t wmi_handle,
48 		uint8_t *evt_buf,
49 		struct cur_regulatory_info *reg_info,
50 		uint32_t len)
51 {
52 	if (wmi_handle &&
53 	    wmi_handle->ops->extract_reg_chan_list_ext_update_event)
54 		return wmi_handle->ops->extract_reg_chan_list_ext_update_event
55 					(wmi_handle, evt_buf, reg_info, len);
56 
57 	return QDF_STATUS_E_FAILURE;
58 }
59 
60 qdf_export_symbol(wmi_extract_reg_chan_list_ext_update_event);
61 
62 #ifdef CONFIG_AFC_SUPPORT
wmi_extract_afc_event(wmi_unified_t wmi_handle,uint8_t * evt_buf,struct afc_regulatory_info * afc_info,uint32_t len)63 QDF_STATUS wmi_extract_afc_event(wmi_unified_t wmi_handle,
64 				 uint8_t *evt_buf,
65 				 struct afc_regulatory_info *afc_info,
66 				 uint32_t len)
67 {
68 	if (wmi_handle &&
69 	    wmi_handle->ops->extract_afc_event)
70 		return wmi_handle->ops->extract_afc_event(wmi_handle, evt_buf,
71 							  afc_info, len);
72 
73 	return QDF_STATUS_E_FAILURE;
74 }
75 
76 qdf_export_symbol(wmi_extract_afc_event);
77 #endif
78 #endif
79 
80 /*
81  * wmi_unified_send_start_11d_scan_cmd() - start 11d scan
82  * @wmi_handle: wmi handle
83  * @start_11d_scan: pointer to 11d scan start req.
84  *
85  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
86  */
wmi_unified_send_start_11d_scan_cmd(wmi_unified_t wmi_handle,struct reg_start_11d_scan_req * start_11d_scan)87 QDF_STATUS wmi_unified_send_start_11d_scan_cmd(wmi_unified_t wmi_handle,
88 		struct reg_start_11d_scan_req *start_11d_scan)
89 {
90 	if (wmi_handle->ops->send_start_11d_scan_cmd)
91 		return wmi_handle->ops->send_start_11d_scan_cmd(wmi_handle,
92 				start_11d_scan);
93 
94 	return QDF_STATUS_E_FAILURE;
95 }
96 qdf_export_symbol(wmi_unified_send_start_11d_scan_cmd);
97 
98 /*
99  * wmi_unified_send_stop_11d_scan_cmd() - stop 11d scan
100  * @wmi_handle: wmi handle
101  * @stop_11d_scan: pointer to 11d scan stop req.
102  *
103  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
104  */
wmi_unified_send_stop_11d_scan_cmd(wmi_unified_t wmi_handle,struct reg_stop_11d_scan_req * stop_11d_scan)105 QDF_STATUS wmi_unified_send_stop_11d_scan_cmd(wmi_unified_t wmi_handle,
106 		struct reg_stop_11d_scan_req *stop_11d_scan)
107 {
108 	if (wmi_handle->ops->send_stop_11d_scan_cmd)
109 		return wmi_handle->ops->send_stop_11d_scan_cmd(wmi_handle,
110 				stop_11d_scan);
111 
112 	return QDF_STATUS_E_FAILURE;
113 }
114 qdf_export_symbol(wmi_unified_send_stop_11d_scan_cmd);
115 
wmi_extract_reg_11d_new_cc_event(wmi_unified_t wmi_handle,uint8_t * evt_buf,struct reg_11d_new_country * reg_11d_new_cc,uint32_t len)116 QDF_STATUS wmi_extract_reg_11d_new_cc_event(
117 		wmi_unified_t wmi_handle,
118 		uint8_t *evt_buf,
119 		struct reg_11d_new_country *reg_11d_new_cc,
120 		uint32_t len)
121 {
122 	if (wmi_handle && wmi_handle->ops->extract_reg_11d_new_country_event)
123 		return wmi_handle->ops->extract_reg_11d_new_country_event(
124 				wmi_handle, evt_buf, reg_11d_new_cc, len);
125 
126 	return QDF_STATUS_E_FAILURE;
127 }
128 qdf_export_symbol(wmi_extract_reg_11d_new_cc_event);
129 
wmi_unified_set_user_country_code_cmd_send(wmi_unified_t wmi_handle,uint8_t pdev_id,struct cc_regdmn_s * rd)130 QDF_STATUS wmi_unified_set_user_country_code_cmd_send(
131 		wmi_unified_t wmi_handle,
132 		uint8_t pdev_id, struct cc_regdmn_s *rd)
133 {
134 	if (wmi_handle->ops->send_user_country_code_cmd)
135 		return wmi_handle->ops->send_user_country_code_cmd(
136 				wmi_handle, pdev_id, rd);
137 
138 	return QDF_STATUS_E_FAILURE;
139 }
140 qdf_export_symbol(wmi_unified_set_user_country_code_cmd_send);
141 
wmi_extract_reg_ch_avoid_event(wmi_unified_t wmi_handle,uint8_t * evt_buf,struct ch_avoid_ind_type * ch_avoid_ind,uint32_t len)142 QDF_STATUS wmi_extract_reg_ch_avoid_event(
143 		wmi_unified_t wmi_handle,
144 		uint8_t *evt_buf,
145 		struct ch_avoid_ind_type *ch_avoid_ind,
146 		uint32_t len)
147 {
148 	if (wmi_handle && wmi_handle->ops->extract_reg_ch_avoid_event)
149 		return wmi_handle->ops->extract_reg_ch_avoid_event(
150 				wmi_handle, evt_buf, ch_avoid_ind, len);
151 
152 	return QDF_STATUS_E_FAILURE;
153 }
154 qdf_export_symbol(wmi_extract_reg_ch_avoid_event);
155 
wmi_extract_tgtr2p_table_event(wmi_unified_t wmi_handle,uint8_t * evt_buf,struct r2p_table_update_status_obj * update_status,uint32_t len)156 QDF_STATUS wmi_extract_tgtr2p_table_event(
157 		wmi_unified_t wmi_handle,
158 		uint8_t *evt_buf,
159 		struct r2p_table_update_status_obj *update_status,
160 		uint32_t len)
161 {
162 	if (wmi_handle &&
163 	    wmi_handle->ops->extract_tgtr2p_table_event)
164 		return wmi_handle->ops->extract_tgtr2p_table_event(
165 				wmi_handle, evt_buf, update_status, len);
166 
167 	return QDF_STATUS_E_FAILURE;
168 }
169 
170 qdf_export_symbol(wmi_extract_tgtr2p_table_event);
171