diff --git a/target_if/init_deinit/src/init_cmd_api.c b/target_if/init_deinit/src/init_cmd_api.c index 93f85be0ab6c..7228a55392ad 100644 --- a/target_if/init_deinit/src/init_cmd_api.c +++ b/target_if/init_deinit/src/init_cmd_api.c @@ -32,6 +32,7 @@ #include #include #include +#include /** * init_deinit_alloc_host_mem_chunk() - allocates chunk of memory requested @@ -462,6 +463,12 @@ void init_deinit_prepare_send_init_cmd( init_deinit_derive_band_to_mac_param(psoc, tgt_hdl, init_param.band_to_mac); + } else { + ret_val = tgt_if_regulatory_modify_freq_range(psoc); + if (QDF_IS_STATUS_ERROR(ret_val)) { + target_if_err("Modify freq range is failed"); + return; + } } ret_val = target_if_alloc_pdevs(psoc, tgt_hdl); diff --git a/target_if/regulatory/inc/target_if_reg.h b/target_if/regulatory/inc/target_if_reg.h index c0cf63c40fa8..60a5c78c4fd7 100644 --- a/target_if/regulatory/inc/target_if_reg.h +++ b/target_if/regulatory/inc/target_if_reg.h @@ -41,4 +41,9 @@ QDF_STATUS target_if_register_regulatory_tx_ops(struct wlan_lmac_if_tx_ops */ QDF_STATUS target_if_reg_set_offloaded_info(struct wlan_objmgr_psoc *psoc); +/** + * tgt_if_regulatory_modify_freq_range() - Modify low and high freq ranges based + * on wireless mode. + */ +QDF_STATUS tgt_if_regulatory_modify_freq_range(struct wlan_objmgr_psoc *psoc); #endif /* __TARGET_IF_REG_H__ */ diff --git a/target_if/regulatory/src/target_if_reg.c b/target_if/regulatory/src/target_if_reg.c index ec50a3aa61bd..c1aceb9efd3f 100644 --- a/target_if/regulatory/src/target_if_reg.c +++ b/target_if/regulatory/src/target_if_reg.c @@ -29,6 +29,7 @@ #include #include #include +#include static inline uint32_t get_chan_list_cc_event_id(void) { @@ -334,6 +335,37 @@ static QDF_STATUS tgt_if_regulatory_stop_11d_scan( reg_stop_11d_scan_req); } +QDF_STATUS tgt_if_regulatory_modify_freq_range(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap; + + reg_cap = ucfg_reg_get_hal_reg_cap(psoc); + if (!reg_cap) { + target_if_err("reg cap is NULL"); + return QDF_STATUS_E_FAILURE; + } + + if (!(reg_cap->wireless_modes & WMI_HOST_REGDMN_MODE_11A)) { + reg_cap->low_5ghz_chan = 0; + reg_cap->high_5ghz_chan = 0; + } + + if (!(reg_cap->wireless_modes & + (WMI_HOST_REGDMN_MODE_11B | WMI_HOST_REGDMN_MODE_PUREG))) { + reg_cap->low_2ghz_chan = 0; + reg_cap->high_2ghz_chan = 0; + } + + target_if_info( + "phy_id = %d - low_2ghz_chan = %d high_2ghz_chan = %d low_5ghz_chan = %d high_5ghz_chan = %d", + reg_cap->phy_id, + reg_cap->low_2ghz_chan, + reg_cap->high_2ghz_chan, + reg_cap->low_5ghz_chan, + reg_cap->high_5ghz_chan); + + return QDF_STATUS_SUCCESS; +} QDF_STATUS target_if_register_regulatory_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)