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