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
This commit is contained in:
Arif Hussain
2016-10-12 13:42:43 -07:00
committed by qcabuildsw
parent 97d2b8f0d9
commit d944578076

View File

@@ -436,6 +436,23 @@ enum channel_state cds_get_5g_bonded_channel_state(
return CHANNEL_STATE_DISABLE; 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 * 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; ch_params->ch_width = CH_WIDTH_80P80MHZ;
while (ch_params->ch_width != CH_WIDTH_INVALID) { 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, chan_state = cds_search_5g_bonded_channel(oper_ch,
ch_params->ch_width, ch_params->ch_width,
&bonded_chan_ptr); &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_params->center_freq_seg1 - 2,
CH_WIDTH_80MHZ); CH_WIDTH_80MHZ);
if (chan_state2 < chan_state) chan_state = cds_combine_channel_states(chan_state,
chan_state = chan_state2; chan_state2);
if ((CHANNEL_STATE_ENABLE == chan_state) || if ((CHANNEL_STATE_ENABLE == chan_state) ||
(CHANNEL_STATE_DFS == chan_state)) { (CHANNEL_STATE_DFS == chan_state)) {
if (CH_WIDTH_20MHZ >= ch_params->ch_width) { if (CH_WIDTH_20MHZ >= ch_params->ch_width) {
ch_params->sec_ch_offset ch_params->sec_ch_offset
= PHY_SINGLE_CHANNEL_CENTERED; = PHY_SINGLE_CHANNEL_CENTERED;
ch_params->center_freq_seg0 = oper_ch; ch_params->center_freq_seg0 = oper_ch;
break;
} else if (CH_WIDTH_40MHZ <= ch_params->ch_width) { } else if (CH_WIDTH_40MHZ <= ch_params->ch_width) {
cds_search_5g_bonded_chan_array(oper_ch, cds_search_5g_bonded_chan_array(oper_ch,
bonded_chan_40mhz_array, bonded_chan_40mhz_array,
@@ -493,10 +514,10 @@ static void cds_set_5g_channel_params(uint16_t oper_ch,
ch_params->center_freq_seg0 = ch_params->center_freq_seg0 =
(bonded_chan_ptr->start_ch + (bonded_chan_ptr->start_ch +
bonded_chan_ptr->end_ch)/2; bonded_chan_ptr->end_ch)/2;
}
}
break; break;
} }
}
}
ch_params->ch_width = next_lower_bw[ch_params->ch_width]; ch_params->ch_width = next_lower_bw[ch_params->ch_width];
} }
if (CH_WIDTH_160MHZ == ch_params->ch_width) { if (CH_WIDTH_160MHZ == ch_params->ch_width) {