blob: fbbd5fe02aa83df210c8f823197090a7c6dce097 [file] [log] [blame]
Kalle Valod5c65152019-11-23 09:58:40 +02001/* 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
Kalle Valod5c65152019-11-23 09:58:40 +02009#include "trace.h"
Kalle Valoda3a9d32020-09-16 16:55:20 +030010#include "debugfs.h"
Maharaja Kennadyrajan64f1d7e2019-11-27 14:08:57 +000011
Kalle Valod5c65152019-11-23 09:58:40 +020012enum 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,
Govind Singh5697a562020-08-13 12:04:22 +030025 ATH11K_DBG_PCI = 0x00001000,
Venkateswara Naralasettyaa2092a2020-09-08 06:32:21 +000026 ATH11K_DBG_DP_TX = 0x00001000,
27 ATH11K_DBG_DP_RX = 0x00002000,
Kalle Valod5c65152019-11-23 09:58:40 +020028 ATH11K_DBG_ANY = 0xffffffff,
29};
30
Kalle Valod5c65152019-11-23 09:58:40 +020031__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
Kalle Valod5c65152019-11-23 09:58:40 +020061#define ath11k_dbg(ar, dbg_mask, fmt, ...) \
62do { \
Venkateswara Naralasettyfb123052021-11-09 12:05:55 +053063 if ((ath11k_debug_mask & dbg_mask) || \
64 trace_ath11k_log_dbg_enabled()) \
Kalle Valod5c65152019-11-23 09:58:40 +020065 __ath11k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \
66} while (0)
67
68#endif /* _ATH11K_DEBUG_H_ */