1 /* 2 * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. 3 * 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /** 21 * @file wlan_req_ucfg_api.c 22 * @brief contains regulatory user config interface definations 23 */ 24 25 #include <wlan_reg_ucfg_api.h> 26 #include "../../core/src/reg_services.h" 27 #include <qdf_module.h> 28 29 QDF_STATUS ucfg_reg_register_event_handler(uint8_t vdev_id, reg_event_cb cb, 30 void *arg) 31 { 32 /* Register a event cb handler */ 33 return QDF_STATUS_SUCCESS; 34 } 35 36 QDF_STATUS ucfg_reg_unregister_event_handler(uint8_t vdev_id, reg_event_cb cb, 37 void *arg) 38 { 39 /* unregister a event cb handler */ 40 return QDF_STATUS_SUCCESS; 41 } 42 43 QDF_STATUS ucfg_reg_init_handler(uint8_t pdev_id) 44 { 45 /* regulatory initialization handler */ 46 return QDF_STATUS_SUCCESS; 47 } 48 49 QDF_STATUS ucfg_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev, 50 struct regulatory_channel *chan_list) 51 { 52 return reg_get_current_chan_list(pdev, chan_list); 53 } 54 55 qdf_export_symbol(ucfg_reg_get_current_chan_list); 56 57 QDF_STATUS ucfg_reg_modify_chan_144(struct wlan_objmgr_pdev *pdev, 58 bool enable_ch_144) 59 { 60 return reg_modify_chan_144(pdev, enable_ch_144); 61 } 62 63 bool ucfg_reg_get_en_chan_144(struct wlan_objmgr_pdev *pdev) 64 { 65 return reg_get_en_chan_144(pdev); 66 } 67 68 QDF_STATUS ucfg_reg_set_config_vars(struct wlan_objmgr_psoc *psoc, 69 struct reg_config_vars config_vars) 70 { 71 return reg_set_config_vars(psoc, config_vars); 72 } 73 74 bool ucfg_reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc) 75 { 76 return reg_is_regdb_offloaded(psoc); 77 } 78 79 void ucfg_reg_program_mas_chan_list(struct wlan_objmgr_psoc *psoc, 80 struct regulatory_channel *reg_channels, 81 uint8_t *alpha2, 82 enum dfs_reg dfs_region) 83 { 84 reg_program_mas_chan_list(psoc, reg_channels, alpha2, dfs_region); 85 } 86 87 QDF_STATUS ucfg_reg_get_regd_rules(struct wlan_objmgr_pdev *pdev, 88 struct reg_rule_info *reg_rules) 89 { 90 return reg_get_regd_rules(pdev, reg_rules); 91 } 92 93 QDF_STATUS ucfg_reg_program_default_cc(struct wlan_objmgr_pdev *pdev, 94 uint16_t regdmn) 95 { 96 return reg_program_default_cc(pdev, regdmn); 97 } 98 99 QDF_STATUS ucfg_reg_program_cc(struct wlan_objmgr_pdev *pdev, 100 struct cc_regdmn_s *rd) 101 { 102 return reg_program_chan_list(pdev, rd); 103 } 104 105 QDF_STATUS ucfg_reg_get_current_cc(struct wlan_objmgr_pdev *pdev, 106 struct cc_regdmn_s *rd) 107 { 108 return reg_get_current_cc(pdev, rd); 109 } 110 111 /** 112 * ucfg_reg_set_band() - Sets the band information for the PDEV 113 * @pdev: The physical pdev to set the band for 114 * @band: The set band parameter to configure for the pysical device 115 * 116 * Return: QDF_STATUS 117 */ 118 QDF_STATUS ucfg_reg_set_band(struct wlan_objmgr_pdev *pdev, 119 enum band_info band) 120 { 121 return reg_set_band(pdev, band); 122 } 123 124 /** 125 * ucfg_reg_notify_sap_event() - Notify regulatory domain for sap event 126 * @pdev: The physical dev to set the band for 127 * @sap_state: true for sap start else false 128 * 129 * Return: QDF_STATUS 130 */ 131 QDF_STATUS ucfg_reg_notify_sap_event(struct wlan_objmgr_pdev *pdev, 132 bool sap_state) 133 { 134 return reg_notify_sap_event(pdev, sap_state); 135 } 136 137 #ifdef DISABLE_CHANNEL_LIST 138 /** 139 * ucfg_reg_cache_channel_state() - Cache the current state of the channles 140 * @pdev: The physical dev to cache the channels for 141 * @channel_list: List of the channels for which states needs to be cached 142 * @num_channels: Number of channels in the list 143 * 144 */ 145 void ucfg_reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, 146 uint32_t *channel_list, uint32_t num_channels) 147 { 148 reg_cache_channel_state(pdev, channel_list, num_channels); 149 } 150 151 /** 152 * ucfg_reg_restore_cached_channels() - Cache the current state of the channles 153 * @pdev: The physical dev to cache the channels for 154 */ 155 void ucfg_reg_restore_cached_channels(struct wlan_objmgr_pdev *pdev) 156 { 157 reg_restore_cached_channels(pdev); 158 } 159 #endif 160 161 /** 162 * ucfg_reg_set_fcc_constraint() - apply fcc constraints on channels 12/13 163 * @pdev: The physical pdev to reduce tx power for 164 * 165 * This function adjusts the transmit power on channels 12 and 13, to comply 166 * with FCC regulations in the USA. 167 * 168 * Return: QDF_STATUS 169 */ 170 QDF_STATUS ucfg_reg_set_fcc_constraint(struct wlan_objmgr_pdev *pdev, 171 bool fcc_constraint) 172 { 173 return reg_set_fcc_constraint(pdev, fcc_constraint); 174 } 175 176 177 /** 178 * ucfg_reg_get_default_country() - Get the default regulatory country 179 * @psoc: The physical SoC to get default country from 180 * @country_code: the buffer to populate the country code into 181 * 182 * Return: QDF_STATUS 183 */ 184 QDF_STATUS ucfg_reg_get_default_country(struct wlan_objmgr_psoc *psoc, 185 uint8_t *country_code) 186 { 187 return reg_read_default_country(psoc, country_code); 188 } 189 190 QDF_STATUS ucfg_reg_get_current_country(struct wlan_objmgr_psoc *psoc, 191 uint8_t *country_code) 192 { 193 return reg_read_current_country(psoc, country_code); 194 } 195 /** 196 * ucfg_reg_set_default_country() - Set the default regulatory country 197 * @psoc: The physical SoC to set default country for 198 * @country: The country information to configure 199 * 200 * Return: QDF_STATUS 201 */ 202 QDF_STATUS ucfg_reg_set_default_country(struct wlan_objmgr_psoc *psoc, 203 uint8_t *country) 204 { 205 return reg_set_default_country(psoc, country); 206 } 207 208 /** 209 * ucfg_reg_set_country() - Set the current regulatory country 210 * @pdev: The physical dev to set current country for 211 * @country: The country information to configure 212 * 213 * Return: QDF_STATUS 214 */ 215 QDF_STATUS ucfg_reg_set_country(struct wlan_objmgr_pdev *pdev, 216 uint8_t *country) 217 { 218 return reg_set_country(pdev, country); 219 } 220 221 /** 222 * ucfg_reg_reset_country() - Reset the regulatory country to default 223 * @psoc: The physical SoC to reset country for 224 * 225 * Return: QDF_STATUS 226 */ 227 QDF_STATUS ucfg_reg_reset_country(struct wlan_objmgr_psoc *psoc) 228 { 229 return reg_reset_country(psoc); 230 } 231 232 /** 233 * ucfg_reg_enable_dfs_channels() - Enable the use of DFS channels 234 * @pdev: The physical dev to enable DFS channels for 235 * 236 * Return: QDF_STATUS 237 */ 238 QDF_STATUS ucfg_reg_enable_dfs_channels(struct wlan_objmgr_pdev *pdev, 239 bool dfs_enable) 240 { 241 return reg_enable_dfs_channels(pdev, dfs_enable); 242 } 243 244 QDF_STATUS ucfg_reg_get_curr_band(struct wlan_objmgr_pdev *pdev, 245 enum band_info *band) 246 { 247 return reg_get_curr_band(pdev, band); 248 249 } 250 251 void ucfg_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc, 252 reg_chan_change_callback cbk, 253 void *arg) 254 { 255 reg_register_chan_change_callback(psoc, cbk, arg); 256 } 257 258 void ucfg_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc, 259 reg_chan_change_callback cbk) 260 { 261 reg_unregister_chan_change_callback(psoc, cbk); 262 } 263 264 enum country_src ucfg_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc, 265 uint8_t *alpha2) 266 { 267 return reg_get_cc_and_src(psoc, alpha2); 268 } 269 270 void ucfg_reg_unit_simulate_ch_avoid(struct wlan_objmgr_psoc *psoc, 271 struct ch_avoid_ind_type *ch_avoid) 272 { 273 reg_process_ch_avoid_event(psoc, ch_avoid); 274 } 275 276 QDF_STATUS ucfg_reg_11d_vdev_delete_update(struct wlan_objmgr_vdev *vdev) 277 { 278 return reg_11d_vdev_delete_update(vdev); 279 } 280 281 QDF_STATUS ucfg_reg_11d_vdev_created_update(struct wlan_objmgr_vdev *vdev) 282 { 283 return reg_11d_vdev_created_update(vdev); 284 } 285 286 struct wlan_psoc_host_hal_reg_capabilities_ext *ucfg_reg_get_hal_reg_cap( 287 struct wlan_objmgr_psoc *psoc) 288 { 289 return reg_get_hal_reg_cap(psoc); 290 } 291 qdf_export_symbol(ucfg_reg_get_hal_reg_cap); 292 293 QDF_STATUS ucfg_reg_set_hal_reg_cap(struct wlan_objmgr_psoc *psoc, 294 struct wlan_psoc_host_hal_reg_capabilities_ext *hal_reg_cap, 295 uint16_t phy_cnt) 296 297 { 298 return reg_set_hal_reg_cap(psoc, hal_reg_cap, phy_cnt); 299 } 300 qdf_export_symbol(ucfg_reg_set_hal_reg_cap); 301