1967439c7SZong-Zhe Yang /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2967439c7SZong-Zhe Yang  * Copyright(c) 2020-2022  Realtek Corporation
3967439c7SZong-Zhe Yang  */
4967439c7SZong-Zhe Yang 
5967439c7SZong-Zhe Yang #ifndef __RTW89_CHAN_H__
6967439c7SZong-Zhe Yang #define __RTW89_CHAN_H__
7967439c7SZong-Zhe Yang 
8967439c7SZong-Zhe Yang #include "core.h"
9967439c7SZong-Zhe Yang 
10967439c7SZong-Zhe Yang static inline bool rtw89_get_entity_state(struct rtw89_dev *rtwdev)
11967439c7SZong-Zhe Yang {
12967439c7SZong-Zhe Yang 	struct rtw89_hal *hal = &rtwdev->hal;
13967439c7SZong-Zhe Yang 
14967439c7SZong-Zhe Yang 	return READ_ONCE(hal->entity_active);
15967439c7SZong-Zhe Yang }
16967439c7SZong-Zhe Yang 
17967439c7SZong-Zhe Yang static inline void rtw89_set_entity_state(struct rtw89_dev *rtwdev, bool active)
18967439c7SZong-Zhe Yang {
19967439c7SZong-Zhe Yang 	struct rtw89_hal *hal = &rtwdev->hal;
20967439c7SZong-Zhe Yang 
21967439c7SZong-Zhe Yang 	WRITE_ONCE(hal->entity_active, active);
22967439c7SZong-Zhe Yang }
23967439c7SZong-Zhe Yang 
24*7cf674ffSZong-Zhe Yang static inline
25*7cf674ffSZong-Zhe Yang enum rtw89_entity_mode rtw89_get_entity_mode(struct rtw89_dev *rtwdev)
26*7cf674ffSZong-Zhe Yang {
27*7cf674ffSZong-Zhe Yang 	struct rtw89_hal *hal = &rtwdev->hal;
28*7cf674ffSZong-Zhe Yang 
29*7cf674ffSZong-Zhe Yang 	return READ_ONCE(hal->entity_mode);
30*7cf674ffSZong-Zhe Yang }
31*7cf674ffSZong-Zhe Yang 
32*7cf674ffSZong-Zhe Yang static inline void rtw89_set_entity_mode(struct rtw89_dev *rtwdev,
33*7cf674ffSZong-Zhe Yang 					 enum rtw89_entity_mode mode)
34*7cf674ffSZong-Zhe Yang {
35*7cf674ffSZong-Zhe Yang 	struct rtw89_hal *hal = &rtwdev->hal;
36*7cf674ffSZong-Zhe Yang 
37*7cf674ffSZong-Zhe Yang 	WRITE_ONCE(hal->entity_mode, mode);
38*7cf674ffSZong-Zhe Yang }
39*7cf674ffSZong-Zhe Yang 
40bb8152b3SZong-Zhe Yang void rtw89_chan_create(struct rtw89_chan *chan, u8 center_chan, u8 primary_chan,
41bb8152b3SZong-Zhe Yang 		       enum rtw89_band band, enum rtw89_bandwidth bandwidth);
42cbb145b9SZong-Zhe Yang bool rtw89_assign_entity_chan(struct rtw89_dev *rtwdev,
43cbb145b9SZong-Zhe Yang 			      enum rtw89_sub_entity_idx idx,
44cbb145b9SZong-Zhe Yang 			      const struct rtw89_chan *new);
45494399b2SZong-Zhe Yang void rtw89_config_entity_chandef(struct rtw89_dev *rtwdev,
46494399b2SZong-Zhe Yang 				 enum rtw89_sub_entity_idx idx,
47494399b2SZong-Zhe Yang 				 const struct cfg80211_chan_def *chandef);
48a88b6cc4SZong-Zhe Yang void rtw89_entity_init(struct rtw89_dev *rtwdev);
49*7cf674ffSZong-Zhe Yang enum rtw89_entity_mode rtw89_entity_recalc(struct rtw89_dev *rtwdev);
50cbb145b9SZong-Zhe Yang 
51967439c7SZong-Zhe Yang #endif
52