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 ath12k_base *ab, const char *fmt, ...); 35 36 extern unsigned int ath12k_debug_mask; 37 38 #ifdef CONFIG_ATH12K_DEBUG 39 __printf(3, 4) void __ath12k_dbg(struct ath12k_base *ab, 40 enum ath12k_debug_mask mask, 41 const char *fmt, ...); 42 void ath12k_dbg_dump(struct ath12k_base *ab, 43 enum ath12k_debug_mask mask, 44 const char *msg, const char *prefix, 45 const void *buf, size_t len); 46 #else /* CONFIG_ATH12K_DEBUG */ 47 static inline void __ath12k_dbg(struct ath12k_base *ab, 48 enum ath12k_debug_mask dbg_mask, 49 const char *fmt, ...) 50 { 51 } 52 53 static inline void ath12k_dbg_dump(struct ath12k_base *ab, 54 enum ath12k_debug_mask mask, 55 const char *msg, const char *prefix, 56 const void *buf, size_t len) 57 { 58 } 59 #endif /* CONFIG_ATH12K_DEBUG */ 60 61 #define ath12k_dbg(ar, dbg_mask, fmt, ...) \ 62 do { \ 63 typeof(dbg_mask) mask = (dbg_mask); \ 64 if (ath12k_debug_mask & mask) \ 65 __ath12k_dbg(ar, mask, fmt, ##__VA_ARGS__); \ 66 } while (0) 67 68 #endif /* _ATH12K_DEBUG_H_ */ 69