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