• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) Rockchip Electronics Co., Ltd.
4  *
5  * Author:
6  *	Cerf Yu <cerf.yu@rock-chips.com>
7  *	Huang Lee <Putin.li@rock-chips.com>
8  */
9 
10 #ifndef _RGA_DEBUGGER_H_
11 #define _RGA_DEBUGGER_H_
12 
13 #ifdef CONFIG_ROCKCHIP_RGA_DEBUGGER
14 
15 extern int RGA_DEBUG_REG;
16 extern int RGA_DEBUG_MSG;
17 extern int RGA_DEBUG_TIME;
18 extern int RGA_DEBUG_CHECK_MODE;
19 extern int RGA_DEBUG_NONUSE;
20 extern int RGA_DEBUG_INT_FLAG;
21 
22 #define DEBUGGER_EN(name) (unlikely(RGA_DEBUG_##name ? true : false))
23 
24 /*
25  * struct rga_debugger - RGA debugger information
26  *
27  * This structure represents a debugger to be created by the rga driver
28  * or core.
29  */
30 struct rga_debugger {
31 #ifdef CONFIG_ROCKCHIP_RGA_DEBUG_FS
32 	/* Directory of debugfs file */
33 	struct dentry *debugfs_dir;
34 	struct list_head debugfs_entry_list;
35 	struct mutex debugfs_lock;
36 #endif
37 
38 #ifdef CONFIG_ROCKCHIP_RGA_PROC_FS
39 	/* Directory of procfs file */
40 	struct proc_dir_entry *procfs_dir;
41 	struct list_head procfs_entry_list;
42 	struct mutex procfs_lock;
43 #endif
44 };
45 
46 /*
47  * struct rga_debugger_list - debugfs/procfs info list entry
48  *
49  * This structure represents a debugfs/procfs file to be created by the rga
50  * driver or core.
51  */
52 struct rga_debugger_list {
53 	/* File name */
54 	const char *name;
55 	/*
56 	 * Show callback. &seq_file->private will be set to the &struct
57 	 * rga_debugger_node corresponding to the instance of this info
58 	 * on a given &struct rga_debugger.
59 	 */
60 	int (*show)(struct seq_file *seq, void *data);
61 	/*
62 	 * Write callback. &seq_file->private will be set to the &struct
63 	 * rga_debugger_node corresponding to the instance of this info
64 	 * on a given &struct rga_debugger.
65 	 */
66 	ssize_t (*write)(struct file *file, const char __user *ubuf,
67 		size_t len, loff_t *offp);
68 	/* Procfs/Debugfs private data. */
69 	void *data;
70 };
71 
72 /*
73  * struct rga_debugger_node - Nodes for debugfs/procfs
74  *
75  * This structure represents each instance of procfs/debugfs created from the
76  * template.
77  */
78 struct rga_debugger_node {
79 	struct rga_debugger *debugger;
80 
81 	/* template for this node. */
82 	const struct rga_debugger_list *info_ent;
83 
84 	/* Each Procfs/Debugfs file. */
85 #ifdef CONFIG_ROCKCHIP_RGA_DEBUG_FS
86 	struct dentry *dent;
87 #endif
88 
89 #ifdef CONFIG_ROCKCHIP_RGA_PROC_FS
90 	struct proc_dir_entry *pent;
91 #endif
92 
93 	struct list_head list;
94 };
95 
96 #ifdef CONFIG_ROCKCHIP_RGA_DEBUG_FS
97 int rga_debugfs_init(void);
98 int rga_debugfs_remove(void);
99 #else
rga_debugfs_remove(void)100 static inline int rga_debugfs_remove(void)
101 {
102 	return 0;
103 }
rga_debugfs_init(void)104 static inline int rga_debugfs_init(void)
105 {
106 	return 0;
107 }
108 #endif /* #ifdef CONFIG_ROCKCHIP_RGA_DEBUG_FS */
109 
110 #ifdef CONFIG_ROCKCHIP_RGA_PROC_FS
111 int rga_procfs_remove(void);
112 int rga_procfs_init(void);
113 #else
rga_procfs_remove(void)114 static inline int rga_procfs_remove(void)
115 {
116 	return 0;
117 }
rga_procfs_init(void)118 static inline int rga_procfs_init(void)
119 {
120 	return 0;
121 }
122 #endif /* #ifdef CONFIG_ROCKCHIP_RGA_PROC_FS */
123 
124 #else
125 
126 #define DEBUGGER_EN(name) (unlikely(false))
127 
128 #endif /* #ifdef CONFIG_ROCKCHIP_RGA_DEBUGGER */
129 
130 void rga_cmd_print_debug_info(struct rga_req *req);
131 
132 #endif /* #ifndef _RGA_DEBUGGER_H_ */
133 
134