Commit | Line | Data |
---|---|---|
52217195 DV |
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_CONNECTOR_H__ | |
24 | #define __DRM_CONNECTOR_H__ | |
25 | ||
26 | #include <linux/list.h> | |
ea497bb9 | 27 | #include <linux/llist.h> |
52217195 | 28 | #include <linux/ctype.h> |
0e9f25d0 | 29 | #include <linux/hdmi.h> |
949619f3 | 30 | #include <drm/drm_mode_object.h> |
52217195 | 31 | |
199e4e96 DV |
32 | #include <uapi/drm/drm_mode.h> |
33 | ||
52217195 | 34 | struct drm_connector_helper_funcs; |
6c5ed5ae | 35 | struct drm_modeset_acquire_ctx; |
52217195 DV |
36 | struct drm_device; |
37 | struct drm_crtc; | |
38 | struct drm_encoder; | |
39 | struct drm_property; | |
40 | struct drm_property_blob; | |
fceffb32 | 41 | struct drm_printer; |
52217195 DV |
42 | struct edid; |
43 | ||
44 | enum drm_connector_force { | |
45 | DRM_FORCE_UNSPECIFIED, | |
46 | DRM_FORCE_OFF, | |
47 | DRM_FORCE_ON, /* force on analog part normally */ | |
48 | DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ | |
49 | }; | |
50 | ||
ae2a6da8 DV |
51 | /** |
52 | * enum drm_connector_status - status for a &drm_connector | |
53 | * | |
54 | * This enum is used to track the connector status. There are no separate | |
55 | * #defines for the uapi! | |
56 | */ | |
52217195 | 57 | enum drm_connector_status { |
ae2a6da8 DV |
58 | /** |
59 | * @connector_status_connected: The connector is definitely connected to | |
60 | * a sink device, and can be enabled. | |
61 | */ | |
52217195 | 62 | connector_status_connected = 1, |
ae2a6da8 DV |
63 | /** |
64 | * @connector_status_disconnected: The connector isn't connected to a | |
65 | * sink device which can be autodetect. For digital outputs like DP or | |
66 | * HDMI (which can be realiable probed) this means there's really | |
67 | * nothing there. It is driver-dependent whether a connector with this | |
68 | * status can be lit up or not. | |
69 | */ | |
52217195 | 70 | connector_status_disconnected = 2, |
ae2a6da8 DV |
71 | /** |
72 | * @connector_status_unknown: The connector's status could not be | |
73 | * reliably detected. This happens when probing would either cause | |
74 | * flicker (like load-detection when the connector is in use), or when a | |
75 | * hardware resource isn't available (like when load-detection needs a | |
76 | * free CRTC). It should be possible to light up the connector with one | |
77 | * of the listed fallback modes. For default configuration userspace | |
78 | * should only try to light up connectors with unknown status when | |
79 | * there's not connector with @connector_status_connected. | |
80 | */ | |
52217195 DV |
81 | connector_status_unknown = 3, |
82 | }; | |
83 | ||
84 | enum subpixel_order { | |
85 | SubPixelUnknown = 0, | |
86 | SubPixelHorizontalRGB, | |
87 | SubPixelHorizontalBGR, | |
88 | SubPixelVerticalRGB, | |
89 | SubPixelVerticalBGR, | |
90 | SubPixelNone, | |
afa1c763 SS |
91 | |
92 | }; | |
93 | ||
62c58af3 SS |
94 | /** |
95 | * struct drm_scrambling: sink's scrambling support. | |
96 | */ | |
97 | struct drm_scrambling { | |
98 | /** | |
99 | * @supported: scrambling supported for rates > 340 Mhz. | |
100 | */ | |
101 | bool supported; | |
102 | /** | |
103 | * @low_rates: scrambling supported for rates <= 340 Mhz. | |
104 | */ | |
105 | bool low_rates; | |
106 | }; | |
107 | ||
afa1c763 SS |
108 | /* |
109 | * struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink | |
110 | * | |
111 | * Provides SCDC register support and capabilities related information on a | |
112 | * HDMI 2.0 sink. In case of a HDMI 1.4 sink, all parameter must be 0. | |
113 | */ | |
114 | struct drm_scdc { | |
115 | /** | |
116 | * @supported: status control & data channel present. | |
117 | */ | |
118 | bool supported; | |
119 | /** | |
120 | * @read_request: sink is capable of generating scdc read request. | |
121 | */ | |
122 | bool read_request; | |
62c58af3 SS |
123 | /** |
124 | * @scrambling: sink's scrambling capabilities | |
125 | */ | |
126 | struct drm_scrambling scrambling; | |
afa1c763 SS |
127 | }; |
128 | ||
62c58af3 | 129 | |
afa1c763 SS |
130 | /** |
131 | * struct drm_hdmi_info - runtime information about the connected HDMI sink | |
132 | * | |
133 | * Describes if a given display supports advanced HDMI 2.0 features. | |
134 | * This information is available in CEA-861-F extension blocks (like HF-VSDB). | |
135 | */ | |
136 | struct drm_hdmi_info { | |
86cc921c | 137 | /** @scdc: sink's scdc support and capabilities */ |
afa1c763 | 138 | struct drm_scdc scdc; |
d8523153 SS |
139 | |
140 | /** | |
141 | * @y420_vdb_modes: bitmap of modes which can support ycbcr420 | |
142 | * output only (not normal RGB/YCBCR444/422 outputs). There are total | |
143 | * 107 VICs defined by CEA-861-F spec, so the size is 128 bits to map | |
144 | * upto 128 VICs; | |
145 | */ | |
146 | unsigned long y420_vdb_modes[BITS_TO_LONGS(128)]; | |
832d4f2f SS |
147 | |
148 | /** | |
149 | * @y420_cmdb_modes: bitmap of modes which can support ycbcr420 | |
150 | * output also, along with normal HDMI outputs. There are total 107 | |
151 | * VICs defined by CEA-861-F spec, so the size is 128 bits to map upto | |
152 | * 128 VICs; | |
153 | */ | |
154 | unsigned long y420_cmdb_modes[BITS_TO_LONGS(128)]; | |
155 | ||
156 | /** @y420_cmdb_map: bitmap of SVD index, to extraxt vcb modes */ | |
157 | u64 y420_cmdb_map; | |
e6a9a2c3 SS |
158 | |
159 | /** @y420_dc_modes: bitmap of deep color support index */ | |
160 | u8 y420_dc_modes; | |
52217195 DV |
161 | }; |
162 | ||
40ee6fbe MN |
163 | /** |
164 | * enum drm_link_status - connector's link_status property value | |
165 | * | |
166 | * This enum is used as the connector's link status property value. | |
167 | * It is set to the values defined in uapi. | |
41232c1b MN |
168 | * |
169 | * @DRM_LINK_STATUS_GOOD: DP Link is Good as a result of successful | |
170 | * link training | |
171 | * @DRM_LINK_STATUS_BAD: DP Link is BAD as a result of link training | |
172 | * failure | |
40ee6fbe MN |
173 | */ |
174 | enum drm_link_status { | |
175 | DRM_LINK_STATUS_GOOD = DRM_MODE_LINK_STATUS_GOOD, | |
176 | DRM_LINK_STATUS_BAD = DRM_MODE_LINK_STATUS_BAD, | |
177 | }; | |
178 | ||
8d70f395 HG |
179 | /** |
180 | * enum drm_panel_orientation - panel_orientation info for &drm_display_info | |
181 | * | |
182 | * This enum is used to track the (LCD) panel orientation. There are no | |
183 | * separate #defines for the uapi! | |
184 | * | |
185 | * @DRM_MODE_PANEL_ORIENTATION_UNKNOWN: The drm driver has not provided any | |
186 | * panel orientation information (normal | |
187 | * for non panels) in this case the "panel | |
188 | * orientation" connector prop will not be | |
189 | * attached. | |
190 | * @DRM_MODE_PANEL_ORIENTATION_NORMAL: The top side of the panel matches the | |
191 | * top side of the device's casing. | |
192 | * @DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP: The top side of the panel matches the | |
193 | * bottom side of the device's casing, iow | |
194 | * the panel is mounted upside-down. | |
195 | * @DRM_MODE_PANEL_ORIENTATION_LEFT_UP: The left side of the panel matches the | |
196 | * top side of the device's casing. | |
197 | * @DRM_MODE_PANEL_ORIENTATION_RIGHT_UP: The right side of the panel matches the | |
198 | * top side of the device's casing. | |
199 | */ | |
200 | enum drm_panel_orientation { | |
201 | DRM_MODE_PANEL_ORIENTATION_UNKNOWN = -1, | |
202 | DRM_MODE_PANEL_ORIENTATION_NORMAL = 0, | |
203 | DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, | |
204 | DRM_MODE_PANEL_ORIENTATION_LEFT_UP, | |
205 | DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, | |
206 | }; | |
207 | ||
b3c6c8bf DV |
208 | /** |
209 | * struct drm_display_info - runtime data about the connected sink | |
210 | * | |
211 | * Describes a given display (e.g. CRT or flat panel) and its limitations. For | |
212 | * fixed display sinks like built-in panels there's not much difference between | |
ea0dd85a | 213 | * this and &struct drm_connector. But for sinks with a real cable this |
b3c6c8bf DV |
214 | * structure is meant to describe all the things at the other end of the cable. |
215 | * | |
216 | * For sinks which provide an EDID this can be filled out by calling | |
217 | * drm_add_edid_modes(). | |
52217195 DV |
218 | */ |
219 | struct drm_display_info { | |
b3c6c8bf DV |
220 | /** |
221 | * @name: Name of the display. | |
222 | */ | |
52217195 DV |
223 | char name[DRM_DISPLAY_INFO_LEN]; |
224 | ||
b3c6c8bf DV |
225 | /** |
226 | * @width_mm: Physical width in mm. | |
227 | */ | |
52217195 | 228 | unsigned int width_mm; |
b3c6c8bf DV |
229 | /** |
230 | * @height_mm: Physical height in mm. | |
231 | */ | |
52217195 DV |
232 | unsigned int height_mm; |
233 | ||
b3c6c8bf DV |
234 | /** |
235 | * @pixel_clock: Maximum pixel clock supported by the sink, in units of | |
188f7882 | 236 | * 100Hz. This mismatches the clock in &drm_display_mode (which is in |
b3c6c8bf DV |
237 | * kHZ), because that's what the EDID uses as base unit. |
238 | */ | |
52217195 | 239 | unsigned int pixel_clock; |
b3c6c8bf DV |
240 | /** |
241 | * @bpc: Maximum bits per color channel. Used by HDMI and DP outputs. | |
242 | */ | |
52217195 DV |
243 | unsigned int bpc; |
244 | ||
b3c6c8bf DV |
245 | /** |
246 | * @subpixel_order: Subpixel order of LCD panels. | |
247 | */ | |
52217195 DV |
248 | enum subpixel_order subpixel_order; |
249 | ||
250 | #define DRM_COLOR_FORMAT_RGB444 (1<<0) | |
251 | #define DRM_COLOR_FORMAT_YCRCB444 (1<<1) | |
252 | #define DRM_COLOR_FORMAT_YCRCB422 (1<<2) | |
832d4f2f | 253 | #define DRM_COLOR_FORMAT_YCRCB420 (1<<3) |
52217195 | 254 | |
8d70f395 HG |
255 | /** |
256 | * @panel_orientation: Read only connector property for built-in panels, | |
257 | * indicating the orientation of the panel vs the device's casing. | |
258 | * drm_connector_init() sets this to DRM_MODE_PANEL_ORIENTATION_UNKNOWN. | |
259 | * When not UNKNOWN this gets used by the drm_fb_helpers to rotate the | |
260 | * fb to compensate and gets exported as prop to userspace. | |
261 | */ | |
262 | int panel_orientation; | |
263 | ||
b3c6c8bf DV |
264 | /** |
265 | * @color_formats: HDMI Color formats, selects between RGB and YCrCb | |
266 | * modes. Used DRM_COLOR_FORMAT\_ defines, which are _not_ the same ones | |
267 | * as used to describe the pixel format in framebuffers, and also don't | |
268 | * match the formats in @bus_formats which are shared with v4l. | |
269 | */ | |
52217195 DV |
270 | u32 color_formats; |
271 | ||
b3c6c8bf DV |
272 | /** |
273 | * @bus_formats: Pixel data format on the wire, somewhat redundant with | |
274 | * @color_formats. Array of size @num_bus_formats encoded using | |
275 | * MEDIA_BUS_FMT\_ defines shared with v4l and media drivers. | |
276 | */ | |
52217195 | 277 | const u32 *bus_formats; |
b3c6c8bf DV |
278 | /** |
279 | * @num_bus_formats: Size of @bus_formats array. | |
280 | */ | |
52217195 DV |
281 | unsigned int num_bus_formats; |
282 | ||
283 | #define DRM_BUS_FLAG_DE_LOW (1<<0) | |
284 | #define DRM_BUS_FLAG_DE_HIGH (1<<1) | |
285 | /* drive data on pos. edge */ | |
286 | #define DRM_BUS_FLAG_PIXDATA_POSEDGE (1<<2) | |
287 | /* drive data on neg. edge */ | |
288 | #define DRM_BUS_FLAG_PIXDATA_NEGEDGE (1<<3) | |
5ec1a960 LP |
289 | /* data is transmitted MSB to LSB on the bus */ |
290 | #define DRM_BUS_FLAG_DATA_MSB_TO_LSB (1<<4) | |
291 | /* data is transmitted LSB to MSB on the bus */ | |
292 | #define DRM_BUS_FLAG_DATA_LSB_TO_MSB (1<<5) | |
52217195 | 293 | |
b3c6c8bf DV |
294 | /** |
295 | * @bus_flags: Additional information (like pixel signal polarity) for | |
296 | * the pixel data on the bus, using DRM_BUS_FLAGS\_ defines. | |
297 | */ | |
52217195 DV |
298 | u32 bus_flags; |
299 | ||
2a272ca9 VS |
300 | /** |
301 | * @max_tmds_clock: Maximum TMDS clock rate supported by the | |
302 | * sink in kHz. 0 means undefined. | |
303 | */ | |
304 | int max_tmds_clock; | |
305 | ||
306 | /** | |
307 | * @dvi_dual: Dual-link DVI sink? | |
308 | */ | |
309 | bool dvi_dual; | |
310 | ||
f1781e9b VS |
311 | /** |
312 | * @has_hdmi_infoframe: Does the sink support the HDMI infoframe? | |
313 | */ | |
314 | bool has_hdmi_infoframe; | |
315 | ||
b3c6c8bf DV |
316 | /** |
317 | * @edid_hdmi_dc_modes: Mask of supported hdmi deep color modes. Even | |
318 | * more stuff redundant with @bus_formats. | |
319 | */ | |
52217195 DV |
320 | u8 edid_hdmi_dc_modes; |
321 | ||
b3c6c8bf DV |
322 | /** |
323 | * @cea_rev: CEA revision of the HDMI sink. | |
324 | */ | |
52217195 | 325 | u8 cea_rev; |
afa1c763 SS |
326 | |
327 | /** | |
328 | * @hdmi: advance features of a HDMI sink. | |
329 | */ | |
330 | struct drm_hdmi_info hdmi; | |
66660d4c DA |
331 | |
332 | /** | |
333 | * @non_desktop: Non desktop display (HMD). | |
334 | */ | |
335 | bool non_desktop; | |
52217195 DV |
336 | }; |
337 | ||
b3c6c8bf DV |
338 | int drm_display_info_set_bus_formats(struct drm_display_info *info, |
339 | const u32 *formats, | |
340 | unsigned int num_formats); | |
341 | ||
299a16b1 BB |
342 | /** |
343 | * struct drm_tv_connector_state - TV connector related states | |
344 | * @subconnector: selected subconnector | |
07d85290 JN |
345 | * @margins: margins |
346 | * @margins.left: left margin | |
347 | * @margins.right: right margin | |
348 | * @margins.top: top margin | |
349 | * @margins.bottom: bottom margin | |
299a16b1 BB |
350 | * @mode: TV mode |
351 | * @brightness: brightness in percent | |
352 | * @contrast: contrast in percent | |
353 | * @flicker_reduction: flicker reduction in percent | |
354 | * @overscan: overscan in percent | |
355 | * @saturation: saturation in percent | |
356 | * @hue: hue in percent | |
357 | */ | |
358 | struct drm_tv_connector_state { | |
359 | enum drm_mode_subconnector subconnector; | |
360 | struct { | |
361 | unsigned int left; | |
362 | unsigned int right; | |
363 | unsigned int top; | |
364 | unsigned int bottom; | |
365 | } margins; | |
366 | unsigned int mode; | |
367 | unsigned int brightness; | |
368 | unsigned int contrast; | |
369 | unsigned int flicker_reduction; | |
370 | unsigned int overscan; | |
371 | unsigned int saturation; | |
372 | unsigned int hue; | |
373 | }; | |
374 | ||
52217195 DV |
375 | /** |
376 | * struct drm_connector_state - mutable connector state | |
377 | * @connector: backpointer to the connector | |
52217195 DV |
378 | * @best_encoder: can be used by helpers and drivers to select the encoder |
379 | * @state: backpointer to global drm_atomic_state | |
299a16b1 | 380 | * @tv: TV connector state |
52217195 DV |
381 | */ |
382 | struct drm_connector_state { | |
383 | struct drm_connector *connector; | |
384 | ||
afb21ea6 DV |
385 | /** |
386 | * @crtc: CRTC to connect connector to, NULL if disabled. | |
387 | * | |
388 | * Do not change this directly, use drm_atomic_set_crtc_for_connector() | |
389 | * instead. | |
390 | */ | |
391 | struct drm_crtc *crtc; | |
52217195 DV |
392 | |
393 | struct drm_encoder *best_encoder; | |
394 | ||
40ee6fbe MN |
395 | /** |
396 | * @link_status: Connector link_status to keep track of whether link is | |
397 | * GOOD or BAD to notify userspace if retraining is necessary. | |
398 | */ | |
399 | enum drm_link_status link_status; | |
400 | ||
52217195 | 401 | struct drm_atomic_state *state; |
299a16b1 | 402 | |
21a01abb ML |
403 | /** |
404 | * @commit: Tracks the pending commit to prevent use-after-free conditions. | |
405 | * | |
406 | * Is only set when @crtc is NULL. | |
407 | */ | |
408 | struct drm_crtc_commit *commit; | |
409 | ||
299a16b1 | 410 | struct drm_tv_connector_state tv; |
0e9f25d0 ML |
411 | |
412 | /** | |
413 | * @picture_aspect_ratio: Connector property to control the | |
414 | * HDMI infoframe aspect ratio setting. | |
415 | * | |
8f6e1e22 | 416 | * The %DRM_MODE_PICTURE_ASPECT_\* values much match the |
0e9f25d0 ML |
417 | * values for &enum hdmi_picture_aspect |
418 | */ | |
419 | enum hdmi_picture_aspect picture_aspect_ratio; | |
8f6e1e22 | 420 | |
50525c33 SL |
421 | /** |
422 | * @content_type: Connector property to control the | |
423 | * HDMI infoframe content type setting. | |
424 | * The %DRM_MODE_CONTENT_TYPE_\* values much | |
425 | * match the values. | |
426 | */ | |
427 | unsigned int content_type; | |
428 | ||
8f6e1e22 ML |
429 | /** |
430 | * @scaling_mode: Connector property to control the | |
431 | * upscaling, mostly used for built-in panels. | |
432 | */ | |
433 | unsigned int scaling_mode; | |
24557865 SP |
434 | |
435 | /** | |
436 | * @content_protection: Connector property to request content | |
437 | * protection. This is most commonly used for HDCP. | |
438 | */ | |
439 | unsigned int content_protection; | |
52217195 DV |
440 | }; |
441 | ||
442 | /** | |
443 | * struct drm_connector_funcs - control connectors on a given device | |
444 | * | |
445 | * Each CRTC may have one or more connectors attached to it. The functions | |
446 | * below allow the core DRM code to control connectors, enumerate available modes, | |
447 | * etc. | |
448 | */ | |
449 | struct drm_connector_funcs { | |
450 | /** | |
451 | * @dpms: | |
452 | * | |
453 | * Legacy entry point to set the per-connector DPMS state. Legacy DPMS | |
454 | * is exposed as a standard property on the connector, but diverted to | |
455 | * this callback in the drm core. Note that atomic drivers don't | |
456 | * implement the 4 level DPMS support on the connector any more, but | |
457 | * instead only have an on/off "ACTIVE" property on the CRTC object. | |
458 | * | |
144a7999 DV |
459 | * This hook is not used by atomic drivers, remapping of the legacy DPMS |
460 | * property is entirely handled in the DRM core. | |
52217195 DV |
461 | * |
462 | * RETURNS: | |
463 | * | |
464 | * 0 on success or a negative error code on failure. | |
465 | */ | |
466 | int (*dpms)(struct drm_connector *connector, int mode); | |
467 | ||
468 | /** | |
469 | * @reset: | |
470 | * | |
471 | * Reset connector hardware and software state to off. This function isn't | |
472 | * called by the core directly, only through drm_mode_config_reset(). | |
473 | * It's not a helper hook only for historical reasons. | |
474 | * | |
475 | * Atomic drivers can use drm_atomic_helper_connector_reset() to reset | |
476 | * atomic state using this hook. | |
477 | */ | |
478 | void (*reset)(struct drm_connector *connector); | |
479 | ||
480 | /** | |
481 | * @detect: | |
482 | * | |
483 | * Check to see if anything is attached to the connector. The parameter | |
484 | * force is set to false whilst polling, true when checking the | |
485 | * connector due to a user request. force can be used by the driver to | |
486 | * avoid expensive, destructive operations during automated probing. | |
487 | * | |
949f0886 LP |
488 | * This callback is optional, if not implemented the connector will be |
489 | * considered as always being attached. | |
490 | * | |
52217195 DV |
491 | * FIXME: |
492 | * | |
493 | * Note that this hook is only called by the probe helper. It's not in | |
494 | * the helper library vtable purely for historical reasons. The only DRM | |
495 | * core entry point to probe connector state is @fill_modes. | |
496 | * | |
6c5ed5ae ML |
497 | * Note that the helper library will already hold |
498 | * &drm_mode_config.connection_mutex. Drivers which need to grab additional | |
499 | * locks to avoid races with concurrent modeset changes need to use | |
500 | * &drm_connector_helper_funcs.detect_ctx instead. | |
501 | * | |
52217195 DV |
502 | * RETURNS: |
503 | * | |
504 | * drm_connector_status indicating the connector's status. | |
505 | */ | |
506 | enum drm_connector_status (*detect)(struct drm_connector *connector, | |
507 | bool force); | |
508 | ||
509 | /** | |
510 | * @force: | |
511 | * | |
512 | * This function is called to update internal encoder state when the | |
513 | * connector is forced to a certain state by userspace, either through | |
514 | * the sysfs interfaces or on the kernel cmdline. In that case the | |
515 | * @detect callback isn't called. | |
516 | * | |
517 | * FIXME: | |
518 | * | |
519 | * Note that this hook is only called by the probe helper. It's not in | |
520 | * the helper library vtable purely for historical reasons. The only DRM | |
521 | * core entry point to probe connector state is @fill_modes. | |
522 | */ | |
523 | void (*force)(struct drm_connector *connector); | |
524 | ||
525 | /** | |
526 | * @fill_modes: | |
527 | * | |
528 | * Entry point for output detection and basic mode validation. The | |
529 | * driver should reprobe the output if needed (e.g. when hotplug | |
d574528a | 530 | * handling is unreliable), add all detected modes to &drm_connector.modes |
52217195 DV |
531 | * and filter out any the device can't support in any configuration. It |
532 | * also needs to filter out any modes wider or higher than the | |
533 | * parameters max_width and max_height indicate. | |
534 | * | |
535 | * The drivers must also prune any modes no longer valid from | |
d574528a DV |
536 | * &drm_connector.modes. Furthermore it must update |
537 | * &drm_connector.status and &drm_connector.edid. If no EDID has been | |
538 | * received for this output connector->edid must be NULL. | |
52217195 DV |
539 | * |
540 | * Drivers using the probe helpers should use | |
541 | * drm_helper_probe_single_connector_modes() or | |
542 | * drm_helper_probe_single_connector_modes_nomerge() to implement this | |
543 | * function. | |
544 | * | |
545 | * RETURNS: | |
546 | * | |
d574528a | 547 | * The number of modes detected and filled into &drm_connector.modes. |
52217195 DV |
548 | */ |
549 | int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); | |
550 | ||
551 | /** | |
552 | * @set_property: | |
553 | * | |
554 | * This is the legacy entry point to update a property attached to the | |
555 | * connector. | |
556 | * | |
52217195 | 557 | * This callback is optional if the driver does not support any legacy |
144a7999 DV |
558 | * driver-private properties. For atomic drivers it is not used because |
559 | * property handling is done entirely in the DRM core. | |
52217195 DV |
560 | * |
561 | * RETURNS: | |
562 | * | |
563 | * 0 on success or a negative error code on failure. | |
564 | */ | |
565 | int (*set_property)(struct drm_connector *connector, struct drm_property *property, | |
566 | uint64_t val); | |
567 | ||
568 | /** | |
569 | * @late_register: | |
570 | * | |
571 | * This optional hook can be used to register additional userspace | |
572 | * interfaces attached to the connector, light backlight control, i2c, | |
573 | * DP aux or similar interfaces. It is called late in the driver load | |
574 | * sequence from drm_connector_register() when registering all the | |
575 | * core drm connector interfaces. Everything added from this callback | |
576 | * should be unregistered in the early_unregister callback. | |
577 | * | |
d574528a | 578 | * This is called while holding &drm_connector.mutex. |
e73ab00e | 579 | * |
52217195 DV |
580 | * Returns: |
581 | * | |
582 | * 0 on success, or a negative error code on failure. | |
583 | */ | |
584 | int (*late_register)(struct drm_connector *connector); | |
585 | ||
586 | /** | |
587 | * @early_unregister: | |
588 | * | |
589 | * This optional hook should be used to unregister the additional | |
590 | * userspace interfaces attached to the connector from | |
621a9993 | 591 | * late_register(). It is called from drm_connector_unregister(), |
52217195 DV |
592 | * early in the driver unload sequence to disable userspace access |
593 | * before data structures are torndown. | |
e73ab00e | 594 | * |
d574528a | 595 | * This is called while holding &drm_connector.mutex. |
52217195 DV |
596 | */ |
597 | void (*early_unregister)(struct drm_connector *connector); | |
598 | ||
599 | /** | |
600 | * @destroy: | |
601 | * | |
602 | * Clean up connector resources. This is called at driver unload time | |
603 | * through drm_mode_config_cleanup(). It can also be called at runtime | |
604 | * when a connector is being hot-unplugged for drivers that support | |
605 | * connector hotplugging (e.g. DisplayPort MST). | |
606 | */ | |
607 | void (*destroy)(struct drm_connector *connector); | |
608 | ||
609 | /** | |
610 | * @atomic_duplicate_state: | |
611 | * | |
612 | * Duplicate the current atomic state for this connector and return it. | |
621a9993 | 613 | * The core and helpers guarantee that any atomic state duplicated with |
52217195 | 614 | * this hook and still owned by the caller (i.e. not transferred to the |
d574528a DV |
615 | * driver by calling &drm_mode_config_funcs.atomic_commit) will be |
616 | * cleaned up by calling the @atomic_destroy_state hook in this | |
617 | * structure. | |
52217195 | 618 | * |
ba1f665f HM |
619 | * This callback is mandatory for atomic drivers. |
620 | * | |
ea0dd85a | 621 | * Atomic drivers which don't subclass &struct drm_connector_state should use |
52217195 DV |
622 | * drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the |
623 | * state structure to extend it with driver-private state should use | |
624 | * __drm_atomic_helper_connector_duplicate_state() to make sure shared state is | |
625 | * duplicated in a consistent fashion across drivers. | |
626 | * | |
d574528a | 627 | * It is an error to call this hook before &drm_connector.state has been |
52217195 DV |
628 | * initialized correctly. |
629 | * | |
630 | * NOTE: | |
631 | * | |
632 | * If the duplicate state references refcounted resources this hook must | |
633 | * acquire a reference for each of them. The driver must release these | |
634 | * references again in @atomic_destroy_state. | |
635 | * | |
636 | * RETURNS: | |
637 | * | |
638 | * Duplicated atomic state or NULL when the allocation failed. | |
639 | */ | |
640 | struct drm_connector_state *(*atomic_duplicate_state)(struct drm_connector *connector); | |
641 | ||
642 | /** | |
643 | * @atomic_destroy_state: | |
644 | * | |
645 | * Destroy a state duplicated with @atomic_duplicate_state and release | |
646 | * or unreference all resources it references | |
ba1f665f HM |
647 | * |
648 | * This callback is mandatory for atomic drivers. | |
52217195 DV |
649 | */ |
650 | void (*atomic_destroy_state)(struct drm_connector *connector, | |
651 | struct drm_connector_state *state); | |
652 | ||
653 | /** | |
654 | * @atomic_set_property: | |
655 | * | |
656 | * Decode a driver-private property value and store the decoded value | |
657 | * into the passed-in state structure. Since the atomic core decodes all | |
658 | * standardized properties (even for extensions beyond the core set of | |
659 | * properties which might not be implemented by all drivers) this | |
660 | * requires drivers to subclass the state structure. | |
661 | * | |
662 | * Such driver-private properties should really only be implemented for | |
663 | * truly hardware/vendor specific state. Instead it is preferred to | |
664 | * standardize atomic extension and decode the properties used to expose | |
665 | * such an extension in the core. | |
666 | * | |
667 | * Do not call this function directly, use | |
668 | * drm_atomic_connector_set_property() instead. | |
669 | * | |
670 | * This callback is optional if the driver does not support any | |
671 | * driver-private atomic properties. | |
672 | * | |
673 | * NOTE: | |
674 | * | |
675 | * This function is called in the state assembly phase of atomic | |
676 | * modesets, which can be aborted for any reason (including on | |
677 | * userspace's request to just check whether a configuration would be | |
678 | * possible). Drivers MUST NOT touch any persistent state (hardware or | |
679 | * software) or data structures except the passed in @state parameter. | |
680 | * | |
681 | * Also since userspace controls in which order properties are set this | |
682 | * function must not do any input validation (since the state update is | |
683 | * incomplete and hence likely inconsistent). Instead any such input | |
684 | * validation must be done in the various atomic_check callbacks. | |
685 | * | |
686 | * RETURNS: | |
687 | * | |
688 | * 0 if the property has been found, -EINVAL if the property isn't | |
689 | * implemented by the driver (which shouldn't ever happen, the core only | |
690 | * asks for properties attached to this connector). No other validation | |
691 | * is allowed by the driver. The core already checks that the property | |
692 | * value is within the range (integer, valid enum value, ...) the driver | |
693 | * set when registering the property. | |
694 | */ | |
695 | int (*atomic_set_property)(struct drm_connector *connector, | |
696 | struct drm_connector_state *state, | |
697 | struct drm_property *property, | |
698 | uint64_t val); | |
699 | ||
700 | /** | |
701 | * @atomic_get_property: | |
702 | * | |
703 | * Reads out the decoded driver-private property. This is used to | |
704 | * implement the GETCONNECTOR IOCTL. | |
705 | * | |
706 | * Do not call this function directly, use | |
707 | * drm_atomic_connector_get_property() instead. | |
708 | * | |
709 | * This callback is optional if the driver does not support any | |
710 | * driver-private atomic properties. | |
711 | * | |
712 | * RETURNS: | |
713 | * | |
714 | * 0 on success, -EINVAL if the property isn't implemented by the | |
715 | * driver (which shouldn't ever happen, the core only asks for | |
716 | * properties attached to this connector). | |
717 | */ | |
718 | int (*atomic_get_property)(struct drm_connector *connector, | |
719 | const struct drm_connector_state *state, | |
720 | struct drm_property *property, | |
721 | uint64_t *val); | |
fceffb32 RC |
722 | |
723 | /** | |
724 | * @atomic_print_state: | |
725 | * | |
ea0dd85a | 726 | * If driver subclasses &struct drm_connector_state, it should implement |
fceffb32 RC |
727 | * this optional hook for printing additional driver specific state. |
728 | * | |
729 | * Do not call this directly, use drm_atomic_connector_print_state() | |
730 | * instead. | |
731 | */ | |
732 | void (*atomic_print_state)(struct drm_printer *p, | |
733 | const struct drm_connector_state *state); | |
52217195 DV |
734 | }; |
735 | ||
736 | /* mode specified on the command line */ | |
737 | struct drm_cmdline_mode { | |
738 | bool specified; | |
739 | bool refresh_specified; | |
740 | bool bpp_specified; | |
741 | int xres, yres; | |
742 | int bpp; | |
743 | int refresh; | |
744 | bool rb; | |
745 | bool interlace; | |
746 | bool cvt; | |
747 | bool margins; | |
748 | enum drm_connector_force force; | |
749 | }; | |
750 | ||
751 | /** | |
752 | * struct drm_connector - central DRM connector control structure | |
753 | * @dev: parent DRM device | |
754 | * @kdev: kernel device for sysfs attributes | |
755 | * @attr: sysfs attributes | |
756 | * @head: list management | |
757 | * @base: base KMS object | |
758 | * @name: human readable name, can be overwritten by the driver | |
759 | * @connector_type: one of the DRM_MODE_CONNECTOR_<foo> types from drm_mode.h | |
760 | * @connector_type_id: index into connector type enum | |
761 | * @interlace_allowed: can this connector handle interlaced modes? | |
762 | * @doublescan_allowed: can this connector handle doublescan? | |
763 | * @stereo_allowed: can this connector handle stereo modes? | |
52217195 DV |
764 | * @funcs: connector control functions |
765 | * @edid_blob_ptr: DRM property containing EDID if present | |
766 | * @properties: property tracking for this connector | |
52217195 DV |
767 | * @dpms: current dpms state |
768 | * @helper_private: mid-layer private data | |
769 | * @cmdline_mode: mode line parsed from the kernel cmdline for this connector | |
770 | * @force: a DRM_FORCE_<foo> state for forced mode sets | |
771 | * @override_edid: has the EDID been overwritten through debugfs for testing? | |
772 | * @encoder_ids: valid encoders for this connector | |
52217195 | 773 | * @eld: EDID-like data, if present |
52217195 DV |
774 | * @latency_present: AV delay info from ELD, if found |
775 | * @video_latency: video latency info from ELD, if found | |
776 | * @audio_latency: audio latency info from ELD, if found | |
777 | * @null_edid_counter: track sinks that give us all zeros for the EDID | |
778 | * @bad_edid_counter: track sinks that give us an EDID with invalid checksum | |
779 | * @edid_corrupt: indicates whether the last read EDID was corrupt | |
780 | * @debugfs_entry: debugfs directory for this connector | |
52217195 DV |
781 | * @has_tile: is this connector connected to a tiled monitor |
782 | * @tile_group: tile group for the connected monitor | |
783 | * @tile_is_single_monitor: whether the tile is one monitor housing | |
784 | * @num_h_tile: number of horizontal tiles in the tile group | |
785 | * @num_v_tile: number of vertical tiles in the tile group | |
786 | * @tile_h_loc: horizontal location of this tile | |
787 | * @tile_v_loc: vertical location of this tile | |
788 | * @tile_h_size: horizontal size of this tile. | |
789 | * @tile_v_size: vertical size of this tile. | |
8f6e1e22 | 790 | * @scaling_mode_property: Optional atomic property to control the upscaling. |
24557865 | 791 | * @content_protection_property: Optional property to control content protection |
52217195 DV |
792 | * |
793 | * Each connector may be connected to one or more CRTCs, or may be clonable by | |
794 | * another connector if they can share a CRTC. Each connector also has a specific | |
795 | * position in the broader display (referred to as a 'screen' though it could | |
796 | * span multiple monitors). | |
797 | */ | |
798 | struct drm_connector { | |
799 | struct drm_device *dev; | |
800 | struct device *kdev; | |
801 | struct device_attribute *attr; | |
802 | struct list_head head; | |
803 | ||
804 | struct drm_mode_object base; | |
805 | ||
806 | char *name; | |
807 | ||
e73ab00e DV |
808 | /** |
809 | * @mutex: Lock for general connector state, but currently only protects | |
d574528a DV |
810 | * @registered. Most of the connector state is still protected by |
811 | * &drm_mode_config.mutex. | |
e73ab00e DV |
812 | */ |
813 | struct mutex mutex; | |
814 | ||
52217195 DV |
815 | /** |
816 | * @index: Compacted connector index, which matches the position inside | |
817 | * the mode_config.list for drivers not supporting hot-add/removing. Can | |
818 | * be used as an array index. It is invariant over the lifetime of the | |
819 | * connector. | |
820 | */ | |
821 | unsigned index; | |
822 | ||
823 | int connector_type; | |
824 | int connector_type_id; | |
825 | bool interlace_allowed; | |
826 | bool doublescan_allowed; | |
827 | bool stereo_allowed; | |
d8523153 SS |
828 | |
829 | /** | |
830 | * @ycbcr_420_allowed : This bool indicates if this connector is | |
831 | * capable of handling YCBCR 420 output. While parsing the EDID | |
832 | * blocks, its very helpful to know, if the source is capable of | |
833 | * handling YCBCR 420 outputs. | |
834 | */ | |
835 | bool ycbcr_420_allowed; | |
836 | ||
e73ab00e DV |
837 | /** |
838 | * @registered: Is this connector exposed (registered) with userspace? | |
839 | * Protected by @mutex. | |
840 | */ | |
52217195 | 841 | bool registered; |
91eefc05 DV |
842 | |
843 | /** | |
844 | * @modes: | |
845 | * Modes available on this connector (from fill_modes() + user). | |
d574528a | 846 | * Protected by &drm_mode_config.mutex. |
91eefc05 | 847 | */ |
d574528a | 848 | struct list_head modes; |
52217195 | 849 | |
91eefc05 DV |
850 | /** |
851 | * @status: | |
852 | * One of the drm_connector_status enums (connected, not, or unknown). | |
d574528a | 853 | * Protected by &drm_mode_config.mutex. |
91eefc05 | 854 | */ |
52217195 DV |
855 | enum drm_connector_status status; |
856 | ||
91eefc05 DV |
857 | /** |
858 | * @probed_modes: | |
859 | * These are modes added by probing with DDC or the BIOS, before | |
d574528a DV |
860 | * filtering is applied. Used by the probe helpers. Protected by |
861 | * &drm_mode_config.mutex. | |
91eefc05 | 862 | */ |
52217195 DV |
863 | struct list_head probed_modes; |
864 | ||
ae2a6da8 DV |
865 | /** |
866 | * @display_info: Display information is filled from EDID information | |
867 | * when a display is detected. For non hot-pluggable displays such as | |
868 | * flat panels in embedded systems, the driver should initialize the | |
d574528a DV |
869 | * &drm_display_info.width_mm and &drm_display_info.height_mm fields |
870 | * with the physical size of the display. | |
91eefc05 | 871 | * |
d574528a | 872 | * Protected by &drm_mode_config.mutex. |
ae2a6da8 | 873 | */ |
52217195 DV |
874 | struct drm_display_info display_info; |
875 | const struct drm_connector_funcs *funcs; | |
876 | ||
877 | struct drm_property_blob *edid_blob_ptr; | |
878 | struct drm_object_properties properties; | |
879 | ||
8f6e1e22 ML |
880 | struct drm_property *scaling_mode_property; |
881 | ||
24557865 SP |
882 | /** |
883 | * @content_protection_property: DRM ENUM property for content | |
884 | * protection | |
885 | */ | |
886 | struct drm_property *content_protection_property; | |
887 | ||
52217195 DV |
888 | /** |
889 | * @path_blob_ptr: | |
890 | * | |
891 | * DRM blob property data for the DP MST path property. | |
892 | */ | |
893 | struct drm_property_blob *path_blob_ptr; | |
894 | ||
895 | /** | |
896 | * @tile_blob_ptr: | |
897 | * | |
898 | * DRM blob property data for the tile property (used mostly by DP MST). | |
899 | * This is meant for screens which are driven through separate display | |
900 | * pipelines represented by &drm_crtc, which might not be running with | |
901 | * genlocked clocks. For tiled panels which are genlocked, like | |
902 | * dual-link LVDS or dual-link DSI, the driver should try to not expose | |
903 | * the tiling and virtualize both &drm_crtc and &drm_plane if needed. | |
904 | */ | |
905 | struct drm_property_blob *tile_blob_ptr; | |
906 | ||
907 | /* should we poll this connector for connects and disconnects */ | |
908 | /* hot plug detectable */ | |
909 | #define DRM_CONNECTOR_POLL_HPD (1 << 0) | |
910 | /* poll for connections */ | |
911 | #define DRM_CONNECTOR_POLL_CONNECT (1 << 1) | |
912 | /* can cleanly poll for disconnections without flickering the screen */ | |
913 | /* DACs should rarely do this without a lot of testing */ | |
914 | #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2) | |
915 | ||
ae2a6da8 DV |
916 | /** |
917 | * @polled: | |
918 | * | |
919 | * Connector polling mode, a combination of | |
920 | * | |
921 | * DRM_CONNECTOR_POLL_HPD | |
922 | * The connector generates hotplug events and doesn't need to be | |
923 | * periodically polled. The CONNECT and DISCONNECT flags must not | |
924 | * be set together with the HPD flag. | |
925 | * | |
926 | * DRM_CONNECTOR_POLL_CONNECT | |
927 | * Periodically poll the connector for connection. | |
928 | * | |
929 | * DRM_CONNECTOR_POLL_DISCONNECT | |
930 | * Periodically poll the connector for disconnection. | |
931 | * | |
932 | * Set to 0 for connectors that don't support connection status | |
933 | * discovery. | |
934 | */ | |
935 | uint8_t polled; | |
52217195 DV |
936 | |
937 | /* requested DPMS state */ | |
938 | int dpms; | |
939 | ||
940 | const struct drm_connector_helper_funcs *helper_private; | |
941 | ||
942 | /* forced on connector */ | |
943 | struct drm_cmdline_mode cmdline_mode; | |
944 | enum drm_connector_force force; | |
945 | bool override_edid; | |
946 | ||
947 | #define DRM_CONNECTOR_MAX_ENCODER 3 | |
948 | uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; | |
2e2b96ef DV |
949 | /** |
950 | * @encoder: Currently bound encoder driving this connector, if any. | |
951 | * Only really meaningful for non-atomic drivers. Atomic drivers should | |
952 | * instead look at &drm_connector_state.best_encoder, and in case they | |
953 | * need the CRTC driving this output, &drm_connector_state.crtc. | |
954 | */ | |
955 | struct drm_encoder *encoder; | |
52217195 DV |
956 | |
957 | #define MAX_ELD_BYTES 128 | |
958 | /* EDID bits */ | |
959 | uint8_t eld[MAX_ELD_BYTES]; | |
52217195 DV |
960 | bool latency_present[2]; |
961 | int video_latency[2]; /* [0]: progressive, [1]: interlaced */ | |
962 | int audio_latency[2]; | |
963 | int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */ | |
964 | unsigned bad_edid_counter; | |
965 | ||
966 | /* Flag for raw EDID header corruption - used in Displayport | |
967 | * compliance testing - * Displayport Link CTS Core 1.2 rev1.1 4.2.2.6 | |
968 | */ | |
969 | bool edid_corrupt; | |
970 | ||
971 | struct dentry *debugfs_entry; | |
972 | ||
c9e42b72 DV |
973 | /** |
974 | * @state: | |
975 | * | |
976 | * Current atomic state for this connector. | |
977 | * | |
978 | * This is protected by @drm_mode_config.connection_mutex. Note that | |
979 | * nonblocking atomic commits access the current connector state without | |
980 | * taking locks. Either by going through the &struct drm_atomic_state | |
77ac3b00 | 981 | * pointers, see for_each_oldnew_connector_in_state(), |
c9e42b72 DV |
982 | * for_each_old_connector_in_state() and |
983 | * for_each_new_connector_in_state(). Or through careful ordering of | |
984 | * atomic commit operations as implemented in the atomic helpers, see | |
985 | * &struct drm_crtc_commit. | |
986 | */ | |
52217195 DV |
987 | struct drm_connector_state *state; |
988 | ||
989 | /* DisplayID bits */ | |
990 | bool has_tile; | |
991 | struct drm_tile_group *tile_group; | |
992 | bool tile_is_single_monitor; | |
993 | ||
994 | uint8_t num_h_tile, num_v_tile; | |
995 | uint8_t tile_h_loc, tile_v_loc; | |
996 | uint16_t tile_h_size, tile_v_size; | |
a703c550 DV |
997 | |
998 | /** | |
ea497bb9 | 999 | * @free_node: |
a703c550 | 1000 | * |
ea497bb9 DV |
1001 | * List used only by &drm_connector_iter to be able to clean up a |
1002 | * connector from any context, in conjunction with | |
1003 | * &drm_mode_config.connector_free_work. | |
a703c550 | 1004 | */ |
ea497bb9 | 1005 | struct llist_node free_node; |
52217195 DV |
1006 | }; |
1007 | ||
1008 | #define obj_to_connector(x) container_of(x, struct drm_connector, base) | |
1009 | ||
1010 | int drm_connector_init(struct drm_device *dev, | |
1011 | struct drm_connector *connector, | |
1012 | const struct drm_connector_funcs *funcs, | |
1013 | int connector_type); | |
1014 | int drm_connector_register(struct drm_connector *connector); | |
1015 | void drm_connector_unregister(struct drm_connector *connector); | |
1016 | int drm_mode_connector_attach_encoder(struct drm_connector *connector, | |
1017 | struct drm_encoder *encoder); | |
1018 | ||
1019 | void drm_connector_cleanup(struct drm_connector *connector); | |
1020 | static inline unsigned drm_connector_index(struct drm_connector *connector) | |
1021 | { | |
1022 | return connector->index; | |
1023 | } | |
1024 | ||
1025 | /** | |
1026 | * drm_connector_lookup - lookup connector object | |
1027 | * @dev: DRM device | |
e7e62c7e | 1028 | * @file_priv: drm file to check for lease against. |
52217195 DV |
1029 | * @id: connector object id |
1030 | * | |
1031 | * This function looks up the connector object specified by id | |
1032 | * add takes a reference to it. | |
1033 | */ | |
1034 | static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev, | |
418da172 | 1035 | struct drm_file *file_priv, |
52217195 DV |
1036 | uint32_t id) |
1037 | { | |
1038 | struct drm_mode_object *mo; | |
418da172 | 1039 | mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CONNECTOR); |
52217195 DV |
1040 | return mo ? obj_to_connector(mo) : NULL; |
1041 | } | |
1042 | ||
1043 | /** | |
ad093607 TR |
1044 | * drm_connector_get - acquire a connector reference |
1045 | * @connector: DRM connector | |
52217195 DV |
1046 | * |
1047 | * This function increments the connector's refcount. | |
1048 | */ | |
ad093607 TR |
1049 | static inline void drm_connector_get(struct drm_connector *connector) |
1050 | { | |
1051 | drm_mode_object_get(&connector->base); | |
1052 | } | |
1053 | ||
1054 | /** | |
1055 | * drm_connector_put - release a connector reference | |
1056 | * @connector: DRM connector | |
1057 | * | |
1058 | * This function decrements the connector's reference count and frees the | |
1059 | * object if the reference count drops to zero. | |
1060 | */ | |
1061 | static inline void drm_connector_put(struct drm_connector *connector) | |
1062 | { | |
1063 | drm_mode_object_put(&connector->base); | |
1064 | } | |
1065 | ||
1066 | /** | |
1067 | * drm_connector_reference - acquire a connector reference | |
1068 | * @connector: DRM connector | |
1069 | * | |
1070 | * This is a compatibility alias for drm_connector_get() and should not be | |
1071 | * used by new code. | |
1072 | */ | |
52217195 DV |
1073 | static inline void drm_connector_reference(struct drm_connector *connector) |
1074 | { | |
ad093607 | 1075 | drm_connector_get(connector); |
52217195 DV |
1076 | } |
1077 | ||
1078 | /** | |
ad093607 TR |
1079 | * drm_connector_unreference - release a connector reference |
1080 | * @connector: DRM connector | |
52217195 | 1081 | * |
ad093607 TR |
1082 | * This is a compatibility alias for drm_connector_put() and should not be |
1083 | * used by new code. | |
52217195 DV |
1084 | */ |
1085 | static inline void drm_connector_unreference(struct drm_connector *connector) | |
1086 | { | |
ad093607 | 1087 | drm_connector_put(connector); |
52217195 DV |
1088 | } |
1089 | ||
1090 | const char *drm_get_connector_status_name(enum drm_connector_status status); | |
1091 | const char *drm_get_subpixel_order_name(enum subpixel_order order); | |
1092 | const char *drm_get_dpms_name(int val); | |
1093 | const char *drm_get_dvi_i_subconnector_name(int val); | |
1094 | const char *drm_get_dvi_i_select_name(int val); | |
1095 | const char *drm_get_tv_subconnector_name(int val); | |
1096 | const char *drm_get_tv_select_name(int val); | |
24557865 | 1097 | const char *drm_get_content_protection_name(int val); |
52217195 DV |
1098 | |
1099 | int drm_mode_create_dvi_i_properties(struct drm_device *dev); | |
1100 | int drm_mode_create_tv_properties(struct drm_device *dev, | |
1101 | unsigned int num_modes, | |
1102 | const char * const modes[]); | |
1103 | int drm_mode_create_scaling_mode_property(struct drm_device *dev); | |
50525c33 | 1104 | int drm_connector_attach_content_type_property(struct drm_connector *dev); |
8f6e1e22 ML |
1105 | int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, |
1106 | u32 scaling_mode_mask); | |
24557865 SP |
1107 | int drm_connector_attach_content_protection_property( |
1108 | struct drm_connector *connector); | |
52217195 | 1109 | int drm_mode_create_aspect_ratio_property(struct drm_device *dev); |
50525c33 SL |
1110 | int drm_mode_create_content_type_property(struct drm_device *dev); |
1111 | void drm_hdmi_avi_infoframe_content_type(struct hdmi_avi_infoframe *frame, | |
1112 | const struct drm_connector_state *conn_state); | |
1113 | ||
52217195 DV |
1114 | int drm_mode_create_suggested_offset_properties(struct drm_device *dev); |
1115 | ||
1116 | int drm_mode_connector_set_path_property(struct drm_connector *connector, | |
1117 | const char *path); | |
1118 | int drm_mode_connector_set_tile_property(struct drm_connector *connector); | |
1119 | int drm_mode_connector_update_edid_property(struct drm_connector *connector, | |
1120 | const struct edid *edid); | |
40ee6fbe MN |
1121 | void drm_mode_connector_set_link_status_property(struct drm_connector *connector, |
1122 | uint64_t link_status); | |
8d70f395 HG |
1123 | int drm_connector_init_panel_orientation_property( |
1124 | struct drm_connector *connector, int width, int height); | |
afb21ea6 | 1125 | |
9498c19b DV |
1126 | /** |
1127 | * struct drm_tile_group - Tile group metadata | |
1128 | * @refcount: reference count | |
1129 | * @dev: DRM device | |
1130 | * @id: tile group id exposed to userspace | |
1131 | * @group_data: Sink-private data identifying this group | |
1132 | * | |
1133 | * @group_data corresponds to displayid vend/prod/serial for external screens | |
1134 | * with an EDID. | |
1135 | */ | |
1136 | struct drm_tile_group { | |
1137 | struct kref refcount; | |
1138 | struct drm_device *dev; | |
1139 | int id; | |
1140 | u8 group_data[8]; | |
1141 | }; | |
1142 | ||
1143 | struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev, | |
1144 | char topology[8]); | |
1145 | struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev, | |
1146 | char topology[8]); | |
1147 | void drm_mode_put_tile_group(struct drm_device *dev, | |
1148 | struct drm_tile_group *tg); | |
1149 | ||
613051da DV |
1150 | /** |
1151 | * struct drm_connector_list_iter - connector_list iterator | |
1152 | * | |
1153 | * This iterator tracks state needed to be able to walk the connector_list | |
1154 | * within struct drm_mode_config. Only use together with | |
b982dab1 | 1155 | * drm_connector_list_iter_begin(), drm_connector_list_iter_end() and |
613051da DV |
1156 | * drm_connector_list_iter_next() respectively the convenience macro |
1157 | * drm_for_each_connector_iter(). | |
1158 | */ | |
1159 | struct drm_connector_list_iter { | |
1160 | /* private: */ | |
1161 | struct drm_device *dev; | |
1162 | struct drm_connector *conn; | |
1163 | }; | |
1164 | ||
b982dab1 TR |
1165 | void drm_connector_list_iter_begin(struct drm_device *dev, |
1166 | struct drm_connector_list_iter *iter); | |
613051da DV |
1167 | struct drm_connector * |
1168 | drm_connector_list_iter_next(struct drm_connector_list_iter *iter); | |
b982dab1 | 1169 | void drm_connector_list_iter_end(struct drm_connector_list_iter *iter); |
613051da DV |
1170 | |
1171 | /** | |
1172 | * drm_for_each_connector_iter - connector_list iterator macro | |
ea0dd85a DV |
1173 | * @connector: &struct drm_connector pointer used as cursor |
1174 | * @iter: &struct drm_connector_list_iter | |
613051da DV |
1175 | * |
1176 | * Note that @connector is only valid within the list body, if you want to use | |
b982dab1 | 1177 | * @connector after calling drm_connector_list_iter_end() then you need to grab |
5e851c9d | 1178 | * your own reference first using drm_connector_get(). |
613051da DV |
1179 | */ |
1180 | #define drm_for_each_connector_iter(connector, iter) \ | |
1181 | while ((connector = drm_connector_list_iter_next(iter))) | |
1182 | ||
52217195 | 1183 | #endif |