rtw89: include subband type in channel params
Make stuffs related to channel be collected in channel_params, and encapsulate the corresponding decision in get_channel_params(). Then, functions that takes channel_params can also notice subband type. Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220113011042.6705-2-pkshih@realtek.com
This commit is contained in:
committed by
Kalle Valo
parent
0237f65aa6
commit
e0925375b2
@@ -232,6 +232,7 @@ static void rtw89_get_channel_params(struct cfg80211_chan_def *chandef,
|
|||||||
u8 bandwidth = RTW89_CHANNEL_WIDTH_20;
|
u8 bandwidth = RTW89_CHANNEL_WIDTH_20;
|
||||||
u8 primary_chan_idx = 0;
|
u8 primary_chan_idx = 0;
|
||||||
u8 band;
|
u8 band;
|
||||||
|
u8 subband;
|
||||||
|
|
||||||
center_chan = channel->hw_value;
|
center_chan = channel->hw_value;
|
||||||
primary_freq = channel->center_freq;
|
primary_freq = channel->center_freq;
|
||||||
@@ -291,11 +292,28 @@ static void rtw89_get_channel_params(struct cfg80211_chan_def *chandef,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (center_chan) {
|
||||||
|
default:
|
||||||
|
case 1 ... 14:
|
||||||
|
subband = RTW89_CH_2G;
|
||||||
|
break;
|
||||||
|
case 36 ... 64:
|
||||||
|
subband = RTW89_CH_5G_BAND_1;
|
||||||
|
break;
|
||||||
|
case 100 ... 144:
|
||||||
|
subband = RTW89_CH_5G_BAND_3;
|
||||||
|
break;
|
||||||
|
case 149 ... 177:
|
||||||
|
subband = RTW89_CH_5G_BAND_4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
chan_param->center_chan = center_chan;
|
chan_param->center_chan = center_chan;
|
||||||
chan_param->primary_chan = channel->hw_value;
|
chan_param->primary_chan = channel->hw_value;
|
||||||
chan_param->bandwidth = bandwidth;
|
chan_param->bandwidth = bandwidth;
|
||||||
chan_param->pri_ch_idx = primary_chan_idx;
|
chan_param->pri_ch_idx = primary_chan_idx;
|
||||||
chan_param->band_type = band;
|
chan_param->band_type = band;
|
||||||
|
chan_param->subband_type = subband;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtw89_set_channel(struct rtw89_dev *rtwdev)
|
void rtw89_set_channel(struct rtw89_dev *rtwdev)
|
||||||
@@ -322,21 +340,7 @@ void rtw89_set_channel(struct rtw89_dev *rtwdev)
|
|||||||
hal->prev_primary_channel = hal->current_primary_channel;
|
hal->prev_primary_channel = hal->current_primary_channel;
|
||||||
hal->current_primary_channel = ch_param.primary_chan;
|
hal->current_primary_channel = ch_param.primary_chan;
|
||||||
hal->current_band_type = ch_param.band_type;
|
hal->current_band_type = ch_param.band_type;
|
||||||
|
hal->current_subband = ch_param.subband_type;
|
||||||
switch (center_chan) {
|
|
||||||
case 1 ... 14:
|
|
||||||
hal->current_subband = RTW89_CH_2G;
|
|
||||||
break;
|
|
||||||
case 36 ... 64:
|
|
||||||
hal->current_subband = RTW89_CH_5G_BAND_1;
|
|
||||||
break;
|
|
||||||
case 100 ... 144:
|
|
||||||
hal->current_subband = RTW89_CH_5G_BAND_3;
|
|
||||||
break;
|
|
||||||
case 149 ... 177:
|
|
||||||
hal->current_subband = RTW89_CH_5G_BAND_4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
rtw89_chip_set_channel_prepare(rtwdev, &bak);
|
rtw89_chip_set_channel_prepare(rtwdev, &bak);
|
||||||
|
|
||||||
|
|||||||
@@ -570,6 +570,7 @@ struct rtw89_channel_params {
|
|||||||
u8 bandwidth;
|
u8 bandwidth;
|
||||||
u8 pri_ch_idx;
|
u8 pri_ch_idx;
|
||||||
u8 band_type;
|
u8 band_type;
|
||||||
|
u8 subband_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rtw89_channel_help_params {
|
struct rtw89_channel_help_params {
|
||||||
|
|||||||
Reference in New Issue
Block a user