| 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-2025 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_CE = 0x00010000, |
| 30 |
ATH12K_DBG_ANY = 0xffffffff, |
| 31 |
}; |
| 32 |
|
| 33 |
__printf(2, 3) void ath12k_info(struct ath12k_base *ab, const char *fmt, ...); |
| 34 |
__printf(2, 3) void ath12k_err(struct ath12k_base *ab, const char *fmt, ...); |
| 35 |
__printf(2, 3) void __ath12k_warn(struct device *dev, const char *fmt, ...); |
| 36 |
|
| 37 |
#define ath12k_warn(ab, fmt, ...) __ath12k_warn((ab)->dev, fmt, ##__VA_ARGS__) |
| 38 |
#define ath12k_hw_warn(ah, fmt, ...) __ath12k_warn((ah)->dev, fmt, ##__VA_ARGS__) |
| 39 |
|
| 40 |
extern unsigned int ath12k_debug_mask; |
| 41 |
extern bool ath12k_ftm_mode; |
| 42 |
|
| 43 |
#ifdef CONFIG_ATH12K_DEBUG |
| 44 |
__printf(3, 4) void __ath12k_dbg(struct ath12k_base *ab, |
| 45 |
enum ath12k_debug_mask mask, |
| 46 |
const char *fmt, ...); |
| 47 |
void ath12k_dbg_dump(struct ath12k_base *ab, |
| 48 |
enum ath12k_debug_mask mask, |
| 49 |
const char *msg, const char *prefix, |
| 50 |
const void *buf, size_t len); |
| 51 |
#else /* CONFIG_ATH12K_DEBUG */ |
| 52 |
static inline void __ath12k_dbg(struct ath12k_base *ab, |
| 53 |
enum ath12k_debug_mask dbg_mask, |
| 54 |
const char *fmt, ...) |
| 55 |
{ |
| 56 |
} |
| 57 |
|
| 58 |
static inline void ath12k_dbg_dump(struct ath12k_base *ab, |
| 59 |
enum ath12k_debug_mask mask, |
| 60 |
const char *msg, const char *prefix, |
| 61 |
const void *buf, size_t len) |
| 62 |
{ |
| 63 |
} |
| 64 |
#endif /* CONFIG_ATH12K_DEBUG */ |
| 65 |
|
| 66 |
#define ath12k_dbg(ab, dbg_mask, fmt, ...) \ |
| 67 |
do { \ |
| 68 |
typeof(dbg_mask) mask = (dbg_mask); \ |
| 69 |
if (ath12k_debug_mask & mask) \ |
| 70 |
__ath12k_dbg(ab, mask, fmt, ##__VA_ARGS__); \ |
| 71 |
} while (0) |
| 72 |
|
| 73 |
#define ath12k_generic_dbg(dbg_mask, fmt, ...) \ |
| 74 |
ath12k_dbg(NULL, dbg_mask, fmt, ##__VA_ARGS__) |
| 75 |
|
| 76 |
#endif /* _ATH12K_DEBUG_H_ */ |