xref: /wlan-driver/qca-wifi-host-cmn/target_if/regulatory/src/target_if_reg.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  * DOC: target_if_reg.c
23*5113495bSYour Name  * This file contains regulatory target interfaces.
24*5113495bSYour Name  */
25*5113495bSYour Name 
26*5113495bSYour Name #include <wmi_unified_api.h>
27*5113495bSYour Name #include <reg_services_public_struct.h>
28*5113495bSYour Name #include <wlan_reg_tgt_api.h>
29*5113495bSYour Name #include <target_if.h>
30*5113495bSYour Name #include <target_if_reg.h>
31*5113495bSYour Name #include <wmi_unified_reg_api.h>
32*5113495bSYour Name #include <qdf_platform.h>
33*5113495bSYour Name #include <target_if_reg_11d.h>
34*5113495bSYour Name #include <target_if_reg_lte.h>
35*5113495bSYour Name #include <wlan_reg_ucfg_api.h>
36*5113495bSYour Name #include <wlan_utility.h>
37*5113495bSYour Name #ifdef CONFIG_REG_CLIENT
38*5113495bSYour Name #include <wlan_dcs_tgt_api.h>
39*5113495bSYour Name #endif
40*5113495bSYour Name 
41*5113495bSYour Name /**
42*5113495bSYour Name  * get_chan_list_cc_event_id() - Get chan_list_cc event id
43*5113495bSYour Name  *
44*5113495bSYour Name  * Return: Event id
45*5113495bSYour Name  */
get_chan_list_cc_event_id(void)46*5113495bSYour Name static inline uint32_t get_chan_list_cc_event_id(void)
47*5113495bSYour Name {
48*5113495bSYour Name 	return wmi_reg_chan_list_cc_event_id;
49*5113495bSYour Name }
50*5113495bSYour Name 
51*5113495bSYour Name /**
52*5113495bSYour Name  * tgt_if_regulatory_is_regdb_offloaded() - Check if regdb is offloaded
53*5113495bSYour Name  * @psoc: Pointer to psoc
54*5113495bSYour Name  *
55*5113495bSYour Name  * Return: true if regdb if offloaded, else false
56*5113495bSYour Name  */
tgt_if_regulatory_is_regdb_offloaded(struct wlan_objmgr_psoc * psoc)57*5113495bSYour Name static bool tgt_if_regulatory_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc)
58*5113495bSYour Name {
59*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
60*5113495bSYour Name 
61*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
62*5113495bSYour Name 
63*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
64*5113495bSYour Name 	if (!reg_rx_ops) {
65*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
66*5113495bSYour Name 		return false;
67*5113495bSYour Name 	}
68*5113495bSYour Name 
69*5113495bSYour Name 	if (!wmi_handle)
70*5113495bSYour Name 		return false;
71*5113495bSYour Name 
72*5113495bSYour Name 	if (reg_rx_ops->reg_ignore_fw_reg_offload_ind &&
73*5113495bSYour Name 	    reg_rx_ops->reg_ignore_fw_reg_offload_ind(psoc)) {
74*5113495bSYour Name 		target_if_debug("User disabled regulatory offload from ini");
75*5113495bSYour Name 		return 0;
76*5113495bSYour Name 	}
77*5113495bSYour Name 
78*5113495bSYour Name 	return wmi_service_enabled(wmi_handle, wmi_service_regulatory_db);
79*5113495bSYour Name }
80*5113495bSYour Name 
81*5113495bSYour Name /**
82*5113495bSYour Name  * tgt_if_regulatory_is_6ghz_supported() - Check if 6 GHz is supported
83*5113495bSYour Name  * @psoc: Pointer to psoc
84*5113495bSYour Name  *
85*5113495bSYour Name  * Return: true if regdb if offloaded, else false
86*5113495bSYour Name  */
tgt_if_regulatory_is_6ghz_supported(struct wlan_objmgr_psoc * psoc)87*5113495bSYour Name static bool tgt_if_regulatory_is_6ghz_supported(struct wlan_objmgr_psoc *psoc)
88*5113495bSYour Name {
89*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
90*5113495bSYour Name 
91*5113495bSYour Name 	if (!wmi_handle)
92*5113495bSYour Name 		return false;
93*5113495bSYour Name 
94*5113495bSYour Name 	return wmi_service_enabled(wmi_handle, wmi_service_6ghz_support);
95*5113495bSYour Name }
96*5113495bSYour Name 
97*5113495bSYour Name /**
98*5113495bSYour Name  * tgt_if_regulatory_is_5dot9_ghz_supported() - Check if 5.9 GHz is supported
99*5113495bSYour Name  * @psoc: Pointer to psoc
100*5113495bSYour Name  *
101*5113495bSYour Name  * Return: true if 5.9 GHz is supported, else false
102*5113495bSYour Name  */
103*5113495bSYour Name static bool
tgt_if_regulatory_is_5dot9_ghz_supported(struct wlan_objmgr_psoc * psoc)104*5113495bSYour Name tgt_if_regulatory_is_5dot9_ghz_supported(struct wlan_objmgr_psoc *psoc)
105*5113495bSYour Name {
106*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
107*5113495bSYour Name 
108*5113495bSYour Name 	if (!wmi_handle)
109*5113495bSYour Name 		return false;
110*5113495bSYour Name 
111*5113495bSYour Name 	return wmi_service_enabled(wmi_handle, wmi_service_5dot9_ghz_support);
112*5113495bSYour Name }
113*5113495bSYour Name 
114*5113495bSYour Name /**
115*5113495bSYour Name  * tgt_if_regulatory_is_there_serv_ready_extn() - Check for service ready
116*5113495bSYour Name  * extension
117*5113495bSYour Name  * @psoc: Pointer to psoc object
118*5113495bSYour Name  *
119*5113495bSYour Name  * Return: true if service ready extension is present, else false.
120*5113495bSYour Name  */
tgt_if_regulatory_is_there_serv_ready_extn(struct wlan_objmgr_psoc * psoc)121*5113495bSYour Name static bool tgt_if_regulatory_is_there_serv_ready_extn(
122*5113495bSYour Name 		struct wlan_objmgr_psoc *psoc)
123*5113495bSYour Name {
124*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
125*5113495bSYour Name 
126*5113495bSYour Name 	if (!wmi_handle)
127*5113495bSYour Name 		return false;
128*5113495bSYour Name 
129*5113495bSYour Name 	return wmi_service_enabled(wmi_handle, wmi_service_ext_msg);
130*5113495bSYour Name }
131*5113495bSYour Name 
132*5113495bSYour Name /**
133*5113495bSYour Name  * target_if_regulatory_get_rx_ops() - Get regdb rx ops
134*5113495bSYour Name  * @psoc: Pointer to psoc object
135*5113495bSYour Name  *
136*5113495bSYour Name  * Return: Reg rx_ops
137*5113495bSYour Name  */
138*5113495bSYour Name struct wlan_lmac_if_reg_rx_ops *
target_if_regulatory_get_rx_ops(struct wlan_objmgr_psoc * psoc)139*5113495bSYour Name target_if_regulatory_get_rx_ops(struct wlan_objmgr_psoc *psoc)
140*5113495bSYour Name {
141*5113495bSYour Name 	struct wlan_lmac_if_rx_ops *rx_ops;
142*5113495bSYour Name 
143*5113495bSYour Name 	rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
144*5113495bSYour Name 	if (!rx_ops) {
145*5113495bSYour Name 		target_if_err("rx_ops is NULL");
146*5113495bSYour Name 		return NULL;
147*5113495bSYour Name 	}
148*5113495bSYour Name 
149*5113495bSYour Name 	return &rx_ops->reg_rx_ops;
150*5113495bSYour Name }
151*5113495bSYour Name 
152*5113495bSYour Name struct wlan_lmac_if_reg_tx_ops *
target_if_regulatory_get_tx_ops(struct wlan_objmgr_psoc * psoc)153*5113495bSYour Name target_if_regulatory_get_tx_ops(struct wlan_objmgr_psoc *psoc)
154*5113495bSYour Name {
155*5113495bSYour Name 	struct wlan_lmac_if_tx_ops *tx_ops;
156*5113495bSYour Name 
157*5113495bSYour Name 	tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
158*5113495bSYour Name 	if (!tx_ops) {
159*5113495bSYour Name 		target_if_err("tx_ops is NULL");
160*5113495bSYour Name 		return NULL;
161*5113495bSYour Name 	}
162*5113495bSYour Name 
163*5113495bSYour Name 	return &tx_ops->reg_ops;
164*5113495bSYour Name }
165*5113495bSYour Name 
target_if_reg_set_offloaded_info(struct wlan_objmgr_psoc * psoc)166*5113495bSYour Name QDF_STATUS target_if_reg_set_offloaded_info(struct wlan_objmgr_psoc *psoc)
167*5113495bSYour Name {
168*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
169*5113495bSYour Name 
170*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
171*5113495bSYour Name 	if (!reg_rx_ops) {
172*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
173*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
174*5113495bSYour Name 	}
175*5113495bSYour Name 
176*5113495bSYour Name 	if (reg_rx_ops->reg_set_regdb_offloaded)
177*5113495bSYour Name 		reg_rx_ops->reg_set_regdb_offloaded(
178*5113495bSYour Name 				psoc,
179*5113495bSYour Name 				tgt_if_regulatory_is_regdb_offloaded(psoc));
180*5113495bSYour Name 
181*5113495bSYour Name 	if (reg_rx_ops->reg_set_11d_offloaded)
182*5113495bSYour Name 		reg_rx_ops->reg_set_11d_offloaded(
183*5113495bSYour Name 				psoc, tgt_if_regulatory_is_11d_offloaded(psoc));
184*5113495bSYour Name 
185*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
186*5113495bSYour Name }
187*5113495bSYour Name 
target_if_reg_set_6ghz_info(struct wlan_objmgr_psoc * psoc)188*5113495bSYour Name QDF_STATUS target_if_reg_set_6ghz_info(struct wlan_objmgr_psoc *psoc)
189*5113495bSYour Name {
190*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
191*5113495bSYour Name 
192*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
193*5113495bSYour Name 	if (!reg_rx_ops) {
194*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
195*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
196*5113495bSYour Name 	}
197*5113495bSYour Name 
198*5113495bSYour Name 	if (reg_rx_ops->reg_set_6ghz_supported)
199*5113495bSYour Name 		reg_rx_ops->reg_set_6ghz_supported(
200*5113495bSYour Name 			psoc,
201*5113495bSYour Name 			tgt_if_regulatory_is_6ghz_supported(psoc));
202*5113495bSYour Name 
203*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
204*5113495bSYour Name }
205*5113495bSYour Name 
target_if_reg_set_5dot9_ghz_info(struct wlan_objmgr_psoc * psoc)206*5113495bSYour Name QDF_STATUS target_if_reg_set_5dot9_ghz_info(struct wlan_objmgr_psoc *psoc)
207*5113495bSYour Name {
208*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
209*5113495bSYour Name 
210*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
211*5113495bSYour Name 	if (!reg_rx_ops) {
212*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
213*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
214*5113495bSYour Name 	}
215*5113495bSYour Name 
216*5113495bSYour Name 	if (reg_rx_ops->reg_set_5dot9_ghz_supported)
217*5113495bSYour Name 		reg_rx_ops->reg_set_5dot9_ghz_supported(
218*5113495bSYour Name 			psoc,
219*5113495bSYour Name 			tgt_if_regulatory_is_5dot9_ghz_supported(psoc));
220*5113495bSYour Name 
221*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
222*5113495bSYour Name }
223*5113495bSYour Name 
224*5113495bSYour Name bool
target_if_reg_is_reg_cc_ext_event_host_supported(struct wlan_objmgr_psoc * psoc)225*5113495bSYour Name target_if_reg_is_reg_cc_ext_event_host_supported(struct wlan_objmgr_psoc *psoc)
226*5113495bSYour Name {
227*5113495bSYour Name 	struct wlan_lmac_if_reg_tx_ops *reg_tx_ops;
228*5113495bSYour Name 	bool reg_ext_cc_supp = false;
229*5113495bSYour Name 
230*5113495bSYour Name 	reg_tx_ops = target_if_regulatory_get_tx_ops(psoc);
231*5113495bSYour Name 	if (!reg_tx_ops) {
232*5113495bSYour Name 		target_if_err("reg_tx_ops is NULL");
233*5113495bSYour Name 		return reg_ext_cc_supp;
234*5113495bSYour Name 	}
235*5113495bSYour Name 
236*5113495bSYour Name 	if (reg_tx_ops->register_master_ext_handler)
237*5113495bSYour Name 		reg_ext_cc_supp = true;
238*5113495bSYour Name 
239*5113495bSYour Name 	return reg_ext_cc_supp;
240*5113495bSYour Name }
241*5113495bSYour Name 
242*5113495bSYour Name /**
243*5113495bSYour Name  * tgt_reg_chan_list_update_handler() - Channel list update handler
244*5113495bSYour Name  * @handle: scn handle
245*5113495bSYour Name  * @event_buf: pointer to event buffer
246*5113495bSYour Name  * @len: buffer length
247*5113495bSYour Name  *
248*5113495bSYour Name  * Return: 0 on success
249*5113495bSYour Name  */
tgt_reg_chan_list_update_handler(ol_scn_t handle,uint8_t * event_buf,uint32_t len)250*5113495bSYour Name static int tgt_reg_chan_list_update_handler(ol_scn_t handle, uint8_t *event_buf,
251*5113495bSYour Name 					    uint32_t len)
252*5113495bSYour Name {
253*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc;
254*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
255*5113495bSYour Name 	struct cur_regulatory_info *reg_info;
256*5113495bSYour Name 	QDF_STATUS status;
257*5113495bSYour Name 	struct wmi_unified *wmi_handle;
258*5113495bSYour Name 	int ret_val = 0;
259*5113495bSYour Name 
260*5113495bSYour Name 	TARGET_IF_ENTER();
261*5113495bSYour Name 
262*5113495bSYour Name 	psoc = target_if_get_psoc_from_scn_hdl(handle);
263*5113495bSYour Name 	if (!psoc) {
264*5113495bSYour Name 		target_if_err("psoc ptr is NULL");
265*5113495bSYour Name 		return -EINVAL;
266*5113495bSYour Name 	}
267*5113495bSYour Name 
268*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
269*5113495bSYour Name 	if (!reg_rx_ops) {
270*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
271*5113495bSYour Name 		return -EINVAL;
272*5113495bSYour Name 	}
273*5113495bSYour Name 
274*5113495bSYour Name 	if (!reg_rx_ops->master_list_handler) {
275*5113495bSYour Name 		target_if_err("master_list_handler is NULL");
276*5113495bSYour Name 		return -EINVAL;
277*5113495bSYour Name 	}
278*5113495bSYour Name 
279*5113495bSYour Name 	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
280*5113495bSYour Name 	if (!wmi_handle) {
281*5113495bSYour Name 		target_if_err("invalid wmi handle");
282*5113495bSYour Name 		return -EINVAL;
283*5113495bSYour Name 	}
284*5113495bSYour Name 
285*5113495bSYour Name 	reg_info = qdf_mem_malloc(sizeof(*reg_info));
286*5113495bSYour Name 	if (!reg_info)
287*5113495bSYour Name 		return -ENOMEM;
288*5113495bSYour Name 
289*5113495bSYour Name 	if (wmi_extract_reg_chan_list_update_event(wmi_handle,
290*5113495bSYour Name 						   event_buf, reg_info, len)
291*5113495bSYour Name 	    != QDF_STATUS_SUCCESS) {
292*5113495bSYour Name 		target_if_err("Extraction of channel list event failed");
293*5113495bSYour Name 		ret_val = -EFAULT;
294*5113495bSYour Name 		goto clean;
295*5113495bSYour Name 	}
296*5113495bSYour Name 
297*5113495bSYour Name 	if (reg_info->phy_id >= PSOC_MAX_PHY_REG_CAP) {
298*5113495bSYour Name 		target_if_err_rl("phy_id %d is out of bounds",
299*5113495bSYour Name 				 reg_info->phy_id);
300*5113495bSYour Name 		ret_val = -EFAULT;
301*5113495bSYour Name 		goto clean;
302*5113495bSYour Name 	}
303*5113495bSYour Name 
304*5113495bSYour Name 	reg_info->psoc = psoc;
305*5113495bSYour Name 
306*5113495bSYour Name 	status = reg_rx_ops->master_list_handler(reg_info);
307*5113495bSYour Name 	if (status != QDF_STATUS_SUCCESS) {
308*5113495bSYour Name 		target_if_err("Failed to process master channel list handler");
309*5113495bSYour Name 		ret_val = -EFAULT;
310*5113495bSYour Name 	}
311*5113495bSYour Name 
312*5113495bSYour Name clean:
313*5113495bSYour Name 	qdf_mem_free(reg_info->reg_rules_2g_ptr);
314*5113495bSYour Name 	qdf_mem_free(reg_info->reg_rules_5g_ptr);
315*5113495bSYour Name 	qdf_mem_free(reg_info);
316*5113495bSYour Name 
317*5113495bSYour Name 	TARGET_IF_EXIT();
318*5113495bSYour Name 
319*5113495bSYour Name 	return ret_val;
320*5113495bSYour Name }
321*5113495bSYour Name 
322*5113495bSYour Name /**
323*5113495bSYour Name  * tgt_if_regulatory_register_master_list_handler() - Register master channel
324*5113495bSYour Name  * list
325*5113495bSYour Name  * @psoc: Pointer to psoc
326*5113495bSYour Name  * @arg: Pointer to argument list
327*5113495bSYour Name  *
328*5113495bSYour Name  * Return: QDF_STATUS
329*5113495bSYour Name  */
tgt_if_regulatory_register_master_list_handler(struct wlan_objmgr_psoc * psoc,void * arg)330*5113495bSYour Name static QDF_STATUS tgt_if_regulatory_register_master_list_handler(
331*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc, void *arg)
332*5113495bSYour Name {
333*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
334*5113495bSYour Name 
335*5113495bSYour Name 	if (!wmi_handle)
336*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
337*5113495bSYour Name 
338*5113495bSYour Name 	return wmi_unified_register_event_handler(
339*5113495bSYour Name 			wmi_handle, wmi_reg_chan_list_cc_event_id,
340*5113495bSYour Name 			tgt_reg_chan_list_update_handler, WMI_RX_WORK_CTX);
341*5113495bSYour Name }
342*5113495bSYour Name 
343*5113495bSYour Name /**
344*5113495bSYour Name  * tgt_if_regulatory_unregister_master_list_handler() - Unregister master
345*5113495bSYour Name  * channel list
346*5113495bSYour Name  * @psoc: Pointer to psoc
347*5113495bSYour Name  * @arg: Pointer to argument list
348*5113495bSYour Name  *
349*5113495bSYour Name  * Return: QDF_STATUS
350*5113495bSYour Name  */
tgt_if_regulatory_unregister_master_list_handler(struct wlan_objmgr_psoc * psoc,void * arg)351*5113495bSYour Name static QDF_STATUS tgt_if_regulatory_unregister_master_list_handler(
352*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc, void *arg)
353*5113495bSYour Name {
354*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
355*5113495bSYour Name 
356*5113495bSYour Name 	if (!wmi_handle)
357*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
358*5113495bSYour Name 
359*5113495bSYour Name 	return wmi_unified_unregister_event_handler(
360*5113495bSYour Name 			wmi_handle, wmi_reg_chan_list_cc_event_id);
361*5113495bSYour Name }
362*5113495bSYour Name 
363*5113495bSYour Name #ifdef CONFIG_BAND_6GHZ
364*5113495bSYour Name #ifdef CONFIG_REG_CLIENT
365*5113495bSYour Name /**
366*5113495bSYour Name  * tgt_reg_mem_free_fcc_rules() - Free regulatory fcc rules
367*5113495bSYour Name  * @reg_info: Pointer to regulatory info
368*5113495bSYour Name  *
369*5113495bSYour Name  */
tgt_reg_mem_free_fcc_rules(struct cur_regulatory_info * reg_info)370*5113495bSYour Name static void tgt_reg_mem_free_fcc_rules(struct cur_regulatory_info *reg_info)
371*5113495bSYour Name {
372*5113495bSYour Name 	qdf_mem_free(reg_info->fcc_rules_ptr);
373*5113495bSYour Name }
374*5113495bSYour Name #else
tgt_reg_mem_free_fcc_rules(struct cur_regulatory_info * reg_info)375*5113495bSYour Name static void tgt_reg_mem_free_fcc_rules(struct cur_regulatory_info *reg_info)
376*5113495bSYour Name {
377*5113495bSYour Name }
378*5113495bSYour Name #endif
379*5113495bSYour Name 
380*5113495bSYour Name /**
381*5113495bSYour Name  * tgt_reg_chan_list_ext_update_handler() - Extended channel list update handler
382*5113495bSYour Name  * @handle: scn handle
383*5113495bSYour Name  * @event_buf: pointer to event buffer
384*5113495bSYour Name  * @len: buffer length
385*5113495bSYour Name  *
386*5113495bSYour Name  * Return: 0 on success
387*5113495bSYour Name  */
tgt_reg_chan_list_ext_update_handler(ol_scn_t handle,uint8_t * event_buf,uint32_t len)388*5113495bSYour Name static int tgt_reg_chan_list_ext_update_handler(ol_scn_t handle,
389*5113495bSYour Name 						uint8_t *event_buf,
390*5113495bSYour Name 						uint32_t len)
391*5113495bSYour Name {
392*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc;
393*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
394*5113495bSYour Name 	struct cur_regulatory_info *reg_info;
395*5113495bSYour Name 	QDF_STATUS status;
396*5113495bSYour Name 	struct wmi_unified *wmi_handle;
397*5113495bSYour Name 	int ret_val = 0;
398*5113495bSYour Name 	uint32_t i;
399*5113495bSYour Name 
400*5113495bSYour Name 	TARGET_IF_ENTER();
401*5113495bSYour Name 
402*5113495bSYour Name 	psoc = target_if_get_psoc_from_scn_hdl(handle);
403*5113495bSYour Name 	if (!psoc) {
404*5113495bSYour Name 		target_if_err("psoc ptr is NULL");
405*5113495bSYour Name 		return -EINVAL;
406*5113495bSYour Name 	}
407*5113495bSYour Name 
408*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
409*5113495bSYour Name 	if (!reg_rx_ops) {
410*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
411*5113495bSYour Name 		return -EINVAL;
412*5113495bSYour Name 	}
413*5113495bSYour Name 
414*5113495bSYour Name 	if (!reg_rx_ops->master_list_ext_handler) {
415*5113495bSYour Name 		target_if_err("master_list_ext_handler is NULL");
416*5113495bSYour Name 		return -EINVAL;
417*5113495bSYour Name 	}
418*5113495bSYour Name 
419*5113495bSYour Name 	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
420*5113495bSYour Name 	if (!wmi_handle) {
421*5113495bSYour Name 		target_if_err("invalid wmi handle");
422*5113495bSYour Name 		return -EINVAL;
423*5113495bSYour Name 	}
424*5113495bSYour Name 
425*5113495bSYour Name 	reg_info = qdf_mem_malloc(sizeof(*reg_info));
426*5113495bSYour Name 	if (!reg_info)
427*5113495bSYour Name 		return -ENOMEM;
428*5113495bSYour Name 
429*5113495bSYour Name 	status = wmi_extract_reg_chan_list_ext_update_event(wmi_handle,
430*5113495bSYour Name 							    event_buf,
431*5113495bSYour Name 							    reg_info, len);
432*5113495bSYour Name 	if (!QDF_IS_STATUS_SUCCESS(status)) {
433*5113495bSYour Name 		target_if_err("Extraction of ext channel list event failed");
434*5113495bSYour Name 		ret_val = -EFAULT;
435*5113495bSYour Name 		goto clean;
436*5113495bSYour Name 	}
437*5113495bSYour Name 
438*5113495bSYour Name 	if (reg_info->phy_id >= PSOC_MAX_PHY_REG_CAP) {
439*5113495bSYour Name 		target_if_err_rl("phy_id %d is out of bounds",
440*5113495bSYour Name 				 reg_info->phy_id);
441*5113495bSYour Name 		ret_val = -EFAULT;
442*5113495bSYour Name 		goto clean;
443*5113495bSYour Name 	}
444*5113495bSYour Name 
445*5113495bSYour Name 	reg_info->psoc = psoc;
446*5113495bSYour Name 
447*5113495bSYour Name 	status = reg_rx_ops->master_list_ext_handler(reg_info);
448*5113495bSYour Name 	if (!QDF_IS_STATUS_SUCCESS(status)) {
449*5113495bSYour Name 		target_if_err("Failed to process master ext channel list handler");
450*5113495bSYour Name 		ret_val = -EFAULT;
451*5113495bSYour Name 	}
452*5113495bSYour Name 
453*5113495bSYour Name clean:
454*5113495bSYour Name 	qdf_mem_free(reg_info->reg_rules_2g_ptr);
455*5113495bSYour Name 	qdf_mem_free(reg_info->reg_rules_5g_ptr);
456*5113495bSYour Name 	tgt_reg_mem_free_fcc_rules(reg_info);
457*5113495bSYour Name 
458*5113495bSYour Name 	for (i = 0; i < REG_CURRENT_MAX_AP_TYPE; i++) {
459*5113495bSYour Name 		qdf_mem_free(reg_info->reg_rules_6g_ap_ptr[i]);
460*5113495bSYour Name 		qdf_mem_free(reg_info->
461*5113495bSYour Name 			reg_rules_6g_client_ptr[i][REG_DEFAULT_CLIENT]);
462*5113495bSYour Name 		qdf_mem_free(reg_info->
463*5113495bSYour Name 			reg_rules_6g_client_ptr[i][REG_SUBORDINATE_CLIENT]);
464*5113495bSYour Name 	}
465*5113495bSYour Name 
466*5113495bSYour Name 	qdf_mem_free(reg_info);
467*5113495bSYour Name 
468*5113495bSYour Name 	TARGET_IF_EXIT();
469*5113495bSYour Name 
470*5113495bSYour Name 	return ret_val;
471*5113495bSYour Name }
472*5113495bSYour Name 
473*5113495bSYour Name /**
474*5113495bSYour Name  * tgt_if_regulatory_register_master_list_ext_handler() - Register extended
475*5113495bSYour Name  * master channel list event handler
476*5113495bSYour Name  * @psoc: Pointer to psoc
477*5113495bSYour Name  * @arg: Pointer to argument list
478*5113495bSYour Name  *
479*5113495bSYour Name  * Return: QDF_STATUS
480*5113495bSYour Name  */
tgt_if_regulatory_register_master_list_ext_handler(struct wlan_objmgr_psoc * psoc,void * arg)481*5113495bSYour Name static QDF_STATUS tgt_if_regulatory_register_master_list_ext_handler(
482*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc, void *arg)
483*5113495bSYour Name {
484*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
485*5113495bSYour Name 
486*5113495bSYour Name 	if (!wmi_handle)
487*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
488*5113495bSYour Name 
489*5113495bSYour Name 	return wmi_unified_register_event_handler(
490*5113495bSYour Name 			wmi_handle, wmi_reg_chan_list_cc_ext_event_id,
491*5113495bSYour Name 			tgt_reg_chan_list_ext_update_handler, WMI_RX_WORK_CTX);
492*5113495bSYour Name }
493*5113495bSYour Name 
494*5113495bSYour Name /**
495*5113495bSYour Name  * tgt_if_regulatory_unregister_master_list_ext_handler() - Unregister extended
496*5113495bSYour Name  * master channel list event handler
497*5113495bSYour Name  * @psoc: Pointer to psoc
498*5113495bSYour Name  * @arg: Pointer to argument list
499*5113495bSYour Name  *
500*5113495bSYour Name  * Return: QDF_STATUS
501*5113495bSYour Name  */
tgt_if_regulatory_unregister_master_list_ext_handler(struct wlan_objmgr_psoc * psoc,void * arg)502*5113495bSYour Name static QDF_STATUS tgt_if_regulatory_unregister_master_list_ext_handler(
503*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc, void *arg)
504*5113495bSYour Name {
505*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
506*5113495bSYour Name 
507*5113495bSYour Name 	if (!wmi_handle)
508*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
509*5113495bSYour Name 
510*5113495bSYour Name 	return wmi_unified_unregister_event_handler(
511*5113495bSYour Name 			wmi_handle, wmi_reg_chan_list_cc_ext_event_id);
512*5113495bSYour Name }
513*5113495bSYour Name 
514*5113495bSYour Name #ifdef CONFIG_AFC_SUPPORT
515*5113495bSYour Name /**
516*5113495bSYour Name  * tgt_afc_event_handler() - Handler for AFC Event
517*5113495bSYour Name  * @handle: scn handle
518*5113495bSYour Name  * @event_buf: pointer to event buffer
519*5113495bSYour Name  * @len: buffer length
520*5113495bSYour Name  *
521*5113495bSYour Name  * Return: 0 on success
522*5113495bSYour Name  */
523*5113495bSYour Name static int
tgt_afc_event_handler(ol_scn_t handle,uint8_t * event_buf,uint32_t len)524*5113495bSYour Name tgt_afc_event_handler(ol_scn_t handle, uint8_t *event_buf, uint32_t len)
525*5113495bSYour Name {
526*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc;
527*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
528*5113495bSYour Name 	struct afc_regulatory_info *afc_info;
529*5113495bSYour Name 	QDF_STATUS status;
530*5113495bSYour Name 	struct wmi_unified *wmi_handle;
531*5113495bSYour Name 	int ret_val = 0;
532*5113495bSYour Name 
533*5113495bSYour Name 	TARGET_IF_ENTER();
534*5113495bSYour Name 
535*5113495bSYour Name 	psoc = target_if_get_psoc_from_scn_hdl(handle);
536*5113495bSYour Name 	if (!psoc) {
537*5113495bSYour Name 		target_if_err("psoc ptr is NULL");
538*5113495bSYour Name 		return -EINVAL;
539*5113495bSYour Name 	}
540*5113495bSYour Name 
541*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
542*5113495bSYour Name 	if (!reg_rx_ops) {
543*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
544*5113495bSYour Name 		return -EINVAL;
545*5113495bSYour Name 	}
546*5113495bSYour Name 
547*5113495bSYour Name 	if (!reg_rx_ops->afc_event_handler) {
548*5113495bSYour Name 		target_if_err("afc_event_handler is NULL");
549*5113495bSYour Name 		return -EINVAL;
550*5113495bSYour Name 	}
551*5113495bSYour Name 
552*5113495bSYour Name 	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
553*5113495bSYour Name 	if (!wmi_handle) {
554*5113495bSYour Name 		target_if_err("invalid wmi handle");
555*5113495bSYour Name 		return -EINVAL;
556*5113495bSYour Name 	}
557*5113495bSYour Name 
558*5113495bSYour Name 	afc_info = qdf_mem_malloc(sizeof(*afc_info));
559*5113495bSYour Name 	if (!afc_info)
560*5113495bSYour Name 		return -ENOMEM;
561*5113495bSYour Name 
562*5113495bSYour Name 	status = wmi_extract_afc_event(wmi_handle, event_buf, afc_info, len);
563*5113495bSYour Name 	if (!QDF_IS_STATUS_SUCCESS(status)) {
564*5113495bSYour Name 		target_if_err("Extraction of AFC event failed");
565*5113495bSYour Name 		ret_val = -EFAULT;
566*5113495bSYour Name 		goto clean;
567*5113495bSYour Name 	}
568*5113495bSYour Name 
569*5113495bSYour Name 	if (afc_info->phy_id >= PSOC_MAX_PHY_REG_CAP) {
570*5113495bSYour Name 		target_if_err_rl("phy_id %d is out of bounds",
571*5113495bSYour Name 				 afc_info->phy_id);
572*5113495bSYour Name 		ret_val = -EFAULT;
573*5113495bSYour Name 		goto clean;
574*5113495bSYour Name 	}
575*5113495bSYour Name 
576*5113495bSYour Name 	afc_info->psoc = psoc;
577*5113495bSYour Name 
578*5113495bSYour Name 	status = reg_rx_ops->afc_event_handler(afc_info);
579*5113495bSYour Name 	if (!QDF_IS_STATUS_SUCCESS(status)) {
580*5113495bSYour Name 		target_if_err("Failed to process AFC event handler");
581*5113495bSYour Name 		ret_val = -EFAULT;
582*5113495bSYour Name 		goto clean;
583*5113495bSYour Name 	}
584*5113495bSYour Name 
585*5113495bSYour Name clean:
586*5113495bSYour Name 	qdf_mem_free(afc_info);
587*5113495bSYour Name 	TARGET_IF_EXIT();
588*5113495bSYour Name 
589*5113495bSYour Name 	return ret_val;
590*5113495bSYour Name }
591*5113495bSYour Name 
592*5113495bSYour Name /**
593*5113495bSYour Name  * tgt_if_regulatory_register_afc_event_handler() - Register AFC event
594*5113495bSYour Name  * handler
595*5113495bSYour Name  * @psoc: Pointer to psoc
596*5113495bSYour Name  * @arg: Pointer to argument list
597*5113495bSYour Name  *
598*5113495bSYour Name  * Return: QDF_STATUS
599*5113495bSYour Name  */
tgt_if_regulatory_register_afc_event_handler(struct wlan_objmgr_psoc * psoc,void * arg)600*5113495bSYour Name static QDF_STATUS tgt_if_regulatory_register_afc_event_handler(
601*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc, void *arg)
602*5113495bSYour Name {
603*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
604*5113495bSYour Name 
605*5113495bSYour Name 	if (!wmi_handle)
606*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
607*5113495bSYour Name 
608*5113495bSYour Name 	return wmi_unified_register_event_handler(
609*5113495bSYour Name 			wmi_handle, wmi_afc_event_id,
610*5113495bSYour Name 			tgt_afc_event_handler, WMI_RX_WORK_CTX);
611*5113495bSYour Name }
612*5113495bSYour Name 
613*5113495bSYour Name /**
614*5113495bSYour Name  * tgt_if_regulatory_unregister_afc_event_handler() - Unregister AFC event
615*5113495bSYour Name  * handler
616*5113495bSYour Name  * @psoc: Pointer to psoc
617*5113495bSYour Name  * @arg: Pointer to argument list
618*5113495bSYour Name  *
619*5113495bSYour Name  * Return: QDF_STATUS
620*5113495bSYour Name  */
621*5113495bSYour Name static QDF_STATUS
tgt_if_regulatory_unregister_afc_event_handler(struct wlan_objmgr_psoc * psoc,void * arg)622*5113495bSYour Name tgt_if_regulatory_unregister_afc_event_handler(struct wlan_objmgr_psoc *psoc,
623*5113495bSYour Name 					       void *arg)
624*5113495bSYour Name {
625*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
626*5113495bSYour Name 
627*5113495bSYour Name 	if (!wmi_handle)
628*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
629*5113495bSYour Name 
630*5113495bSYour Name 	return wmi_unified_unregister_event_handler(
631*5113495bSYour Name 			wmi_handle, wmi_afc_event_id);
632*5113495bSYour Name }
633*5113495bSYour Name #endif
634*5113495bSYour Name #endif
635*5113495bSYour Name 
636*5113495bSYour Name /**
637*5113495bSYour Name  * tgt_if_regulatory_set_country_code() - Set country code
638*5113495bSYour Name  * @psoc: Pointer to psoc
639*5113495bSYour Name  * @arg: Pointer to argument list
640*5113495bSYour Name  *
641*5113495bSYour Name  * Return: QDF_STATUS
642*5113495bSYour Name  */
tgt_if_regulatory_set_country_code(struct wlan_objmgr_psoc * psoc,void * arg)643*5113495bSYour Name static QDF_STATUS tgt_if_regulatory_set_country_code(
644*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc, void *arg)
645*5113495bSYour Name {
646*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
647*5113495bSYour Name 
648*5113495bSYour Name 	if (!wmi_handle)
649*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
650*5113495bSYour Name 
651*5113495bSYour Name 	return wmi_unified_set_country_cmd_send(wmi_handle, arg);
652*5113495bSYour Name }
653*5113495bSYour Name 
654*5113495bSYour Name /**
655*5113495bSYour Name  * tgt_if_regulatory_set_user_country_code() - Set user country code
656*5113495bSYour Name  * @psoc: Pointer to psoc
657*5113495bSYour Name  * @pdev_id: Pdev id
658*5113495bSYour Name  * @rd: Pointer to regdomain structure
659*5113495bSYour Name  *
660*5113495bSYour Name  * Return: QDF_STATUS
661*5113495bSYour Name  */
tgt_if_regulatory_set_user_country_code(struct wlan_objmgr_psoc * psoc,uint8_t pdev_id,struct cc_regdmn_s * rd)662*5113495bSYour Name static QDF_STATUS tgt_if_regulatory_set_user_country_code(
663*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, struct cc_regdmn_s *rd)
664*5113495bSYour Name {
665*5113495bSYour Name 	struct wlan_objmgr_pdev *pdev;
666*5113495bSYour Name 	wmi_unified_t wmi_handle;
667*5113495bSYour Name 	QDF_STATUS status;
668*5113495bSYour Name 
669*5113495bSYour Name 	pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id,
670*5113495bSYour Name 					  WLAN_REGULATORY_NB_ID);
671*5113495bSYour Name 
672*5113495bSYour Name 	wmi_handle = get_wmi_unified_hdl_from_pdev(pdev);
673*5113495bSYour Name 
674*5113495bSYour Name 	if (!wmi_handle) {
675*5113495bSYour Name 		status = QDF_STATUS_E_FAILURE;
676*5113495bSYour Name 		goto free_pdevref;
677*5113495bSYour Name 	}
678*5113495bSYour Name 
679*5113495bSYour Name 	status = wmi_unified_set_user_country_code_cmd_send(wmi_handle,
680*5113495bSYour Name 							    pdev_id, rd);
681*5113495bSYour Name 	if (QDF_IS_STATUS_ERROR(status))
682*5113495bSYour Name 		target_if_err("Set user country code failed,status %d",
683*5113495bSYour Name 			      status);
684*5113495bSYour Name free_pdevref:
685*5113495bSYour Name 	wlan_objmgr_pdev_release_ref(pdev, WLAN_REGULATORY_NB_ID);
686*5113495bSYour Name 
687*5113495bSYour Name 	return status;
688*5113495bSYour Name }
689*5113495bSYour Name 
tgt_if_regulatory_modify_freq_range(struct wlan_objmgr_psoc * psoc)690*5113495bSYour Name QDF_STATUS tgt_if_regulatory_modify_freq_range(struct wlan_objmgr_psoc *psoc)
691*5113495bSYour Name {
692*5113495bSYour Name 	struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap;
693*5113495bSYour Name 
694*5113495bSYour Name 	reg_cap = ucfg_reg_get_hal_reg_cap(psoc);
695*5113495bSYour Name 	if (!reg_cap) {
696*5113495bSYour Name 		target_if_err("reg cap is NULL");
697*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
698*5113495bSYour Name 	}
699*5113495bSYour Name 
700*5113495bSYour Name 	if (!(reg_cap->wireless_modes & HOST_REGDMN_MODE_11A)) {
701*5113495bSYour Name 		reg_cap->low_5ghz_chan = 0;
702*5113495bSYour Name 		reg_cap->high_5ghz_chan = 0;
703*5113495bSYour Name 	}
704*5113495bSYour Name 
705*5113495bSYour Name 	if (!(reg_cap->wireless_modes &
706*5113495bSYour Name 	     (HOST_REGDMN_MODE_11B | HOST_REGDMN_MODE_PUREG))) {
707*5113495bSYour Name 		reg_cap->low_2ghz_chan = 0;
708*5113495bSYour Name 		reg_cap->high_2ghz_chan = 0;
709*5113495bSYour Name 	}
710*5113495bSYour Name 
711*5113495bSYour Name 	target_if_debug("phy_id = %d - low_2ghz_chan = %d high_2ghz_chan = %d low_5ghz_chan = %d high_5ghz_chan = %d",
712*5113495bSYour Name 			reg_cap->phy_id,
713*5113495bSYour Name 			reg_cap->low_2ghz_chan,
714*5113495bSYour Name 			reg_cap->high_2ghz_chan,
715*5113495bSYour Name 			reg_cap->low_5ghz_chan,
716*5113495bSYour Name 			reg_cap->high_5ghz_chan);
717*5113495bSYour Name 
718*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
719*5113495bSYour Name }
720*5113495bSYour Name 
721*5113495bSYour Name #ifdef CONFIG_REG_CLIENT
722*5113495bSYour Name /**
723*5113495bSYour Name  * tgt_if_regulatory_send_ctl_info() - Send CTL info to firmware
724*5113495bSYour Name  * @psoc: Pointer to psoc
725*5113495bSYour Name  * @params: Pointer to reg control params
726*5113495bSYour Name  *
727*5113495bSYour Name  * Return: QDF_STATUS
728*5113495bSYour Name  */
729*5113495bSYour Name static QDF_STATUS
tgt_if_regulatory_send_ctl_info(struct wlan_objmgr_psoc * psoc,struct reg_ctl_params * params)730*5113495bSYour Name tgt_if_regulatory_send_ctl_info(struct wlan_objmgr_psoc *psoc,
731*5113495bSYour Name 				struct reg_ctl_params *params)
732*5113495bSYour Name {
733*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
734*5113495bSYour Name 
735*5113495bSYour Name 	if (!wmi_handle)
736*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
737*5113495bSYour Name 
738*5113495bSYour Name 	return wmi_unified_send_regdomain_info_to_fw_cmd(wmi_handle,
739*5113495bSYour Name 							 params->regd,
740*5113495bSYour Name 							 params->regd_2g,
741*5113495bSYour Name 							 params->regd_5g,
742*5113495bSYour Name 							 params->ctl_2g,
743*5113495bSYour Name 							 params->ctl_5g);
744*5113495bSYour Name }
745*5113495bSYour Name #else
746*5113495bSYour Name static QDF_STATUS
tgt_if_regulatory_send_ctl_info(struct wlan_objmgr_psoc * psoc,struct reg_ctl_params * params)747*5113495bSYour Name tgt_if_regulatory_send_ctl_info(struct wlan_objmgr_psoc *psoc,
748*5113495bSYour Name 				struct reg_ctl_params *params)
749*5113495bSYour Name {
750*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
751*5113495bSYour Name }
752*5113495bSYour Name #endif
753*5113495bSYour Name 
754*5113495bSYour Name /**
755*5113495bSYour Name  * tgt_if_regulatory_get_phy_id_from_pdev_id() - Get phy_id from pdev_id
756*5113495bSYour Name  * @psoc: Pointer to psoc
757*5113495bSYour Name  * @pdev_id: Pdev id
758*5113495bSYour Name  * @phy_id: phy_id
759*5113495bSYour Name  *
760*5113495bSYour Name  * Return: QDF_STATUS
761*5113495bSYour Name  */
tgt_if_regulatory_get_phy_id_from_pdev_id(struct wlan_objmgr_psoc * psoc,uint8_t pdev_id,uint8_t * phy_id)762*5113495bSYour Name static QDF_STATUS tgt_if_regulatory_get_phy_id_from_pdev_id(
763*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, uint8_t *phy_id)
764*5113495bSYour Name {
765*5113495bSYour Name 	struct target_psoc_info *tgt_if_handle = psoc->tgt_if_handle;
766*5113495bSYour Name 	uint8_t ret;
767*5113495bSYour Name 
768*5113495bSYour Name 	if (pdev_id >= WLAN_UMAC_MAX_PDEVS) {
769*5113495bSYour Name 		target_if_err("pdev_id is greater than WLAN_UMAC_MAX_PDEVS");
770*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
771*5113495bSYour Name 	}
772*5113495bSYour Name 
773*5113495bSYour Name 	/* By default pdev_id and phy_id have one to one mapping */
774*5113495bSYour Name 	*phy_id = pdev_id;
775*5113495bSYour Name 
776*5113495bSYour Name 	if (!(tgt_if_handle &&
777*5113495bSYour Name 	      tgt_if_handle->info.is_pdevid_to_phyid_map))
778*5113495bSYour Name 		return QDF_STATUS_SUCCESS;
779*5113495bSYour Name 
780*5113495bSYour Name 	ret = tgt_if_handle->info.pdev_id_to_phy_id_map[pdev_id];
781*5113495bSYour Name 
782*5113495bSYour Name 	if (ret < PSOC_MAX_PHY_REG_CAP) {
783*5113495bSYour Name 		*phy_id = ret;
784*5113495bSYour Name 	} else {
785*5113495bSYour Name 		target_if_err("phy_id is greater than PSOC_MAX_PHY_REG_CAP");
786*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
787*5113495bSYour Name 	}
788*5113495bSYour Name 
789*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
790*5113495bSYour Name }
791*5113495bSYour Name 
792*5113495bSYour Name /**
793*5113495bSYour Name  * tgt_if_regulatory_get_pdev_id_from_phy_id() - Get pdev_id for phy_id
794*5113495bSYour Name  * @psoc: Pointer to psoc
795*5113495bSYour Name  * @phy_id: Phy id
796*5113495bSYour Name  * @pdev_id: Pdev id
797*5113495bSYour Name  *
798*5113495bSYour Name  * Return: QDF_STATUS
799*5113495bSYour Name  */
tgt_if_regulatory_get_pdev_id_from_phy_id(struct wlan_objmgr_psoc * psoc,uint8_t phy_id,uint8_t * pdev_id)800*5113495bSYour Name static QDF_STATUS tgt_if_regulatory_get_pdev_id_from_phy_id(
801*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc, uint8_t phy_id, uint8_t *pdev_id)
802*5113495bSYour Name {
803*5113495bSYour Name 	struct target_psoc_info *tgt_if_handle = psoc->tgt_if_handle;
804*5113495bSYour Name 	uint8_t i;
805*5113495bSYour Name 
806*5113495bSYour Name 	if (phy_id >= PSOC_MAX_PHY_REG_CAP) {
807*5113495bSYour Name 		target_if_err("phy_id is greater than PSOC_MAX_PHY_REG_CAP");
808*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
809*5113495bSYour Name 	}
810*5113495bSYour Name 
811*5113495bSYour Name 	/* By default pdev_id and phy_id have one to one mapping */
812*5113495bSYour Name 	*pdev_id = phy_id;
813*5113495bSYour Name 
814*5113495bSYour Name 	if (!(tgt_if_handle &&
815*5113495bSYour Name 	      tgt_if_handle->info.is_pdevid_to_phyid_map))
816*5113495bSYour Name 		return QDF_STATUS_SUCCESS;
817*5113495bSYour Name 
818*5113495bSYour Name 	for (i = 0; i < WLAN_UMAC_MAX_PDEVS; i++) {
819*5113495bSYour Name 		if (tgt_if_handle->info.pdev_id_to_phy_id_map[i] == phy_id)
820*5113495bSYour Name 			break;
821*5113495bSYour Name 	}
822*5113495bSYour Name 
823*5113495bSYour Name 	if (i < WLAN_UMAC_MAX_PDEVS) {
824*5113495bSYour Name 		*pdev_id = i;
825*5113495bSYour Name 	} else {
826*5113495bSYour Name 		target_if_err("pdev_id is greater than WLAN_UMAC_MAX_PDEVS");
827*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
828*5113495bSYour Name 	}
829*5113495bSYour Name 
830*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
831*5113495bSYour Name }
832*5113495bSYour Name 
833*5113495bSYour Name #ifdef CONFIG_BAND_6GHZ
target_if_register_master_ext_handler(struct wlan_lmac_if_reg_tx_ops * reg_ops)834*5113495bSYour Name static void target_if_register_master_ext_handler(
835*5113495bSYour Name 				struct wlan_lmac_if_reg_tx_ops *reg_ops)
836*5113495bSYour Name {
837*5113495bSYour Name 	reg_ops->register_master_ext_handler =
838*5113495bSYour Name 		tgt_if_regulatory_register_master_list_ext_handler;
839*5113495bSYour Name 
840*5113495bSYour Name 	reg_ops->unregister_master_ext_handler =
841*5113495bSYour Name 		tgt_if_regulatory_unregister_master_list_ext_handler;
842*5113495bSYour Name }
843*5113495bSYour Name 
844*5113495bSYour Name #ifdef CONFIG_AFC_SUPPORT
target_if_register_afc_event_handler(struct wlan_lmac_if_reg_tx_ops * reg_ops)845*5113495bSYour Name static void target_if_register_afc_event_handler(
846*5113495bSYour Name 				struct wlan_lmac_if_reg_tx_ops *reg_ops)
847*5113495bSYour Name {
848*5113495bSYour Name 	reg_ops->register_afc_event_handler =
849*5113495bSYour Name 		tgt_if_regulatory_register_afc_event_handler;
850*5113495bSYour Name 
851*5113495bSYour Name 	reg_ops->unregister_afc_event_handler =
852*5113495bSYour Name 		tgt_if_regulatory_unregister_afc_event_handler;
853*5113495bSYour Name }
854*5113495bSYour Name 
855*5113495bSYour Name #ifdef CONFIG_REG_CLIENT
target_if_register_acs_trigger_for_afc(struct wlan_lmac_if_reg_tx_ops * reg_ops)856*5113495bSYour Name static void target_if_register_acs_trigger_for_afc
857*5113495bSYour Name 				(struct wlan_lmac_if_reg_tx_ops *reg_ops)
858*5113495bSYour Name {
859*5113495bSYour Name 	reg_ops->trigger_acs_for_afc = tgt_afc_trigger_dcs;
860*5113495bSYour Name }
861*5113495bSYour Name #else
target_if_register_acs_trigger_for_afc(struct wlan_lmac_if_reg_tx_ops * reg_ops)862*5113495bSYour Name static void target_if_register_acs_trigger_for_afc
863*5113495bSYour Name 				(struct wlan_lmac_if_reg_tx_ops *reg_ops)
864*5113495bSYour Name {
865*5113495bSYour Name 	reg_ops->trigger_acs_for_afc = NULL;
866*5113495bSYour Name }
867*5113495bSYour Name #endif
868*5113495bSYour Name #else
target_if_register_afc_event_handler(struct wlan_lmac_if_reg_tx_ops * reg_ops)869*5113495bSYour Name static void target_if_register_afc_event_handler(
870*5113495bSYour Name 				struct wlan_lmac_if_reg_tx_ops *reg_ops)
871*5113495bSYour Name {
872*5113495bSYour Name }
873*5113495bSYour Name 
target_if_register_acs_trigger_for_afc(struct wlan_lmac_if_reg_tx_ops * reg_ops)874*5113495bSYour Name static void target_if_register_acs_trigger_for_afc
875*5113495bSYour Name 				(struct wlan_lmac_if_reg_tx_ops *reg_ops)
876*5113495bSYour Name {
877*5113495bSYour Name }
878*5113495bSYour Name #endif
879*5113495bSYour Name #else
880*5113495bSYour Name static inline void
target_if_register_master_ext_handler(struct wlan_lmac_if_reg_tx_ops * reg_ops)881*5113495bSYour Name target_if_register_master_ext_handler(struct wlan_lmac_if_reg_tx_ops *reg_ops)
882*5113495bSYour Name {
883*5113495bSYour Name }
884*5113495bSYour Name 
target_if_register_afc_event_handler(struct wlan_lmac_if_reg_tx_ops * reg_ops)885*5113495bSYour Name static void target_if_register_afc_event_handler(
886*5113495bSYour Name 				struct wlan_lmac_if_reg_tx_ops *reg_ops)
887*5113495bSYour Name {
888*5113495bSYour Name }
889*5113495bSYour Name 
target_if_register_acs_trigger_for_afc(struct wlan_lmac_if_reg_tx_ops * reg_ops)890*5113495bSYour Name static void target_if_register_acs_trigger_for_afc
891*5113495bSYour Name 				(struct wlan_lmac_if_reg_tx_ops *reg_ops)
892*5113495bSYour Name {
893*5113495bSYour Name }
894*5113495bSYour Name #endif
895*5113495bSYour Name 
896*5113495bSYour Name static QDF_STATUS
tgt_if_regulatory_set_tpc_power(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,struct reg_tpc_power_info * param)897*5113495bSYour Name tgt_if_regulatory_set_tpc_power(struct wlan_objmgr_psoc *psoc,
898*5113495bSYour Name 				uint8_t vdev_id,
899*5113495bSYour Name 				struct reg_tpc_power_info *param)
900*5113495bSYour Name {
901*5113495bSYour Name 	wmi_unified_t wmi_handle;
902*5113495bSYour Name 	uint8_t pdev_id;
903*5113495bSYour Name 	struct wlan_objmgr_pdev *pdev;
904*5113495bSYour Name 	QDF_STATUS status;
905*5113495bSYour Name 
906*5113495bSYour Name 	pdev_id = wlan_get_pdev_id_from_vdev_id(psoc,
907*5113495bSYour Name 						vdev_id, WLAN_REGULATORY_NB_ID);
908*5113495bSYour Name 
909*5113495bSYour Name 	pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id,
910*5113495bSYour Name 					  WLAN_REGULATORY_NB_ID);
911*5113495bSYour Name 
912*5113495bSYour Name 	wmi_handle = get_wmi_unified_hdl_from_pdev(pdev);
913*5113495bSYour Name 
914*5113495bSYour Name 	if (!wmi_handle) {
915*5113495bSYour Name 		status = QDF_STATUS_E_FAILURE;
916*5113495bSYour Name 		goto free_pdevref;
917*5113495bSYour Name 	}
918*5113495bSYour Name 	status = wmi_unified_send_set_tpc_power_cmd(wmi_handle, vdev_id, param);
919*5113495bSYour Name 	if (QDF_IS_STATUS_ERROR(status))
920*5113495bSYour Name 		target_if_err("send tpc power cmd failed, status: %d", status);
921*5113495bSYour Name 
922*5113495bSYour Name free_pdevref:
923*5113495bSYour Name 	wlan_objmgr_pdev_release_ref(pdev, WLAN_REGULATORY_NB_ID);
924*5113495bSYour Name 
925*5113495bSYour Name 	return status;
926*5113495bSYour Name }
927*5113495bSYour Name 
928*5113495bSYour Name #ifdef CONFIG_AFC_SUPPORT
929*5113495bSYour Name /**
930*5113495bSYour Name  * tgt_if_regulatory_send_afc_cmd() - Send AFC command to the FW
931*5113495bSYour Name  *
932*5113495bSYour Name  * @psoc: Pointer to psoc
933*5113495bSYour Name  * @pdev_id: Pdev id
934*5113495bSYour Name  * @param: Pointer to hold AFC indication.
935*5113495bSYour Name  *
936*5113495bSYour Name  * Return: QDF_STATUS_SUCCESS if WMI_AFC_CMD is sent, else QDF_STATUS_E_FAILURE
937*5113495bSYour Name  */
938*5113495bSYour Name static QDF_STATUS
tgt_if_regulatory_send_afc_cmd(struct wlan_objmgr_psoc * psoc,uint8_t pdev_id,struct reg_afc_resp_rx_ind_info * param)939*5113495bSYour Name tgt_if_regulatory_send_afc_cmd(struct wlan_objmgr_psoc *psoc,
940*5113495bSYour Name 			       uint8_t pdev_id,
941*5113495bSYour Name 			       struct reg_afc_resp_rx_ind_info *param)
942*5113495bSYour Name {
943*5113495bSYour Name 	struct wlan_objmgr_pdev *pdev;
944*5113495bSYour Name 	wmi_unified_t wmi_handle;
945*5113495bSYour Name 	QDF_STATUS status;
946*5113495bSYour Name 
947*5113495bSYour Name 	pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id,
948*5113495bSYour Name 					  WLAN_REGULATORY_NB_ID);
949*5113495bSYour Name 
950*5113495bSYour Name 	wmi_handle = get_wmi_unified_hdl_from_pdev(pdev);
951*5113495bSYour Name 
952*5113495bSYour Name 	if (!wmi_handle) {
953*5113495bSYour Name 		status = QDF_STATUS_E_FAILURE;
954*5113495bSYour Name 		goto free_pdevref;
955*5113495bSYour Name 	}
956*5113495bSYour Name 
957*5113495bSYour Name 	status = wmi_unified_send_afc_cmd(wmi_handle, pdev_id, param);
958*5113495bSYour Name 
959*5113495bSYour Name 	if (QDF_IS_STATUS_ERROR(status))
960*5113495bSYour Name 		target_if_err("send afc  cmd failed, status: %d", status);
961*5113495bSYour Name 
962*5113495bSYour Name free_pdevref:
963*5113495bSYour Name 	wlan_objmgr_pdev_release_ref(pdev, WLAN_REGULATORY_NB_ID);
964*5113495bSYour Name 
965*5113495bSYour Name 	return status;
966*5113495bSYour Name }
967*5113495bSYour Name 
968*5113495bSYour Name static void
tgt_if_register_afc_callback(struct wlan_lmac_if_reg_tx_ops * reg_ops)969*5113495bSYour Name tgt_if_register_afc_callback(struct wlan_lmac_if_reg_tx_ops *reg_ops)
970*5113495bSYour Name {
971*5113495bSYour Name 	reg_ops->send_afc_ind = tgt_if_regulatory_send_afc_cmd;
972*5113495bSYour Name 	reg_ops->reg_get_min_psd = NULL;
973*5113495bSYour Name 	reg_ops->trigger_update_channel_list = NULL;
974*5113495bSYour Name }
975*5113495bSYour Name #else
976*5113495bSYour Name static void
tgt_if_register_afc_callback(struct wlan_lmac_if_reg_tx_ops * reg_ops)977*5113495bSYour Name tgt_if_register_afc_callback(struct wlan_lmac_if_reg_tx_ops *reg_ops)
978*5113495bSYour Name {
979*5113495bSYour Name }
980*5113495bSYour Name #endif
981*5113495bSYour Name 
982*5113495bSYour Name /**
983*5113495bSYour Name  * tgt_if_regulatory_is_ext_tpc_supported() - Check if FW supports new
984*5113495bSYour Name  * WMI command for TPC power
985*5113495bSYour Name  *
986*5113495bSYour Name  * @psoc: Pointer to psoc
987*5113495bSYour Name  *
988*5113495bSYour Name  * Return: true if FW supports new WMI command for TPC, else false
989*5113495bSYour Name  */
990*5113495bSYour Name static bool
tgt_if_regulatory_is_ext_tpc_supported(struct wlan_objmgr_psoc * psoc)991*5113495bSYour Name tgt_if_regulatory_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc)
992*5113495bSYour Name {
993*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
994*5113495bSYour Name 
995*5113495bSYour Name 	if (!wmi_handle)
996*5113495bSYour Name 		return false;
997*5113495bSYour Name 
998*5113495bSYour Name 	return wmi_service_enabled(wmi_handle,
999*5113495bSYour Name 				   wmi_service_ext_tpc_reg_support);
1000*5113495bSYour Name }
1001*5113495bSYour Name 
target_if_regulatory_set_ext_tpc(struct wlan_objmgr_psoc * psoc)1002*5113495bSYour Name QDF_STATUS target_if_regulatory_set_ext_tpc(struct wlan_objmgr_psoc *psoc)
1003*5113495bSYour Name {
1004*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
1005*5113495bSYour Name 
1006*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
1007*5113495bSYour Name 	if (!reg_rx_ops) {
1008*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
1009*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
1010*5113495bSYour Name 	}
1011*5113495bSYour Name 
1012*5113495bSYour Name 	if (reg_rx_ops->reg_set_ext_tpc_supported)
1013*5113495bSYour Name 		reg_rx_ops->reg_set_ext_tpc_supported(
1014*5113495bSYour Name 			psoc,
1015*5113495bSYour Name 			tgt_if_regulatory_is_ext_tpc_supported(psoc));
1016*5113495bSYour Name 
1017*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
1018*5113495bSYour Name }
1019*5113495bSYour Name 
1020*5113495bSYour Name #if defined(CONFIG_BAND_6GHZ) && defined(CONFIG_AFC_SUPPORT)
tgt_if_set_reg_afc_configure(struct target_psoc_info * tgt_hdl,struct wlan_objmgr_psoc * psoc)1021*5113495bSYour Name void tgt_if_set_reg_afc_configure(struct target_psoc_info *tgt_hdl,
1022*5113495bSYour Name 				  struct wlan_objmgr_psoc *psoc)
1023*5113495bSYour Name {
1024*5113495bSYour Name 	struct tgt_info *info;
1025*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
1026*5113495bSYour Name 
1027*5113495bSYour Name 	if (!wmi_handle || !tgt_hdl)
1028*5113495bSYour Name 		return;
1029*5113495bSYour Name 
1030*5113495bSYour Name 	if (!wmi_service_enabled(wmi_handle, wmi_service_afc_support)) {
1031*5113495bSYour Name 		target_if_err("service afc support not enable");
1032*5113495bSYour Name 		return;
1033*5113495bSYour Name 	}
1034*5113495bSYour Name 
1035*5113495bSYour Name 	info = (&tgt_hdl->info);
1036*5113495bSYour Name 
1037*5113495bSYour Name 	info->wlan_res_cfg.is_6ghz_sp_pwrmode_supp_enabled =
1038*5113495bSYour Name 		ucfg_reg_get_enable_6ghz_sp_mode_support(psoc);
1039*5113495bSYour Name 	info->wlan_res_cfg.afc_timer_check_disable =
1040*5113495bSYour Name 		ucfg_reg_get_afc_disable_timer_check(psoc);
1041*5113495bSYour Name 	info->wlan_res_cfg.afc_req_id_check_disable =
1042*5113495bSYour Name 		ucfg_reg_get_afc_disable_request_id_check(psoc);
1043*5113495bSYour Name }
1044*5113495bSYour Name #endif
1045*5113495bSYour Name 
1046*5113495bSYour Name #if defined(CONFIG_BAND_6GHZ)
1047*5113495bSYour Name /**
1048*5113495bSYour Name  * tgt_if_regulatory_is_lower_6g_edge_ch_supp() - Check if lower 6 GHz
1049*5113495bSYour Name  * edge channel (5935 MHz) is supported
1050*5113495bSYour Name  * @psoc: Pointer to psoc
1051*5113495bSYour Name  *
1052*5113495bSYour Name  * Return: true if channel is supported, else false
1053*5113495bSYour Name  */
1054*5113495bSYour Name static bool
tgt_if_regulatory_is_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc * psoc)1055*5113495bSYour Name tgt_if_regulatory_is_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc)
1056*5113495bSYour Name {
1057*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
1058*5113495bSYour Name 
1059*5113495bSYour Name 	if (!wmi_handle)
1060*5113495bSYour Name 		return false;
1061*5113495bSYour Name 
1062*5113495bSYour Name 	return wmi_service_enabled(wmi_handle,
1063*5113495bSYour Name 				   wmi_service_lower_6g_edge_ch_supp);
1064*5113495bSYour Name }
1065*5113495bSYour Name 
1066*5113495bSYour Name /**
1067*5113495bSYour Name  * tgt_if_regulatory_is_upper_6g_edge_ch_disabled() - Check if upper
1068*5113495bSYour Name  * 6 GHz edge channel (7115 MHz) is disabled
1069*5113495bSYour Name  * @psoc: Pointer to psoc
1070*5113495bSYour Name  *
1071*5113495bSYour Name  * Return: true if channel is disabled, else false
1072*5113495bSYour Name  */
1073*5113495bSYour Name static bool
tgt_if_regulatory_is_upper_6g_edge_ch_disabled(struct wlan_objmgr_psoc * psoc)1074*5113495bSYour Name tgt_if_regulatory_is_upper_6g_edge_ch_disabled(struct wlan_objmgr_psoc *psoc)
1075*5113495bSYour Name {
1076*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
1077*5113495bSYour Name 
1078*5113495bSYour Name 	if (!wmi_handle)
1079*5113495bSYour Name 		return false;
1080*5113495bSYour Name 
1081*5113495bSYour Name 	return wmi_service_enabled(wmi_handle,
1082*5113495bSYour Name 				   wmi_service_disable_upper_6g_edge_ch_supp);
1083*5113495bSYour Name }
1084*5113495bSYour Name 
1085*5113495bSYour Name QDF_STATUS
target_if_reg_set_lower_6g_edge_ch_info(struct wlan_objmgr_psoc * psoc)1086*5113495bSYour Name target_if_reg_set_lower_6g_edge_ch_info(struct wlan_objmgr_psoc *psoc)
1087*5113495bSYour Name {
1088*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
1089*5113495bSYour Name 
1090*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
1091*5113495bSYour Name 	if (!reg_rx_ops) {
1092*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
1093*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
1094*5113495bSYour Name 	}
1095*5113495bSYour Name 
1096*5113495bSYour Name 	if (reg_rx_ops->reg_set_lower_6g_edge_ch_supp)
1097*5113495bSYour Name 		reg_rx_ops->reg_set_lower_6g_edge_ch_supp(
1098*5113495bSYour Name 			psoc,
1099*5113495bSYour Name 			tgt_if_regulatory_is_lower_6g_edge_ch_supp(psoc));
1100*5113495bSYour Name 
1101*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
1102*5113495bSYour Name }
1103*5113495bSYour Name 
1104*5113495bSYour Name QDF_STATUS
target_if_reg_set_disable_upper_6g_edge_ch_info(struct wlan_objmgr_psoc * psoc)1105*5113495bSYour Name target_if_reg_set_disable_upper_6g_edge_ch_info(struct wlan_objmgr_psoc *psoc)
1106*5113495bSYour Name {
1107*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
1108*5113495bSYour Name 
1109*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
1110*5113495bSYour Name 	if (!reg_rx_ops) {
1111*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
1112*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
1113*5113495bSYour Name 	}
1114*5113495bSYour Name 
1115*5113495bSYour Name 	if (reg_rx_ops->reg_set_disable_upper_6g_edge_ch_supp)
1116*5113495bSYour Name 		reg_rx_ops->reg_set_disable_upper_6g_edge_ch_supp(
1117*5113495bSYour Name 			psoc,
1118*5113495bSYour Name 			tgt_if_regulatory_is_upper_6g_edge_ch_disabled(psoc));
1119*5113495bSYour Name 
1120*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
1121*5113495bSYour Name }
1122*5113495bSYour Name #else
1123*5113495bSYour Name static inline bool
tgt_if_regulatory_is_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc * psoc)1124*5113495bSYour Name tgt_if_regulatory_is_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc)
1125*5113495bSYour Name {
1126*5113495bSYour Name 	return false;
1127*5113495bSYour Name }
1128*5113495bSYour Name 
1129*5113495bSYour Name static inline bool
tgt_if_regulatory_is_upper_6g_edge_ch_disabled(struct wlan_objmgr_psoc * psoc)1130*5113495bSYour Name tgt_if_regulatory_is_upper_6g_edge_ch_disabled(struct wlan_objmgr_psoc *psoc)
1131*5113495bSYour Name {
1132*5113495bSYour Name 	return false;
1133*5113495bSYour Name }
1134*5113495bSYour Name #endif
1135*5113495bSYour Name 
1136*5113495bSYour Name #if defined(CONFIG_AFC_SUPPORT)
1137*5113495bSYour Name QDF_STATUS
target_if_reg_set_afc_dev_type(struct wlan_objmgr_psoc * psoc,struct target_psoc_info * tgt_hdl)1138*5113495bSYour Name target_if_reg_set_afc_dev_type(struct wlan_objmgr_psoc *psoc,
1139*5113495bSYour Name 			       struct target_psoc_info *tgt_hdl)
1140*5113495bSYour Name {
1141*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
1142*5113495bSYour Name 	struct tgt_info *info;
1143*5113495bSYour Name 
1144*5113495bSYour Name 	if (!tgt_hdl) {
1145*5113495bSYour Name 		target_if_err("target_psoc_info is null");
1146*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
1147*5113495bSYour Name 	}
1148*5113495bSYour Name 
1149*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
1150*5113495bSYour Name 	if (!reg_rx_ops) {
1151*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
1152*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
1153*5113495bSYour Name 	}
1154*5113495bSYour Name 
1155*5113495bSYour Name 	info = (&tgt_hdl->info);
1156*5113495bSYour Name 
1157*5113495bSYour Name 	if (reg_rx_ops->reg_set_afc_dev_type)
1158*5113495bSYour Name 		reg_rx_ops->reg_set_afc_dev_type(
1159*5113495bSYour Name 			psoc,
1160*5113495bSYour Name 			info->service_ext2_param.afc_dev_type);
1161*5113495bSYour Name 
1162*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
1163*5113495bSYour Name }
1164*5113495bSYour Name 
1165*5113495bSYour Name QDF_STATUS
target_if_reg_get_afc_dev_type(struct wlan_objmgr_psoc * psoc,enum reg_afc_dev_deploy_type * reg_afc_dev_type)1166*5113495bSYour Name target_if_reg_get_afc_dev_type(struct wlan_objmgr_psoc *psoc,
1167*5113495bSYour Name 			       enum reg_afc_dev_deploy_type *reg_afc_dev_type)
1168*5113495bSYour Name {
1169*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
1170*5113495bSYour Name 
1171*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
1172*5113495bSYour Name 	if (!reg_rx_ops) {
1173*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
1174*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
1175*5113495bSYour Name 	}
1176*5113495bSYour Name 
1177*5113495bSYour Name 	if (reg_rx_ops->reg_get_afc_dev_type)
1178*5113495bSYour Name 		reg_rx_ops->reg_get_afc_dev_type(
1179*5113495bSYour Name 			psoc,
1180*5113495bSYour Name 			reg_afc_dev_type);
1181*5113495bSYour Name 
1182*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
1183*5113495bSYour Name }
1184*5113495bSYour Name 
1185*5113495bSYour Name /**
1186*5113495bSYour Name  * target_if_regulatory_is_eirp_preferred_support() - Check if FW prefers EIRP
1187*5113495bSYour Name  * support for TPC power command.
1188*5113495bSYour Name  * @psoc: Pointer to psoc
1189*5113495bSYour Name  *
1190*5113495bSYour Name  * Return: true if FW prefers EIRP format for TPC, else false
1191*5113495bSYour Name  */
1192*5113495bSYour Name static bool
target_if_regulatory_is_eirp_preferred_support(struct wlan_objmgr_psoc * psoc)1193*5113495bSYour Name target_if_regulatory_is_eirp_preferred_support(struct wlan_objmgr_psoc *psoc)
1194*5113495bSYour Name {
1195*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
1196*5113495bSYour Name 
1197*5113495bSYour Name 	if (!wmi_handle)
1198*5113495bSYour Name 		return false;
1199*5113495bSYour Name 
1200*5113495bSYour Name 	return wmi_service_enabled(wmi_handle,
1201*5113495bSYour Name 				   wmi_service_eirp_preferred_support);
1202*5113495bSYour Name }
1203*5113495bSYour Name 
1204*5113495bSYour Name QDF_STATUS
target_if_set_regulatory_eirp_preferred_support(struct wlan_objmgr_psoc * psoc)1205*5113495bSYour Name target_if_set_regulatory_eirp_preferred_support(struct wlan_objmgr_psoc *psoc)
1206*5113495bSYour Name {
1207*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
1208*5113495bSYour Name 
1209*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
1210*5113495bSYour Name 	if (!reg_rx_ops) {
1211*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
1212*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
1213*5113495bSYour Name 	}
1214*5113495bSYour Name 
1215*5113495bSYour Name 	if (reg_rx_ops->reg_set_eirp_preferred_support)
1216*5113495bSYour Name 		reg_rx_ops->reg_set_eirp_preferred_support(
1217*5113495bSYour Name 			psoc,
1218*5113495bSYour Name 			target_if_regulatory_is_eirp_preferred_support(psoc));
1219*5113495bSYour Name 
1220*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
1221*5113495bSYour Name }
1222*5113495bSYour Name #endif
1223*5113495bSYour Name 
1224*5113495bSYour Name /**
1225*5113495bSYour Name  * tgt_if_reg_is_chip_11be_cap() - Finds out if the hardware is capable
1226*5113495bSYour Name  * of 11BE. The capability bit is read from mac_phy_cap populated by the
1227*5113495bSYour Name  * FW per pdev.
1228*5113495bSYour Name  * @psoc: Pointer to psoc
1229*5113495bSYour Name  * @phy_id: phy_id
1230*5113495bSYour Name  *
1231*5113495bSYour Name  * Return: True if chip is 11BE capable, false otherwise.
1232*5113495bSYour Name  */
1233*5113495bSYour Name #ifdef WLAN_FEATURE_11BE
tgt_if_reg_is_chip_11be_cap(struct wlan_objmgr_psoc * psoc,uint16_t phy_id)1234*5113495bSYour Name static bool tgt_if_reg_is_chip_11be_cap(struct wlan_objmgr_psoc *psoc,
1235*5113495bSYour Name 					uint16_t phy_id)
1236*5113495bSYour Name {
1237*5113495bSYour Name 	struct wlan_psoc_host_mac_phy_caps *mac_phy_cap_arr, *mac_phy_cap;
1238*5113495bSYour Name 	struct target_psoc_info *tgt_hdl;
1239*5113495bSYour Name 	uint8_t pdev_id;
1240*5113495bSYour Name 	struct wlan_lmac_if_reg_tx_ops *reg_tx_ops;
1241*5113495bSYour Name 
1242*5113495bSYour Name 	reg_tx_ops = target_if_regulatory_get_tx_ops(psoc);
1243*5113495bSYour Name 
1244*5113495bSYour Name 	if (!reg_tx_ops) {
1245*5113495bSYour Name 		target_if_err("reg_tx_ops is NULL");
1246*5113495bSYour Name 		return false;
1247*5113495bSYour Name 	}
1248*5113495bSYour Name 
1249*5113495bSYour Name 	if (reg_tx_ops->get_pdev_id_from_phy_id)
1250*5113495bSYour Name 		reg_tx_ops->get_pdev_id_from_phy_id(psoc, phy_id, &pdev_id);
1251*5113495bSYour Name 	else
1252*5113495bSYour Name 		pdev_id = phy_id;
1253*5113495bSYour Name 
1254*5113495bSYour Name 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
1255*5113495bSYour Name 	if (tgt_hdl) {
1256*5113495bSYour Name 		mac_phy_cap_arr = target_psoc_get_mac_phy_cap(tgt_hdl);
1257*5113495bSYour Name 		if (!mac_phy_cap_arr)
1258*5113495bSYour Name 			return false;
1259*5113495bSYour Name 		mac_phy_cap = &mac_phy_cap_arr[pdev_id];
1260*5113495bSYour Name 		if (mac_phy_cap && mac_phy_cap->supports_11be)
1261*5113495bSYour Name 			return true;
1262*5113495bSYour Name 	}
1263*5113495bSYour Name 	return false;
1264*5113495bSYour Name }
1265*5113495bSYour Name #else
tgt_if_reg_is_chip_11be_cap(struct wlan_objmgr_psoc * psoc,uint16_t phy_id)1266*5113495bSYour Name static bool tgt_if_reg_is_chip_11be_cap(struct wlan_objmgr_psoc *psoc,
1267*5113495bSYour Name 					uint16_t phy_id)
1268*5113495bSYour Name {
1269*5113495bSYour Name 	return false;
1270*5113495bSYour Name }
1271*5113495bSYour Name #endif
1272*5113495bSYour Name 
1273*5113495bSYour Name static int
tgt_rate_to_power_complete_handler(ol_scn_t handle,uint8_t * event_buf,uint32_t len)1274*5113495bSYour Name tgt_rate_to_power_complete_handler(ol_scn_t handle, uint8_t *event_buf,
1275*5113495bSYour Name 				   uint32_t len)
1276*5113495bSYour Name {
1277*5113495bSYour Name 	int ret_val = 0;
1278*5113495bSYour Name 	struct wlan_objmgr_psoc *psoc;
1279*5113495bSYour Name 	struct wlan_lmac_if_reg_rx_ops *reg_rx_ops;
1280*5113495bSYour Name 	QDF_STATUS status;
1281*5113495bSYour Name 	struct wmi_unified *wmi_handle;
1282*5113495bSYour Name 	struct r2p_table_update_status_obj *update_status_obj = NULL;
1283*5113495bSYour Name 	uint32_t pdev_id;
1284*5113495bSYour Name 
1285*5113495bSYour Name 	TARGET_IF_ENTER();
1286*5113495bSYour Name 
1287*5113495bSYour Name 	psoc = target_if_get_psoc_from_scn_hdl(handle);
1288*5113495bSYour Name 	if (!psoc) {
1289*5113495bSYour Name 		target_if_err("psoc ptr is NULL");
1290*5113495bSYour Name 		ret_val = -EINVAL;
1291*5113495bSYour Name 		goto clean;
1292*5113495bSYour Name 	}
1293*5113495bSYour Name 
1294*5113495bSYour Name 	reg_rx_ops = target_if_regulatory_get_rx_ops(psoc);
1295*5113495bSYour Name 	if (!reg_rx_ops) {
1296*5113495bSYour Name 		target_if_err("reg_rx_ops is NULL");
1297*5113495bSYour Name 		ret_val = -EINVAL;
1298*5113495bSYour Name 		goto clean;
1299*5113495bSYour Name 	}
1300*5113495bSYour Name 
1301*5113495bSYour Name 	if (!reg_rx_ops->reg_r2p_table_update_response_handler) {
1302*5113495bSYour Name 		target_if_err("reg_r2p_table_update_response_handler is NULL");
1303*5113495bSYour Name 		ret_val = -EINVAL;
1304*5113495bSYour Name 		goto clean;
1305*5113495bSYour Name 	}
1306*5113495bSYour Name 
1307*5113495bSYour Name 	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
1308*5113495bSYour Name 	if (!wmi_handle) {
1309*5113495bSYour Name 		target_if_err("invalid wmi handle");
1310*5113495bSYour Name 		ret_val = -EINVAL;
1311*5113495bSYour Name 		goto clean;
1312*5113495bSYour Name 	}
1313*5113495bSYour Name 
1314*5113495bSYour Name 	update_status_obj = qdf_mem_malloc(sizeof(*update_status_obj));
1315*5113495bSYour Name 	if (!update_status_obj) {
1316*5113495bSYour Name 		ret_val = -ENOMEM;
1317*5113495bSYour Name 		goto clean;
1318*5113495bSYour Name 	}
1319*5113495bSYour Name 
1320*5113495bSYour Name 	status = wmi_extract_tgtr2p_table_event(wmi_handle, event_buf,
1321*5113495bSYour Name 						update_status_obj, len);
1322*5113495bSYour Name 	if (!QDF_IS_STATUS_SUCCESS(status)) {
1323*5113495bSYour Name 		target_if_err("Extraction of r2p update response event failed");
1324*5113495bSYour Name 		ret_val = -EFAULT;
1325*5113495bSYour Name 		goto clean;
1326*5113495bSYour Name 	}
1327*5113495bSYour Name 
1328*5113495bSYour Name 	pdev_id = update_status_obj->pdev_id;
1329*5113495bSYour Name 	status = reg_rx_ops->reg_r2p_table_update_response_handler(psoc,
1330*5113495bSYour Name 								   pdev_id);
1331*5113495bSYour Name 	if (!QDF_IS_STATUS_SUCCESS(status)) {
1332*5113495bSYour Name 		target_if_err("Failed to process r2p update response");
1333*5113495bSYour Name 		ret_val = -EFAULT;
1334*5113495bSYour Name 		goto clean;
1335*5113495bSYour Name 	}
1336*5113495bSYour Name clean:
1337*5113495bSYour Name 	qdf_mem_free(update_status_obj);
1338*5113495bSYour Name 	TARGET_IF_EXIT();
1339*5113495bSYour Name 
1340*5113495bSYour Name 	return ret_val;
1341*5113495bSYour Name }
1342*5113495bSYour Name 
1343*5113495bSYour Name /**
1344*5113495bSYour Name  * tgt_if_regulatory_register_rate2power_table_update_handler() - Register
1345*5113495bSYour Name  * rate2power table update handler
1346*5113495bSYour Name  * @psoc: Pointer to psoc
1347*5113495bSYour Name  * @arg: Pointer to argument list
1348*5113495bSYour Name  *
1349*5113495bSYour Name  * Return: QDF_STATUS
1350*5113495bSYour Name  */
1351*5113495bSYour Name static QDF_STATUS
tgt_if_regulatory_register_rate2power_table_update_handler(struct wlan_objmgr_psoc * psoc,void * arg)1352*5113495bSYour Name tgt_if_regulatory_register_rate2power_table_update_handler(
1353*5113495bSYour Name 						struct wlan_objmgr_psoc *psoc,
1354*5113495bSYour Name 						void *arg)
1355*5113495bSYour Name {
1356*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
1357*5113495bSYour Name 
1358*5113495bSYour Name 	if (!wmi_handle)
1359*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
1360*5113495bSYour Name 
1361*5113495bSYour Name 	return wmi_unified_register_event_handler(
1362*5113495bSYour Name 			wmi_handle, wmi_pdev_set_tgtr2p_table_eventid,
1363*5113495bSYour Name 			tgt_rate_to_power_complete_handler, WMI_RX_WORK_CTX);
1364*5113495bSYour Name }
1365*5113495bSYour Name 
1366*5113495bSYour Name /**
1367*5113495bSYour Name  * tgt_if_regulatory_unregister_rate2power_table_update_handler() - Unregister
1368*5113495bSYour Name  * rate2power table update handler
1369*5113495bSYour Name  * @psoc: Pointer to psoc
1370*5113495bSYour Name  * @arg: Pointer to argument list
1371*5113495bSYour Name  *
1372*5113495bSYour Name  * Return: QDF_STATUS
1373*5113495bSYour Name  */
1374*5113495bSYour Name static QDF_STATUS
tgt_if_regulatory_unregister_rate2power_table_update_handler(struct wlan_objmgr_psoc * psoc,void * arg)1375*5113495bSYour Name tgt_if_regulatory_unregister_rate2power_table_update_handler(
1376*5113495bSYour Name 						struct wlan_objmgr_psoc *psoc,
1377*5113495bSYour Name 						void *arg)
1378*5113495bSYour Name {
1379*5113495bSYour Name 	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
1380*5113495bSYour Name 
1381*5113495bSYour Name 	if (!wmi_handle)
1382*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
1383*5113495bSYour Name 
1384*5113495bSYour Name 	return wmi_unified_unregister_event_handler(
1385*5113495bSYour Name 			wmi_handle, wmi_pdev_set_tgtr2p_table_eventid);
1386*5113495bSYour Name }
1387*5113495bSYour Name 
target_if_register_regulatory_tx_ops(struct wlan_lmac_if_tx_ops * tx_ops)1388*5113495bSYour Name QDF_STATUS target_if_register_regulatory_tx_ops(
1389*5113495bSYour Name 		struct wlan_lmac_if_tx_ops *tx_ops)
1390*5113495bSYour Name {
1391*5113495bSYour Name 	struct wlan_lmac_if_reg_tx_ops *reg_ops = &tx_ops->reg_ops;
1392*5113495bSYour Name 
1393*5113495bSYour Name 	reg_ops->register_master_handler =
1394*5113495bSYour Name 		tgt_if_regulatory_register_master_list_handler;
1395*5113495bSYour Name 
1396*5113495bSYour Name 	reg_ops->unregister_master_handler =
1397*5113495bSYour Name 		tgt_if_regulatory_unregister_master_list_handler;
1398*5113495bSYour Name 
1399*5113495bSYour Name 	target_if_register_master_ext_handler(reg_ops);
1400*5113495bSYour Name 
1401*5113495bSYour Name 	target_if_register_afc_event_handler(reg_ops);
1402*5113495bSYour Name 
1403*5113495bSYour Name 	reg_ops->set_country_code = tgt_if_regulatory_set_country_code;
1404*5113495bSYour Name 
1405*5113495bSYour Name 	reg_ops->fill_umac_legacy_chanlist = NULL;
1406*5113495bSYour Name 
1407*5113495bSYour Name 	reg_ops->set_wait_for_init_cc_response_event = NULL;
1408*5113495bSYour Name 
1409*5113495bSYour Name 	target_if_register_acs_trigger_for_afc(reg_ops);
1410*5113495bSYour Name 
1411*5113495bSYour Name 	reg_ops->register_11d_new_cc_handler =
1412*5113495bSYour Name 		tgt_if_regulatory_register_11d_new_cc_handler;
1413*5113495bSYour Name 
1414*5113495bSYour Name 	reg_ops->unregister_11d_new_cc_handler =
1415*5113495bSYour Name 		tgt_if_regulatory_unregister_11d_new_cc_handler;
1416*5113495bSYour Name 
1417*5113495bSYour Name 	reg_ops->start_11d_scan = tgt_if_regulatory_start_11d_scan;
1418*5113495bSYour Name 
1419*5113495bSYour Name 	reg_ops->stop_11d_scan = tgt_if_regulatory_stop_11d_scan;
1420*5113495bSYour Name 
1421*5113495bSYour Name 	reg_ops->is_there_serv_ready_extn =
1422*5113495bSYour Name 		tgt_if_regulatory_is_there_serv_ready_extn;
1423*5113495bSYour Name 
1424*5113495bSYour Name 	reg_ops->set_user_country_code =
1425*5113495bSYour Name 		tgt_if_regulatory_set_user_country_code;
1426*5113495bSYour Name 
1427*5113495bSYour Name 	reg_ops->register_ch_avoid_event_handler =
1428*5113495bSYour Name 		tgt_if_regulatory_register_ch_avoid_event_handler;
1429*5113495bSYour Name 
1430*5113495bSYour Name 	reg_ops->unregister_ch_avoid_event_handler =
1431*5113495bSYour Name 		tgt_if_regulatory_unregister_ch_avoid_event_handler;
1432*5113495bSYour Name 
1433*5113495bSYour Name 	reg_ops->send_ctl_info = tgt_if_regulatory_send_ctl_info;
1434*5113495bSYour Name 
1435*5113495bSYour Name 	reg_ops->get_phy_id_from_pdev_id =
1436*5113495bSYour Name 			tgt_if_regulatory_get_phy_id_from_pdev_id;
1437*5113495bSYour Name 
1438*5113495bSYour Name 	reg_ops->get_pdev_id_from_phy_id =
1439*5113495bSYour Name 			tgt_if_regulatory_get_pdev_id_from_phy_id;
1440*5113495bSYour Name 
1441*5113495bSYour Name 	reg_ops->set_tpc_power = tgt_if_regulatory_set_tpc_power;
1442*5113495bSYour Name 
1443*5113495bSYour Name 	reg_ops->get_opclass_tbl_idx = NULL;
1444*5113495bSYour Name 
1445*5113495bSYour Name 	tgt_if_register_afc_callback(reg_ops);
1446*5113495bSYour Name 
1447*5113495bSYour Name 	reg_ops->is_chip_11be = tgt_if_reg_is_chip_11be_cap;
1448*5113495bSYour Name 
1449*5113495bSYour Name 	reg_ops->register_rate2power_table_update_event_handler =
1450*5113495bSYour Name 		tgt_if_regulatory_register_rate2power_table_update_handler;
1451*5113495bSYour Name 
1452*5113495bSYour Name 	reg_ops->unregister_rate2power_table_update_event_handler =
1453*5113495bSYour Name 		tgt_if_regulatory_unregister_rate2power_table_update_handler;
1454*5113495bSYour Name 
1455*5113495bSYour Name 	reg_ops->end_r2p_table_update_wait = NULL;
1456*5113495bSYour Name 
1457*5113495bSYour Name 	reg_ops->is_80p80_supported = NULL;
1458*5113495bSYour Name 
1459*5113495bSYour Name 	reg_ops->is_freq_80p80_supported = NULL;
1460*5113495bSYour Name 
1461*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
1462*5113495bSYour Name }
1463