chan.h 1.9 KB

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