qcacmn: Add the API wlan_reg_get_band_cap_from_op_class
Add the API wlan_reg_get_band_cap_from_op_class to get the supported band capability from an list of operating class as input. Change-Id: I58dc0bbe7c5436b889c12ac2d68bd769a3c702cf CRs-fixed: 2617526
This commit is contained in:

committed by
nshrivas

parent
eb601eca1e
commit
ee4dcfe6d7
@@ -261,8 +261,8 @@ static const struct reg_dmn_op_class_map_t japan_op_class[] = {
|
|||||||
*
|
*
|
||||||
* Return: class.
|
* Return: class.
|
||||||
*/
|
*/
|
||||||
static const
|
static const struct reg_dmn_op_class_map_t
|
||||||
struct reg_dmn_op_class_map_t *reg_get_class_from_country(uint8_t *country)
|
*reg_get_class_from_country(const uint8_t *country)
|
||||||
{
|
{
|
||||||
const struct reg_dmn_op_class_map_t *class = NULL;
|
const struct reg_dmn_op_class_map_t *class = NULL;
|
||||||
|
|
||||||
@@ -369,6 +369,42 @@ uint8_t reg_dmn_get_opclass_from_freq_width(uint8_t *country,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t reg_get_band_cap_from_op_class(const uint8_t *country,
|
||||||
|
uint8_t num_of_opclass,
|
||||||
|
const uint8_t *opclass)
|
||||||
|
{
|
||||||
|
const struct reg_dmn_op_class_map_t *op_class_tbl;
|
||||||
|
uint8_t supported_band = 0, opclassidx;
|
||||||
|
|
||||||
|
op_class_tbl = reg_get_class_from_country(country);
|
||||||
|
|
||||||
|
while (op_class_tbl && op_class_tbl->op_class) {
|
||||||
|
for (opclassidx = 0; opclassidx < num_of_opclass;
|
||||||
|
opclassidx++) {
|
||||||
|
if (op_class_tbl->op_class == opclass[opclassidx]) {
|
||||||
|
if (op_class_tbl->start_freq ==
|
||||||
|
TWOG_START_FREQ) {
|
||||||
|
supported_band |= BIT(REG_BAND_2G);
|
||||||
|
} else if (op_class_tbl->start_freq ==
|
||||||
|
FIVEG_START_FREQ) {
|
||||||
|
supported_band |= BIT(REG_BAND_5G);
|
||||||
|
} else if (op_class_tbl->start_freq ==
|
||||||
|
SIXG_STARTING_FREQ) {
|
||||||
|
supported_band |= BIT(REG_BAND_6G);
|
||||||
|
} else {
|
||||||
|
reg_err_rl("Unknown band");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
op_class_tbl++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!supported_band)
|
||||||
|
reg_err_rl("None of the operating classes is found");
|
||||||
|
|
||||||
|
return supported_band;
|
||||||
|
}
|
||||||
|
|
||||||
void reg_dmn_print_channels_in_opclass(uint8_t *country, uint8_t op_class)
|
void reg_dmn_print_channels_in_opclass(uint8_t *country, uint8_t op_class)
|
||||||
{
|
{
|
||||||
const struct reg_dmn_op_class_map_t *class = NULL;
|
const struct reg_dmn_op_class_map_t *class = NULL;
|
||||||
|
@@ -62,6 +62,21 @@ uint8_t reg_dmn_get_opclass_from_freq_width(uint8_t *country,
|
|||||||
uint8_t ch_width,
|
uint8_t ch_width,
|
||||||
uint16_t behav_limit);
|
uint16_t behav_limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reg_get_band_cap_from_op_class() - Return band capability bitmap
|
||||||
|
* @country: Pointer to Country code.
|
||||||
|
* @num_of_opclass: Number of Operating class.
|
||||||
|
* @opclass: Pointer to opclass.
|
||||||
|
*
|
||||||
|
* Return supported band bitmap based on the input operating class list
|
||||||
|
* provided.
|
||||||
|
*
|
||||||
|
* Return: Return supported band capability
|
||||||
|
*/
|
||||||
|
uint8_t reg_get_band_cap_from_op_class(const uint8_t *country,
|
||||||
|
uint8_t num_of_opclass,
|
||||||
|
const uint8_t *opclass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reg_dmn_get_opclass_from_channe() - Print channels in op class.
|
* reg_dmn_get_opclass_from_channe() - Print channels in op class.
|
||||||
* @country: Country code.
|
* @country: Country code.
|
||||||
@@ -265,6 +280,14 @@ uint8_t reg_dmn_get_opclass_from_freq_width(uint8_t *country,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
uint8_t reg_get_band_cap_from_op_class(uint8_t *country,
|
||||||
|
uint8_t num_of_opclass,
|
||||||
|
const uint8_t *opclass)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void reg_dmn_print_channels_in_opclass(uint8_t *country,
|
static inline void reg_dmn_print_channels_in_opclass(uint8_t *country,
|
||||||
uint8_t op_class)
|
uint8_t op_class)
|
||||||
{
|
{
|
||||||
|
@@ -40,6 +40,8 @@
|
|||||||
#define CH_AVOID_MAX_RANGE 4
|
#define CH_AVOID_MAX_RANGE 4
|
||||||
#define REG_ALPHA2_LEN 2
|
#define REG_ALPHA2_LEN 2
|
||||||
#define MAX_REG_RULES 10
|
#define MAX_REG_RULES 10
|
||||||
|
#define TWOG_START_FREQ 2407
|
||||||
|
#define FIVEG_START_FREQ 5000
|
||||||
|
|
||||||
#define REGULATORY_CHAN_DISABLED BIT(0)
|
#define REGULATORY_CHAN_DISABLED BIT(0)
|
||||||
#define REGULATORY_CHAN_NO_IR BIT(1)
|
#define REGULATORY_CHAN_NO_IR BIT(1)
|
||||||
|
@@ -561,6 +561,21 @@ uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country,
|
|||||||
uint8_t ch_width,
|
uint8_t ch_width,
|
||||||
uint16_t behav_limit);
|
uint16_t behav_limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wlan_reg_get_band_cap_from_op_class() - Return band capability bitmap
|
||||||
|
* @country: Pointer to Country code.
|
||||||
|
* @num_of_opclass: Number of Operating class.
|
||||||
|
* @opclass: Pointer to opclass.
|
||||||
|
*
|
||||||
|
* Return supported band bitmap based on the input operating class list
|
||||||
|
* provided.
|
||||||
|
*
|
||||||
|
* Return: Return supported band capability
|
||||||
|
*/
|
||||||
|
uint8_t wlan_reg_get_band_cap_from_op_class(const uint8_t *country,
|
||||||
|
uint8_t num_of_opclass,
|
||||||
|
const uint8_t *opclass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wlan_reg_dmn_print_channels_in_opclass() - Print channels in op-class
|
* wlan_reg_dmn_print_channels_in_opclass() - Print channels in op-class
|
||||||
* @country: country alpha2
|
* @country: country alpha2
|
||||||
|
@@ -267,6 +267,14 @@ uint16_t wlan_reg_dmn_get_opclass_from_channel(uint8_t *country,
|
|||||||
offset);
|
offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t wlan_reg_get_band_cap_from_op_class(const uint8_t *country,
|
||||||
|
uint8_t num_of_opclass,
|
||||||
|
const uint8_t *opclass)
|
||||||
|
{
|
||||||
|
return reg_get_band_cap_from_op_class(country,
|
||||||
|
num_of_opclass, opclass);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country,
|
uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country,
|
||||||
qdf_freq_t freq,
|
qdf_freq_t freq,
|
||||||
uint8_t ch_width,
|
uint8_t ch_width,
|
||||||
|
Reference in New Issue
Block a user