19d11b7bfSKarthikeyan Periyasamy /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 29d11b7bfSKarthikeyan Periyasamy /* 39d11b7bfSKarthikeyan Periyasamy * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. 4*586c7fb1SJeff Johnson * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. 59d11b7bfSKarthikeyan Periyasamy */ 69d11b7bfSKarthikeyan Periyasamy 79d11b7bfSKarthikeyan Periyasamy #ifndef ATH11K_SPECTRAL_H 89d11b7bfSKarthikeyan Periyasamy #define ATH11K_SPECTRAL_H 99d11b7bfSKarthikeyan Periyasamy 109d11b7bfSKarthikeyan Periyasamy #include "../spectral_common.h" 119d11b7bfSKarthikeyan Periyasamy #include "dbring.h" 129d11b7bfSKarthikeyan Periyasamy 139d11b7bfSKarthikeyan Periyasamy /* enum ath11k_spectral_mode: 149d11b7bfSKarthikeyan Periyasamy * 159d11b7bfSKarthikeyan Periyasamy * @SPECTRAL_DISABLED: spectral mode is disabled 169d11b7bfSKarthikeyan Periyasamy * @SPECTRAL_BACKGROUND: hardware sends samples when it is not busy with 179d11b7bfSKarthikeyan Periyasamy * something else. 189d11b7bfSKarthikeyan Periyasamy * @SPECTRAL_MANUAL: spectral scan is enabled, triggering for samples 199d11b7bfSKarthikeyan Periyasamy * is performed manually. 209d11b7bfSKarthikeyan Periyasamy */ 219d11b7bfSKarthikeyan Periyasamy enum ath11k_spectral_mode { 229d11b7bfSKarthikeyan Periyasamy ATH11K_SPECTRAL_DISABLED = 0, 239d11b7bfSKarthikeyan Periyasamy ATH11K_SPECTRAL_BACKGROUND, 249d11b7bfSKarthikeyan Periyasamy ATH11K_SPECTRAL_MANUAL, 259d11b7bfSKarthikeyan Periyasamy }; 269d11b7bfSKarthikeyan Periyasamy 279d11b7bfSKarthikeyan Periyasamy struct ath11k_spectral { 289d11b7bfSKarthikeyan Periyasamy struct ath11k_dbring rx_ring; 299d11b7bfSKarthikeyan Periyasamy /* Protects enabled */ 309d11b7bfSKarthikeyan Periyasamy spinlock_t lock; 319d11b7bfSKarthikeyan Periyasamy struct rchan *rfs_scan; /* relay(fs) channel for spectral scan */ 329d11b7bfSKarthikeyan Periyasamy struct dentry *scan_ctl; 339d11b7bfSKarthikeyan Periyasamy struct dentry *scan_count; 349d11b7bfSKarthikeyan Periyasamy struct dentry *scan_bins; 359d11b7bfSKarthikeyan Periyasamy enum ath11k_spectral_mode mode; 369d11b7bfSKarthikeyan Periyasamy u16 count; 379d11b7bfSKarthikeyan Periyasamy u8 fft_size; 389d11b7bfSKarthikeyan Periyasamy bool enabled; 39c92f774aSTamizh Chelvam Raja bool is_primary; 409d11b7bfSKarthikeyan Periyasamy }; 419d11b7bfSKarthikeyan Periyasamy 429d11b7bfSKarthikeyan Periyasamy #ifdef CONFIG_ATH11K_SPECTRAL 439d11b7bfSKarthikeyan Periyasamy 449d11b7bfSKarthikeyan Periyasamy int ath11k_spectral_init(struct ath11k_base *ab); 459d11b7bfSKarthikeyan Periyasamy void ath11k_spectral_deinit(struct ath11k_base *ab); 469d11b7bfSKarthikeyan Periyasamy int ath11k_spectral_vif_stop(struct ath11k_vif *arvif); 479d11b7bfSKarthikeyan Periyasamy void ath11k_spectral_reset_buffer(struct ath11k *ar); 489d11b7bfSKarthikeyan Periyasamy enum ath11k_spectral_mode ath11k_spectral_get_mode(struct ath11k *ar); 499d11b7bfSKarthikeyan Periyasamy struct ath11k_dbring *ath11k_spectral_get_dbring(struct ath11k *ar); 509d11b7bfSKarthikeyan Periyasamy 519d11b7bfSKarthikeyan Periyasamy #else 529d11b7bfSKarthikeyan Periyasamy ath11k_spectral_init(struct ath11k_base * ab)539d11b7bfSKarthikeyan Periyasamystatic inline int ath11k_spectral_init(struct ath11k_base *ab) 549d11b7bfSKarthikeyan Periyasamy { 559d11b7bfSKarthikeyan Periyasamy return 0; 569d11b7bfSKarthikeyan Periyasamy } 579d11b7bfSKarthikeyan Periyasamy ath11k_spectral_deinit(struct ath11k_base * ab)589d11b7bfSKarthikeyan Periyasamystatic inline void ath11k_spectral_deinit(struct ath11k_base *ab) 599d11b7bfSKarthikeyan Periyasamy { 609d11b7bfSKarthikeyan Periyasamy } 619d11b7bfSKarthikeyan Periyasamy ath11k_spectral_vif_stop(struct ath11k_vif * arvif)629d11b7bfSKarthikeyan Periyasamystatic inline int ath11k_spectral_vif_stop(struct ath11k_vif *arvif) 639d11b7bfSKarthikeyan Periyasamy { 649d11b7bfSKarthikeyan Periyasamy return 0; 659d11b7bfSKarthikeyan Periyasamy } 669d11b7bfSKarthikeyan Periyasamy ath11k_spectral_reset_buffer(struct ath11k * ar)679d11b7bfSKarthikeyan Periyasamystatic inline void ath11k_spectral_reset_buffer(struct ath11k *ar) 689d11b7bfSKarthikeyan Periyasamy { 699d11b7bfSKarthikeyan Periyasamy } 709d11b7bfSKarthikeyan Periyasamy 719d11b7bfSKarthikeyan Periyasamy static inline ath11k_spectral_get_mode(struct ath11k * ar)729d11b7bfSKarthikeyan Periyasamyenum ath11k_spectral_mode ath11k_spectral_get_mode(struct ath11k *ar) 739d11b7bfSKarthikeyan Periyasamy { 749d11b7bfSKarthikeyan Periyasamy return ATH11K_SPECTRAL_DISABLED; 759d11b7bfSKarthikeyan Periyasamy } 769d11b7bfSKarthikeyan Periyasamy 779d11b7bfSKarthikeyan Periyasamy static inline ath11k_spectral_get_dbring(struct ath11k * ar)789d11b7bfSKarthikeyan Periyasamystruct ath11k_dbring *ath11k_spectral_get_dbring(struct ath11k *ar) 799d11b7bfSKarthikeyan Periyasamy { 809d11b7bfSKarthikeyan Periyasamy return NULL; 819d11b7bfSKarthikeyan Periyasamy } 829d11b7bfSKarthikeyan Periyasamy 839d11b7bfSKarthikeyan Periyasamy #endif /* CONFIG_ATH11K_SPECTRAL */ 849d11b7bfSKarthikeyan Periyasamy #endif /* ATH11K_SPECTRAL_H */ 85