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