Linux Audio

Check our new training course

Linux kernel drivers training

Mar 31-Apr 9, 2025, special US time zones
Register
Loading...
v6.8
  1/* SPDX-License-Identifier: BSD-3-Clause-Clear */
  2/*
  3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
  4 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5 */
  6
  7#ifndef _ATH11K_DEBUG_H_
  8#define _ATH11K_DEBUG_H_
  9
 10#include "trace.h"
 11#include "debugfs.h"
 12
 13enum ath11k_debug_mask {
 14	ATH11K_DBG_AHB		= 0x00000001,
 15	ATH11K_DBG_WMI		= 0x00000002,
 16	ATH11K_DBG_HTC		= 0x00000004,
 17	ATH11K_DBG_DP_HTT	= 0x00000008,
 18	ATH11K_DBG_MAC		= 0x00000010,
 19	ATH11K_DBG_BOOT		= 0x00000020,
 20	ATH11K_DBG_QMI		= 0x00000040,
 21	ATH11K_DBG_DATA		= 0x00000080,
 22	ATH11K_DBG_MGMT		= 0x00000100,
 23	ATH11K_DBG_REG		= 0x00000200,
 24	ATH11K_DBG_TESTMODE	= 0x00000400,
 25	ATH11K_DBG_HAL		= 0x00000800,
 26	ATH11K_DBG_PCI		= 0x00001000,
 27	ATH11K_DBG_DP_TX	= 0x00002000,
 28	ATH11K_DBG_DP_RX	= 0x00004000,
 29	ATH11K_DBG_CE		= 0x00008000,
 30};
 31
 32static inline const char *ath11k_dbg_str(enum ath11k_debug_mask mask)
 33{
 34	switch (mask) {
 35	case ATH11K_DBG_AHB:
 36		return "ahb";
 37	case ATH11K_DBG_WMI:
 38		return "wmi";
 39	case ATH11K_DBG_HTC:
 40		return "htc";
 41	case ATH11K_DBG_DP_HTT:
 42		return "dp_htt";
 43	case ATH11K_DBG_MAC:
 44		return "mac";
 45	case ATH11K_DBG_BOOT:
 46		return "boot";
 47	case ATH11K_DBG_QMI:
 48		return "qmi";
 49	case ATH11K_DBG_DATA:
 50		return "data";
 51	case ATH11K_DBG_MGMT:
 52		return "mgmt";
 53	case ATH11K_DBG_REG:
 54		return "reg";
 55	case ATH11K_DBG_TESTMODE:
 56		return "testmode";
 57	case ATH11K_DBG_HAL:
 58		return "hal";
 59	case ATH11K_DBG_PCI:
 60		return "pci";
 61	case ATH11K_DBG_DP_TX:
 62		return "dp_tx";
 63	case ATH11K_DBG_DP_RX:
 64		return "dp_rx";
 65	case ATH11K_DBG_CE:
 66		return "ce";
 67
 68	/* no default handler to allow compiler to check that the
 69	 * enum is fully handled
 70	 */
 71	}
 72
 73	return "<?>";
 74}
 75
 76__printf(2, 3) void ath11k_info(struct ath11k_base *ab, const char *fmt, ...);
 77__printf(2, 3) void ath11k_err(struct ath11k_base *ab, const char *fmt, ...);
 78__printf(2, 3) void ath11k_warn(struct ath11k_base *ab, const char *fmt, ...);
 79
 80extern unsigned int ath11k_debug_mask;
 81
 82#ifdef CONFIG_ATH11K_DEBUG
 83__printf(3, 4) void __ath11k_dbg(struct ath11k_base *ab,
 84				 enum ath11k_debug_mask mask,
 85				 const char *fmt, ...);
 86void ath11k_dbg_dump(struct ath11k_base *ab,
 87		     enum ath11k_debug_mask mask,
 88		     const char *msg, const char *prefix,
 89		     const void *buf, size_t len);
 90#else /* CONFIG_ATH11K_DEBUG */
 91static inline int __ath11k_dbg(struct ath11k_base *ab,
 92			       enum ath11k_debug_mask dbg_mask,
 93			       const char *fmt, ...)
 94{
 95	return 0;
 96}
 97
 98static inline void ath11k_dbg_dump(struct ath11k_base *ab,
 99				   enum ath11k_debug_mask mask,
100				   const char *msg, const char *prefix,
101				   const void *buf, size_t len)
102{
103}
104#endif /* CONFIG_ATH11K_DEBUG */
105
106#define ath11k_dbg(ar, dbg_mask, fmt, ...)			\
107do {								\
108	if ((ath11k_debug_mask & dbg_mask) ||			\
109	    trace_ath11k_log_dbg_enabled())			\
110		__ath11k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__);	\
111} while (0)
112
113#endif /* _ATH11K_DEBUG_H_ */
v6.2
 1/* SPDX-License-Identifier: BSD-3-Clause-Clear */
 2/*
 3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
 
 4 */
 5
 6#ifndef _ATH11K_DEBUG_H_
 7#define _ATH11K_DEBUG_H_
 8
 9#include "trace.h"
10#include "debugfs.h"
11
12enum ath11k_debug_mask {
13	ATH11K_DBG_AHB		= 0x00000001,
14	ATH11K_DBG_WMI		= 0x00000002,
15	ATH11K_DBG_HTC		= 0x00000004,
16	ATH11K_DBG_DP_HTT	= 0x00000008,
17	ATH11K_DBG_MAC		= 0x00000010,
18	ATH11K_DBG_BOOT		= 0x00000020,
19	ATH11K_DBG_QMI		= 0x00000040,
20	ATH11K_DBG_DATA		= 0x00000080,
21	ATH11K_DBG_MGMT		= 0x00000100,
22	ATH11K_DBG_REG		= 0x00000200,
23	ATH11K_DBG_TESTMODE	= 0x00000400,
24	ATH11k_DBG_HAL		= 0x00000800,
25	ATH11K_DBG_PCI		= 0x00001000,
26	ATH11K_DBG_DP_TX	= 0x00002000,
27	ATH11K_DBG_DP_RX	= 0x00004000,
28	ATH11K_DBG_ANY		= 0xffffffff,
29};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
31__printf(2, 3) void ath11k_info(struct ath11k_base *ab, const char *fmt, ...);
32__printf(2, 3) void ath11k_err(struct ath11k_base *ab, const char *fmt, ...);
33__printf(2, 3) void ath11k_warn(struct ath11k_base *ab, const char *fmt, ...);
34
35extern unsigned int ath11k_debug_mask;
36
37#ifdef CONFIG_ATH11K_DEBUG
38__printf(3, 4) void __ath11k_dbg(struct ath11k_base *ab,
39				 enum ath11k_debug_mask mask,
40				 const char *fmt, ...);
41void ath11k_dbg_dump(struct ath11k_base *ab,
42		     enum ath11k_debug_mask mask,
43		     const char *msg, const char *prefix,
44		     const void *buf, size_t len);
45#else /* CONFIG_ATH11K_DEBUG */
46static inline int __ath11k_dbg(struct ath11k_base *ab,
47			       enum ath11k_debug_mask dbg_mask,
48			       const char *fmt, ...)
49{
50	return 0;
51}
52
53static inline void ath11k_dbg_dump(struct ath11k_base *ab,
54				   enum ath11k_debug_mask mask,
55				   const char *msg, const char *prefix,
56				   const void *buf, size_t len)
57{
58}
59#endif /* CONFIG_ATH11K_DEBUG */
60
61#define ath11k_dbg(ar, dbg_mask, fmt, ...)			\
62do {								\
63	if ((ath11k_debug_mask & dbg_mask) ||			\
64	    trace_ath11k_log_dbg_enabled())			\
65		__ath11k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__);	\
66} while (0)
67
68#endif /* _ATH11K_DEBUG_H_ */