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