diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index 7551cc154e..b51768c594 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -221,19 +221,24 @@ static const struct bonded_channel_freq bonded_chan_320mhz_list_freq[] = { #endif /*CONFIG_CHAN_FREQ_API*/ -static const enum phy_ch_width get_next_lower_bw[] = { +enum phy_ch_width get_next_lower_bandwidth(enum phy_ch_width ch_width) +{ + static const enum phy_ch_width get_next_lower_bw[] = { /* 80+80 mode not supported in chips that support 320 mode */ #ifdef WLAN_FEATURE_11BE - [CH_WIDTH_320MHZ] = CH_WIDTH_160MHZ, + [CH_WIDTH_320MHZ] = CH_WIDTH_160MHZ, #endif - [CH_WIDTH_80P80MHZ] = CH_WIDTH_160MHZ, - [CH_WIDTH_160MHZ] = CH_WIDTH_80MHZ, - [CH_WIDTH_80MHZ] = CH_WIDTH_40MHZ, - [CH_WIDTH_40MHZ] = CH_WIDTH_20MHZ, - [CH_WIDTH_20MHZ] = CH_WIDTH_10MHZ, - [CH_WIDTH_10MHZ] = CH_WIDTH_5MHZ, - [CH_WIDTH_5MHZ] = CH_WIDTH_INVALID -}; + [CH_WIDTH_80P80MHZ] = CH_WIDTH_160MHZ, + [CH_WIDTH_160MHZ] = CH_WIDTH_80MHZ, + [CH_WIDTH_80MHZ] = CH_WIDTH_40MHZ, + [CH_WIDTH_40MHZ] = CH_WIDTH_20MHZ, + [CH_WIDTH_20MHZ] = CH_WIDTH_10MHZ, + [CH_WIDTH_10MHZ] = CH_WIDTH_5MHZ, + [CH_WIDTH_5MHZ] = CH_WIDTH_INVALID + }; + + return get_next_lower_bw[ch_width]; +} const struct chan_map channel_map_us[NUM_CHANNELS] = { [CHAN_ENUM_2412] = {2412, 1, 20, 40}, @@ -1393,9 +1398,8 @@ enum channel_state reg_get_2g_bonded_channel_state( * * Return: Channel state */ -static enum channel_state reg_combine_channel_states( - enum channel_state chan_state1, - enum channel_state chan_state2) +enum channel_state reg_combine_channel_states(enum channel_state chan_state1, + enum channel_state chan_state2) { if ((chan_state1 == CHANNEL_STATE_INVALID) || (chan_state2 == CHANNEL_STATE_INVALID)) @@ -1483,7 +1487,8 @@ static void reg_set_5g_channel_params(struct wlan_objmgr_pdev *pdev, break; } update_bw: - ch_params->ch_width = get_next_lower_bw[ch_params->ch_width]; + ch_params->ch_width = + get_next_lower_bandwidth(ch_params->ch_width); } if (ch_params->ch_width == CH_WIDTH_160MHZ) { @@ -1550,7 +1555,8 @@ static void reg_set_2g_channel_params(struct wlan_objmgr_pdev *pdev, break; } - ch_params->ch_width = get_next_lower_bw[ch_params->ch_width]; + ch_params->ch_width = + get_next_lower_bandwidth(ch_params->ch_width); } /* Overwrite center_freq_seg1 to 0 for 2.4 Ghz */ ch_params->center_freq_seg1 = 0; @@ -3897,7 +3903,8 @@ static void reg_set_5g_channel_params_for_freq(struct wlan_objmgr_pdev *pdev, break; } update_bw: - ch_params->ch_width = get_next_lower_bw[ch_params->ch_width]; + ch_params->ch_width = + get_next_lower_bandwidth(ch_params->ch_width); } if (ch_params->ch_width == CH_WIDTH_160MHZ) { @@ -3926,18 +3933,10 @@ update_bw: } } -/** - * reg_set_2g_channel_params_for_freq() - set the 2.4G bonded channel parameters - * @oper_freq: operating channel - * @ch_params: channel parameters - * @sec_ch_2g_freq: 2.4G secondary channel - * - * Return: void - */ -static void reg_set_2g_channel_params_for_freq(struct wlan_objmgr_pdev *pdev, - uint16_t oper_freq, - struct ch_params *ch_params, - uint16_t sec_ch_2g_freq) +void reg_set_2g_channel_params_for_freq(struct wlan_objmgr_pdev *pdev, + uint16_t oper_freq, + struct ch_params *ch_params, + uint16_t sec_ch_2g_freq) { enum channel_state chan_state = CHANNEL_STATE_ENABLE; struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; @@ -4011,7 +4010,8 @@ static void reg_set_2g_channel_params_for_freq(struct wlan_objmgr_pdev *pdev, break; } update_bw: - ch_params->ch_width = get_next_lower_bw[ch_params->ch_width]; + ch_params->ch_width = + get_next_lower_bandwidth(ch_params->ch_width); } /* Overwrite mhz_freq_seg1 and center_freq_seg1 to 0 for 2.4 Ghz */ ch_params->mhz_freq_seg1 = 0; diff --git a/umac/regulatory/core/src/reg_services_common.h b/umac/regulatory/core/src/reg_services_common.h index 96ab90a932..c1a9d034d5 100644 --- a/umac/regulatory/core/src/reg_services_common.h +++ b/umac/regulatory/core/src/reg_services_common.h @@ -144,6 +144,13 @@ extern const struct chan_map channel_map_global[]; #ifdef WLAN_FEATURE_11BE #define ALL_SCHANS_PUNC 0x0000 /* all subchannels punctured */ #endif +/** + * get_next_lower_bandwidth() - Get next lower bandwidth + * @ch_width: Channel width + * + * Return: Channel width + */ +enum phy_ch_width get_next_lower_bandwidth(enum phy_ch_width ch_width); #ifdef CONFIG_CHAN_NUM_API /** @@ -1611,6 +1618,29 @@ bool reg_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc); const struct bonded_channel_freq * reg_get_bonded_chan_entry(qdf_freq_t freq, enum phy_ch_width chwidth); +/** + * reg_set_2g_channel_params_for_freq() - set the 2.4G bonded channel parameters + * @oper_freq: operating channel + * @ch_params: channel parameters + * @sec_ch_2g_freq: 2.4G secondary channel + * + * Return: void + */ +void reg_set_2g_channel_params_for_freq(struct wlan_objmgr_pdev *pdev, + uint16_t oper_freq, + struct ch_params *ch_params, + uint16_t sec_ch_2g_freq); + +/** + * reg_combine_channel_states() - Get minimum of channel state1 and state2 + * @chan_state1: Channel state1 + * @chan_state2: Channel state2 + * + * Return: Channel state + */ +enum channel_state reg_combine_channel_states(enum channel_state chan_state1, + enum channel_state chan_state2); + #if defined(CONFIG_BAND_6GHZ) && defined(CONFIG_REG_CLIENT) /** * reg_set_lower_6g_edge_ch_supp() - Set if lower 6ghz edge channel is