1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2 * Copyright(c) 2020-2022 Realtek Corporation 3 */ 4 5 #ifndef __RTW89_CHAN_H__ 6 #define __RTW89_CHAN_H__ 7 8 #include "core.h" 9 10 static inline bool rtw89_get_entity_state(struct rtw89_dev *rtwdev) 11 { 12 struct rtw89_hal *hal = &rtwdev->hal; 13 14 return READ_ONCE(hal->entity_active); 15 } 16 17 static inline void rtw89_set_entity_state(struct rtw89_dev *rtwdev, bool active) 18 { 19 struct rtw89_hal *hal = &rtwdev->hal; 20 21 WRITE_ONCE(hal->entity_active, active); 22 } 23 24 static inline 25 enum rtw89_entity_mode rtw89_get_entity_mode(struct rtw89_dev *rtwdev) 26 { 27 struct rtw89_hal *hal = &rtwdev->hal; 28 29 return READ_ONCE(hal->entity_mode); 30 } 31 32 static inline void rtw89_set_entity_mode(struct rtw89_dev *rtwdev, 33 enum rtw89_entity_mode mode) 34 { 35 struct rtw89_hal *hal = &rtwdev->hal; 36 37 WRITE_ONCE(hal->entity_mode, mode); 38 } 39 40 void rtw89_chan_create(struct rtw89_chan *chan, u8 center_chan, u8 primary_chan, 41 enum rtw89_band band, enum rtw89_bandwidth bandwidth); 42 bool rtw89_assign_entity_chan(struct rtw89_dev *rtwdev, 43 enum rtw89_sub_entity_idx idx, 44 const struct rtw89_chan *new); 45 void rtw89_config_entity_chandef(struct rtw89_dev *rtwdev, 46 enum rtw89_sub_entity_idx idx, 47 const struct cfg80211_chan_def *chandef); 48 void rtw89_entity_init(struct rtw89_dev *rtwdev); 49 enum rtw89_entity_mode rtw89_entity_recalc(struct rtw89_dev *rtwdev); 50 int rtw89_chanctx_ops_add(struct rtw89_dev *rtwdev, 51 struct ieee80211_chanctx_conf *ctx); 52 void rtw89_chanctx_ops_remove(struct rtw89_dev *rtwdev, 53 struct ieee80211_chanctx_conf *ctx); 54 void rtw89_chanctx_ops_change(struct rtw89_dev *rtwdev, 55 struct ieee80211_chanctx_conf *ctx, 56 u32 changed); 57 int rtw89_chanctx_ops_assign_vif(struct rtw89_dev *rtwdev, 58 struct rtw89_vif *rtwvif, 59 struct ieee80211_chanctx_conf *ctx); 60 void rtw89_chanctx_ops_unassign_vif(struct rtw89_dev *rtwdev, 61 struct rtw89_vif *rtwvif, 62 struct ieee80211_chanctx_conf *ctx); 63 64 #endif 65