Kalle Valo | d5c6515 | 2019-11-23 09:58:40 +0200 | [diff] [blame] | 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 | |
Kalle Valo | d5c6515 | 2019-11-23 09:58:40 +0200 | [diff] [blame] | 9 | #include "trace.h" |
Kalle Valo | da3a9d3 | 2020-09-16 16:55:20 +0300 | [diff] [blame] | 10 | #include "debugfs.h" |
Maharaja Kennadyrajan | 64f1d7e | 2019-11-27 14:08:57 +0000 | [diff] [blame] | 11 | |
Kalle Valo | d5c6515 | 2019-11-23 09:58:40 +0200 | [diff] [blame] | 12 | enum 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 Singh | 5697a56 | 2020-08-13 12:04:22 +0300 | [diff] [blame] | 25 | ATH11K_DBG_PCI = 0x00001000, |
Venkateswara Naralasetty | aa2092a | 2020-09-08 06:32:21 +0000 | [diff] [blame] | 26 | ATH11K_DBG_DP_TX = 0x00001000, |
| 27 | ATH11K_DBG_DP_RX = 0x00002000, |
Kalle Valo | d5c6515 | 2019-11-23 09:58:40 +0200 | [diff] [blame] | 28 | ATH11K_DBG_ANY = 0xffffffff, |
| 29 | }; |
| 30 | |
Kalle Valo | d5c6515 | 2019-11-23 09:58:40 +0200 | [diff] [blame] | 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 | |
| 35 | extern 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, ...); |
| 41 | void 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 */ |
| 46 | static 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 | |
| 53 | static 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 Valo | d5c6515 | 2019-11-23 09:58:40 +0200 | [diff] [blame] | 61 | #define ath11k_dbg(ar, dbg_mask, fmt, ...) \ |
| 62 | do { \ |
Venkateswara Naralasetty | fb12305 | 2021-11-09 12:05:55 +0530 | [diff] [blame] | 63 | if ((ath11k_debug_mask & dbg_mask) || \ |
| 64 | trace_ath11k_log_dbg_enabled()) \ |
Kalle Valo | d5c6515 | 2019-11-23 09:58:40 +0200 | [diff] [blame] | 65 | __ath11k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \ |
| 66 | } while (0) |
| 67 | |
| 68 | #endif /* _ATH11K_DEBUG_H_ */ |