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: reg_db.h 22 * This file contains regulatory data base parser function declarations 23 */ 24 25 #ifndef __REG_DB_PARSER_H 26 #define __REG_DB_PARSER_H 27 28 extern const struct country_code_to_reg_domain g_all_countries[]; 29 extern const struct reg_domain_pair g_reg_dmn_pairs[]; 30 extern const struct regulatory_rule reg_rules_2g[]; 31 extern const struct regdomain regdomains_2g[]; 32 extern const struct regulatory_rule reg_rules_5g[]; 33 extern const struct regdomain regdomains_5g[]; 34 35 #ifdef CONFIG_REG_CLIENT 36 extern const uint32_t reg_2g_sub_dmn_code[]; 37 extern const uint32_t reg_5g_sub_dmn_code[]; 38 #endif 39 40 /** 41 * reg_is_country_code_valid() - Check if the given country code is valid 42 * @alpha2: Country string 43 * 44 * Return: QDF_STATUS 45 */ 46 QDF_STATUS reg_is_country_code_valid(uint8_t *alpha2); 47 48 /** 49 * reg_regrules_assign() - Get 2GHz and 5GHz regulatory rules from regdomain 50 * structure. 51 * @dmn_id_2g: 2GHz regdomain ID 52 * @dmn_id_5g: 5GHz regdomain ID 53 * @ant_gain_2g: 2GHz antenna gain 54 * @ant_gain_5g: 5GHz antenna gain 55 * @reg_info: Pointer to current regulatory info structure 56 * 57 * Return: QDF_STATUS 58 */ 59 QDF_STATUS reg_regrules_assign(uint8_t dmn_id_2g, uint8_t dmn_id_5g, 60 uint8_t ant_gain_2g, uint8_t ant_gain_5g, 61 struct cur_regulatory_info *reg_info); 62 63 /** 64 * reg_get_cur_reginfo() - Get current regulatory info for a given country code 65 * @reg_info: Pointer to current regulatory info structure 66 * @country_index: Country code index in the country code table 67 * @regdmn_pair: Regdomain pair ID 68 * 69 * Return: QDF_STATUS 70 */ 71 QDF_STATUS reg_get_cur_reginfo(struct cur_regulatory_info *reg_info, 72 uint16_t country_index, uint16_t regdmn_pair); 73 74 /** 75 * reg_get_rdpair_from_country_iso() - Get regdomain pair ID from country string 76 * @alpha: Pointer to country code string 77 * @country_index: Pointer to save country code index 78 * @regdmn_pair: Pointer to save regdomain pair ID index 79 * 80 * Return: QDF_STATUS 81 */ 82 QDF_STATUS reg_get_rdpair_from_country_iso(uint8_t *alpha, 83 uint16_t *country_index, 84 uint16_t *regdmn_pair); 85 86 /** 87 * reg_get_rdpair_from_country_code() - Get regdomain pair ID from country code 88 * @cc: Country code 89 * @country_index: Pointer to save country code index 90 * @regdmn_pair: Pointer to save regdomain pair ID index 91 * 92 * Return: QDF_STATUS 93 */ 94 QDF_STATUS reg_get_rdpair_from_country_code(uint16_t cc, 95 uint16_t *country_index, 96 uint16_t *regdmn_pair); 97 98 /** 99 * reg_get_rdpair_from_regdmn_id() - Get regdomain pair ID from regdomain ID 100 * @regdmn_id: Regdomain ID 101 * @regdmn_pair: Pointer to save regdomain pair ID index 102 * 103 * Return: QDF_STATUS 104 */ 105 QDF_STATUS reg_get_rdpair_from_regdmn_id(uint16_t regdmn_id, 106 uint16_t *regdmn_pair); 107 #endif 108