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