1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 /* 3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. 4 * Copyright (c) 2021-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved. 5 */ 6 7 #ifndef _ATH12K_DEBUG_H_ 8 #define _ATH12K_DEBUG_H_ 9 10 #include "trace.h" 11 12 enum ath12k_debug_mask { 13 ATH12K_DBG_AHB = 0x00000001, 14 ATH12K_DBG_WMI = 0x00000002, 15 ATH12K_DBG_HTC = 0x00000004, 16 ATH12K_DBG_DP_HTT = 0x00000008, 17 ATH12K_DBG_MAC = 0x00000010, 18 ATH12K_DBG_BOOT = 0x00000020, 19 ATH12K_DBG_QMI = 0x00000040, 20 ATH12K_DBG_DATA = 0x00000080, 21 ATH12K_DBG_MGMT = 0x00000100, 22 ATH12K_DBG_REG = 0x00000200, 23 ATH12K_DBG_TESTMODE = 0x00000400, 24 ATH12K_DBG_HAL = 0x00000800, 25 ATH12K_DBG_PCI = 0x00001000, 26 ATH12K_DBG_DP_TX = 0x00002000, 27 ATH12K_DBG_DP_RX = 0x00004000, 28 ATH12K_DBG_WOW = 0x00008000, 29 ATH12K_DBG_ANY = 0xffffffff, 30 }; 31 32 __printf(2, 3) void ath12k_info(struct ath12k_base *ab, const char *fmt, ...); 33 __printf(2, 3) void ath12k_err(struct ath12k_base *ab, const char *fmt, ...); 34 __printf(2, 3) void __ath12k_warn(struct device *dev, const char *fmt, ...); 35 36 #define ath12k_warn(ab, fmt, ...) __ath12k_warn((ab)->dev, fmt, ##__VA_ARGS__) 37 #define ath12k_hw_warn(ah, fmt, ...) __ath12k_warn((ah)->dev, fmt, ##__VA_ARGS__) 38 39 extern unsigned int ath12k_debug_mask; 40 41 #ifdef CONFIG_ATH12K_DEBUG 42 __printf(3, 4) void __ath12k_dbg(struct ath12k_base *ab, 43 enum ath12k_debug_mask mask, 44 const char *fmt, ...); 45 void ath12k_dbg_dump(struct ath12k_base *ab, 46 enum ath12k_debug_mask mask, 47 const char *msg, const char *prefix, 48 const void *buf, size_t len); 49 #else /* CONFIG_ATH12K_DEBUG */ 50 static inline void __ath12k_dbg(struct ath12k_base *ab, 51 enum ath12k_debug_mask dbg_mask, 52 const char *fmt, ...) 53 { 54 } 55 56 static inline void ath12k_dbg_dump(struct ath12k_base *ab, 57 enum ath12k_debug_mask mask, 58 const char *msg, const char *prefix, 59 const void *buf, size_t len) 60 { 61 } 62 #endif /* CONFIG_ATH12K_DEBUG */ 63 64 #define ath12k_dbg(ar, dbg_mask, fmt, ...) \ 65 do { \ 66 typeof(dbg_mask) mask = (dbg_mask); \ 67 if (ath12k_debug_mask & mask) \ 68 __ath12k_dbg(ar, mask, fmt, ##__VA_ARGS__); \ 69 } while (0) 70 71 #endif /* _ATH12K_DEBUG_H_ */ 72