1 /* 2 * Copyright (c) 2017-2019 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 * DOC: wlan_reg_ucfg_api.h 22 * This file provides prototypes of the regulatory component user 23 * config interface routines 24 */ 25 26 #ifndef __WLAN_REG_UCFG_API_H 27 #define __WLAN_REG_UCFG_API_H 28 29 typedef QDF_STATUS (*reg_event_cb)(void *status_struct); 30 31 /** 32 * ucfg_reg_set_band() - Sets the band information for the PDEV 33 * @pdev: The physical pdev to set the band for 34 * @band: The set band parameter to configure for the physical device 35 * 36 * Return: QDF_STATUS 37 */ 38 QDF_STATUS ucfg_reg_set_band(struct wlan_objmgr_pdev *pdev, 39 enum band_info band); 40 41 /** 42 * ucfg_reg_get_band() - Gets the band information for the PDEV 43 * @pdev: The physical pdev to get the band for 44 * @band: The band parameter of the physical device 45 * 46 * Return: QDF_STATUS 47 */ 48 QDF_STATUS ucfg_reg_get_band(struct wlan_objmgr_pdev *pdev, 49 enum band_info *band); 50 51 /** 52 * ucfg_reg_notify_sap_event() - Notify regulatory domain for sap event 53 * @pdev: The physical dev to set the band for 54 * @sap_state: true for sap start else false 55 * 56 * Return: QDF_STATUS 57 */ 58 QDF_STATUS ucfg_reg_notify_sap_event(struct wlan_objmgr_pdev *pdev, 59 bool sap_state); 60 61 /** 62 * ucfg_reg_cache_channel_state() - Cache the current state of the channles 63 * @pdev: The physical dev to cache the channels for 64 * @channel_list: List of the channels for which states needs to be cached 65 * @num_channels: Number of channels in the list 66 * 67 * Return: QDF_STATUS 68 */ 69 #ifdef DISABLE_CHANNEL_LIST 70 void ucfg_reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, 71 uint32_t *channel_list, 72 uint32_t num_channels); 73 #else 74 static inline 75 void ucfg_reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, 76 uint32_t *channel_list, 77 uint32_t num_channels) 78 { 79 } 80 #endif 81 82 /** 83 * ucfg_reg_restore_cached_channels() - Cache the current state of the channles 84 * @pdev: The physical dev to cache the channels for 85 * 86 * Return: QDF_STATUS 87 */ 88 #ifdef DISABLE_CHANNEL_LIST 89 void ucfg_reg_restore_cached_channels(struct wlan_objmgr_pdev *pdev); 90 #else 91 static inline 92 void ucfg_reg_restore_cached_channels(struct wlan_objmgr_pdev *pdev) 93 { 94 } 95 #endif 96 97 /** 98 * ucfg_reg_set_fcc_constraint() - apply fcc constraints on channels 12/13 99 * @pdev: The physical pdev to reduce tx power for 100 * 101 * This function adjusts the transmit power on channels 12 and 13, to comply 102 * with FCC regulations in the USA. 103 * 104 * Return: QDF_STATUS 105 */ 106 QDF_STATUS ucfg_reg_set_fcc_constraint(struct wlan_objmgr_pdev *pdev, 107 bool fcc_constraint); 108 109 /** 110 * ucfg_reg_get_default_country() - Get the default regulatory country 111 * @psoc: The physical SoC to get default country from 112 * @country_code: the buffer to populate the country code into 113 * 114 * Return: QDF_STATUS 115 */ 116 QDF_STATUS ucfg_reg_get_default_country(struct wlan_objmgr_psoc *psoc, 117 uint8_t *country_code); 118 119 /** 120 * ucfg_reg_get_current_country() - Get the current regulatory country 121 * @psoc: The physical SoC to get current country from 122 * @country_code: the buffer to populate the country code into 123 * 124 * Return: QDF_STATUS 125 */ 126 QDF_STATUS ucfg_reg_get_current_country(struct wlan_objmgr_psoc *psoc, 127 uint8_t *country_code); 128 /** 129 * ucfg_reg_set_default_country() - Set the default regulatory country 130 * @psoc: The physical SoC to set default country for 131 * @country_code: The country information to configure 132 * 133 * Return: QDF_STATUS 134 */ 135 QDF_STATUS ucfg_reg_set_default_country(struct wlan_objmgr_psoc *psoc, 136 uint8_t *country_code); 137 138 /** 139 * ucfg_reg_set_country() - Set the current regulatory country 140 * @pdev: The physical dev to set current country for 141 * @country_code: The country information to configure 142 * 143 * Return: QDF_STATUS 144 */ 145 QDF_STATUS ucfg_reg_set_country(struct wlan_objmgr_pdev *dev, 146 uint8_t *country_code); 147 148 /** 149 * ucfg_reg_reset_country() - Reset the regulatory country to default 150 * @psoc: The physical SoC to reset country for 151 * 152 * Return: QDF_STATUS 153 */ 154 QDF_STATUS ucfg_reg_reset_country(struct wlan_objmgr_psoc *psoc); 155 156 /** 157 * ucfg_reg_get_curr_band() - Get the current band capability 158 * @pdev: The physical dev to get default country from 159 * @band: buffer to populate the band into 160 * 161 * Return: QDF_STATUS 162 */ 163 QDF_STATUS ucfg_reg_get_curr_band(struct wlan_objmgr_pdev *pdev, 164 enum band_info *band); 165 /** 166 * ucfg_reg_enable_dfs_channels() - Enable the use of DFS channels 167 * @pdev: The physical dev to enable DFS channels for 168 * 169 * Return: QDF_STATUS 170 */ 171 QDF_STATUS ucfg_reg_enable_dfs_channels(struct wlan_objmgr_pdev *pdev, 172 bool dfs_enable); 173 174 QDF_STATUS ucfg_reg_register_event_handler(uint8_t vdev_id, reg_event_cb cb, 175 void *arg); 176 QDF_STATUS ucfg_reg_unregister_event_handler(uint8_t vdev_id, reg_event_cb cb, 177 void *arg); 178 QDF_STATUS ucfg_reg_init_handler(uint8_t pdev_id); 179 180 QDF_STATUS ucfg_reg_program_default_cc(struct wlan_objmgr_pdev *pdev, 181 uint16_t regdmn); 182 183 /** 184 * ucfg_reg_program_cc() - Program user country code or regdomain 185 * @pdev: The physical dev to program country code or regdomain 186 * @rd: User country code or regdomain 187 * 188 * Return: QDF_STATUS 189 */ 190 QDF_STATUS ucfg_reg_program_cc(struct wlan_objmgr_pdev *pdev, 191 struct cc_regdmn_s *rd); 192 193 /** 194 * ucfg_reg_get_current_cc() - get current country code or regdomain 195 * @pdev: The physical dev to program country code or regdomain 196 * @rd: Pointer to country code or regdomain 197 * 198 * Return: QDF_STATUS 199 */ 200 QDF_STATUS ucfg_reg_get_current_cc(struct wlan_objmgr_pdev *pdev, 201 struct cc_regdmn_s *rd); 202 203 /** 204 * ucfg_reg_set_config_vars () - Set the config vars in reg component 205 * @psoc: psoc ptr 206 * @config_vars: config variables structure 207 * 208 * Return: QDF_STATUS 209 */ 210 QDF_STATUS ucfg_reg_set_config_vars(struct wlan_objmgr_psoc *psoc, 211 struct reg_config_vars config_vars); 212 213 /** 214 * ucfg_reg_get_current_chan_list () - get current channel list 215 * @pdev: pdev ptr 216 * @chan_list: channel list 217 * 218 * Return: QDF_STATUS 219 */ 220 QDF_STATUS ucfg_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev, 221 struct regulatory_channel *chan_list); 222 223 /** 224 * ucfg_reg_modify_chan_144() - Enable/Disable channel 144 225 * @pdev: pdev pointer 226 * @enable_chan_144: flag to disable/enable channel 144 227 * 228 * Return: Success or Failure 229 */ 230 QDF_STATUS ucfg_reg_modify_chan_144(struct wlan_objmgr_pdev *pdev, 231 bool enable_ch_144); 232 233 /** 234 * ucfg_reg_get_en_chan_144() - get en_chan_144 flag value 235 * @pdev: pdev pointer 236 * 237 * Return: en_chan_144 flag value 238 */ 239 bool ucfg_reg_get_en_chan_144(struct wlan_objmgr_pdev *pdev); 240 241 /** 242 * ucfg_reg_is_regdb_offloaded () - is regulatory database offloaded 243 * @psoc: psoc ptr 244 * 245 * Return: bool 246 */ 247 bool ucfg_reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc); 248 249 /** 250 * ucfg_reg_program_mas_chan_list () - program master channel list 251 * @psoc: psoc ptr 252 * @reg_channels: regulatory channels 253 * @alpha2: country code 254 * @dfs_region: dfs region 255 * 256 * Return: void 257 */ 258 void ucfg_reg_program_mas_chan_list(struct wlan_objmgr_psoc *psoc, 259 struct regulatory_channel *reg_channels, 260 uint8_t *alpha2, 261 enum dfs_reg dfs_region); 262 263 /** 264 * ucfg_reg_get_regd_rules() - provides the reg domain rules info pointer 265 * @pdev: pdev ptr 266 * @reg_rules: regulatory rules 267 * 268 * Return: QDF_STATUS 269 */ 270 QDF_STATUS ucfg_reg_get_regd_rules(struct wlan_objmgr_pdev *pdev, 271 struct reg_rule_info *reg_rules); 272 273 /** 274 * ucfg_reg_register_chan_change_callback () - add chan change cbk 275 * @psoc: psoc ptr 276 * @cbk: callback 277 * @arg: argument 278 * 279 * Return: void 280 */ 281 void ucfg_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc, 282 void *cbk, void *arg); 283 284 /** 285 * ucfg_reg_unregister_chan_change_callback () - remove chan change cbk 286 * @psoc: psoc ptr 287 * @cbk: callback 288 * 289 * Return: void 290 */ 291 void ucfg_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc, 292 void *cbk); 293 294 /** 295 * ucfg_reg_get_cc_and_src () - get country code and src 296 * @psoc: psoc ptr 297 * @alpha2: country code alpha2 298 * 299 * Return: void 300 */ 301 enum country_src ucfg_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc, 302 uint8_t *alpha2); 303 304 /** 305 * ucfg_reg_unit_simulate_ch_avoid () - fake a ch avoid event 306 * @psoc: psoc ptr 307 * @ch_avoid: ch_avoid_ind_type ranges 308 * 309 * This function inject a ch_avoid event for unit test sap chan switch. 310 * 311 * Return: void 312 */ 313 void ucfg_reg_unit_simulate_ch_avoid(struct wlan_objmgr_psoc *psoc, 314 struct ch_avoid_ind_type *ch_avoid); 315 316 /** 317 * ucfg_reg_11d_vdev_delete_update() - update vdev delete to regulatory 318 * @vdev: vdev ptr 319 * 320 * Return: QDF_STATUS 321 */ 322 QDF_STATUS ucfg_reg_11d_vdev_delete_update(struct wlan_objmgr_vdev *vdev); 323 324 /** 325 * ucfg_reg_11d_vdev_created_update() - update vdev create to regulatory 326 * @vdev: vdev ptr 327 * 328 * Return: QDF_STATUS 329 */ 330 QDF_STATUS ucfg_reg_11d_vdev_created_update(struct wlan_objmgr_vdev *vdev); 331 332 /** 333 * ucfg_reg_get_hal_reg_cap() - return hal reg cap 334 * @psoc: psoc ptr 335 * 336 * Return: ptr to wlan_psoc_host_hal_reg_capabilities_ext 337 */ 338 struct wlan_psoc_host_hal_reg_capabilities_ext *ucfg_reg_get_hal_reg_cap( 339 struct wlan_objmgr_psoc *psoc); 340 341 /** 342 * ucfg_reg_set_hal_reg_cap() - update hal reg cap 343 * @psoc: psoc ptr 344 * @reg_cap: Regulatory cap array 345 * @phy_cnt: Number of phy 346 * 347 * Return: QDF_STATUS 348 */ 349 QDF_STATUS ucfg_reg_set_hal_reg_cap(struct wlan_objmgr_psoc *psoc, 350 struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap, 351 uint16_t phy_cnt); 352 #endif 353