xref: /linux/drivers/net/wireless/ath/ath12k/debug.h (revision 58f6259b7a08f8d47d4629609703d358b042f0fd)
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 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_ANY		= 0xffffffff,
29 };
30 
31 __printf(2, 3) void ath12k_info(struct ath12k_base *ab, const char *fmt, ...);
32 __printf(2, 3) void ath12k_err(struct ath12k_base *ab, const char *fmt, ...);
33 __printf(2, 3) void ath12k_warn(struct ath12k_base *ab, const char *fmt, ...);
34 
35 extern unsigned int ath12k_debug_mask;
36 
37 #ifdef CONFIG_ATH12K_DEBUG
38 __printf(3, 4) void __ath12k_dbg(struct ath12k_base *ab,
39 				 enum ath12k_debug_mask mask,
40 				 const char *fmt, ...);
41 void ath12k_dbg_dump(struct ath12k_base *ab,
42 		     enum ath12k_debug_mask mask,
43 		     const char *msg, const char *prefix,
44 		     const void *buf, size_t len);
45 #else /* CONFIG_ATH12K_DEBUG */
46 static inline void __ath12k_dbg(struct ath12k_base *ab,
47 				enum ath12k_debug_mask dbg_mask,
48 				const char *fmt, ...)
49 {
50 }
51 
52 static inline void ath12k_dbg_dump(struct ath12k_base *ab,
53 				   enum ath12k_debug_mask mask,
54 				   const char *msg, const char *prefix,
55 				   const void *buf, size_t len)
56 {
57 }
58 #endif /* CONFIG_ATH12K_DEBUG */
59 
60 #define ath12k_dbg(ar, dbg_mask, fmt, ...)			\
61 do {								\
62 	typeof(dbg_mask) mask = (dbg_mask);			\
63 	if (ath12k_debug_mask & mask)				\
64 		__ath12k_dbg(ar, mask, fmt, ##__VA_ARGS__);	\
65 } while (0)
66 
67 #endif /* _ATH12K_DEBUG_H_ */
68