xref: /linux/drivers/net/wireless/realtek/rtw88/debug.h (revision 8cb090b7)
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2018-2019  Realtek Corporation
3  */
4 
5 #ifndef __RTW_DEBUG_H
6 #define __RTW_DEBUG_H
7 
8 enum rtw_debug_mask {
9 	RTW_DBG_PCI		= 0x00000001,
10 	RTW_DBG_TX		= 0x00000002,
11 	RTW_DBG_RX		= 0x00000004,
12 	RTW_DBG_PHY		= 0x00000008,
13 	RTW_DBG_FW		= 0x00000010,
14 	RTW_DBG_EFUSE		= 0x00000020,
15 	RTW_DBG_COEX		= 0x00000040,
16 	RTW_DBG_RFK		= 0x00000080,
17 	RTW_DBG_REGD		= 0x00000100,
18 	RTW_DBG_DEBUGFS		= 0x00000200,
19 	RTW_DBG_PS		= 0x00000400,
20 	RTW_DBG_BF		= 0x00000800,
21 	RTW_DBG_WOW		= 0x00001000,
22 	RTW_DBG_CFO		= 0x00002000,
23 	RTW_DBG_PATH_DIV	= 0x00004000,
24 	RTW_DBG_ADAPTIVITY	= 0x00008000,
25 	RTW_DBG_HW_SCAN		= 0x00010000,
26 	RTW_DBG_STATE		= 0x00020000,
27 	RTW_DBG_SDIO		= 0x00040000,
28 
29 	RTW_DBG_UNEXP		= 0x80000000,
30 	RTW_DBG_ALL		= 0xffffffff
31 };
32 
33 #ifdef CONFIG_RTW88_DEBUGFS
34 
35 void rtw_debugfs_init(struct rtw_dev *rtwdev);
36 void rtw_debugfs_get_simple_phy_info(struct seq_file *m);
37 
38 #else
39 
rtw_debugfs_init(struct rtw_dev * rtwdev)40 static inline void rtw_debugfs_init(struct rtw_dev *rtwdev) {}
41 
42 #endif /* CONFIG_RTW88_DEBUGFS */
43 
44 #ifdef CONFIG_RTW88_DEBUG
45 
46 __printf(3, 4)
47 void rtw_dbg(struct rtw_dev *rtwdev, enum rtw_debug_mask mask,
48 	     const char *fmt, ...);
49 
rtw_dbg_is_enabled(struct rtw_dev * rtwdev,enum rtw_debug_mask mask)50 static inline bool rtw_dbg_is_enabled(struct rtw_dev *rtwdev,
51 				      enum rtw_debug_mask mask)
52 {
53 	return !!(rtw_debug_mask & mask);
54 }
55 
56 #else
57 
rtw_dbg(struct rtw_dev * rtwdev,enum rtw_debug_mask mask,const char * fmt,...)58 static inline void rtw_dbg(struct rtw_dev *rtwdev, enum rtw_debug_mask mask,
59 			   const char *fmt, ...) {}
60 
rtw_dbg_is_enabled(struct rtw_dev * rtwdev,enum rtw_debug_mask mask)61 static inline bool rtw_dbg_is_enabled(struct rtw_dev *rtwdev,
62 				      enum rtw_debug_mask mask)
63 {
64 	return false;
65 }
66 
67 #endif /* CONFIG_RTW88_DEBUG */
68 
69 #define rtw_info(rtwdev, a...) dev_info(rtwdev->dev, ##a)
70 #define rtw_warn(rtwdev, a...) dev_warn(rtwdev->dev, ##a)
71 #define rtw_err(rtwdev, a...) dev_err(rtwdev->dev, ##a)
72 
73 #endif
74