xref: /wlan-dirver/qca-wifi-host-cmn/wmi/src/wmi_unified_reg_api.c (revision 503663c6daafffe652fa360bde17243568cd6d2a)
1 /*
2  * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
3  *
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 
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 /*
46  * wmi_unified_send_start_11d_scan_cmd() - start 11d scan
47  * @wmi_handle: wmi handle
48  * @start_11d_scan: pointer to 11d scan start req.
49  *
50  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
51  */
52 QDF_STATUS wmi_unified_send_start_11d_scan_cmd(wmi_unified_t wmi_handle,
53 		struct reg_start_11d_scan_req *start_11d_scan)
54 {
55 	if (wmi_handle->ops->send_start_11d_scan_cmd)
56 		return wmi_handle->ops->send_start_11d_scan_cmd(wmi_handle,
57 				start_11d_scan);
58 
59 	return QDF_STATUS_E_FAILURE;
60 }
61 qdf_export_symbol(wmi_unified_send_start_11d_scan_cmd);
62 
63 /*
64  * wmi_unified_send_stop_11d_scan_cmd() - stop 11d scan
65  * @wmi_handle: wmi handle
66  * @stop_11d_scan: pointer to 11d scan stop req.
67  *
68  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
69  */
70 QDF_STATUS wmi_unified_send_stop_11d_scan_cmd(wmi_unified_t wmi_handle,
71 		struct reg_stop_11d_scan_req *stop_11d_scan)
72 {
73 	if (wmi_handle->ops->send_stop_11d_scan_cmd)
74 		return wmi_handle->ops->send_stop_11d_scan_cmd(wmi_handle,
75 				stop_11d_scan);
76 
77 	return QDF_STATUS_E_FAILURE;
78 }
79 qdf_export_symbol(wmi_unified_send_stop_11d_scan_cmd);
80 
81 QDF_STATUS wmi_extract_reg_11d_new_cc_event(
82 		wmi_unified_t wmi_handle,
83 		uint8_t *evt_buf,
84 		struct reg_11d_new_country *reg_11d_new_cc,
85 		uint32_t len)
86 {
87 	if (wmi_handle && wmi_handle->ops->extract_reg_11d_new_country_event)
88 		return wmi_handle->ops->extract_reg_11d_new_country_event(
89 				wmi_handle, evt_buf, reg_11d_new_cc, len);
90 
91 	return QDF_STATUS_E_FAILURE;
92 }
93 qdf_export_symbol(wmi_extract_reg_11d_new_cc_event);
94 
95 QDF_STATUS wmi_unified_set_user_country_code_cmd_send(
96 		wmi_unified_t wmi_handle,
97 		uint8_t pdev_id, struct cc_regdmn_s *rd)
98 {
99 	if (wmi_handle->ops->send_user_country_code_cmd)
100 		return wmi_handle->ops->send_user_country_code_cmd(
101 				wmi_handle, pdev_id, rd);
102 
103 	return QDF_STATUS_E_FAILURE;
104 }
105 qdf_export_symbol(wmi_unified_set_user_country_code_cmd_send);
106 
107 QDF_STATUS wmi_extract_reg_ch_avoid_event(
108 		wmi_unified_t wmi_handle,
109 		uint8_t *evt_buf,
110 		struct ch_avoid_ind_type *ch_avoid_ind,
111 		uint32_t len)
112 {
113 	if (wmi_handle && wmi_handle->ops->extract_reg_ch_avoid_event)
114 		return wmi_handle->ops->extract_reg_ch_avoid_event(
115 				wmi_handle, evt_buf, ch_avoid_ind, len);
116 
117 	return QDF_STATUS_E_FAILURE;
118 }
119 qdf_export_symbol(wmi_extract_reg_ch_avoid_event);
120