Lines Matching +full:switch +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /* Copyright(c) 2020-2022 Realtek Corporation
14 switch (band) { in rtw89_get_subband_type()
17 switch (center_chan) { in rtw89_get_subband_type()
23 switch (center_chan) { in rtw89_get_subband_type()
33 switch (center_chan) { in rtw89_get_subband_type()
62 switch (bw) { in rtw89_get_primary_chan_idx()
76 offset = (primary_freq - center_freq - 10) / 20; in rtw89_get_primary_chan_idx()
79 offset = (center_freq - primary_freq - 10) / 20; in rtw89_get_primary_chan_idx()
95 chan->channel = center_chan; in rtw89_chan_create()
96 chan->primary_channel = primary_chan; in rtw89_chan_create()
97 chan->band_type = band; in rtw89_chan_create()
98 chan->band_width = bandwidth; in rtw89_chan_create()
103 chan->freq = center_freq; in rtw89_chan_create()
104 chan->subband_type = rtw89_get_subband_type(band, center_chan); in rtw89_chan_create()
105 chan->pri_ch_idx = rtw89_get_primary_chan_idx(bandwidth, center_freq, in rtw89_chan_create()
113 struct rtw89_hal *hal = &rtwdev->hal; in rtw89_assign_entity_chan()
114 struct rtw89_chan *chan = &hal->sub[idx].chan; in rtw89_assign_entity_chan()
115 struct rtw89_chan_rcd *rcd = &hal->sub[idx].rcd; in rtw89_assign_entity_chan()
118 rcd->prev_primary_channel = chan->primary_channel; in rtw89_assign_entity_chan()
119 rcd->prev_band_type = chan->band_type; in rtw89_assign_entity_chan()
120 band_changed = new->band_type != chan->band_type; in rtw89_assign_entity_chan()
121 rcd->band_changed = band_changed; in rtw89_assign_entity_chan()
132 struct rtw89_hal *hal = &rtwdev->hal; in __rtw89_config_entity_chandef()
134 hal->sub[idx].chandef = *chandef; in __rtw89_config_entity_chandef()
137 set_bit(idx, hal->entity_map); in __rtw89_config_entity_chandef()
151 struct rtw89_hal *hal = &rtwdev->hal; in rtw89_config_roc_chandef()
155 cur = atomic_cmpxchg(&hal->roc_entity_idx, in rtw89_config_roc_chandef()
163 hal->roc_chandef = *chandef; in rtw89_config_roc_chandef()
165 cur = atomic_cmpxchg(&hal->roc_entity_idx, idx, in rtw89_config_roc_chandef()
189 struct rtw89_hal *hal = &rtwdev->hal; in rtw89_entity_init()
191 bitmap_zero(hal->entity_map, NUM_OF_RTW89_SUB_ENTITY); in rtw89_entity_init()
192 atomic_set(&hal->roc_entity_idx, RTW89_SUB_ENTITY_IDLE); in rtw89_entity_init()
198 struct rtw89_hal *hal = &rtwdev->hal; in rtw89_entity_recalc()
200 enum rtw89_entity_mode mode; in rtw89_entity_recalc() local
206 weight = bitmap_weight(hal->entity_map, NUM_OF_RTW89_SUB_ENTITY); in rtw89_entity_recalc()
207 switch (weight) { in rtw89_entity_recalc()
210 bitmap_zero(hal->entity_map, NUM_OF_RTW89_SUB_ENTITY); in rtw89_entity_recalc()
217 mode = RTW89_ENTITY_MODE_SCC; in rtw89_entity_recalc()
221 mode = rtw89_get_entity_mode(rtwdev); in rtw89_entity_recalc()
222 if (mode == RTW89_ENTITY_MODE_MCC) in rtw89_entity_recalc()
225 mode = RTW89_ENTITY_MODE_MCC_PREPARE; in rtw89_entity_recalc()
240 rtw89_set_entity_mode(rtwdev, mode); in rtw89_entity_recalc()
241 return mode; in rtw89_entity_recalc()
247 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_chanctx_notify()
248 const struct rtw89_chanctx_listener *listener = chip->chanctx_listener; in rtw89_chanctx_notify()
255 if (!listener->callbacks[i]) in rtw89_chanctx_notify()
262 listener->callbacks[i](rtwdev, state); in rtw89_chanctx_notify()
268 if (rtwdev->scanning) in rtw89_mcc_start()
269 rtw89_hw_scan_abort(rtwdev, rtwdev->scan_info.scanning_vif); in rtw89_mcc_start()
288 enum rtw89_entity_mode mode; in rtw89_chanctx_work() local
291 mutex_lock(&rtwdev->mutex); in rtw89_chanctx_work()
293 mode = rtw89_get_entity_mode(rtwdev); in rtw89_chanctx_work()
294 switch (mode) { in rtw89_chanctx_work()
307 mutex_unlock(&rtwdev->mutex); in rtw89_chanctx_work()
312 enum rtw89_entity_mode mode; in rtw89_queue_chanctx_work() local
315 mode = rtw89_get_entity_mode(rtwdev); in rtw89_queue_chanctx_work()
316 switch (mode) { in rtw89_queue_chanctx_work()
325 "queue chanctx work for mode %d with delay %d us\n", in rtw89_queue_chanctx_work()
326 mode, delay); in rtw89_queue_chanctx_work()
327 ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->chanctx_work, in rtw89_queue_chanctx_work()
334 struct rtw89_hal *hal = &rtwdev->hal; in rtw89_chanctx_ops_add()
335 struct rtw89_chanctx_cfg *cfg = (struct rtw89_chanctx_cfg *)ctx->drv_priv; in rtw89_chanctx_ops_add()
336 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_chanctx_ops_add()
339 idx = find_first_zero_bit(hal->entity_map, NUM_OF_RTW89_SUB_ENTITY); in rtw89_chanctx_ops_add()
340 if (idx >= chip->support_chanctx_num) in rtw89_chanctx_ops_add()
341 return -ENOENT; in rtw89_chanctx_ops_add()
343 rtw89_config_entity_chandef(rtwdev, idx, &ctx->def); in rtw89_chanctx_ops_add()
345 cfg->idx = idx; in rtw89_chanctx_ops_add()
346 hal->sub[idx].cfg = cfg; in rtw89_chanctx_ops_add()
353 struct rtw89_hal *hal = &rtwdev->hal; in rtw89_chanctx_ops_remove()
354 struct rtw89_chanctx_cfg *cfg = (struct rtw89_chanctx_cfg *)ctx->drv_priv; in rtw89_chanctx_ops_remove()
355 enum rtw89_entity_mode mode; in rtw89_chanctx_ops_remove() local
359 drop = cfg->idx; in rtw89_chanctx_ops_remove()
363 roll = find_next_bit(hal->entity_map, NUM_OF_RTW89_SUB_ENTITY, drop + 1); in rtw89_chanctx_ops_remove()
372 hal->sub[roll].cfg->idx = RTW89_SUB_ENTITY_0; in rtw89_chanctx_ops_remove()
373 hal->sub[RTW89_SUB_ENTITY_0] = hal->sub[roll]; in rtw89_chanctx_ops_remove()
376 if (rtwvif->sub_entity_idx == roll) in rtw89_chanctx_ops_remove()
377 rtwvif->sub_entity_idx = RTW89_SUB_ENTITY_0; in rtw89_chanctx_ops_remove()
380 atomic_cmpxchg(&hal->roc_entity_idx, roll, RTW89_SUB_ENTITY_0); in rtw89_chanctx_ops_remove()
385 mode = rtw89_get_entity_mode(rtwdev); in rtw89_chanctx_ops_remove()
386 switch (mode) { in rtw89_chanctx_ops_remove()
394 clear_bit(drop, hal->entity_map); in rtw89_chanctx_ops_remove()
402 struct rtw89_chanctx_cfg *cfg = (struct rtw89_chanctx_cfg *)ctx->drv_priv; in rtw89_chanctx_ops_change()
403 u8 idx = cfg->idx; in rtw89_chanctx_ops_change()
406 rtw89_config_entity_chandef(rtwdev, idx, &ctx->def); in rtw89_chanctx_ops_change()
415 struct rtw89_chanctx_cfg *cfg = (struct rtw89_chanctx_cfg *)ctx->drv_priv; in rtw89_chanctx_ops_assign_vif()
417 rtwvif->sub_entity_idx = cfg->idx; in rtw89_chanctx_ops_assign_vif()
425 rtwvif->sub_entity_idx = RTW89_SUB_ENTITY_0; in rtw89_chanctx_ops_unassign_vif()