Linux Audio

Check our new training course

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