xref: /openbmc/linux/drivers/gpu/drm/msm/dp/dp_debug.h (revision 7effbd18)
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  * @usbpd: instance of usbpd module
36  * @link: instance of link module
37  * @connector: double pointer to display connector
38  * @minor: pointer to drm minor number after device registration
39  * return: pointer to allocated debug module data
40  *
41  * This function sets up the debug module and provides a way
42  * for debugfs input to be communicated with existing modules
43  */
44 struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel,
45 		struct dp_usbpd *usbpd, struct dp_link *link,
46 		struct drm_connector *connector,
47 		struct drm_minor *minor);
48 
49 /**
50  * dp_debug_put()
51  *
52  * Cleans up dp_debug instance
53  *
54  * @dp_debug: instance of dp_debug
55  */
56 void dp_debug_put(struct dp_debug *dp_debug);
57 
58 #else
59 
60 static inline
61 struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel,
62 		struct dp_usbpd *usbpd, struct dp_link *link,
63 		struct drm_connector *connector, struct drm_minor *minor)
64 {
65 	return ERR_PTR(-EINVAL);
66 }
67 
68 static inline void dp_debug_put(struct dp_debug *dp_debug)
69 {
70 }
71 
72 #endif /* defined(CONFIG_DEBUG_FS) */
73 
74 #endif /* _DP_DEBUG_H_ */
75