xref: /wlan-dirver/qca-wifi-host-cmn/umac/regulatory/dispatcher/src/wlan_reg_tgt_api.c (revision 6d768494e5ce14eb1603a695c86739d12ecc6ec2)
1 /*
2  * Copyright (c) 2017-2020 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  * @file wlan_req_tgt_api.c
22  * @brief contains regulatory target interface definations
23  */
24 
25 #include <qdf_status.h>
26 #include <qdf_types.h>
27 #include <wlan_cmn.h>
28 #include <reg_services_public_struct.h>
29 #include <wlan_reg_tgt_api.h>
30 #include <wlan_objmgr_psoc_obj.h>
31 #include <../../core/src/reg_priv_objs.h>
32 #include <../../core/src/reg_utils.h>
33 #include <../../core/src/reg_services_common.h>
34 #include <../../core/src/reg_lte.h>
35 #include <../../core/src/reg_build_chan_list.h>
36 #include <../../core/src/reg_offload_11d_scan.h>
37 
38 /**
39  * tgt_process_master_chan_list() - process master channel list
40  * @reg_info: regulatory info
41  *
42  * Return: QDF_STATUS
43  */
44 QDF_STATUS tgt_reg_process_master_chan_list(struct cur_regulatory_info
45 					    *reg_info)
46 {
47 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
48 	struct wlan_objmgr_psoc *psoc;
49 
50 	psoc = reg_info->psoc;
51 	soc_reg = reg_get_psoc_obj(psoc);
52 
53 	if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) {
54 		reg_err("psoc reg component is NULL");
55 		return QDF_STATUS_E_FAILURE;
56 	}
57 
58 	if (!soc_reg->offload_enabled)
59 		return QDF_STATUS_SUCCESS;
60 
61 	return reg_process_master_chan_list(reg_info);
62 }
63 
64 QDF_STATUS tgt_reg_process_11d_new_country(struct wlan_objmgr_psoc *psoc,
65 		struct reg_11d_new_country *reg_11d_new_cc)
66 {
67 	return reg_save_new_11d_country(psoc, reg_11d_new_cc->alpha2);
68 }
69 
70 QDF_STATUS tgt_reg_set_regdb_offloaded(struct wlan_objmgr_psoc *psoc,
71 		bool val)
72 {
73 	return reg_set_regdb_offloaded(psoc, val);
74 }
75 
76 QDF_STATUS tgt_reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc,
77 		bool val)
78 {
79 	return reg_set_11d_offloaded(psoc, val);
80 }
81 
82 QDF_STATUS tgt_reg_process_ch_avoid_event(struct wlan_objmgr_psoc *psoc,
83 		struct ch_avoid_ind_type *ch_avoid_evnt)
84 {
85 	return reg_process_ch_avoid_event(psoc, ch_avoid_evnt);
86 }
87 
88 bool tgt_reg_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc)
89 {
90 	return reg_get_ignore_fw_reg_offload_ind(psoc);
91 }
92 
93 QDF_STATUS tgt_reg_set_6ghz_supported(struct wlan_objmgr_psoc *psoc,
94 				      bool val)
95 {
96 	return reg_set_6ghz_supported(psoc, val);
97 }
98