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  * DOC: This file contains the API definitions for the Unified Wireless Module
21  * Interface (WMI) which are specific to Regulatory module.
22  */
23 
24 #ifndef _WMI_UNIFIED_REG_API_H_
25 #define _WMI_UNIFIED_REG_API_H_
26 
27 #include "reg_services_public_struct.h"
28 /**
29  * wmi_extract_reg_chan_list_update_event() - function to update channel list
30  * @wmi_handle: wmi handle
31  * @evt_buf: event buffer
32  * @reg_info: regulatory info
33  * @len: length of buffer
34  *
35  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
36  */
37 QDF_STATUS wmi_extract_reg_chan_list_update_event(
38 		wmi_unified_t wmi_handle,
39 		uint8_t *evt_buf,
40 		struct cur_regulatory_info *reg_info,
41 		uint32_t len);
42 
43 #ifdef CONFIG_BAND_6GHZ
44 /**
45  * wmi_extract_reg_chan_list_ext_update_event() - function to update the
46  * extended channel list
47  * @wmi_handle: wmi handle
48  * @evt_buf: event buffer
49  * @reg_info: regulatory info
50  * @len: length of buffer
51  *
52  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
53  */
54 QDF_STATUS wmi_extract_reg_chan_list_ext_update_event(wmi_unified_t wmi_handle,
55 					uint8_t *evt_buf,
56 					struct cur_regulatory_info *reg_info,
57 					uint32_t len);
58 
59 #ifdef CONFIG_AFC_SUPPORT
60 /**
61  * wmi_extract_afc_event() - function to read the contents of the AFC event
62  * @wmi_handle: wmi handle
63  * @evt_buf: event buffer
64  * @afc_info: AFC regulatory info
65  * @len: length of buffer
66  *
67  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
68  */
69 QDF_STATUS wmi_extract_afc_event(wmi_unified_t wmi_handle,
70 				 uint8_t *evt_buf,
71 				 struct afc_regulatory_info *afc_info,
72 				 uint32_t len);
73 #endif
74 #endif
75 
76 /*
77  * wmi_unified_send_stop_11d_scan_cmd() - stop 11d scan
78  * @wmi_handle: wmi handle
79  * @stop_11d_scan: pointer to 11d scan stop req.
80  *
81  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
82  */
83 QDF_STATUS wmi_unified_send_stop_11d_scan_cmd(wmi_unified_t wmi_handle,
84 		struct reg_stop_11d_scan_req *stop_11d_scan);
85 
86 /*
87  * wmi_unified_send_start_11d_scan_cmd() - start 11d scan
88  * @wmi_handle: wmi handle
89  * @start_11d_scan: pointer to 11d scan start req.
90  *
91  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
92  */
93 QDF_STATUS wmi_unified_send_start_11d_scan_cmd(wmi_unified_t wmi_handle,
94 		struct reg_start_11d_scan_req *start_11d_scan);
95 
96 /**
97  * wmi_extract_reg_11d_new_cc_event() - function to extract the 11d new country
98  * @wmi_handle: wmi handle
99  * @evt_buf: event buffer
100  * @reg_11d_new_cc: pointer to new 11d country info
101  * @len: length of buffer
102  *
103  * Return: 0 for success or error code
104  */
105 QDF_STATUS wmi_extract_reg_11d_new_cc_event(
106 		wmi_unified_t wmi_handle,
107 		uint8_t *evt_buf,
108 		struct reg_11d_new_country *reg_11d_new_cc,
109 		uint32_t len);
110 
111 /**
112  * wmi_unified_set_user_country_code_cmd_send() - WMI set country function
113  * @wmi_handle: wmi handle.
114  * @pdev_id: Pdev id
115  * @rd: User country code or regdomain
116  *
117  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
118  */
119 QDF_STATUS wmi_unified_set_user_country_code_cmd_send(
120 		wmi_unified_t wmi_handle,
121 		uint8_t pdev_id, struct cc_regdmn_s *rd);
122 
123 /**
124  * wmi_extract_reg_ch_avoid_event() - process freq avoid event
125  * @wmi_handle: wmi handle.
126  * @evt_buf: event buffer
127  * @ch_avoid_ind: buffer pointer to save the event processed data
128  * @len: length of buffer
129  *
130  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
131  */
132 QDF_STATUS wmi_extract_reg_ch_avoid_event(
133 		wmi_unified_t wmi_handle,
134 		uint8_t *evt_buf,
135 		struct ch_avoid_ind_type *ch_avoid_ind,
136 		uint32_t len);
137 
138 /**
139  * wmi_extract_tgtr2p_table_event() - function to read the contents of the
140  * rate2power update response event
141  * @wmi_handle: wmi handle
142  * @evt_buf: event buffer
143  * @update_status: Status object
144  * @len: length of buffer
145  *
146  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on error
147  */
148 QDF_STATUS wmi_extract_tgtr2p_table_event(wmi_unified_t wmi_handle,
149 		uint8_t *evt_buf,
150 		struct r2p_table_update_status_obj *update_status,
151 		uint32_t len);
152 
153 #endif /* _WMI_UNIFIED_REG_API_H_ */
154