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