GNU Linux-libre 4.19.264-gnu1
[releases.git] / drivers / gpu / drm / msm / disp / dpu1 / dpu_dbg.h
1 /* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 and
5  * only version 2 as published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12
13 #ifndef DPU_DBG_H_
14 #define DPU_DBG_H_
15
16 #include <stdarg.h>
17 #include <linux/debugfs.h>
18 #include <linux/list.h>
19
20 enum dpu_dbg_dump_flag {
21         DPU_DBG_DUMP_IN_LOG = BIT(0),
22         DPU_DBG_DUMP_IN_MEM = BIT(1),
23 };
24
25 #if defined(CONFIG_DEBUG_FS)
26
27 /**
28  * dpu_dbg_init_dbg_buses - initialize debug bus dumping support for the chipset
29  * @hwversion:          Chipset revision
30  */
31 void dpu_dbg_init_dbg_buses(u32 hwversion);
32
33 /**
34  * dpu_dbg_init - initialize global dpu debug facilities: regdump
35  * @dev:                device handle
36  * Returns:             0 or -ERROR
37  */
38 int dpu_dbg_init(struct device *dev);
39
40 /**
41  * dpu_dbg_debugfs_register - register entries at the given debugfs dir
42  * @debugfs_root:       debugfs root in which to create dpu debug entries
43  * Returns:     0 or -ERROR
44  */
45 int dpu_dbg_debugfs_register(struct dentry *debugfs_root);
46
47 /**
48  * dpu_dbg_destroy - destroy the global dpu debug facilities
49  * Returns:     none
50  */
51 void dpu_dbg_destroy(void);
52
53 /**
54  * dpu_dbg_dump - trigger dumping of all dpu_dbg facilities
55  * @queue_work:   whether to queue the dumping work to the work_struct
56  * @name:         string indicating origin of dump
57  * @dump_dbgbus:  dump the dpu debug bus
58  * @dump_vbif_rt: dump the vbif rt bus
59  * Returns:     none
60  */
61 void dpu_dbg_dump(bool queue_work, const char *name, bool dump_dbgbus_dpu,
62                   bool dump_dbgbus_vbif_rt);
63
64 /**
65  * dpu_dbg_set_dpu_top_offset - set the target specific offset from mdss base
66  *      address of the top registers. Used for accessing debug bus controls.
67  * @blk_off: offset from mdss base of the top block
68  */
69 void dpu_dbg_set_dpu_top_offset(u32 blk_off);
70
71 #else
72
73 static inline void dpu_dbg_init_dbg_buses(u32 hwversion)
74 {
75 }
76
77 static inline int dpu_dbg_init(struct device *dev)
78 {
79         return 0;
80 }
81
82 static inline int dpu_dbg_debugfs_register(struct dentry *debugfs_root)
83 {
84         return 0;
85 }
86
87 static inline void dpu_dbg_destroy(void)
88 {
89 }
90
91 static inline void dpu_dbg_dump(bool queue_work, const char *name,
92                                 bool dump_dbgbus_dpu, bool dump_dbgbus_vbif_rt)
93 {
94 }
95
96 static inline void dpu_dbg_set_dpu_top_offset(u32 blk_off)
97 {
98 }
99
100 #endif /* defined(CONFIG_DEBUG_FS) */
101
102
103 #endif /* DPU_DBG_H_ */