aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2016-08-31 12:09:05 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-09-19 09:04:15 -0400
commit199e4e967af476bdcab96c76237e6a1f9244d6ca (patch)
tree2240f5bbb1e96a06876eb12d90048d8dc7cb3704 /include/drm
parentafb21ea63d815d05f6081ee3efef6772a16317eb (diff)
drm: Extract drm_bridge.h
We don't want to burry the bridge structures kerneldoc in drm_crtc.h. Cc: Archit Taneja <archit.taneja@gmail.com> Reviewed-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20160831160913.12991-3-daniel.vetter@ffwll.ch
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_bridge.h218
-rw-r--r--include/drm/drm_connector.h4
-rw-r--r--include/drm/drm_crtc.h187
-rw-r--r--include/drm/drm_mode_object.h1
-rw-r--r--include/drm/drm_modes.h4
5 files changed, 228 insertions, 186 deletions
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
new file mode 100644
index 000000000000..530a1d6e8cde
--- /dev/null
+++ b/include/drm/drm_bridge.h
@@ -0,0 +1,218 @@
1/*
2 * Copyright (c) 2016 Intel Corporation
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22
23#ifndef __DRM_BRIDGE_H__
24#define __DRM_BRIDGE_H__
25
26#include <linux/list.h>
27#include <linux/ctype.h>
28#include <drm/drm_mode_object.h>
29#include <drm/drm_modes.h>
30
31struct drm_bridge;
32
33/**
34 * struct drm_bridge_funcs - drm_bridge control functions
35 */
36struct drm_bridge_funcs {
37 /**
38 * @attach:
39 *
40 * This callback is invoked whenever our bridge is being attached to a
41 * &drm_encoder.
42 *
43 * The attach callback is optional.
44 *
45 * RETURNS:
46 *
47 * Zero on success, error code on failure.
48 */
49 int (*attach)(struct drm_bridge *bridge);
50
51 /**
52 * @detach:
53 *
54 * This callback is invoked whenever our bridge is being detached from a
55 * &drm_encoder.
56 *
57 * The detach callback is optional.
58 */
59 void (*detach)(struct drm_bridge *bridge);
60
61 /**
62 * @mode_fixup:
63 *
64 * This callback is used to validate and adjust a mode. The paramater
65 * mode is the display mode that should be fed to the next element in
66 * the display chain, either the final &drm_connector or the next
67 * &drm_bridge. The parameter adjusted_mode is the input mode the bridge
68 * requires. It can be modified by this callback and does not need to
69 * match mode.
70 *
71 * This is the only hook that allows a bridge to reject a modeset. If
72 * this function passes all other callbacks must succeed for this
73 * configuration.
74 *
75 * The mode_fixup callback is optional.
76 *
77 * NOTE:
78 *
79 * This function is called in the check phase of atomic modesets, which
80 * can be aborted for any reason (including on userspace's request to
81 * just check whether a configuration would be possible). Drivers MUST
82 * NOT touch any persistent state (hardware or software) or data
83 * structures except the passed in @state parameter.
84 *
85 * RETURNS:
86 *
87 * True if an acceptable configuration is possible, false if the modeset
88 * operation should be rejected.
89 */
90 bool (*mode_fixup)(struct drm_bridge *bridge,
91 const struct drm_display_mode *mode,
92 struct drm_display_mode *adjusted_mode);
93 /**
94 * @disable:
95 *
96 * This callback should disable the bridge. It is called right before
97 * the preceding element in the display pipe is disabled. If the
98 * preceding element is a bridge this means it's called before that
99 * bridge's ->disable() function. If the preceding element is a
100 * &drm_encoder it's called right before the encoder's ->disable(),
101 * ->prepare() or ->dpms() hook from struct &drm_encoder_helper_funcs.
102 *
103 * The bridge can assume that the display pipe (i.e. clocks and timing
104 * signals) feeding it is still running when this callback is called.
105 *
106 * The disable callback is optional.
107 */
108 void (*disable)(struct drm_bridge *bridge);
109
110 /**
111 * @post_disable:
112 *
113 * This callback should disable the bridge. It is called right after
114 * the preceding element in the display pipe is disabled. If the
115 * preceding element is a bridge this means it's called after that
116 * bridge's ->post_disable() function. If the preceding element is a
117 * &drm_encoder it's called right after the encoder's ->disable(),
118 * ->prepare() or ->dpms() hook from struct &drm_encoder_helper_funcs.
119 *
120 * The bridge must assume that the display pipe (i.e. clocks and timing
121 * singals) feeding it is no longer running when this callback is
122 * called.
123 *
124 * The post_disable callback is optional.
125 */
126 void (*post_disable)(struct drm_bridge *bridge);
127
128 /**
129 * @mode_set:
130 *
131 * This callback should set the given mode on the bridge. It is called
132 * after the ->mode_set() callback for the preceding element in the
133 * display pipeline has been called already. The display pipe (i.e.
134 * clocks and timing signals) is off when this function is called.
135 */
136 void (*mode_set)(struct drm_bridge *bridge,
137 struct drm_display_mode *mode,
138 struct drm_display_mode *adjusted_mode);
139 /**
140 * @pre_enable:
141 *
142 * This callback should enable the bridge. It is called right before
143 * the preceding element in the display pipe is enabled. If the
144 * preceding element is a bridge this means it's called before that
145 * bridge's ->pre_enable() function. If the preceding element is a
146 * &drm_encoder it's called right before the encoder's ->enable(),
147 * ->commit() or ->dpms() hook from struct &drm_encoder_helper_funcs.
148 *
149 * The display pipe (i.e. clocks and timing signals) feeding this bridge
150 * will not yet be running when this callback is called. The bridge must
151 * not enable the display link feeding the next bridge in the chain (if
152 * there is one) when this callback is called.
153 *
154 * The pre_enable callback is optional.
155 */
156 void (*pre_enable)(struct drm_bridge *bridge);
157
158 /**
159 * @enable:
160 *
161 * This callback should enable the bridge. It is called right after
162 * the preceding element in the display pipe is enabled. If the
163 * preceding element is a bridge this means it's called after that
164 * bridge's ->enable() function. If the preceding element is a
165 * &drm_encoder it's called right after the encoder's ->enable(),
166 * ->commit() or ->dpms() hook from struct &drm_encoder_helper_funcs.
167 *
168 * The bridge can assume that the display pipe (i.e. clocks and timing
169 * signals) feeding it is running when this callback is called. This
170 * callback must enable the display link feeding the next bridge in the
171 * chain if there is one.
172 *
173 * The enable callback is optional.
174 */
175 void (*enable)(struct drm_bridge *bridge);
176};
177
178/**
179 * struct drm_bridge - central DRM bridge control structure
180 * @dev: DRM device this bridge belongs to
181 * @encoder: encoder to which this bridge is connected
182 * @next: the next bridge in the encoder chain
183 * @of_node: device node pointer to the bridge
184 * @list: to keep track of all added bridges
185 * @funcs: control functions
186 * @driver_private: pointer to the bridge driver's internal context
187 */
188struct drm_bridge {
189 struct drm_device *dev;
190 struct drm_encoder *encoder;
191 struct drm_bridge *next;
192#ifdef CONFIG_OF
193 struct device_node *of_node;
194#endif
195 struct list_head list;
196
197 const struct drm_bridge_funcs *funcs;
198 void *driver_private;
199};
200
201int drm_bridge_add(struct drm_bridge *bridge);
202void drm_bridge_remove(struct drm_bridge *bridge);
203struct drm_bridge *of_drm_find_bridge(struct device_node *np);
204int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge);
205void drm_bridge_detach(struct drm_bridge *bridge);
206
207bool drm_bridge_mode_fixup(struct drm_bridge *bridge,
208 const struct drm_display_mode *mode,
209 struct drm_display_mode *adjusted_mode);
210void drm_bridge_disable(struct drm_bridge *bridge);
211void drm_bridge_post_disable(struct drm_bridge *bridge);
212void drm_bridge_mode_set(struct drm_bridge *bridge,
213 struct drm_display_mode *mode,
214 struct drm_display_mode *adjusted_mode);
215void drm_bridge_pre_enable(struct drm_bridge *bridge);
216void drm_bridge_enable(struct drm_bridge *bridge);
217
218#endif
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index e4e545e9516d..51a15deda161 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -27,6 +27,10 @@
27#include <linux/ctype.h> 27#include <linux/ctype.h>
28#include <drm/drm_mode_object.h> 28#include <drm/drm_mode_object.h>
29 29
30#include <uapi/drm/drm_mode.h>
31
32struct drm_device;
33
30struct drm_connector_helper_funcs; 34struct drm_connector_helper_funcs;
31struct drm_device; 35struct drm_device;
32struct drm_crtc; 36struct drm_crtc;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 749d3b2017fd..a2d1108c7c2c 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -42,6 +42,7 @@
42#include <drm/drm_connector.h> 42#include <drm/drm_connector.h>
43#include <drm/drm_encoder.h> 43#include <drm/drm_encoder.h>
44#include <drm/drm_property.h> 44#include <drm/drm_property.h>
45#include <drm/drm_bridge.h>
45 46
46struct drm_device; 47struct drm_device;
47struct drm_mode_set; 48struct drm_mode_set;
@@ -1019,174 +1020,6 @@ struct drm_plane {
1019}; 1020};
1020 1021
1021/** 1022/**
1022 * struct drm_bridge_funcs - drm_bridge control functions
1023 */
1024struct drm_bridge_funcs {
1025 /**
1026 * @attach:
1027 *
1028 * This callback is invoked whenever our bridge is being attached to a
1029 * &drm_encoder.
1030 *
1031 * The attach callback is optional.
1032 *
1033 * RETURNS:
1034 *
1035 * Zero on success, error code on failure.
1036 */
1037 int (*attach)(struct drm_bridge *bridge);
1038
1039 /**
1040 * @detach:
1041 *
1042 * This callback is invoked whenever our bridge is being detached from a
1043 * &drm_encoder.
1044 *
1045 * The detach callback is optional.
1046 */
1047 void (*detach)(struct drm_bridge *bridge);
1048
1049 /**
1050 * @mode_fixup:
1051 *
1052 * This callback is used to validate and adjust a mode. The paramater
1053 * mode is the display mode that should be fed to the next element in
1054 * the display chain, either the final &drm_connector or the next
1055 * &drm_bridge. The parameter adjusted_mode is the input mode the bridge
1056 * requires. It can be modified by this callback and does not need to
1057 * match mode.
1058 *
1059 * This is the only hook that allows a bridge to reject a modeset. If
1060 * this function passes all other callbacks must succeed for this
1061 * configuration.
1062 *
1063 * The mode_fixup callback is optional.
1064 *
1065 * NOTE:
1066 *
1067 * This function is called in the check phase of atomic modesets, which
1068 * can be aborted for any reason (including on userspace's request to
1069 * just check whether a configuration would be possible). Drivers MUST
1070 * NOT touch any persistent state (hardware or software) or data
1071 * structures except the passed in @state parameter.
1072 *
1073 * RETURNS:
1074 *
1075 * True if an acceptable configuration is possible, false if the modeset
1076 * operation should be rejected.
1077 */
1078 bool (*mode_fixup)(struct drm_bridge *bridge,
1079 const struct drm_display_mode *mode,
1080 struct drm_display_mode *adjusted_mode);
1081 /**
1082 * @disable:
1083 *
1084 * This callback should disable the bridge. It is called right before
1085 * the preceding element in the display pipe is disabled. If the
1086 * preceding element is a bridge this means it's called before that
1087 * bridge's ->disable() function. If the preceding element is a
1088 * &drm_encoder it's called right before the encoder's ->disable(),
1089 * ->prepare() or ->dpms() hook from struct &drm_encoder_helper_funcs.
1090 *
1091 * The bridge can assume that the display pipe (i.e. clocks and timing
1092 * signals) feeding it is still running when this callback is called.
1093 *
1094 * The disable callback is optional.
1095 */
1096 void (*disable)(struct drm_bridge *bridge);
1097
1098 /**
1099 * @post_disable:
1100 *
1101 * This callback should disable the bridge. It is called right after
1102 * the preceding element in the display pipe is disabled. If the
1103 * preceding element is a bridge this means it's called after that
1104 * bridge's ->post_disable() function. If the preceding element is a
1105 * &drm_encoder it's called right after the encoder's ->disable(),
1106 * ->prepare() or ->dpms() hook from struct &drm_encoder_helper_funcs.
1107 *
1108 * The bridge must assume that the display pipe (i.e. clocks and timing
1109 * singals) feeding it is no longer running when this callback is
1110 * called.
1111 *
1112 * The post_disable callback is optional.
1113 */
1114 void (*post_disable)(struct drm_bridge *bridge);
1115
1116 /**
1117 * @mode_set:
1118 *
1119 * This callback should set the given mode on the bridge. It is called
1120 * after the ->mode_set() callback for the preceding element in the
1121 * display pipeline has been called already. The display pipe (i.e.
1122 * clocks and timing signals) is off when this function is called.
1123 */
1124 void (*mode_set)(struct drm_bridge *bridge,
1125 struct drm_display_mode *mode,
1126 struct drm_display_mode *adjusted_mode);
1127 /**
1128 * @pre_enable:
1129 *
1130 * This callback should enable the bridge. It is called right before
1131 * the preceding element in the display pipe is enabled. If the
1132 * preceding element is a bridge this means it's called before that
1133 * bridge's ->pre_enable() function. If the preceding element is a
1134 * &drm_encoder it's called right before the encoder's ->enable(),
1135 * ->commit() or ->dpms() hook from struct &drm_encoder_helper_funcs.
1136 *
1137 * The display pipe (i.e. clocks and timing signals) feeding this bridge
1138 * will not yet be running when this callback is called. The bridge must
1139 * not enable the display link feeding the next bridge in the chain (if
1140 * there is one) when this callback is called.
1141 *
1142 * The pre_enable callback is optional.
1143 */
1144 void (*pre_enable)(struct drm_bridge *bridge);
1145
1146 /**
1147 * @enable:
1148 *
1149 * This callback should enable the bridge. It is called right after
1150 * the preceding element in the display pipe is enabled. If the
1151 * preceding element is a bridge this means it's called after that
1152 * bridge's ->enable() function. If the preceding element is a
1153 * &drm_encoder it's called right after the encoder's ->enable(),
1154 * ->commit() or ->dpms() hook from struct &drm_encoder_helper_funcs.
1155 *
1156 * The bridge can assume that the display pipe (i.e. clocks and timing
1157 * signals) feeding it is running when this callback is called. This
1158 * callback must enable the display link feeding the next bridge in the
1159 * chain if there is one.
1160 *
1161 * The enable callback is optional.
1162 */
1163 void (*enable)(struct drm_bridge *bridge);
1164};
1165
1166/**
1167 * struct drm_bridge - central DRM bridge control structure
1168 * @dev: DRM device this bridge belongs to
1169 * @encoder: encoder to which this bridge is connected
1170 * @next: the next bridge in the encoder chain
1171 * @of_node: device node pointer to the bridge
1172 * @list: to keep track of all added bridges
1173 * @funcs: control functions
1174 * @driver_private: pointer to the bridge driver's internal context
1175 */
1176struct drm_bridge {
1177 struct drm_device *dev;
1178 struct drm_encoder *encoder;
1179 struct drm_bridge *next;
1180#ifdef CONFIG_OF
1181 struct device_node *of_node;
1182#endif
1183 struct list_head list;
1184
1185 const struct drm_bridge_funcs *funcs;
1186 void *driver_private;
1187};
1188
1189/**
1190 * struct drm_crtc_commit - track modeset commits on a CRTC 1023 * struct drm_crtc_commit - track modeset commits on a CRTC
1191 * 1024 *
1192 * This structure is used to track pending modeset changes and atomic commit on 1025 * This structure is used to track pending modeset changes and atomic commit on
@@ -2200,22 +2033,4 @@ struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
2200 int hsize, int vsize, int fresh, 2033 int hsize, int vsize, int fresh,
2201 bool rb); 2034 bool rb);
2202 2035
2203/* drm_bridge.c */
2204extern int drm_bridge_add(struct drm_bridge *bridge);
2205extern void drm_bridge_remove(struct drm_bridge *bridge);
2206extern struct drm_bridge *of_drm_find_bridge(struct device_node *np);
2207extern int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge);
2208extern void drm_bridge_detach(struct drm_bridge *bridge);
2209
2210bool drm_bridge_mode_fixup(struct drm_bridge *bridge,
2211 const struct drm_display_mode *mode,
2212 struct drm_display_mode *adjusted_mode);
2213void drm_bridge_disable(struct drm_bridge *bridge);
2214void drm_bridge_post_disable(struct drm_bridge *bridge);
2215void drm_bridge_mode_set(struct drm_bridge *bridge,
2216 struct drm_display_mode *mode,
2217 struct drm_display_mode *adjusted_mode);
2218void drm_bridge_pre_enable(struct drm_bridge *bridge);
2219void drm_bridge_enable(struct drm_bridge *bridge);
2220
2221#endif /* __DRM_CRTC_H__ */ 2036#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_mode_object.h b/include/drm/drm_mode_object.h
index be3d93839ae2..43460b21d112 100644
--- a/include/drm/drm_mode_object.h
+++ b/include/drm/drm_mode_object.h
@@ -26,6 +26,7 @@
26#include <linux/kref.h> 26#include <linux/kref.h>
27struct drm_object_properties; 27struct drm_object_properties;
28struct drm_property; 28struct drm_property;
29struct drm_device;
29 30
30/** 31/**
31 * struct drm_mode_object - base structure for modeset objects 32 * struct drm_mode_object - base structure for modeset objects
diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
index 986ed6ff635a..9934d91619c1 100644
--- a/include/drm/drm_modes.h
+++ b/include/drm/drm_modes.h
@@ -27,9 +27,13 @@
27#ifndef __DRM_MODES_H__ 27#ifndef __DRM_MODES_H__
28#define __DRM_MODES_H__ 28#define __DRM_MODES_H__
29 29
30#include <linux/hdmi.h>
31
30#include <drm/drm_mode_object.h> 32#include <drm/drm_mode_object.h>
31#include <drm/drm_connector.h> 33#include <drm/drm_connector.h>
32 34
35struct videomode;
36
33/* 37/*
34 * Note on terminology: here, for brevity and convenience, we refer to connector 38 * Note on terminology: here, for brevity and convenience, we refer to connector
35 * control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS, 39 * control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS,