spectral.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* SPDX-License-Identifier: BSD-3-Clause-Clear */
  2. /*
  3. * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef ATH11K_SPECTRAL_H
  6. #define ATH11K_SPECTRAL_H
  7. #include "../spectral_common.h"
  8. #include "dbring.h"
  9. /* enum ath11k_spectral_mode:
  10. *
  11. * @SPECTRAL_DISABLED: spectral mode is disabled
  12. * @SPECTRAL_BACKGROUND: hardware sends samples when it is not busy with
  13. * something else.
  14. * @SPECTRAL_MANUAL: spectral scan is enabled, triggering for samples
  15. * is performed manually.
  16. */
  17. enum ath11k_spectral_mode {
  18. ATH11K_SPECTRAL_DISABLED = 0,
  19. ATH11K_SPECTRAL_BACKGROUND,
  20. ATH11K_SPECTRAL_MANUAL,
  21. };
  22. struct ath11k_spectral {
  23. struct ath11k_dbring rx_ring;
  24. /* Protects enabled */
  25. spinlock_t lock;
  26. struct rchan *rfs_scan; /* relay(fs) channel for spectral scan */
  27. struct dentry *scan_ctl;
  28. struct dentry *scan_count;
  29. struct dentry *scan_bins;
  30. enum ath11k_spectral_mode mode;
  31. u16 count;
  32. u8 fft_size;
  33. bool enabled;
  34. bool is_primary;
  35. };
  36. #ifdef CONFIG_ATH11K_SPECTRAL
  37. int ath11k_spectral_init(struct ath11k_base *ab);
  38. void ath11k_spectral_deinit(struct ath11k_base *ab);
  39. int ath11k_spectral_vif_stop(struct ath11k_vif *arvif);
  40. void ath11k_spectral_reset_buffer(struct ath11k *ar);
  41. enum ath11k_spectral_mode ath11k_spectral_get_mode(struct ath11k *ar);
  42. struct ath11k_dbring *ath11k_spectral_get_dbring(struct ath11k *ar);
  43. #else
  44. static inline int ath11k_spectral_init(struct ath11k_base *ab)
  45. {
  46. return 0;
  47. }
  48. static inline void ath11k_spectral_deinit(struct ath11k_base *ab)
  49. {
  50. }
  51. static inline int ath11k_spectral_vif_stop(struct ath11k_vif *arvif)
  52. {
  53. return 0;
  54. }
  55. static inline void ath11k_spectral_reset_buffer(struct ath11k *ar)
  56. {
  57. }
  58. static inline
  59. enum ath11k_spectral_mode ath11k_spectral_get_mode(struct ath11k *ar)
  60. {
  61. return ATH11K_SPECTRAL_DISABLED;
  62. }
  63. static inline
  64. struct ath11k_dbring *ath11k_spectral_get_dbring(struct ath11k *ar)
  65. {
  66. return NULL;
  67. }
  68. #endif /* CONFIG_ATH11K_SPECTRAL */
  69. #endif /* ATH11K_SPECTRAL_H */