18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: BSD-3-Clause-Clear */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef ATH11K_SPECTRAL_H
78c2ecf20Sopenharmony_ci#define ATH11K_SPECTRAL_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include "../spectral_common.h"
108c2ecf20Sopenharmony_ci#include "dbring.h"
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/* enum ath11k_spectral_mode:
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * @SPECTRAL_DISABLED: spectral mode is disabled
158c2ecf20Sopenharmony_ci * @SPECTRAL_BACKGROUND: hardware sends samples when it is not busy with
168c2ecf20Sopenharmony_ci *	something else.
178c2ecf20Sopenharmony_ci * @SPECTRAL_MANUAL: spectral scan is enabled, triggering for samples
188c2ecf20Sopenharmony_ci *	is performed manually.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_cienum ath11k_spectral_mode {
218c2ecf20Sopenharmony_ci	ATH11K_SPECTRAL_DISABLED = 0,
228c2ecf20Sopenharmony_ci	ATH11K_SPECTRAL_BACKGROUND,
238c2ecf20Sopenharmony_ci	ATH11K_SPECTRAL_MANUAL,
248c2ecf20Sopenharmony_ci};
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_cistruct ath11k_spectral {
278c2ecf20Sopenharmony_ci	struct ath11k_dbring rx_ring;
288c2ecf20Sopenharmony_ci	/* Protects enabled */
298c2ecf20Sopenharmony_ci	spinlock_t lock;
308c2ecf20Sopenharmony_ci	struct rchan *rfs_scan;	/* relay(fs) channel for spectral scan */
318c2ecf20Sopenharmony_ci	struct dentry *scan_ctl;
328c2ecf20Sopenharmony_ci	struct dentry *scan_count;
338c2ecf20Sopenharmony_ci	struct dentry *scan_bins;
348c2ecf20Sopenharmony_ci	enum ath11k_spectral_mode mode;
358c2ecf20Sopenharmony_ci	u16 count;
368c2ecf20Sopenharmony_ci	u8 fft_size;
378c2ecf20Sopenharmony_ci	bool enabled;
388c2ecf20Sopenharmony_ci};
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#ifdef CONFIG_ATH11K_SPECTRAL
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciint ath11k_spectral_init(struct ath11k_base *ab);
438c2ecf20Sopenharmony_civoid ath11k_spectral_deinit(struct ath11k_base *ab);
448c2ecf20Sopenharmony_ciint ath11k_spectral_vif_stop(struct ath11k_vif *arvif);
458c2ecf20Sopenharmony_civoid ath11k_spectral_reset_buffer(struct ath11k *ar);
468c2ecf20Sopenharmony_cienum ath11k_spectral_mode ath11k_spectral_get_mode(struct ath11k *ar);
478c2ecf20Sopenharmony_cistruct ath11k_dbring *ath11k_spectral_get_dbring(struct ath11k *ar);
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#else
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_cistatic inline int ath11k_spectral_init(struct ath11k_base *ab)
528c2ecf20Sopenharmony_ci{
538c2ecf20Sopenharmony_ci	return 0;
548c2ecf20Sopenharmony_ci}
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cistatic inline void ath11k_spectral_deinit(struct ath11k_base *ab)
578c2ecf20Sopenharmony_ci{
588c2ecf20Sopenharmony_ci}
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_cistatic inline int ath11k_spectral_vif_stop(struct ath11k_vif *arvif)
618c2ecf20Sopenharmony_ci{
628c2ecf20Sopenharmony_ci	return 0;
638c2ecf20Sopenharmony_ci}
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_cistatic inline void ath11k_spectral_reset_buffer(struct ath11k *ar)
668c2ecf20Sopenharmony_ci{
678c2ecf20Sopenharmony_ci}
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_cistatic inline
708c2ecf20Sopenharmony_cienum ath11k_spectral_mode ath11k_spectral_get_mode(struct ath11k *ar)
718c2ecf20Sopenharmony_ci{
728c2ecf20Sopenharmony_ci	return ATH11K_SPECTRAL_DISABLED;
738c2ecf20Sopenharmony_ci}
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cistatic inline
768c2ecf20Sopenharmony_cistruct ath11k_dbring *ath11k_spectral_get_dbring(struct ath11k *ar)
778c2ecf20Sopenharmony_ci{
788c2ecf20Sopenharmony_ci	return NULL;
798c2ecf20Sopenharmony_ci}
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#endif /* CONFIG_ATH11K_SPECTRAL */
828c2ecf20Sopenharmony_ci#endif /* ATH11K_SPECTRAL_H */
83