qcacmn: Add API to get 2GHz/5GHz freq range and wireless modes

Offload layer uses low and high 2GHz/5GHz freq ranges and chip
supported wireless modes to populate umac ic channel list.

Change-Id: I899edd83548d68e67659b3a9273ddaaaf740540b
CRs-Fixed: 2047212
This commit is contained in:
Baila, Shashikala Prabhu 2017-05-23 11:54:45 +05:30 • committed by snandini
commit bc3efea885
8 changed files with 88 additions and 12 deletions

View file

@ -211,6 +211,9 @@ static void target_if_sptrl_tx_ops_register(
static
QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
{
/* call regulatory callback to register tx ops */
target_if_register_regulatory_tx_ops(tx_ops);
/* call umac callback to register legacy tx ops */
wlan_lmac_if_umac_tx_ops_register(tx_ops);
@ -227,9 +230,6 @@ QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
target_if_dfs_tx_ops_register(tx_ops);
/* call regulatory callback to register tx ops */
target_if_register_regulatory_tx_ops(tx_ops);
target_if_son_tx_ops_register(tx_ops);
target_if_tdls_tx_ops_register(tx_ops);

View file

@ -148,6 +148,9 @@ QDF_STATUS target_if_register_regulatory_tx_ops(struct wlan_lmac_if_tx_ops
tgt_if_regulatory_unregister_master_list_handler;
reg_ops->set_country_code = tgt_if_regulatory_set_country_code;
reg_ops->fill_umac_legacy_chanlist = NULL;
return QDF_STATUS_SUCCESS;
}

View file

@ -544,6 +544,8 @@ struct wlan_lmac_if_reg_tx_ops {
void *arg);
QDF_STATUS (*set_country_code)(struct wlan_objmgr_psoc *psoc,
void *arg);
QDF_STATUS (*fill_umac_legacy_chanlist)(struct wlan_objmgr_pdev *pdev,
struct regulatory_channel *cur_chan_list);
};
/**

View file

@ -212,6 +212,9 @@ static inline QDF_STATUS reg_get_reginfo_form_country_code_and_regdmn_pair(
g_all_countries[country_index].alpha2_11d,
sizeof(g_all_countries[country_index].alpha2_11d));
reg_info->ctry_code =
g_all_countries[country_index].country_code;
reg_info->reg_dmn_pair = 0;
reg_info->dfs_region = regdomains_5g[dmn_id_5g].dfs_region;
reg_info->phybitmap =
g_all_countries[country_index].phymode_bitmap;
@ -276,6 +279,9 @@ static inline QDF_STATUS reg_get_reginfo_form_regdmn_pair(
qdf_mem_zero(reg_info->alpha2, sizeof(reg_info->alpha2));
reg_info->reg_dmn_pair =
g_reg_dmn_pairs[regdmn_pair].reg_dmn_pair_id;
reg_info->ctry_code = 0;
reg_info->dfs_region = regdomains_5g[dmn_id_5g].dfs_region;
reg_info->phybitmap = 0;

View file

@ -84,6 +84,7 @@ struct wlan_regulatory_pdev_priv_obj {
bool set_fcc_channel;
enum band_info band_capability;
bool indoor_chan_enabled;
uint32_t wireless_modes;
};
#endif

View file

@ -1716,6 +1716,7 @@ static void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc,
struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
enum direction *dir = arg;
struct wlan_lmac_if_reg_tx_ops *reg_tx_ops;
wlan_psoc_obj_lock(psoc);
psoc_priv_obj = (struct wlan_regulatory_psoc_priv_obj *)
@ -1740,6 +1741,11 @@ static void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc,
compute_pdev_current_chan_list(pdev_priv_obj);
reg_tx_ops = reg_get_psoc_tx_ops(psoc);
if(reg_tx_ops->fill_umac_legacy_chanlist)
reg_tx_ops->fill_umac_legacy_chanlist(pdev,
pdev_priv_obj->cur_chan_list);
if (*dir == NORTHBOUND)
send_scheduler_msg_nb(psoc, pdev);
else
@ -2171,6 +2177,7 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification(
pdev_priv_obj->range_2g_high = range_2g_high;
pdev_priv_obj->range_5g_low = range_5g_low;
pdev_priv_obj->range_5g_high = range_5g_high;
pdev_priv_obj->wireless_modes = reg_cap_ptr->wireless_modes;
init_pdev_chan_list(psoc_priv_obj,
pdev_priv_obj);
@ -2669,15 +2676,6 @@ QDF_STATUS reg_program_chan_list(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_FAILURE;
}
if (rd->flags == CC_IS_SET ||
rd->flags == ALPHA_IS_SET) {
soc_reg->ctry_code =
g_all_countries[country_index].country_code;
}
if (rd->flags == REGDMN_IS_SET)
soc_reg->reg_dmn_pair = rd->cc.regdmn_id;
reg_info->offload_enabled = false;
reg_process_master_chan_list(reg_info);

View file

@ -360,4 +360,29 @@ void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
reg_chan_change_callback cbk);
/**
* wlan_reg_get_chip_mode() - get supported chip mode
* @pdev: pdev pointer
* @chip_mode: chip mode
*
* Return: QDF STATUS
*/
QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev,
uint32_t *chip_mode);
/**
* wlan_reg_get_freq_range() - Get 2GHz and 5GHz frequency range
* @pdev: pdev pointer
* @low_2g: low 2GHz frequency range
* @high_2g: high 2GHz frequency range
* @low_5g: low 5GHz frequency range
* @high_5g: high 5GHz frequency range
*
* Return: QDF status
*/
QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev,
uint32_t *low_2g,
uint32_t *high_2g,
uint32_t *low_5g,
uint32_t *high_5g);
#endif

View file

@ -409,3 +409,44 @@ void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
}
QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev,
uint32_t *chip_mode)
{
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
WLAN_UMAC_COMP_REGULATORY);
if (NULL == pdev_priv_obj) {
reg_err("reg pdev private obj is NULL");
return QDF_STATUS_E_FAULT;
}
*chip_mode = pdev_priv_obj->wireless_modes;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev,
uint32_t *low_2g,
uint32_t *high_2g,
uint32_t *low_5g,
uint32_t *high_5g)
{
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
WLAN_UMAC_COMP_REGULATORY);
if (NULL == pdev_priv_obj) {
reg_err("reg pdev private obj is NULL");
return QDF_STATUS_E_FAULT;
}
*low_2g = pdev_priv_obj->range_2g_low;
*high_2g = pdev_priv_obj->range_2g_high;
*low_5g = pdev_priv_obj->range_5g_low;
*high_5g = pdev_priv_obj->range_5g_high;
return QDF_STATUS_SUCCESS;
}