xref: /linux/drivers/usb/mtu3/mtu3_debug.h (revision 4d49d352b66799802388f7ef6ce75d12440be6fa)
1*4d49d352SNishad Kamdar /* SPDX-License-Identifier: GPL-2.0 */
2ae078092SChunfeng Yun /*
3ae078092SChunfeng Yun  * mtu3_debug.h - debug header
4ae078092SChunfeng Yun  *
5ae078092SChunfeng Yun  * Copyright (C) 2019 MediaTek Inc.
6ae078092SChunfeng Yun  *
7ae078092SChunfeng Yun  * Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
8ae078092SChunfeng Yun  */
9ae078092SChunfeng Yun 
10ae078092SChunfeng Yun #ifndef __MTU3_DEBUG_H__
11ae078092SChunfeng Yun #define __MTU3_DEBUG_H__
12ae078092SChunfeng Yun 
13ae078092SChunfeng Yun #include <linux/debugfs.h>
14ae078092SChunfeng Yun 
15ae078092SChunfeng Yun #define MTU3_DEBUGFS_NAME_LEN 32
16ae078092SChunfeng Yun 
17ae078092SChunfeng Yun struct mtu3_regset {
18ae078092SChunfeng Yun 	char name[MTU3_DEBUGFS_NAME_LEN];
19ae078092SChunfeng Yun 	struct debugfs_regset32 regset;
20ae078092SChunfeng Yun 	size_t nregs;
21ae078092SChunfeng Yun };
22ae078092SChunfeng Yun 
23ae078092SChunfeng Yun struct mtu3_file_map {
24ae078092SChunfeng Yun 	const char *name;
25ae078092SChunfeng Yun 	int (*show)(struct seq_file *s, void *unused);
26ae078092SChunfeng Yun };
27ae078092SChunfeng Yun 
28ae078092SChunfeng Yun #if IS_ENABLED(CONFIG_DEBUG_FS)
29ae078092SChunfeng Yun void ssusb_dev_debugfs_init(struct ssusb_mtk *ssusb);
304aab6ad2SChunfeng Yun void ssusb_dr_debugfs_init(struct ssusb_mtk *ssusb);
31ae078092SChunfeng Yun void ssusb_debugfs_create_root(struct ssusb_mtk *ssusb);
32ae078092SChunfeng Yun void ssusb_debugfs_remove_root(struct ssusb_mtk *ssusb);
33ae078092SChunfeng Yun 
34ae078092SChunfeng Yun #else
35ae078092SChunfeng Yun static inline void ssusb_dev_debugfs_init(struct ssusb_mtk *ssusb) {}
364aab6ad2SChunfeng Yun static inline void ssusb_dr_debugfs_init(struct ssusb_mtk *ssusb) {}
37ae078092SChunfeng Yun static inline void ssusb_debugfs_create_root(struct ssusb_mtk *ssusb) {}
38ae078092SChunfeng Yun static inline void ssusb_debugfs_remove_root(struct ssusb_mtk *ssusb) {}
39ae078092SChunfeng Yun 
40ae078092SChunfeng Yun #endif /* CONFIG_DEBUG_FS */
41ae078092SChunfeng Yun 
4283374e03SChunfeng Yun #if IS_ENABLED(CONFIG_TRACING)
4383374e03SChunfeng Yun void mtu3_dbg_trace(struct device *dev, const char *fmt, ...);
4483374e03SChunfeng Yun 
4583374e03SChunfeng Yun #else
4683374e03SChunfeng Yun static inline void mtu3_dbg_trace(struct device *dev, const char *fmt, ...) {}
4783374e03SChunfeng Yun 
4883374e03SChunfeng Yun #endif /* CONFIG_TRACING */
4983374e03SChunfeng Yun 
50ae078092SChunfeng Yun #endif /* __MTU3_DEBUG_H__ */
51