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