xref: /openbmc/linux/drivers/gpu/drm/msm/dp/dp_debug.h (revision 88a6f899)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
4  */
5 
6 #ifndef _DP_DEBUG_H_
7 #define _DP_DEBUG_H_
8 
9 #include "dp_panel.h"
10 #include "dp_link.h"
11 
12 /**
13  * struct dp_debug
14  * @debug_en: specifies whether debug mode enabled
15  * @vdisplay: used to filter out vdisplay value
16  * @hdisplay: used to filter out hdisplay value
17  * @vrefresh: used to filter out vrefresh value
18  * @tpg_state: specifies whether tpg feature is enabled
19  */
20 struct dp_debug {
21 	bool debug_en;
22 	int aspect_ratio;
23 	int vdisplay;
24 	int hdisplay;
25 	int vrefresh;
26 };
27 
28 #if defined(CONFIG_DEBUG_FS)
29 
30 /**
31  * dp_debug_get() - configure and get the DisplayPlot debug module data
32  *
33  * @dev: device instance of the caller
34  * @panel: instance of panel module
35  * @link: instance of link module
36  * @connector: double pointer to display connector
37  * @minor: pointer to drm minor number after device registration
38  * return: pointer to allocated debug module data
39  *
40  * This function sets up the debug module and provides a way
41  * for debugfs input to be communicated with existing modules
42  */
43 struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel,
44 		struct dp_link *link,
45 		struct drm_connector *connector,
46 		struct drm_minor *minor);
47 
48 /**
49  * dp_debug_put()
50  *
51  * Cleans up dp_debug instance
52  *
53  * @dp_debug: instance of dp_debug
54  */
55 void dp_debug_put(struct dp_debug *dp_debug);
56 
57 #else
58 
59 static inline
60 struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel,
61 		struct dp_link *link,
62 		struct drm_connector *connector, struct drm_minor *minor)
63 {
64 	return ERR_PTR(-EINVAL);
65 }
66 
67 static inline void dp_debug_put(struct dp_debug *dp_debug)
68 {
69 }
70 
71 #endif /* defined(CONFIG_DEBUG_FS) */
72 
73 #endif /* _DP_DEBUG_H_ */
74