diff options
| author | Arif Hussain <arifhussain@codeaurora.org> | 2016-10-12 13:42:43 -0700 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2016-10-17 22:41:25 -0700 |
| commit | d9445780766121dfe5df2c0efdafc75644a208e1 (patch) | |
| tree | 3ad9cb96a188ac97c28a0548c369d4798355c98d | |
| parent | 97d2b8f0d92b241d3bafede941ae97917d890868 (diff) | |
qcacld-3.0: Add helper function cds_combine_channel_states
cds_combine_channel_states to select final channel state based
on the two channel states specially when operating on 80+80 MHZ.
Change-Id: I5f470c96ce499c8d9aa2e41ceff59cdfc2f31151
CRs-Fixed: 1075098
| -rw-r--r-- | core/cds/src/cds_reg_service.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/core/cds/src/cds_reg_service.c b/core/cds/src/cds_reg_service.c index 302c670c0aca..9b6b00d8d079 100644 --- a/core/cds/src/cds_reg_service.c +++ b/core/cds/src/cds_reg_service.c @@ -436,6 +436,23 @@ enum channel_state cds_get_5g_bonded_channel_state( return CHANNEL_STATE_DISABLE; } +/** + * cds_combine_channel_states() - combine channel states + * @chan_state1: channel state1 + * @chan_state2: channel state2 + * + * Return: enum channel_state + */ + static enum channel_state cds_combine_channel_states( + enum channel_state chan_state1, + enum channel_state chan_state2) +{ + if ((CHANNEL_STATE_INVALID == chan_state1) || + (CHANNEL_STATE_INVALID == chan_state2)) + return CHANNEL_STATE_INVALID; + else + return min(chan_state1, chan_state2); +} /** * cds_set_5g_channel_params() - set the 5G bonded channel parameters @@ -456,6 +473,8 @@ static void cds_set_5g_channel_params(uint16_t oper_ch, ch_params->ch_width = CH_WIDTH_80P80MHZ; while (ch_params->ch_width != CH_WIDTH_INVALID) { + bonded_chan_ptr = NULL; + bonded_chan_ptr2 = NULL; chan_state = cds_search_5g_bonded_channel(oper_ch, ch_params->ch_width, &bonded_chan_ptr); @@ -468,14 +487,16 @@ static void cds_set_5g_channel_params(uint16_t oper_ch, ch_params->center_freq_seg1 - 2, CH_WIDTH_80MHZ); - if (chan_state2 < chan_state) - chan_state = chan_state2; + chan_state = cds_combine_channel_states(chan_state, + chan_state2); + if ((CHANNEL_STATE_ENABLE == chan_state) || (CHANNEL_STATE_DFS == chan_state)) { if (CH_WIDTH_20MHZ >= ch_params->ch_width) { ch_params->sec_ch_offset = PHY_SINGLE_CHANNEL_CENTERED; ch_params->center_freq_seg0 = oper_ch; + break; } else if (CH_WIDTH_40MHZ <= ch_params->ch_width) { cds_search_5g_bonded_chan_array(oper_ch, bonded_chan_40mhz_array, @@ -493,9 +514,9 @@ static void cds_set_5g_channel_params(uint16_t oper_ch, ch_params->center_freq_seg0 = (bonded_chan_ptr->start_ch + bonded_chan_ptr->end_ch)/2; + break; } } - break; } ch_params->ch_width = next_lower_bw[ch_params->ch_width]; } |
