xref: /wlan-driver/qca-wifi-host-cmn/umac/regulatory/dispatcher/src/wlan_reg_tgt_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  *
6*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
7*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
8*5113495bSYour Name  * above copyright notice and this permission notice appear in all
9*5113495bSYour Name  * copies.
10*5113495bSYour Name  *
11*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
12*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
16*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
17*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
19*5113495bSYour Name  */
20*5113495bSYour Name 
21*5113495bSYour Name  /**
22*5113495bSYour Name  * @file wlan_req_tgt_api.c
23*5113495bSYour Name  * @brief contains regulatory target interface definitions
24*5113495bSYour Name  */
25*5113495bSYour Name 
26*5113495bSYour Name #include <qdf_status.h>
27*5113495bSYour Name #include <qdf_types.h>
28*5113495bSYour Name #include <wlan_cmn.h>
29*5113495bSYour Name #include <reg_services_public_struct.h>
30*5113495bSYour Name #include <wlan_reg_tgt_api.h>
31*5113495bSYour Name #include <wlan_objmgr_psoc_obj.h>
32*5113495bSYour Name #include <../../core/src/reg_priv_objs.h>
33*5113495bSYour Name #include <../../core/src/reg_utils.h>
34*5113495bSYour Name #include <../../core/src/reg_services_common.h>
35*5113495bSYour Name #include <../../core/src/reg_lte.h>
36*5113495bSYour Name #include <../../core/src/reg_build_chan_list.h>
37*5113495bSYour Name #include <../../core/src/reg_offload_11d_scan.h>
38*5113495bSYour Name 
tgt_reg_process_master_chan_list(struct cur_regulatory_info * reg_info)39*5113495bSYour Name QDF_STATUS tgt_reg_process_master_chan_list(struct cur_regulatory_info
40*5113495bSYour Name 					    *reg_info)
41*5113495bSYour Name {
42*5113495bSYour Name 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
43*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc;
44*5113495bSYour Name 
45*5113495bSYour Name 	psoc = reg_info->psoc;
46*5113495bSYour Name 	soc_reg = reg_get_psoc_obj(psoc);
47*5113495bSYour Name 
48*5113495bSYour Name 	if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) {
49*5113495bSYour Name 		reg_err("psoc reg component is NULL");
50*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
51*5113495bSYour Name 	}
52*5113495bSYour Name 
53*5113495bSYour Name 	if (!soc_reg->offload_enabled)
54*5113495bSYour Name 		return QDF_STATUS_SUCCESS;
55*5113495bSYour Name 
56*5113495bSYour Name 	return reg_process_master_chan_list(reg_info);
57*5113495bSYour Name }
58*5113495bSYour Name 
59*5113495bSYour Name #ifdef CONFIG_BAND_6GHZ
tgt_reg_process_master_chan_list_ext(struct cur_regulatory_info * reg_info)60*5113495bSYour Name QDF_STATUS tgt_reg_process_master_chan_list_ext(struct cur_regulatory_info
61*5113495bSYour Name 						*reg_info)
62*5113495bSYour Name {
63*5113495bSYour Name 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
64*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc;
65*5113495bSYour Name 
66*5113495bSYour Name 	psoc = reg_info->psoc;
67*5113495bSYour Name 	soc_reg = reg_get_psoc_obj(psoc);
68*5113495bSYour Name 
69*5113495bSYour Name 	if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) {
70*5113495bSYour Name 		reg_err("psoc reg component is NULL");
71*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
72*5113495bSYour Name 	}
73*5113495bSYour Name 
74*5113495bSYour Name 	if (!soc_reg->offload_enabled)
75*5113495bSYour Name 		return QDF_STATUS_SUCCESS;
76*5113495bSYour Name 
77*5113495bSYour Name 	return reg_process_master_chan_list_ext(reg_info);
78*5113495bSYour Name }
79*5113495bSYour Name 
80*5113495bSYour Name #ifdef CONFIG_AFC_SUPPORT
81*5113495bSYour Name QDF_STATUS
tgt_reg_process_afc_event(struct afc_regulatory_info * afc_info)82*5113495bSYour Name tgt_reg_process_afc_event(struct afc_regulatory_info *afc_info)
83*5113495bSYour Name {
84*5113495bSYour Name 	return reg_process_afc_event(afc_info);
85*5113495bSYour Name }
86*5113495bSYour Name #endif
87*5113495bSYour Name #endif
88*5113495bSYour Name 
tgt_reg_process_11d_new_country(struct wlan_objmgr_psoc * psoc,struct reg_11d_new_country * reg_11d_new_cc)89*5113495bSYour Name QDF_STATUS tgt_reg_process_11d_new_country(struct wlan_objmgr_psoc *psoc,
90*5113495bSYour Name 		struct reg_11d_new_country *reg_11d_new_cc)
91*5113495bSYour Name {
92*5113495bSYour Name 	return reg_save_new_11d_country(psoc, reg_11d_new_cc->alpha2);
93*5113495bSYour Name }
94*5113495bSYour Name 
tgt_reg_set_regdb_offloaded(struct wlan_objmgr_psoc * psoc,bool val)95*5113495bSYour Name QDF_STATUS tgt_reg_set_regdb_offloaded(struct wlan_objmgr_psoc *psoc,
96*5113495bSYour Name 		bool val)
97*5113495bSYour Name {
98*5113495bSYour Name 	return reg_set_regdb_offloaded(psoc, val);
99*5113495bSYour Name }
100*5113495bSYour Name 
tgt_reg_set_11d_offloaded(struct wlan_objmgr_psoc * psoc,bool val)101*5113495bSYour Name QDF_STATUS tgt_reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc,
102*5113495bSYour Name 		bool val)
103*5113495bSYour Name {
104*5113495bSYour Name 	return reg_set_11d_offloaded(psoc, val);
105*5113495bSYour Name }
106*5113495bSYour Name 
tgt_reg_process_ch_avoid_event(struct wlan_objmgr_psoc * psoc,struct ch_avoid_ind_type * ch_avoid_evnt)107*5113495bSYour Name QDF_STATUS tgt_reg_process_ch_avoid_event(struct wlan_objmgr_psoc *psoc,
108*5113495bSYour Name 		struct ch_avoid_ind_type *ch_avoid_evnt)
109*5113495bSYour Name {
110*5113495bSYour Name 	return reg_process_ch_avoid_event(psoc, ch_avoid_evnt);
111*5113495bSYour Name }
112*5113495bSYour Name 
tgt_reg_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc * psoc)113*5113495bSYour Name bool tgt_reg_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc)
114*5113495bSYour Name {
115*5113495bSYour Name 	return reg_get_ignore_fw_reg_offload_ind(psoc);
116*5113495bSYour Name }
117*5113495bSYour Name 
tgt_reg_set_6ghz_supported(struct wlan_objmgr_psoc * psoc,bool val)118*5113495bSYour Name QDF_STATUS tgt_reg_set_6ghz_supported(struct wlan_objmgr_psoc *psoc,
119*5113495bSYour Name 				      bool val)
120*5113495bSYour Name {
121*5113495bSYour Name 	return reg_set_6ghz_supported(psoc, val);
122*5113495bSYour Name }
123*5113495bSYour Name 
tgt_reg_set_5dot9_ghz_supported(struct wlan_objmgr_psoc * psoc,bool val)124*5113495bSYour Name QDF_STATUS tgt_reg_set_5dot9_ghz_supported(struct wlan_objmgr_psoc *psoc,
125*5113495bSYour Name 					   bool val)
126*5113495bSYour Name {
127*5113495bSYour Name 	return reg_set_5dot9_ghz_supported(psoc, val);
128*5113495bSYour Name }
129*5113495bSYour Name 
tgt_reg_set_ext_tpc_supported(struct wlan_objmgr_psoc * psoc,bool val)130*5113495bSYour Name QDF_STATUS tgt_reg_set_ext_tpc_supported(struct wlan_objmgr_psoc *psoc,
131*5113495bSYour Name 					 bool val)
132*5113495bSYour Name {
133*5113495bSYour Name 	return reg_set_ext_tpc_supported(psoc, val);
134*5113495bSYour Name }
135*5113495bSYour Name 
136*5113495bSYour Name #if defined(CONFIG_BAND_6GHZ)
tgt_reg_set_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc * psoc,bool val)137*5113495bSYour Name QDF_STATUS tgt_reg_set_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc,
138*5113495bSYour Name 					     bool val)
139*5113495bSYour Name {
140*5113495bSYour Name 	return reg_set_lower_6g_edge_ch_supp(psoc, val);
141*5113495bSYour Name }
142*5113495bSYour Name 
143*5113495bSYour Name QDF_STATUS
tgt_reg_set_disable_upper_6g_edge_ch_supp(struct wlan_objmgr_psoc * psoc,bool val)144*5113495bSYour Name tgt_reg_set_disable_upper_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc,
145*5113495bSYour Name 					  bool val)
146*5113495bSYour Name {
147*5113495bSYour Name 	return reg_set_disable_upper_6g_edge_ch_supp(psoc, val);
148*5113495bSYour Name }
149*5113495bSYour Name #endif
150*5113495bSYour Name 
151*5113495bSYour Name #ifdef CONFIG_AFC_SUPPORT
tgt_reg_set_afc_dev_type(struct wlan_objmgr_psoc * psoc,enum reg_afc_dev_deploy_type reg_afc_dev_type)152*5113495bSYour Name QDF_STATUS tgt_reg_set_afc_dev_type(struct wlan_objmgr_psoc *psoc,
153*5113495bSYour Name 				    enum reg_afc_dev_deploy_type
154*5113495bSYour Name 				    reg_afc_dev_type)
155*5113495bSYour Name {
156*5113495bSYour Name 	return reg_set_afc_soc_dev_type(psoc, reg_afc_dev_type);
157*5113495bSYour Name }
158*5113495bSYour Name 
tgt_reg_get_afc_dev_type(struct wlan_objmgr_psoc * psoc,enum reg_afc_dev_deploy_type * reg_afc_dev_type)159*5113495bSYour Name QDF_STATUS tgt_reg_get_afc_dev_type(struct wlan_objmgr_psoc *psoc,
160*5113495bSYour Name 				    enum reg_afc_dev_deploy_type
161*5113495bSYour Name 				    *reg_afc_dev_type)
162*5113495bSYour Name {
163*5113495bSYour Name 	return reg_get_afc_soc_dev_type(psoc, reg_afc_dev_type);
164*5113495bSYour Name }
165*5113495bSYour Name 
166*5113495bSYour Name QDF_STATUS
tgt_reg_set_eirp_preferred_support(struct wlan_objmgr_psoc * psoc,bool reg_is_eirp_support_preferred)167*5113495bSYour Name tgt_reg_set_eirp_preferred_support(struct wlan_objmgr_psoc *psoc,
168*5113495bSYour Name 				   bool reg_is_eirp_support_preferred)
169*5113495bSYour Name {
170*5113495bSYour Name 	return reg_set_eirp_preferred_support(psoc,
171*5113495bSYour Name 					      reg_is_eirp_support_preferred);
172*5113495bSYour Name }
173*5113495bSYour Name 
174*5113495bSYour Name QDF_STATUS
tgt_reg_get_eirp_preferred_support(struct wlan_objmgr_psoc * psoc,bool * reg_is_eirp_support_preferred)175*5113495bSYour Name tgt_reg_get_eirp_preferred_support(struct wlan_objmgr_psoc *psoc,
176*5113495bSYour Name 				   bool *reg_is_eirp_support_preferred)
177*5113495bSYour Name {
178*5113495bSYour Name 	return reg_get_eirp_preferred_support(psoc,
179*5113495bSYour Name 					      reg_is_eirp_support_preferred);
180*5113495bSYour Name }
181*5113495bSYour Name #endif
182*5113495bSYour Name 
tgt_reg_process_r2p_table_update_response(struct wlan_objmgr_psoc * psoc,uint32_t pdev_id)183*5113495bSYour Name QDF_STATUS tgt_reg_process_r2p_table_update_response(
184*5113495bSYour Name 						struct wlan_objmgr_psoc *psoc,
185*5113495bSYour Name 						uint32_t pdev_id)
186*5113495bSYour Name {
187*5113495bSYour Name 	return reg_process_r2p_table_update_response(psoc, pdev_id);
188*5113495bSYour Name }
189