xref: /wlan-dirver/qca-wifi-host-cmn/umac/regulatory/dispatcher/src/wlan_reg_tgt_api.c (revision 2f4b444fb7e689b83a4ab0e7b3b38f0bf4def8e0)
1 /*
2  * Copyright (c) 2017-2021 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 QDF_STATUS tgt_reg_process_master_chan_list(struct cur_regulatory_info
39 					    *reg_info)
40 {
41 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
42 	struct wlan_objmgr_psoc *psoc;
43 
44 	psoc = reg_info->psoc;
45 	soc_reg = reg_get_psoc_obj(psoc);
46 
47 	if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) {
48 		reg_err("psoc reg component is NULL");
49 		return QDF_STATUS_E_FAILURE;
50 	}
51 
52 	if (!soc_reg->offload_enabled)
53 		return QDF_STATUS_SUCCESS;
54 
55 	return reg_process_master_chan_list(reg_info);
56 }
57 
58 #ifdef CONFIG_BAND_6GHZ
59 QDF_STATUS tgt_reg_process_master_chan_list_ext(struct cur_regulatory_info
60 						*reg_info)
61 {
62 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
63 	struct wlan_objmgr_psoc *psoc;
64 
65 	psoc = reg_info->psoc;
66 	soc_reg = reg_get_psoc_obj(psoc);
67 
68 	if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) {
69 		reg_err("psoc reg component is NULL");
70 		return QDF_STATUS_E_FAILURE;
71 	}
72 
73 	if (!soc_reg->offload_enabled)
74 		return QDF_STATUS_SUCCESS;
75 
76 	return reg_process_master_chan_list_ext(reg_info);
77 }
78 
79 #ifdef CONFIG_AFC_SUPPORT
80 QDF_STATUS
81 tgt_reg_process_afc_event(struct afc_regulatory_info *afc_info)
82 {
83 	return reg_process_afc_event(afc_info);
84 }
85 #endif
86 #endif
87 
88 QDF_STATUS tgt_reg_process_11d_new_country(struct wlan_objmgr_psoc *psoc,
89 		struct reg_11d_new_country *reg_11d_new_cc)
90 {
91 	return reg_save_new_11d_country(psoc, reg_11d_new_cc->alpha2);
92 }
93 
94 QDF_STATUS tgt_reg_set_regdb_offloaded(struct wlan_objmgr_psoc *psoc,
95 		bool val)
96 {
97 	return reg_set_regdb_offloaded(psoc, val);
98 }
99 
100 QDF_STATUS tgt_reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc,
101 		bool val)
102 {
103 	return reg_set_11d_offloaded(psoc, val);
104 }
105 
106 QDF_STATUS tgt_reg_process_ch_avoid_event(struct wlan_objmgr_psoc *psoc,
107 		struct ch_avoid_ind_type *ch_avoid_evnt)
108 {
109 	return reg_process_ch_avoid_event(psoc, ch_avoid_evnt);
110 }
111 
112 bool tgt_reg_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc)
113 {
114 	return reg_get_ignore_fw_reg_offload_ind(psoc);
115 }
116 
117 QDF_STATUS tgt_reg_set_6ghz_supported(struct wlan_objmgr_psoc *psoc,
118 				      bool val)
119 {
120 	return reg_set_6ghz_supported(psoc, val);
121 }
122 
123 QDF_STATUS tgt_reg_set_5dot9_ghz_supported(struct wlan_objmgr_psoc *psoc,
124 					   bool val)
125 {
126 	return reg_set_5dot9_ghz_supported(psoc, val);
127 }
128 
129 QDF_STATUS tgt_reg_set_ext_tpc_supported(struct wlan_objmgr_psoc *psoc,
130 					 bool val)
131 {
132 	return reg_set_ext_tpc_supported(psoc, val);
133 }
134 
135 #if defined(CONFIG_BAND_6GHZ)
136 QDF_STATUS tgt_reg_set_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc,
137 					     bool val)
138 {
139 	return reg_set_lower_6g_edge_ch_supp(psoc, val);
140 }
141 
142 QDF_STATUS
143 tgt_reg_set_disable_upper_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc,
144 					  bool val)
145 {
146 	return reg_set_disable_upper_6g_edge_ch_supp(psoc, val);
147 }
148 #endif
149