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