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>
27 #include <linux/llist.h>
28 #include <linux/ctype.h>
29 #include <linux/hdmi.h>
30 #include <linux/notifier.h>
31 #include <drm/drm_mode_object.h>
32 #include <drm/drm_util.h>
33 #include <drm/drm_property.h>
34
35 #include <uapi/drm/drm_mode.h>
36
37 struct drm_connector_helper_funcs;
38 struct drm_modeset_acquire_ctx;
39 struct drm_device;
40 struct drm_crtc;
41 struct drm_display_mode;
42 struct drm_encoder;
43 struct drm_panel;
44 struct drm_property;
45 struct drm_property_blob;
46 struct drm_printer;
47 struct drm_privacy_screen;
48 struct drm_edid;
49 struct edid;
50 struct hdmi_codec_daifmt;
51 struct hdmi_codec_params;
52 struct i2c_adapter;
53
54 enum drm_connector_force {
55 DRM_FORCE_UNSPECIFIED,
56 DRM_FORCE_OFF,
57 DRM_FORCE_ON, /* force on analog part normally */
58 DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */
59 };
60
61 /**
62 * enum drm_connector_status - status for a &drm_connector
63 *
64 * This enum is used to track the connector status. There are no separate
65 * #defines for the uapi!
66 */
67 enum drm_connector_status {
68 /**
69 * @connector_status_connected: The connector is definitely connected to
70 * a sink device, and can be enabled.
71 */
72 connector_status_connected = 1,
73 /**
74 * @connector_status_disconnected: The connector isn't connected to a
75 * sink device which can be autodetect. For digital outputs like DP or
76 * HDMI (which can be realiable probed) this means there's really
77 * nothing there. It is driver-dependent whether a connector with this
78 * status can be lit up or not.
79 */
80 connector_status_disconnected = 2,
81 /**
82 * @connector_status_unknown: The connector's status could not be
83 * reliably detected. This happens when probing would either cause
84 * flicker (like load-detection when the connector is in use), or when a
85 * hardware resource isn't available (like when load-detection needs a
86 * free CRTC). It should be possible to light up the connector with one
87 * of the listed fallback modes. For default configuration userspace
88 * should only try to light up connectors with unknown status when
89 * there's not connector with @connector_status_connected.
90 */
91 connector_status_unknown = 3,
92 };
93
94 /**
95 * enum drm_connector_registration_state - userspace registration status for
96 * a &drm_connector
97 *
98 * This enum is used to track the status of initializing a connector and
99 * registering it with userspace, so that DRM can prevent bogus modesets on
100 * connectors that no longer exist.
101 */
102 enum drm_connector_registration_state {
103 /**
104 * @DRM_CONNECTOR_INITIALIZING: The connector has just been created,
105 * but has yet to be exposed to userspace. There should be no
106 * additional restrictions to how the state of this connector may be
107 * modified.
108 */
109 DRM_CONNECTOR_INITIALIZING = 0,
110
111 /**
112 * @DRM_CONNECTOR_REGISTERED: The connector has been fully initialized
113 * and registered with sysfs, as such it has been exposed to
114 * userspace. There should be no additional restrictions to how the
115 * state of this connector may be modified.
116 */
117 DRM_CONNECTOR_REGISTERED = 1,
118
119 /**
120 * @DRM_CONNECTOR_UNREGISTERED: The connector has either been exposed
121 * to userspace and has since been unregistered and removed from
122 * userspace, or the connector was unregistered before it had a chance
123 * to be exposed to userspace (e.g. still in the
124 * @DRM_CONNECTOR_INITIALIZING state). When a connector is
125 * unregistered, there are additional restrictions to how its state
126 * may be modified:
127 *
128 * - An unregistered connector may only have its DPMS changed from
129 * On->Off. Once DPMS is changed to Off, it may not be switched back
130 * to On.
131 * - Modesets are not allowed on unregistered connectors, unless they
132 * would result in disabling its assigned CRTCs. This means
133 * disabling a CRTC on an unregistered connector is OK, but enabling
134 * one is not.
135 * - Removing a CRTC from an unregistered connector is OK, but new
136 * CRTCs may never be assigned to an unregistered connector.
137 */
138 DRM_CONNECTOR_UNREGISTERED = 2,
139 };
140
141 enum subpixel_order {
142 SubPixelUnknown = 0,
143 SubPixelHorizontalRGB,
144 SubPixelHorizontalBGR,
145 SubPixelVerticalRGB,
146 SubPixelVerticalBGR,
147 SubPixelNone,
148
149 };
150
151 /**
152 * enum drm_connector_tv_mode - Analog TV output mode
153 *
154 * This enum is used to indicate the TV output mode used on an analog TV
155 * connector.
156 *
157 * WARNING: The values of this enum is uABI since they're exposed in the
158 * "TV mode" connector property.
159 */
160 enum drm_connector_tv_mode {
161 /**
162 * @DRM_MODE_TV_MODE_NTSC: CCIR System M (aka 525-lines)
163 * together with the NTSC Color Encoding.
164 */
165 DRM_MODE_TV_MODE_NTSC,
166
167 /**
168 * @DRM_MODE_TV_MODE_NTSC_443: Variant of
169 * @DRM_MODE_TV_MODE_NTSC. Uses a color subcarrier frequency
170 * of 4.43 MHz.
171 */
172 DRM_MODE_TV_MODE_NTSC_443,
173
174 /**
175 * @DRM_MODE_TV_MODE_NTSC_J: Variant of @DRM_MODE_TV_MODE_NTSC
176 * used in Japan. Uses a black level equals to the blanking
177 * level.
178 */
179 DRM_MODE_TV_MODE_NTSC_J,
180
181 /**
182 * @DRM_MODE_TV_MODE_PAL: CCIR System B together with the PAL
183 * color system.
184 */
185 DRM_MODE_TV_MODE_PAL,
186
187 /**
188 * @DRM_MODE_TV_MODE_PAL_M: CCIR System M (aka 525-lines)
189 * together with the PAL color encoding
190 */
191 DRM_MODE_TV_MODE_PAL_M,
192
193 /**
194 * @DRM_MODE_TV_MODE_PAL_N: CCIR System N together with the PAL
195 * color encoding. It uses 625 lines, but has a color subcarrier
196 * frequency of 3.58MHz, the SECAM color space, and narrower
197 * channels compared to most of the other PAL variants.
198 */
199 DRM_MODE_TV_MODE_PAL_N,
200
201 /**
202 * @DRM_MODE_TV_MODE_SECAM: CCIR System B together with the
203 * SECAM color system.
204 */
205 DRM_MODE_TV_MODE_SECAM,
206
207 /**
208 * @DRM_MODE_TV_MODE_MONOCHROME: Use timings appropriate to
209 * the DRM mode, including equalizing pulses for a 525-line
210 * or 625-line mode, with no pedestal or color encoding.
211 */
212 DRM_MODE_TV_MODE_MONOCHROME,
213
214 /**
215 * @DRM_MODE_TV_MODE_MAX: Number of analog TV output modes.
216 *
217 * Internal implementation detail; this is not uABI.
218 */
219 DRM_MODE_TV_MODE_MAX,
220 };
221
222 /**
223 * struct drm_scrambling: sink's scrambling support.
224 */
225 struct drm_scrambling {
226 /**
227 * @supported: scrambling supported for rates > 340 Mhz.
228 */
229 bool supported;
230 /**
231 * @low_rates: scrambling supported for rates <= 340 Mhz.
232 */
233 bool low_rates;
234 };
235
236 /*
237 * struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink
238 *
239 * Provides SCDC register support and capabilities related information on a
240 * HDMI 2.0 sink. In case of a HDMI 1.4 sink, all parameter must be 0.
241 */
242 struct drm_scdc {
243 /**
244 * @supported: status control & data channel present.
245 */
246 bool supported;
247 /**
248 * @read_request: sink is capable of generating scdc read request.
249 */
250 bool read_request;
251 /**
252 * @scrambling: sink's scrambling capabilities
253 */
254 struct drm_scrambling scrambling;
255 };
256
257 /**
258 * struct drm_hdmi_dsc_cap - DSC capabilities of HDMI sink
259 *
260 * Describes the DSC support provided by HDMI 2.1 sink.
261 * The information is fetched fom additional HFVSDB blocks defined
262 * for HDMI 2.1.
263 */
264 struct drm_hdmi_dsc_cap {
265 /** @v_1p2: flag for dsc1.2 version support by sink */
266 bool v_1p2;
267
268 /** @native_420: Does sink support DSC with 4:2:0 compression */
269 bool native_420;
270
271 /**
272 * @all_bpp: Does sink support all bpp with 4:4:4: or 4:2:2
273 * compressed formats
274 */
275 bool all_bpp;
276
277 /**
278 * @bpc_supported: compressed bpc supported by sink : 10, 12 or 16 bpc
279 */
280 u8 bpc_supported;
281
282 /** @max_slices: maximum number of Horizontal slices supported by */
283 u8 max_slices;
284
285 /** @clk_per_slice : max pixel clock in MHz supported per slice */
286 int clk_per_slice;
287
288 /** @max_lanes : dsc max lanes supported for Fixed rate Link training */
289 u8 max_lanes;
290
291 /** @max_frl_rate_per_lane : maximum frl rate with DSC per lane */
292 u8 max_frl_rate_per_lane;
293
294 /** @total_chunk_kbytes: max size of chunks in KBs supported per line*/
295 u8 total_chunk_kbytes;
296 };
297
298 /**
299 * struct drm_hdmi_info - runtime information about the connected HDMI sink
300 *
301 * Describes if a given display supports advanced HDMI 2.0 features.
302 * This information is available in CEA-861-F extension blocks (like HF-VSDB).
303 */
304 struct drm_hdmi_info {
305 /** @scdc: sink's scdc support and capabilities */
306 struct drm_scdc scdc;
307
308 /**
309 * @y420_vdb_modes: bitmap of modes which can support ycbcr420
310 * output only (not normal RGB/YCBCR444/422 outputs). The max VIC
311 * defined by the CEA-861-G spec is 219, so the size is 256 bits to map
312 * up to 256 VICs.
313 */
314 unsigned long y420_vdb_modes[BITS_TO_LONGS(256)];
315
316 /**
317 * @y420_cmdb_modes: bitmap of modes which can support ycbcr420
318 * output also, along with normal HDMI outputs. The max VIC defined by
319 * the CEA-861-G spec is 219, so the size is 256 bits to map up to 256
320 * VICs.
321 */
322 unsigned long y420_cmdb_modes[BITS_TO_LONGS(256)];
323
324 /** @y420_dc_modes: bitmap of deep color support index */
325 u8 y420_dc_modes;
326
327 /** @max_frl_rate_per_lane: support fixed rate link */
328 u8 max_frl_rate_per_lane;
329
330 /** @max_lanes: supported by sink */
331 u8 max_lanes;
332
333 /** @dsc_cap: DSC capabilities of the sink */
334 struct drm_hdmi_dsc_cap dsc_cap;
335 };
336
337 /**
338 * enum drm_link_status - connector's link_status property value
339 *
340 * This enum is used as the connector's link status property value.
341 * It is set to the values defined in uapi.
342 *
343 * @DRM_LINK_STATUS_GOOD: DP Link is Good as a result of successful
344 * link training
345 * @DRM_LINK_STATUS_BAD: DP Link is BAD as a result of link training
346 * failure
347 */
348 enum drm_link_status {
349 DRM_LINK_STATUS_GOOD = DRM_MODE_LINK_STATUS_GOOD,
350 DRM_LINK_STATUS_BAD = DRM_MODE_LINK_STATUS_BAD,
351 };
352
353 /**
354 * enum drm_panel_orientation - panel_orientation info for &drm_display_info
355 *
356 * This enum is used to track the (LCD) panel orientation. There are no
357 * separate #defines for the uapi!
358 *
359 * @DRM_MODE_PANEL_ORIENTATION_UNKNOWN: The drm driver has not provided any
360 * panel orientation information (normal
361 * for non panels) in this case the "panel
362 * orientation" connector prop will not be
363 * attached.
364 * @DRM_MODE_PANEL_ORIENTATION_NORMAL: The top side of the panel matches the
365 * top side of the device's casing.
366 * @DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP: The top side of the panel matches the
367 * bottom side of the device's casing, iow
368 * the panel is mounted upside-down.
369 * @DRM_MODE_PANEL_ORIENTATION_LEFT_UP: The left side of the panel matches the
370 * top side of the device's casing.
371 * @DRM_MODE_PANEL_ORIENTATION_RIGHT_UP: The right side of the panel matches the
372 * top side of the device's casing.
373 */
374 enum drm_panel_orientation {
375 DRM_MODE_PANEL_ORIENTATION_UNKNOWN = -1,
376 DRM_MODE_PANEL_ORIENTATION_NORMAL = 0,
377 DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP,
378 DRM_MODE_PANEL_ORIENTATION_LEFT_UP,
379 DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
380 };
381
382 /**
383 * enum drm_hdmi_broadcast_rgb - Broadcast RGB Selection for an HDMI @drm_connector
384 */
385 enum drm_hdmi_broadcast_rgb {
386 /**
387 * @DRM_HDMI_BROADCAST_RGB_AUTO: The RGB range is selected
388 * automatically based on the mode.
389 */
390 DRM_HDMI_BROADCAST_RGB_AUTO,
391
392 /**
393 * @DRM_HDMI_BROADCAST_RGB_FULL: Full range RGB is forced.
394 */
395 DRM_HDMI_BROADCAST_RGB_FULL,
396
397 /**
398 * @DRM_HDMI_BROADCAST_RGB_LIMITED: Limited range RGB is forced.
399 */
400 DRM_HDMI_BROADCAST_RGB_LIMITED,
401 };
402
403 const char *
404 drm_hdmi_connector_get_broadcast_rgb_name(enum drm_hdmi_broadcast_rgb broadcast_rgb);
405
406 /**
407 * struct drm_monitor_range_info - Panel's Monitor range in EDID for
408 * &drm_display_info
409 *
410 * This struct is used to store a frequency range supported by panel
411 * as parsed from EDID's detailed monitor range descriptor block.
412 *
413 * @min_vfreq: This is the min supported refresh rate in Hz from
414 * EDID's detailed monitor range.
415 * @max_vfreq: This is the max supported refresh rate in Hz from
416 * EDID's detailed monitor range
417 */
418 struct drm_monitor_range_info {
419 u16 min_vfreq;
420 u16 max_vfreq;
421 };
422
423 /**
424 * struct drm_luminance_range_info - Panel's luminance range for
425 * &drm_display_info. Calculated using data in EDID
426 *
427 * This struct is used to store a luminance range supported by panel
428 * as calculated using data from EDID's static hdr metadata.
429 *
430 * @min_luminance: This is the min supported luminance value
431 *
432 * @max_luminance: This is the max supported luminance value
433 */
434 struct drm_luminance_range_info {
435 u32 min_luminance;
436 u32 max_luminance;
437 };
438
439 /**
440 * enum drm_privacy_screen_status - privacy screen status
441 *
442 * This enum is used to track and control the state of the integrated privacy
443 * screen present on some display panels, via the "privacy-screen sw-state"
444 * and "privacy-screen hw-state" properties. Note the _LOCKED enum values
445 * are only valid for the "privacy-screen hw-state" property.
446 *
447 * @PRIVACY_SCREEN_DISABLED:
448 * The privacy-screen on the panel is disabled
449 * @PRIVACY_SCREEN_ENABLED:
450 * The privacy-screen on the panel is enabled
451 * @PRIVACY_SCREEN_DISABLED_LOCKED:
452 * The privacy-screen on the panel is disabled and locked (cannot be changed)
453 * @PRIVACY_SCREEN_ENABLED_LOCKED:
454 * The privacy-screen on the panel is enabled and locked (cannot be changed)
455 */
456 enum drm_privacy_screen_status {
457 PRIVACY_SCREEN_DISABLED = 0,
458 PRIVACY_SCREEN_ENABLED,
459 PRIVACY_SCREEN_DISABLED_LOCKED,
460 PRIVACY_SCREEN_ENABLED_LOCKED,
461 };
462
463 /**
464 * enum drm_colorspace - color space
465 *
466 * This enum is a consolidated colorimetry list supported by HDMI and
467 * DP protocol standard. The respective connectors will register
468 * a property with the subset of this list (supported by that
469 * respective protocol). Userspace will set the colorspace through
470 * a colorspace property which will be created and exposed to
471 * userspace.
472 *
473 * DP definitions come from the DP v2.0 spec
474 * HDMI definitions come from the CTA-861-H spec
475 *
476 * @DRM_MODE_COLORIMETRY_DEFAULT:
477 * Driver specific behavior.
478 * @DRM_MODE_COLORIMETRY_NO_DATA:
479 * Driver specific behavior.
480 * @DRM_MODE_COLORIMETRY_SMPTE_170M_YCC:
481 * (HDMI)
482 * SMPTE ST 170M colorimetry format
483 * @DRM_MODE_COLORIMETRY_BT709_YCC:
484 * (HDMI, DP)
485 * ITU-R BT.709 colorimetry format
486 * @DRM_MODE_COLORIMETRY_XVYCC_601:
487 * (HDMI, DP)
488 * xvYCC601 colorimetry format
489 * @DRM_MODE_COLORIMETRY_XVYCC_709:
490 * (HDMI, DP)
491 * xvYCC709 colorimetry format
492 * @DRM_MODE_COLORIMETRY_SYCC_601:
493 * (HDMI, DP)
494 * sYCC601 colorimetry format
495 * @DRM_MODE_COLORIMETRY_OPYCC_601:
496 * (HDMI, DP)
497 * opYCC601 colorimetry format
498 * @DRM_MODE_COLORIMETRY_OPRGB:
499 * (HDMI, DP)
500 * opRGB colorimetry format
501 * @DRM_MODE_COLORIMETRY_BT2020_CYCC:
502 * (HDMI, DP)
503 * ITU-R BT.2020 Y'c C'bc C'rc (constant luminance) colorimetry format
504 * @DRM_MODE_COLORIMETRY_BT2020_RGB:
505 * (HDMI, DP)
506 * ITU-R BT.2020 R' G' B' colorimetry format
507 * @DRM_MODE_COLORIMETRY_BT2020_YCC:
508 * (HDMI, DP)
509 * ITU-R BT.2020 Y' C'b C'r colorimetry format
510 * @DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65:
511 * (HDMI)
512 * SMPTE ST 2113 P3D65 colorimetry format
513 * @DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER:
514 * (HDMI)
515 * SMPTE ST 2113 P3DCI colorimetry format
516 * @DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED:
517 * (DP)
518 * RGB wide gamut fixed point colorimetry format
519 * @DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT:
520 * (DP)
521 * RGB wide gamut floating point
522 * (scRGB (IEC 61966-2-2)) colorimetry format
523 * @DRM_MODE_COLORIMETRY_BT601_YCC:
524 * (DP)
525 * ITU-R BT.601 colorimetry format
526 * The DP spec does not say whether this is the 525 or the 625
527 * line version.
528 * @DRM_MODE_COLORIMETRY_COUNT:
529 * Not a valid value; merely used four counting
530 */
531 enum drm_colorspace {
532 /* For Default case, driver will set the colorspace */
533 DRM_MODE_COLORIMETRY_DEFAULT = 0,
534 /* CEA 861 Normal Colorimetry options */
535 DRM_MODE_COLORIMETRY_NO_DATA = 0,
536 DRM_MODE_COLORIMETRY_SMPTE_170M_YCC = 1,
537 DRM_MODE_COLORIMETRY_BT709_YCC = 2,
538 /* CEA 861 Extended Colorimetry Options */
539 DRM_MODE_COLORIMETRY_XVYCC_601 = 3,
540 DRM_MODE_COLORIMETRY_XVYCC_709 = 4,
541 DRM_MODE_COLORIMETRY_SYCC_601 = 5,
542 DRM_MODE_COLORIMETRY_OPYCC_601 = 6,
543 DRM_MODE_COLORIMETRY_OPRGB = 7,
544 DRM_MODE_COLORIMETRY_BT2020_CYCC = 8,
545 DRM_MODE_COLORIMETRY_BT2020_RGB = 9,
546 DRM_MODE_COLORIMETRY_BT2020_YCC = 10,
547 /* Additional Colorimetry extension added as part of CTA 861.G */
548 DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65 = 11,
549 DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER = 12,
550 /* Additional Colorimetry Options added for DP 1.4a VSC Colorimetry Format */
551 DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED = 13,
552 DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT = 14,
553 DRM_MODE_COLORIMETRY_BT601_YCC = 15,
554 DRM_MODE_COLORIMETRY_COUNT
555 };
556
557 /**
558 * enum drm_output_color_format - Output Color Format
559 *
560 * This enum is a consolidated color format list supported by
561 * connectors. It's only ever really been used for HDMI and DP so far,
562 * so it's not exhaustive and can be extended to represent other formats
563 * in the future.
564 *
565 *
566 * @DRM_OUTPUT_COLOR_FORMAT_RGB444:
567 * RGB output format
568 * @DRM_OUTPUT_COLOR_FORMAT_YCBCR444:
569 * YCbCr 4:4:4 output format (ie. not subsampled)
570 * @DRM_OUTPUT_COLOR_FORMAT_YCBCR422:
571 * YCbCr 4:2:2 output format (ie. with horizontal subsampling)
572 * @DRM_OUTPUT_COLOR_FORMAT_YCBCR420:
573 * YCbCr 4:2:0 output format (ie. with horizontal and vertical subsampling)
574 * @DRM_OUTPUT_COLOR_FORMAT_COUNT:
575 * Number of valid output color format values in this enum
576 */
577 enum drm_output_color_format {
578 DRM_OUTPUT_COLOR_FORMAT_RGB444 = 0,
579 DRM_OUTPUT_COLOR_FORMAT_YCBCR444,
580 DRM_OUTPUT_COLOR_FORMAT_YCBCR422,
581 DRM_OUTPUT_COLOR_FORMAT_YCBCR420,
582 DRM_OUTPUT_COLOR_FORMAT_COUNT,
583 };
584
585 /**
586 * enum drm_connector_color_format - Connector Color Format Request
587 *
588 * This enum, unlike &enum drm_output_color_format, is used to specify requests
589 * for a specific color format on a connector through the DRM "color format"
590 * property. The difference is that it has an "AUTO" value to specify that
591 * no specific choice has been made.
592 */
593 enum drm_connector_color_format {
594 /**
595 * @DRM_CONNECTOR_COLOR_FORMAT_AUTO: The driver or display protocol
596 * helpers should pick a suitable color format. All implementations of a
597 * specific display protocol must behave the same way with "AUTO", but
598 * different display protocols do not necessarily have the same "AUTO"
599 * semantics.
600 *
601 * For HDMI, "AUTO" picks RGB, but falls back to YCbCr 4:2:0 if the
602 * bandwidth required for full-scale RGB is not available, or the mode
603 * is YCbCr 4:2:0-only, as long as the mode and output both support
604 * YCbCr 4:2:0.
605 *
606 * For display protocols other than HDMI, the recursive bridge chain
607 * format selection picks the first chain of bridge formats that works,
608 * as has already been the case before the introduction of the "color
609 * format" property. Non-HDMI bridges should therefore either sort their
610 * bus output formats by preference, or agree on a unified auto format
611 * selection logic that's implemented in a common state helper (like
612 * how HDMI does it).
613 */
614 DRM_CONNECTOR_COLOR_FORMAT_AUTO = 0,
615
616 /**
617 * @DRM_CONNECTOR_COLOR_FORMAT_RGB444: RGB output format. The
618 * quantization range depends on the value of the "Broadcast RGB"
619 * property if it is present on the connector.
620 */
621 DRM_CONNECTOR_COLOR_FORMAT_RGB444,
622
623 /**
624 * @DRM_CONNECTOR_COLOR_FORMAT_YCBCR444: YCbCr 4:4:4 output format (ie.
625 * not subsampled). Quantization range is "Limited" by default.
626 */
627 DRM_CONNECTOR_COLOR_FORMAT_YCBCR444,
628
629 /**
630 * @DRM_CONNECTOR_COLOR_FORMAT_YCBCR422: YCbCr 4:2:2 output format (ie.
631 * with horizontal subsampling). Quantization range is "Limited" by
632 * default.
633 */
634 DRM_CONNECTOR_COLOR_FORMAT_YCBCR422,
635
636 /**
637 * @DRM_CONNECTOR_COLOR_FORMAT_YCBCR420: YCbCr 4:2:0 output format (ie.
638 * with horizontal and vertical subsampling). Quantization range is
639 * "Limited" by default.
640 */
641 DRM_CONNECTOR_COLOR_FORMAT_YCBCR420,
642
643 /**
644 * @DRM_CONNECTOR_COLOR_FORMAT_COUNT: Number of valid connector color
645 * format values in this enum
646 */
647 DRM_CONNECTOR_COLOR_FORMAT_COUNT,
648 };
649
650 const char *
651 drm_hdmi_connector_get_output_format_name(enum drm_output_color_format fmt);
652
653 /**
654 * enum drm_bus_flags - bus_flags info for &drm_display_info
655 *
656 * This enum defines signal polarities and clock edge information for signals on
657 * a bus as bitmask flags.
658 *
659 * The clock edge information is conveyed by two sets of symbols,
660 * DRM_BUS_FLAGS_*_DRIVE_\* and DRM_BUS_FLAGS_*_SAMPLE_\*. When this enum is
661 * used to describe a bus from the point of view of the transmitter, the
662 * \*_DRIVE_\* flags should be used. When used from the point of view of the
663 * receiver, the \*_SAMPLE_\* flags should be used. The \*_DRIVE_\* and
664 * \*_SAMPLE_\* flags alias each other, with the \*_SAMPLE_POSEDGE and
665 * \*_SAMPLE_NEGEDGE flags being equal to \*_DRIVE_NEGEDGE and \*_DRIVE_POSEDGE
666 * respectively. This simplifies code as signals are usually sampled on the
667 * opposite edge of the driving edge. Transmitters and receivers may however
668 * need to take other signal timings into account to convert between driving
669 * and sample edges.
670 */
671 enum drm_bus_flags {
672 /**
673 * @DRM_BUS_FLAG_DE_LOW:
674 *
675 * The Data Enable signal is active low
676 */
677 DRM_BUS_FLAG_DE_LOW = BIT(0),
678
679 /**
680 * @DRM_BUS_FLAG_DE_HIGH:
681 *
682 * The Data Enable signal is active high
683 */
684 DRM_BUS_FLAG_DE_HIGH = BIT(1),
685
686 /**
687 * @DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE:
688 *
689 * Data is driven on the rising edge of the pixel clock
690 */
691 DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE = BIT(2),
692
693 /**
694 * @DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE:
695 *
696 * Data is driven on the falling edge of the pixel clock
697 */
698 DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE = BIT(3),
699
700 /**
701 * @DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE:
702 *
703 * Data is sampled on the rising edge of the pixel clock
704 */
705 DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE = DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
706
707 /**
708 * @DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE:
709 *
710 * Data is sampled on the falling edge of the pixel clock
711 */
712 DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
713
714 /**
715 * @DRM_BUS_FLAG_DATA_MSB_TO_LSB:
716 *
717 * Data is transmitted MSB to LSB on the bus
718 */
719 DRM_BUS_FLAG_DATA_MSB_TO_LSB = BIT(4),
720
721 /**
722 * @DRM_BUS_FLAG_DATA_LSB_TO_MSB:
723 *
724 * Data is transmitted LSB to MSB on the bus
725 */
726 DRM_BUS_FLAG_DATA_LSB_TO_MSB = BIT(5),
727
728 /**
729 * @DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE:
730 *
731 * Sync signals are driven on the rising edge of the pixel clock
732 */
733 DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE = BIT(6),
734
735 /**
736 * @DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE:
737 *
738 * Sync signals are driven on the falling edge of the pixel clock
739 */
740 DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE = BIT(7),
741
742 /**
743 * @DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE:
744 *
745 * Sync signals are sampled on the rising edge of the pixel clock
746 */
747 DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE = DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE,
748
749 /**
750 * @DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE:
751 *
752 * Sync signals are sampled on the falling edge of the pixel clock
753 */
754 DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE = DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,
755
756 /**
757 * @DRM_BUS_FLAG_SHARP_SIGNALS:
758 *
759 * Set if the Sharp-specific signals (SPL, CLS, PS, REV) must be used
760 */
761 DRM_BUS_FLAG_SHARP_SIGNALS = BIT(8),
762 };
763
764 /**
765 * struct drm_amd_vsdb_info - AMD-specific VSDB information
766 *
767 * This structure holds information parsed from the AMD Vendor-Specific Data
768 * Block (VSDB) version 3.
769 */
770 struct drm_amd_vsdb_info {
771 /**
772 * @version: Version of the Vendor-Specific Data Block (VSDB)
773 */
774 u8 version;
775
776 /**
777 * @replay_mode: Panel Replay supported
778 */
779 bool replay_mode;
780
781 /**
782 * @panel_type: Panel technology type
783 */
784 u8 panel_type;
785
786 /**
787 * @luminance_range1: Luminance for max back light
788 */
789 struct drm_luminance_range_info luminance_range1;
790
791 /**
792 * @luminance_range2: Luminance for min back light
793 */
794 struct drm_luminance_range_info luminance_range2;
795 };
796
797 /**
798 * struct drm_display_info - runtime data about the connected sink
799 *
800 * Describes a given display (e.g. CRT or flat panel) and its limitations. For
801 * fixed display sinks like built-in panels there's not much difference between
802 * this and &struct drm_connector. But for sinks with a real cable this
803 * structure is meant to describe all the things at the other end of the cable.
804 *
805 * For sinks which provide an EDID this can be filled out by calling
806 * drm_add_edid_modes().
807 */
808 struct drm_display_info {
809 /**
810 * @width_mm: Physical width in mm.
811 */
812 unsigned int width_mm;
813
814 /**
815 * @height_mm: Physical height in mm.
816 */
817 unsigned int height_mm;
818
819 /**
820 * @bpc: Maximum bits per color channel. Used by HDMI and DP outputs.
821 */
822 unsigned int bpc;
823
824 /**
825 * @subpixel_order: Subpixel order of LCD panels.
826 */
827 enum subpixel_order subpixel_order;
828
829 /**
830 * @panel_orientation: Read only connector property for built-in panels,
831 * indicating the orientation of the panel vs the device's casing.
832 * drm_connector_init() sets this to DRM_MODE_PANEL_ORIENTATION_UNKNOWN.
833 * When not UNKNOWN this gets used by the drm_fb_helpers to rotate the
834 * fb to compensate and gets exported as prop to userspace.
835 */
836 int panel_orientation;
837
838 /**
839 * @color_formats: HDMI Color formats, selects between RGB and
840 * YCbCr modes. Uses a bitmask of DRM_OUTPUT_COLOR_FORMAT\_
841 * defines, which are _not_ the same ones as used to describe
842 * the pixel format in framebuffers, and also don't match the
843 * formats in @bus_formats which are shared with v4l.
844 */
845 u32 color_formats;
846
847 /**
848 * @bus_formats: Pixel data format on the wire, somewhat redundant with
849 * @color_formats. Array of size @num_bus_formats encoded using
850 * MEDIA_BUS_FMT\_ defines shared with v4l and media drivers.
851 */
852 const u32 *bus_formats;
853 /**
854 * @num_bus_formats: Size of @bus_formats array.
855 */
856 unsigned int num_bus_formats;
857
858 /**
859 * @bus_flags: Additional information (like pixel signal polarity) for
860 * the pixel data on the bus, using &enum drm_bus_flags values
861 * DRM_BUS_FLAGS\_.
862 */
863 u32 bus_flags;
864
865 /**
866 * @max_tmds_clock: Maximum TMDS clock rate supported by the
867 * sink in kHz. 0 means undefined.
868 */
869 int max_tmds_clock;
870
871 /**
872 * @dvi_dual: Dual-link DVI sink?
873 */
874 bool dvi_dual;
875
876 /**
877 * @is_hdmi: True if the sink is an HDMI device.
878 *
879 * This field shall be used instead of calling
880 * drm_detect_hdmi_monitor() when possible.
881 */
882 bool is_hdmi;
883
884 /**
885 * @has_audio: True if the sink supports audio.
886 *
887 * This field shall be used instead of calling
888 * drm_detect_monitor_audio() when possible.
889 */
890 bool has_audio;
891
892 /**
893 * @has_hdmi_infoframe: Does the sink support the HDMI infoframe?
894 */
895 bool has_hdmi_infoframe;
896
897 /**
898 * @rgb_quant_range_selectable: Does the sink support selecting
899 * the RGB quantization range?
900 */
901 bool rgb_quant_range_selectable;
902
903 /**
904 * @edid_hdmi_rgb444_dc_modes: Mask of supported hdmi deep color modes
905 * in RGB 4:4:4. Even more stuff redundant with @bus_formats.
906 */
907 u8 edid_hdmi_rgb444_dc_modes;
908
909 /**
910 * @edid_hdmi_ycbcr444_dc_modes: Mask of supported hdmi deep color
911 * modes in YCbCr 4:4:4. Even more stuff redundant with @bus_formats.
912 */
913 u8 edid_hdmi_ycbcr444_dc_modes;
914
915 /**
916 * @cea_rev: CEA revision of the HDMI sink.
917 */
918 u8 cea_rev;
919
920 /**
921 * @hdmi: advance features of a HDMI sink.
922 */
923 struct drm_hdmi_info hdmi;
924
925 /**
926 * @hdr_sink_metadata: HDR Metadata Information read from sink
927 */
928 struct hdr_sink_metadata hdr_sink_metadata;
929
930 /**
931 * @non_desktop: Non desktop display (HMD).
932 */
933 bool non_desktop;
934
935 /**
936 * @monitor_range: Frequency range supported by monitor range descriptor
937 */
938 struct drm_monitor_range_info monitor_range;
939
940 /**
941 * @luminance_range: Luminance range supported by panel
942 */
943 struct drm_luminance_range_info luminance_range;
944
945 /**
946 * @mso_stream_count: eDP Multi-SST Operation (MSO) stream count from
947 * the DisplayID VESA vendor block. 0 for conventional Single-Stream
948 * Transport (SST), or 2 or 4 MSO streams.
949 */
950 u8 mso_stream_count;
951
952 /**
953 * @mso_pixel_overlap: eDP MSO segment pixel overlap, 0-8 pixels.
954 */
955 u8 mso_pixel_overlap;
956
957 /**
958 * @max_dsc_bpp: Maximum DSC target bitrate, if it is set to 0 the
959 * monitor's default value is used instead.
960 */
961 u32 max_dsc_bpp;
962
963 /**
964 * @vics: Array of vics_len VICs. Internal to EDID parsing.
965 */
966 u8 *vics;
967
968 /**
969 * @vics_len: Number of elements in vics. Internal to EDID parsing.
970 */
971 int vics_len;
972
973 /**
974 * @quirks: EDID based quirks. DRM core and drivers can query the
975 * @drm_edid_quirk quirks using drm_edid_has_quirk(), the rest of
976 * the quirks also tracked here are internal to EDID parsing.
977 */
978 u32 quirks;
979
980 /**
981 * @source_physical_address: Source Physical Address from HDMI
982 * Vendor-Specific Data Block, for CEC usage.
983 *
984 * Defaults to CEC_PHYS_ADDR_INVALID (0xffff).
985 */
986 u16 source_physical_address;
987
988 /**
989 * @amd_vsdb: AMD-specific VSDB information.
990 */
991 struct drm_amd_vsdb_info amd_vsdb;
992
993 /**
994 * @panel_type: Panel type from DisplayID Display Parameters
995 * Data Block (tag 0x21). Uses DRM_MODE_PANEL_TYPE_* constants.
996 */
997 u8 panel_type;
998 };
999
1000 int drm_display_info_set_bus_formats(struct drm_display_info *info,
1001 const u32 *formats,
1002 unsigned int num_formats);
1003
1004 /**
1005 * struct drm_connector_tv_margins - TV connector related margins
1006 *
1007 * Describes the margins in pixels to put around the image on TV
1008 * connectors to deal with overscan.
1009 */
1010 struct drm_connector_tv_margins {
1011 /**
1012 * @bottom: Bottom margin in pixels.
1013 */
1014 unsigned int bottom;
1015
1016 /**
1017 * @left: Left margin in pixels.
1018 */
1019 unsigned int left;
1020
1021 /**
1022 * @right: Right margin in pixels.
1023 */
1024 unsigned int right;
1025
1026 /**
1027 * @top: Top margin in pixels.
1028 */
1029 unsigned int top;
1030 };
1031
1032 /**
1033 * struct drm_tv_connector_state - TV connector related states
1034 * @select_subconnector: selected subconnector
1035 * @subconnector: detected subconnector
1036 * @margins: TV margins
1037 * @legacy_mode: Legacy TV mode, driver specific value
1038 * @mode: TV mode
1039 * @brightness: brightness in percent
1040 * @contrast: contrast in percent
1041 * @flicker_reduction: flicker reduction in percent
1042 * @overscan: overscan in percent
1043 * @saturation: saturation in percent
1044 * @hue: hue in percent
1045 */
1046 struct drm_tv_connector_state {
1047 enum drm_mode_subconnector select_subconnector;
1048 enum drm_mode_subconnector subconnector;
1049 struct drm_connector_tv_margins margins;
1050 unsigned int legacy_mode;
1051 unsigned int mode;
1052 unsigned int brightness;
1053 unsigned int contrast;
1054 unsigned int flicker_reduction;
1055 unsigned int overscan;
1056 unsigned int saturation;
1057 unsigned int hue;
1058 };
1059
1060 /**
1061 * struct drm_connector_hdmi_infoframe - HDMI Infoframe container
1062 */
1063 struct drm_connector_hdmi_infoframe {
1064 /**
1065 * @data: HDMI Infoframe structure
1066 */
1067 union hdmi_infoframe data;
1068
1069 /**
1070 * @set: Is the content of @data valid?
1071 */
1072 bool set;
1073 };
1074
1075 /*
1076 * struct drm_connector_hdmi_state - HDMI state container
1077 */
1078 struct drm_connector_hdmi_state {
1079 /**
1080 * @broadcast_rgb: Connector property to pass the
1081 * Broadcast RGB selection value.
1082 */
1083 enum drm_hdmi_broadcast_rgb broadcast_rgb;
1084
1085 /**
1086 * @infoframes: HDMI Infoframes matching that state
1087 */
1088 struct {
1089 /**
1090 * @avi: AVI Infoframes structure matching our
1091 * state.
1092 */
1093 struct drm_connector_hdmi_infoframe avi;
1094
1095 /**
1096 * @hdr_drm: DRM (Dynamic Range and Mastering)
1097 * Infoframes structure matching our state.
1098 */
1099 struct drm_connector_hdmi_infoframe hdr_drm;
1100
1101 /**
1102 * @spd: SPD Infoframes structure matching our
1103 * state.
1104 */
1105 struct drm_connector_hdmi_infoframe spd;
1106
1107 /**
1108 * @vendor: HDMI Vendor Infoframes structure
1109 * matching our state.
1110 */
1111 struct drm_connector_hdmi_infoframe hdmi;
1112 } infoframes;
1113
1114 /**
1115 * @is_limited_range: Is the output supposed to use a limited
1116 * RGB Quantization Range or not?
1117 */
1118 bool is_limited_range;
1119
1120 /**
1121 * @output_bpc: Bits per color channel to output.
1122 */
1123 unsigned int output_bpc;
1124
1125 /**
1126 * @output_format: Pixel format to output in.
1127 */
1128 enum drm_output_color_format output_format;
1129
1130 /**
1131 * @tmds_char_rate: TMDS Character Rate, in Hz.
1132 */
1133 unsigned long long tmds_char_rate;
1134 };
1135
1136 /**
1137 * struct drm_connector_state - mutable connector state
1138 */
1139 struct drm_connector_state {
1140 /** @connector: backpointer to the connector */
1141 struct drm_connector *connector;
1142
1143 /**
1144 * @crtc: CRTC to connect connector to, NULL if disabled.
1145 *
1146 * Do not change this directly, use drm_atomic_set_crtc_for_connector()
1147 * instead.
1148 */
1149 struct drm_crtc *crtc;
1150
1151 /**
1152 * @best_encoder:
1153 *
1154 * Used by the atomic helpers to select the encoder, through the
1155 * &drm_connector_helper_funcs.atomic_best_encoder or
1156 * &drm_connector_helper_funcs.best_encoder callbacks.
1157 *
1158 * This is also used in the atomic helpers to map encoders to their
1159 * current and previous connectors, see
1160 * drm_atomic_get_old_connector_for_encoder() and
1161 * drm_atomic_get_new_connector_for_encoder().
1162 *
1163 * NOTE: Atomic drivers must fill this out (either themselves or through
1164 * helpers), for otherwise the GETCONNECTOR and GETENCODER IOCTLs will
1165 * not return correct data to userspace.
1166 */
1167 struct drm_encoder *best_encoder;
1168
1169 /**
1170 * @link_status: Connector link_status to keep track of whether link is
1171 * GOOD or BAD to notify userspace if retraining is necessary.
1172 */
1173 enum drm_link_status link_status;
1174
1175 /** @state: backpointer to global drm_atomic_commit */
1176 struct drm_atomic_commit *state;
1177
1178 /**
1179 * @commit: Tracks the pending commit to prevent use-after-free conditions.
1180 *
1181 * Is only set when @crtc is NULL.
1182 */
1183 struct drm_crtc_commit *commit;
1184
1185 /** @tv: TV connector state */
1186 struct drm_tv_connector_state tv;
1187
1188 /**
1189 * @self_refresh_aware:
1190 *
1191 * This tracks whether a connector is aware of the self refresh state.
1192 * It should be set to true for those connector implementations which
1193 * understand the self refresh state. This is needed since the crtc
1194 * registers the self refresh helpers and it doesn't know if the
1195 * connectors downstream have implemented self refresh entry/exit.
1196 *
1197 * Drivers should set this to true in atomic_check if they know how to
1198 * handle self_refresh requests.
1199 */
1200 bool self_refresh_aware;
1201
1202 /**
1203 * @picture_aspect_ratio: Connector property to control the
1204 * HDMI infoframe aspect ratio setting.
1205 *
1206 * The %DRM_MODE_PICTURE_ASPECT_\* values much match the
1207 * values for &enum hdmi_picture_aspect
1208 */
1209 enum hdmi_picture_aspect picture_aspect_ratio;
1210
1211 /**
1212 * @content_type: Connector property to control the
1213 * HDMI infoframe content type setting.
1214 * The %DRM_MODE_CONTENT_TYPE_\* values much
1215 * match the values.
1216 */
1217 unsigned int content_type;
1218
1219 /**
1220 * @hdcp_content_type: Connector property to pass the type of
1221 * protected content. This is most commonly used for HDCP.
1222 */
1223 unsigned int hdcp_content_type;
1224
1225 /**
1226 * @scaling_mode: Connector property to control the
1227 * upscaling, mostly used for built-in panels.
1228 */
1229 unsigned int scaling_mode;
1230
1231 /**
1232 * @content_protection: Connector property to request content
1233 * protection. This is most commonly used for HDCP.
1234 */
1235 unsigned int content_protection;
1236
1237 /**
1238 * @colorspace: State variable for Connector property to request
1239 * colorspace change on Sink. This is most commonly used to switch
1240 * to wider color gamuts like BT2020.
1241 */
1242 enum drm_colorspace colorspace;
1243
1244 /**
1245 * @color_format: State variable for Connector property to request
1246 * color format change on Sink. This is most commonly used to switch
1247 * between RGB to YUV and vice-versa.
1248 */
1249 enum drm_connector_color_format color_format;
1250
1251 /**
1252 * @writeback_job: Writeback job for writeback connectors
1253 *
1254 * Holds the framebuffer and out-fence for a writeback connector. As
1255 * the writeback completion may be asynchronous to the normal commit
1256 * cycle, the writeback job lifetime is managed separately from the
1257 * normal atomic state by this object.
1258 *
1259 * See also: drm_writeback_queue_job() and
1260 * drm_writeback_signal_completion()
1261 */
1262 struct drm_writeback_job *writeback_job;
1263
1264 /**
1265 * @max_requested_bpc: Connector property to limit the maximum bit
1266 * depth of the pixels.
1267 */
1268 u8 max_requested_bpc;
1269
1270 /**
1271 * @max_bpc: Connector max_bpc based on the requested max_bpc property
1272 * and the connector bpc limitations obtained from edid.
1273 */
1274 u8 max_bpc;
1275
1276 /**
1277 * @privacy_screen_sw_state: See :ref:`Standard Connector
1278 * Properties<standard_connector_properties>`
1279 */
1280 enum drm_privacy_screen_status privacy_screen_sw_state;
1281
1282 /**
1283 * @hdr_output_metadata:
1284 * DRM blob property for HDR output metadata
1285 */
1286 struct drm_property_blob *hdr_output_metadata;
1287
1288 /**
1289 * @hdmi: HDMI-related variable and properties. Filled by
1290 * @drm_atomic_helper_connector_hdmi_check().
1291 */
1292 struct drm_connector_hdmi_state hdmi;
1293 };
1294
1295 struct drm_connector_hdmi_audio_funcs {
1296 /**
1297 * @startup:
1298 *
1299 * Called when ASoC starts an audio stream setup. The
1300 * @startup() is optional.
1301 *
1302 * Returns:
1303 * 0 on success, a negative error code otherwise
1304 */
1305 int (*startup)(struct drm_connector *connector);
1306
1307 /**
1308 * @prepare:
1309 * Configures HDMI-encoder for audio stream. Can be called
1310 * multiple times for each setup. Mandatory.
1311 *
1312 * Returns:
1313 * 0 on success, a negative error code otherwise
1314 */
1315 int (*prepare)(struct drm_connector *connector,
1316 struct hdmi_codec_daifmt *fmt,
1317 struct hdmi_codec_params *hparms);
1318
1319 /**
1320 * @shutdown:
1321 *
1322 * Shut down the audio stream. Mandatory.
1323 *
1324 * Returns:
1325 * 0 on success, a negative error code otherwise
1326 */
1327 void (*shutdown)(struct drm_connector *connector);
1328
1329 /**
1330 * @mute_stream:
1331 *
1332 * Mute/unmute HDMI audio stream. The @mute_stream callback is
1333 * optional.
1334 *
1335 * Returns:
1336 * 0 on success, a negative error code otherwise
1337 */
1338 int (*mute_stream)(struct drm_connector *connector,
1339 bool enable, int direction);
1340 };
1341
1342 void drm_connector_cec_phys_addr_invalidate(struct drm_connector *connector);
1343 void drm_connector_cec_phys_addr_set(struct drm_connector *connector);
1344
1345 /**
1346 * struct drm_connector_cec_funcs - drm_hdmi_connector control functions
1347 */
1348 struct drm_connector_cec_funcs {
1349 /**
1350 * @phys_addr_invalidate: mark CEC physical address as invalid
1351 *
1352 * The callback to mark CEC physical address as invalid, abstracting
1353 * the operation.
1354 */
1355 void (*phys_addr_invalidate)(struct drm_connector *connector);
1356
1357 /**
1358 * @phys_addr_set: set CEC physical address
1359 *
1360 * The callback to set CEC physical address, abstracting the operation.
1361 */
1362 void (*phys_addr_set)(struct drm_connector *connector, u16 addr);
1363 };
1364
1365 /**
1366 * struct drm_connector_infoframe_funcs - InfoFrame-related functions
1367 */
1368 struct drm_connector_infoframe_funcs {
1369 /**
1370 * @clear_infoframe:
1371 *
1372 * This callback is invoked through
1373 * @drm_atomic_helper_connector_hdmi_update_infoframes during a
1374 * commit to clear the infoframes into the hardware. It will be
1375 * called once for each frame type to be disabled.
1376 *
1377 * The @clear_infoframe callback is mandatory for AVI and HDMI-VS
1378 * InfoFrame types.
1379 *
1380 * Returns:
1381 * 0 on success, a negative error code otherwise
1382 */
1383 int (*clear_infoframe)(struct drm_connector *connector);
1384
1385 /**
1386 * @write_infoframe:
1387 *
1388 * This callback is invoked through
1389 * @drm_atomic_helper_connector_hdmi_update_infoframes during a
1390 * commit to program the infoframes into the hardware. It will
1391 * be called for every updated infoframe type.
1392 *
1393 * The @write_infoframe callback is mandatory for AVI and HDMI-VS
1394 * InfoFrame types.
1395 *
1396 * Returns:
1397 * 0 on success, a negative error code otherwise
1398 */
1399 int (*write_infoframe)(struct drm_connector *connector,
1400 const u8 *buffer, size_t len);
1401
1402 };
1403
1404 /**
1405 * struct drm_connector_hdmi_funcs - drm_hdmi_connector control functions
1406 */
1407 struct drm_connector_hdmi_funcs {
1408 /**
1409 * @tmds_char_rate_valid:
1410 *
1411 * This callback is invoked at atomic_check time to figure out
1412 * whether a particular TMDS character rate is supported by the
1413 * driver.
1414 *
1415 * The @tmds_char_rate_valid callback is optional.
1416 *
1417 * Returns:
1418 *
1419 * Either &drm_mode_status.MODE_OK or one of the failure reasons
1420 * in &enum drm_mode_status.
1421 */
1422 enum drm_mode_status
1423 (*tmds_char_rate_valid)(const struct drm_connector *connector,
1424 const struct drm_display_mode *mode,
1425 unsigned long long tmds_rate);
1426
1427 /**
1428 * @read_edid:
1429 *
1430 * This callback is used by the framework as a replacement for reading
1431 * the EDID from connector->ddc. It is still recommended to provide
1432 * connector->ddc instead of implementing this callback. Returned EDID
1433 * should be freed via the drm_edid_free().
1434 *
1435 * The @read_edid callback is optional.
1436 *
1437 * Returns:
1438 * Valid EDID on success, NULL in case of failure.
1439 */
1440 const struct drm_edid *(*read_edid)(struct drm_connector *connector);
1441
1442 /**
1443 * @avi:
1444 *
1445 * Set of callbacks for handling the AVI InfoFrame. These callbacks are
1446 * mandatory.
1447 */
1448 struct drm_connector_infoframe_funcs avi;
1449
1450 /**
1451 * @hdmi:
1452 *
1453 * Set of callbacks for handling the HDMI Vendor-Specific InfoFrame.
1454 * These callbacks are mandatory.
1455 */
1456 struct drm_connector_infoframe_funcs hdmi;
1457
1458 /**
1459 * @audio:
1460 *
1461 * Set of callbacks for handling the Audio InfoFrame. These callbacks
1462 * are optional, but they are required for drivers which use
1463 * drm_atomic_helper_connector_hdmi_update_audio_infoframe().
1464 */
1465 struct drm_connector_infoframe_funcs audio;
1466
1467 /**
1468 * @hdr_drm:
1469 *
1470 * Set of callbacks for handling the HDR DRM InfoFrame. These callbacks
1471 * are mandatory if HDR output is to be supported.
1472 */
1473 struct drm_connector_infoframe_funcs hdr_drm;
1474
1475 /**
1476 * @spd:
1477 *
1478 * Set of callbacks for handling the SPD InfoFrame. These callbacks are
1479 * optional.
1480 */
1481 struct drm_connector_infoframe_funcs spd;
1482 };
1483
1484 /**
1485 * struct drm_connector_funcs - control connectors on a given device
1486 *
1487 * Each CRTC may have one or more connectors attached to it. The functions
1488 * below allow the core DRM code to control connectors, enumerate available modes,
1489 * etc.
1490 */
1491 struct drm_connector_funcs {
1492 /**
1493 * @dpms:
1494 *
1495 * Legacy entry point to set the per-connector DPMS state. Legacy DPMS
1496 * is exposed as a standard property on the connector, but diverted to
1497 * this callback in the drm core. Note that atomic drivers don't
1498 * implement the 4 level DPMS support on the connector any more, but
1499 * instead only have an on/off "ACTIVE" property on the CRTC object.
1500 *
1501 * This hook is not used by atomic drivers, remapping of the legacy DPMS
1502 * property is entirely handled in the DRM core.
1503 *
1504 * RETURNS:
1505 *
1506 * 0 on success or a negative error code on failure.
1507 */
1508 int (*dpms)(struct drm_connector *connector, int mode);
1509
1510 /**
1511 * @reset:
1512 *
1513 * Reset connector hardware and software state to off. This function isn't
1514 * called by the core directly, only through drm_mode_config_reset().
1515 * It's not a helper hook only for historical reasons.
1516 *
1517 * Atomic drivers can use drm_atomic_helper_connector_reset() to reset
1518 * atomic state using this hook.
1519 */
1520 void (*reset)(struct drm_connector *connector);
1521
1522 /**
1523 * @detect:
1524 *
1525 * Check to see if anything is attached to the connector. The parameter
1526 * force is set to false whilst polling, true when checking the
1527 * connector due to a user request. force can be used by the driver to
1528 * avoid expensive, destructive operations during automated probing.
1529 *
1530 * This callback is optional, if not implemented the connector will be
1531 * considered as always being attached.
1532 *
1533 * FIXME:
1534 *
1535 * Note that this hook is only called by the probe helper. It's not in
1536 * the helper library vtable purely for historical reasons. The only DRM
1537 * core entry point to probe connector state is @fill_modes.
1538 *
1539 * Note that the helper library will already hold
1540 * &drm_mode_config.connection_mutex. Drivers which need to grab additional
1541 * locks to avoid races with concurrent modeset changes need to use
1542 * &drm_connector_helper_funcs.detect_ctx instead.
1543 *
1544 * Also note that this callback can be called no matter the
1545 * state the connector is in. Drivers that need the underlying
1546 * device to be powered to perform the detection will first need
1547 * to make sure it's been properly enabled.
1548 *
1549 * RETURNS:
1550 *
1551 * drm_connector_status indicating the connector's status.
1552 */
1553 enum drm_connector_status (*detect)(struct drm_connector *connector,
1554 bool force);
1555
1556 /**
1557 * @force:
1558 *
1559 * This function is called to update internal encoder state when the
1560 * connector is forced to a certain state by userspace, either through
1561 * the sysfs interfaces or on the kernel cmdline. In that case the
1562 * @detect callback isn't called.
1563 *
1564 * FIXME:
1565 *
1566 * Note that this hook is only called by the probe helper. It's not in
1567 * the helper library vtable purely for historical reasons. The only DRM
1568 * core entry point to probe connector state is @fill_modes.
1569 */
1570 void (*force)(struct drm_connector *connector);
1571
1572 /**
1573 * @fill_modes:
1574 *
1575 * Entry point for output detection and basic mode validation. The
1576 * driver should reprobe the output if needed (e.g. when hotplug
1577 * handling is unreliable), add all detected modes to &drm_connector.modes
1578 * and filter out any the device can't support in any configuration. It
1579 * also needs to filter out any modes wider or higher than the
1580 * parameters max_width and max_height indicate.
1581 *
1582 * The drivers must also prune any modes no longer valid from
1583 * &drm_connector.modes. Furthermore it must update
1584 * &drm_connector.status and &drm_connector.edid. If no EDID has been
1585 * received for this output connector->edid must be NULL.
1586 *
1587 * Drivers using the probe helpers should use
1588 * drm_helper_probe_single_connector_modes() to implement this
1589 * function.
1590 *
1591 * RETURNS:
1592 *
1593 * The number of modes detected and filled into &drm_connector.modes.
1594 */
1595 int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
1596
1597 /**
1598 * @set_property:
1599 *
1600 * This is the legacy entry point to update a property attached to the
1601 * connector.
1602 *
1603 * This callback is optional if the driver does not support any legacy
1604 * driver-private properties. For atomic drivers it is not used because
1605 * property handling is done entirely in the DRM core.
1606 *
1607 * RETURNS:
1608 *
1609 * 0 on success or a negative error code on failure.
1610 */
1611 int (*set_property)(struct drm_connector *connector, struct drm_property *property,
1612 uint64_t val);
1613
1614 /**
1615 * @late_register:
1616 *
1617 * This optional hook can be used to register additional userspace
1618 * interfaces attached to the connector, light backlight control, i2c,
1619 * DP aux or similar interfaces. It is called late in the driver load
1620 * sequence from drm_connector_register() when registering all the
1621 * core drm connector interfaces. Everything added from this callback
1622 * should be unregistered in the early_unregister callback.
1623 *
1624 * This is called while holding &drm_connector.mutex.
1625 *
1626 * Returns:
1627 *
1628 * 0 on success, or a negative error code on failure.
1629 */
1630 int (*late_register)(struct drm_connector *connector);
1631
1632 /**
1633 * @early_unregister:
1634 *
1635 * This optional hook should be used to unregister the additional
1636 * userspace interfaces attached to the connector from
1637 * late_register(). It is called from drm_connector_unregister(),
1638 * early in the driver unload sequence to disable userspace access
1639 * before data structures are torndown.
1640 *
1641 * This is called while holding &drm_connector.mutex.
1642 */
1643 void (*early_unregister)(struct drm_connector *connector);
1644
1645 /**
1646 * @destroy:
1647 *
1648 * Clean up connector resources. This is called at driver unload time
1649 * through drm_mode_config_cleanup(). It can also be called at runtime
1650 * when a connector is being hot-unplugged for drivers that support
1651 * connector hotplugging (e.g. DisplayPort MST).
1652 */
1653 void (*destroy)(struct drm_connector *connector);
1654
1655 /**
1656 * @atomic_create_state:
1657 *
1658 * Allocate a pristine, initialized, state for the connector
1659 * object and return it. This callback must have no side
1660 * effects: in particular, the returned state must not be
1661 * assigned to the object's state pointer and it must not affect
1662 * the hardware state.
1663 *
1664 * RETURNS:
1665 *
1666 * A new, pristine, connector state instance or an error pointer
1667 * on failure.
1668 */
1669 struct drm_connector_state *(*atomic_create_state)(struct drm_connector *connector);
1670
1671 /**
1672 * @atomic_duplicate_state:
1673 *
1674 * Duplicate the current atomic state for this connector and return it.
1675 * The core and helpers guarantee that any atomic state duplicated with
1676 * this hook and still owned by the caller (i.e. not transferred to the
1677 * driver by calling &drm_mode_config_funcs.atomic_commit) will be
1678 * cleaned up by calling the @atomic_destroy_state hook in this
1679 * structure.
1680 *
1681 * This callback is mandatory for atomic drivers.
1682 *
1683 * Atomic drivers which don't subclass &struct drm_connector_state should use
1684 * drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the
1685 * state structure to extend it with driver-private state should use
1686 * __drm_atomic_helper_connector_duplicate_state() to make sure shared state is
1687 * duplicated in a consistent fashion across drivers.
1688 *
1689 * It is an error to call this hook before &drm_connector.state has been
1690 * initialized correctly.
1691 *
1692 * NOTE:
1693 *
1694 * If the duplicate state references refcounted resources this hook must
1695 * acquire a reference for each of them. The driver must release these
1696 * references again in @atomic_destroy_state.
1697 *
1698 * RETURNS:
1699 *
1700 * Duplicated atomic state or NULL when the allocation failed.
1701 */
1702 struct drm_connector_state *(*atomic_duplicate_state)(struct drm_connector *connector);
1703
1704 /**
1705 * @atomic_destroy_state:
1706 *
1707 * Destroy a state duplicated with @atomic_duplicate_state and release
1708 * or unreference all resources it references
1709 *
1710 * This callback is mandatory for atomic drivers.
1711 */
1712 void (*atomic_destroy_state)(struct drm_connector *connector,
1713 struct drm_connector_state *state);
1714
1715 /**
1716 * @atomic_set_property:
1717 *
1718 * Decode a driver-private property value and store the decoded value
1719 * into the passed-in state structure. Since the atomic core decodes all
1720 * standardized properties (even for extensions beyond the core set of
1721 * properties which might not be implemented by all drivers) this
1722 * requires drivers to subclass the state structure.
1723 *
1724 * Such driver-private properties should really only be implemented for
1725 * truly hardware/vendor specific state. Instead it is preferred to
1726 * standardize atomic extension and decode the properties used to expose
1727 * such an extension in the core.
1728 *
1729 * Do not call this function directly, use
1730 * drm_atomic_connector_set_property() instead.
1731 *
1732 * This callback is optional if the driver does not support any
1733 * driver-private atomic properties.
1734 *
1735 * NOTE:
1736 *
1737 * This function is called in the state assembly phase of atomic
1738 * modesets, which can be aborted for any reason (including on
1739 * userspace's request to just check whether a configuration would be
1740 * possible). Drivers MUST NOT touch any persistent state (hardware or
1741 * software) or data structures except the passed in @state parameter.
1742 *
1743 * Also since userspace controls in which order properties are set this
1744 * function must not do any input validation (since the state update is
1745 * incomplete and hence likely inconsistent). Instead any such input
1746 * validation must be done in the various atomic_check callbacks.
1747 *
1748 * RETURNS:
1749 *
1750 * 0 if the property has been found, -EINVAL if the property isn't
1751 * implemented by the driver (which shouldn't ever happen, the core only
1752 * asks for properties attached to this connector). No other validation
1753 * is allowed by the driver. The core already checks that the property
1754 * value is within the range (integer, valid enum value, ...) the driver
1755 * set when registering the property.
1756 */
1757 int (*atomic_set_property)(struct drm_connector *connector,
1758 struct drm_connector_state *state,
1759 struct drm_property *property,
1760 uint64_t val);
1761
1762 /**
1763 * @atomic_get_property:
1764 *
1765 * Reads out the decoded driver-private property. This is used to
1766 * implement the GETCONNECTOR IOCTL.
1767 *
1768 * Do not call this function directly, use
1769 * drm_atomic_connector_get_property() instead.
1770 *
1771 * This callback is optional if the driver does not support any
1772 * driver-private atomic properties.
1773 *
1774 * RETURNS:
1775 *
1776 * 0 on success, -EINVAL if the property isn't implemented by the
1777 * driver (which shouldn't ever happen, the core only asks for
1778 * properties attached to this connector).
1779 */
1780 int (*atomic_get_property)(struct drm_connector *connector,
1781 const struct drm_connector_state *state,
1782 struct drm_property *property,
1783 uint64_t *val);
1784
1785 /**
1786 * @atomic_print_state:
1787 *
1788 * If driver subclasses &struct drm_connector_state, it should implement
1789 * this optional hook for printing additional driver specific state.
1790 *
1791 * Do not call this directly, use drm_atomic_connector_print_state()
1792 * instead.
1793 */
1794 void (*atomic_print_state)(struct drm_printer *p,
1795 const struct drm_connector_state *state);
1796
1797 /**
1798 * @oob_hotplug_event:
1799 *
1800 * This will get called when a hotplug-event for a drm-connector
1801 * has been received from a source outside the display driver / device.
1802 */
1803 void (*oob_hotplug_event)(struct drm_connector *connector,
1804 enum drm_connector_status status);
1805
1806 /**
1807 * @debugfs_init:
1808 *
1809 * Allows connectors to create connector-specific debugfs files.
1810 */
1811 void (*debugfs_init)(struct drm_connector *connector, struct dentry *root);
1812
1813 /**
1814 * @color_format:
1815 *
1816 * Allows connectors to return a connector color format other than
1817 * @conn_state.color_format for purposes of e.g. display protocol
1818 * specific helper logic having already mapped it to an output format.
1819 */
1820 enum drm_connector_color_format (*color_format)(
1821 const struct drm_connector_state *conn_state);
1822 };
1823
1824 /**
1825 * struct drm_cmdline_mode - DRM Mode passed through the kernel command-line
1826 *
1827 * Each connector can have an initial mode with additional options
1828 * passed through the kernel command line. This structure allows to
1829 * express those parameters and will be filled by the command-line
1830 * parser.
1831 */
1832 struct drm_cmdline_mode {
1833 /**
1834 * @name:
1835 *
1836 * Name of the mode.
1837 */
1838 char name[DRM_DISPLAY_MODE_LEN];
1839
1840 /**
1841 * @specified:
1842 *
1843 * Has a mode been read from the command-line?
1844 */
1845 bool specified;
1846
1847 /**
1848 * @refresh_specified:
1849 *
1850 * Did the mode have a preferred refresh rate?
1851 */
1852 bool refresh_specified;
1853
1854 /**
1855 * @bpp_specified:
1856 *
1857 * Did the mode have a preferred BPP?
1858 */
1859 bool bpp_specified;
1860
1861 /**
1862 * @pixel_clock:
1863 *
1864 * Pixel Clock in kHz. Optional.
1865 */
1866 unsigned int pixel_clock;
1867
1868 /**
1869 * @xres:
1870 *
1871 * Active resolution on the X axis, in pixels.
1872 */
1873 int xres;
1874
1875 /**
1876 * @yres:
1877 *
1878 * Active resolution on the Y axis, in pixels.
1879 */
1880 int yres;
1881
1882 /**
1883 * @bpp:
1884 *
1885 * Bits per pixels for the mode.
1886 */
1887 int bpp;
1888
1889 /**
1890 * @refresh:
1891 *
1892 * Refresh rate, in Hertz.
1893 */
1894 int refresh;
1895
1896 /**
1897 * @rb:
1898 *
1899 * Do we need to use reduced blanking?
1900 */
1901 bool rb;
1902
1903 /**
1904 * @interlace:
1905 *
1906 * The mode is interlaced.
1907 */
1908 bool interlace;
1909
1910 /**
1911 * @cvt:
1912 *
1913 * The timings will be calculated using the VESA Coordinated
1914 * Video Timings instead of looking up the mode from a table.
1915 */
1916 bool cvt;
1917
1918 /**
1919 * @margins:
1920 *
1921 * Add margins to the mode calculation (1.8% of xres rounded
1922 * down to 8 pixels and 1.8% of yres).
1923 */
1924 bool margins;
1925
1926 /**
1927 * @force:
1928 *
1929 * Ignore the hotplug state of the connector, and force its
1930 * state to one of the DRM_FORCE_* values.
1931 */
1932 enum drm_connector_force force;
1933
1934 /**
1935 * @rotation_reflection:
1936 *
1937 * Initial rotation and reflection of the mode setup from the
1938 * command line. See DRM_MODE_ROTATE_* and
1939 * DRM_MODE_REFLECT_*. The only rotations supported are
1940 * DRM_MODE_ROTATE_0 and DRM_MODE_ROTATE_180.
1941 */
1942 unsigned int rotation_reflection;
1943
1944 /**
1945 * @panel_orientation:
1946 *
1947 * drm-connector "panel orientation" property override value,
1948 * DRM_MODE_PANEL_ORIENTATION_UNKNOWN if not set.
1949 */
1950 enum drm_panel_orientation panel_orientation;
1951
1952 /**
1953 * @tv_margins: TV margins to apply to the mode.
1954 */
1955 struct drm_connector_tv_margins tv_margins;
1956
1957 /**
1958 * @tv_mode: TV mode standard. See DRM_MODE_TV_MODE_*.
1959 */
1960 enum drm_connector_tv_mode tv_mode;
1961
1962 /**
1963 * @tv_mode_specified:
1964 *
1965 * Did the mode have a preferred TV mode?
1966 */
1967 bool tv_mode_specified;
1968 };
1969
1970 /**
1971 * struct drm_connector_hdmi_audio - DRM gemeric HDMI Codec-related structure
1972 *
1973 * HDMI drivers usually incorporate a HDMI Codec. This structure expresses the
1974 * generic HDMI Codec as used by the DRM HDMI Codec framework.
1975 */
1976 struct drm_connector_hdmi_audio {
1977 /**
1978 * @funcs:
1979 *
1980 * Implementation of the HDMI codec functionality to be used by the DRM
1981 * HDMI Codec framework.
1982 */
1983 const struct drm_connector_hdmi_audio_funcs *funcs;
1984
1985 /**
1986 * @codec_pdev:
1987 *
1988 * Platform device created to hold the HDMI Codec. It will be
1989 * automatically unregistered during drm_connector_cleanup().
1990 */
1991 struct platform_device *codec_pdev;
1992
1993 /**
1994 * @lock:
1995 *
1996 * Mutex to protect @last_state, @plugged_cb and @plugged_cb_dev.
1997 */
1998 struct mutex lock;
1999
2000 /**
2001 * @plugged_cb:
2002 *
2003 * Callback to be called when the HDMI sink get plugged to or unplugged
2004 * from this connector. This is assigned by the framework when
2005 * requested by the ASoC code.
2006 */
2007 void (*plugged_cb)(struct device *dev, bool plugged);
2008
2009 /**
2010 * @plugged_cb_dev:
2011 *
2012 * The data for @plugged_cb(). It is being provided by the ASoC.
2013 */
2014 struct device *plugged_cb_dev;
2015
2016 /**
2017 * @last_state:
2018 *
2019 * Last plugged state recored by the framework. It is used to correctly
2020 * report the state to @plugged_cb().
2021 */
2022 bool last_state;
2023
2024 /**
2025 * @dai_port:
2026 *
2027 * The port in DT that is used for the Codec DAI.
2028 */
2029 int dai_port;
2030 };
2031
2032 /*
2033 * struct drm_connector_hdmi - DRM Connector HDMI-related structure
2034 */
2035 struct drm_connector_hdmi {
2036 #define DRM_CONNECTOR_HDMI_VENDOR_LEN 8
2037 /**
2038 * @vendor: HDMI Controller Vendor Name
2039 */
2040 unsigned char vendor[DRM_CONNECTOR_HDMI_VENDOR_LEN] __nonstring;
2041
2042 #define DRM_CONNECTOR_HDMI_PRODUCT_LEN 16
2043 /**
2044 * @product: HDMI Controller Product Name
2045 */
2046 unsigned char product[DRM_CONNECTOR_HDMI_PRODUCT_LEN] __nonstring;
2047
2048 /**
2049 * @supported_formats: Bitmask of @drm_output_color_format
2050 * supported by the controller.
2051 */
2052 unsigned long supported_formats;
2053
2054 /**
2055 * @funcs: HDMI connector Control Functions
2056 */
2057 const struct drm_connector_hdmi_funcs *funcs;
2058
2059 /**
2060 * @infoframes: Current Infoframes output by the connector
2061 */
2062 struct {
2063 /**
2064 * @lock: Mutex protecting against concurrent access to
2065 * the infoframes, most notably between KMS and ALSA.
2066 */
2067 struct mutex lock;
2068
2069 /**
2070 * @audio: Current Audio Infoframes structure. Protected
2071 * by @lock.
2072 */
2073 struct drm_connector_hdmi_infoframe audio;
2074 } infoframes;
2075 };
2076
2077 /**
2078 * struct drm_connector_cec - DRM Connector CEC-related structure
2079 */
2080 struct drm_connector_cec {
2081 /**
2082 * @mutex: protects all fields in this structure.
2083 */
2084 struct mutex mutex;
2085
2086 /**
2087 * @funcs: CEC Control Functions
2088 */
2089 const struct drm_connector_cec_funcs *funcs;
2090
2091 /**
2092 * @data: CEC implementation-specific data
2093 */
2094 void *data;
2095 };
2096
2097 /**
2098 * struct drm_connector - central DRM connector control structure
2099 *
2100 * Each connector may be connected to one or more CRTCs, or may be clonable by
2101 * another connector if they can share a CRTC. Each connector also has a specific
2102 * position in the broader display (referred to as a 'screen' though it could
2103 * span multiple monitors).
2104 */
2105 struct drm_connector {
2106 /** @dev: parent DRM device */
2107 struct drm_device *dev;
2108 /** @kdev: kernel device for sysfs attributes */
2109 struct device *kdev;
2110 /** @attr: sysfs attributes */
2111 struct device_attribute *attr;
2112 /**
2113 * @fwnode: associated fwnode supplied by platform firmware
2114 *
2115 * Drivers can set this to associate a fwnode with a connector, drivers
2116 * are expected to get a reference on the fwnode when setting this.
2117 * drm_connector_cleanup() will call fwnode_handle_put() on this.
2118 */
2119 struct fwnode_handle *fwnode;
2120
2121 /**
2122 * @head:
2123 *
2124 * List of all connectors on a @dev, linked from
2125 * &drm_mode_config.connector_list. Protected by
2126 * &drm_mode_config.connector_list_lock, but please only use
2127 * &drm_connector_list_iter to walk this list.
2128 */
2129 struct list_head head;
2130
2131 /**
2132 * @global_connector_list_entry:
2133 *
2134 * Connector entry in the global connector-list, used by
2135 * drm_connector_find_by_fwnode().
2136 */
2137 struct list_head global_connector_list_entry;
2138
2139 /** @base: base KMS object */
2140 struct drm_mode_object base;
2141
2142 /** @name: human readable name, can be overwritten by the driver */
2143 char *name;
2144
2145 /**
2146 * @mutex: Lock for general connector state, but currently only protects
2147 * @registered. Most of the connector state is still protected by
2148 * &drm_mode_config.mutex.
2149 */
2150 struct mutex mutex;
2151
2152 /**
2153 * @index: Compacted connector index, which matches the position inside
2154 * the mode_config.list for drivers not supporting hot-add/removing. Can
2155 * be used as an array index. It is invariant over the lifetime of the
2156 * connector.
2157 */
2158 unsigned index;
2159
2160 /**
2161 * @connector_type:
2162 * one of the DRM_MODE_CONNECTOR_<foo> types from drm_mode.h
2163 */
2164 int connector_type;
2165 /** @connector_type_id: index into connector type enum */
2166 int connector_type_id;
2167 /**
2168 * @interlace_allowed:
2169 * Can this connector handle interlaced modes? Only used by
2170 * drm_helper_probe_single_connector_modes() for mode filtering.
2171 */
2172 bool interlace_allowed;
2173 /**
2174 * @doublescan_allowed:
2175 * Can this connector handle doublescan? Only used by
2176 * drm_helper_probe_single_connector_modes() for mode filtering.
2177 */
2178 bool doublescan_allowed;
2179 /**
2180 * @stereo_allowed:
2181 * Can this connector handle stereo modes? Only used by
2182 * drm_helper_probe_single_connector_modes() for mode filtering.
2183 */
2184 bool stereo_allowed;
2185
2186 /**
2187 * @ycbcr_420_allowed : This bool indicates if this connector is
2188 * capable of handling YCBCR 420 output. While parsing the EDID
2189 * blocks it's very helpful to know if the source is capable of
2190 * handling YCBCR 420 outputs.
2191 */
2192 bool ycbcr_420_allowed;
2193
2194 /**
2195 * @registration_state: Is this connector initializing, exposed
2196 * (registered) with userspace, or unregistered?
2197 *
2198 * Protected by @mutex.
2199 */
2200 enum drm_connector_registration_state registration_state;
2201
2202 /**
2203 * @modes:
2204 * Modes available on this connector (from fill_modes() + user).
2205 * Protected by &drm_mode_config.mutex.
2206 */
2207 struct list_head modes;
2208
2209 /**
2210 * @status:
2211 * One of the drm_connector_status enums (connected, not, or unknown).
2212 * Protected by &drm_mode_config.mutex.
2213 */
2214 enum drm_connector_status status;
2215
2216 /**
2217 * @probed_modes:
2218 * These are modes added by probing with DDC or the BIOS, before
2219 * filtering is applied. Used by the probe helpers. Protected by
2220 * &drm_mode_config.mutex.
2221 */
2222 struct list_head probed_modes;
2223
2224 /**
2225 * @display_info: Display information is filled from EDID information
2226 * when a display is detected. For non hot-pluggable displays such as
2227 * flat panels in embedded systems, the driver should initialize the
2228 * &drm_display_info.width_mm and &drm_display_info.height_mm fields
2229 * with the physical size of the display.
2230 *
2231 * Protected by &drm_mode_config.mutex.
2232 */
2233 struct drm_display_info display_info;
2234
2235 /** @funcs: connector control functions */
2236 const struct drm_connector_funcs *funcs;
2237
2238 /**
2239 * @edid_blob_ptr: DRM property containing EDID if present. Protected by
2240 * &drm_mode_config.mutex.
2241 *
2242 * This must be updated only by calling drm_edid_connector_update() or
2243 * drm_connector_update_edid_property().
2244 *
2245 * This must not be used by drivers directly.
2246 */
2247 struct drm_property_blob *edid_blob_ptr;
2248
2249 /** @properties: property tracking for this connector */
2250 struct drm_object_properties properties;
2251
2252 /**
2253 * @scaling_mode_property: Optional atomic property to control the
2254 * upscaling. See drm_connector_attach_content_protection_property().
2255 */
2256 struct drm_property *scaling_mode_property;
2257
2258 /**
2259 * @vrr_capable_property: Optional property to help userspace
2260 * query hardware support for variable refresh rate on a connector.
2261 * connector. Drivers can add the property to a connector by
2262 * calling drm_connector_attach_vrr_capable_property().
2263 *
2264 * This should be updated only by calling
2265 * drm_connector_set_vrr_capable_property().
2266 */
2267 struct drm_property *vrr_capable_property;
2268
2269 /**
2270 * @colorspace_property: Connector property to set the suitable
2271 * colorspace supported by the sink.
2272 */
2273 struct drm_property *colorspace_property;
2274
2275 /**
2276 * @color_format_property: Connector property to set the suitable
2277 * color format supported by the sink.
2278 */
2279 struct drm_property *color_format_property;
2280
2281 /**
2282 * @path_blob_ptr:
2283 *
2284 * DRM blob property data for the DP MST path property. This should only
2285 * be updated by calling drm_connector_set_path_property().
2286 */
2287 struct drm_property_blob *path_blob_ptr;
2288
2289 /**
2290 * @max_bpc: Maximum bits per color channel the connector supports.
2291 */
2292 unsigned int max_bpc;
2293
2294 /**
2295 * @max_bpc_property: Default connector property for the max bpc to be
2296 * driven out of the connector.
2297 */
2298 struct drm_property *max_bpc_property;
2299
2300 /** @privacy_screen: drm_privacy_screen for this connector, or NULL. */
2301 struct drm_privacy_screen *privacy_screen;
2302
2303 /** @privacy_screen_notifier: privacy-screen notifier_block */
2304 struct notifier_block privacy_screen_notifier;
2305
2306 /**
2307 * @privacy_screen_sw_state_property: Optional atomic property for the
2308 * connector to control the integrated privacy screen.
2309 */
2310 struct drm_property *privacy_screen_sw_state_property;
2311
2312 /**
2313 * @privacy_screen_hw_state_property: Optional atomic property for the
2314 * connector to report the actual integrated privacy screen state.
2315 */
2316 struct drm_property *privacy_screen_hw_state_property;
2317
2318 /**
2319 * @broadcast_rgb_property: Connector property to set the
2320 * Broadcast RGB selection to output with.
2321 */
2322 struct drm_property *broadcast_rgb_property;
2323
2324 #define DRM_CONNECTOR_POLL_HPD (1 << 0)
2325 #define DRM_CONNECTOR_POLL_CONNECT (1 << 1)
2326 #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
2327
2328 /**
2329 * @polled:
2330 *
2331 * Connector polling mode, a combination of
2332 *
2333 * DRM_CONNECTOR_POLL_HPD
2334 * The connector generates hotplug events and doesn't need to be
2335 * periodically polled. The CONNECT and DISCONNECT flags must not
2336 * be set together with the HPD flag.
2337 *
2338 * DRM_CONNECTOR_POLL_CONNECT
2339 * Periodically poll the connector for connection.
2340 *
2341 * DRM_CONNECTOR_POLL_DISCONNECT
2342 * Periodically poll the connector for disconnection, without
2343 * causing flickering even when the connector is in use. DACs should
2344 * rarely do this without a lot of testing.
2345 *
2346 * Set to 0 for connectors that don't support connection status
2347 * discovery.
2348 */
2349 uint8_t polled;
2350
2351 /**
2352 * @dpms: Current dpms state. For legacy drivers the
2353 * &drm_connector_funcs.dpms callback must update this. For atomic
2354 * drivers, this is handled by the core atomic code, and drivers must
2355 * only take &drm_crtc_state.active into account.
2356 */
2357 int dpms;
2358
2359 /** @helper_private: mid-layer private data */
2360 const struct drm_connector_helper_funcs *helper_private;
2361
2362 /** @cmdline_mode: mode line parsed from the kernel cmdline for this connector */
2363 struct drm_cmdline_mode cmdline_mode;
2364 /** @force: a DRM_FORCE_<foo> state for forced mode sets */
2365 enum drm_connector_force force;
2366
2367 /**
2368 * @edid_override: Override EDID set via debugfs.
2369 *
2370 * Do not modify or access outside of the drm_edid_override_* family of
2371 * functions.
2372 */
2373 const struct drm_edid *edid_override;
2374
2375 /**
2376 * @edid_override_mutex: Protect access to edid_override.
2377 */
2378 struct mutex edid_override_mutex;
2379
2380 /**
2381 * @epoch_counter: Used to detect changes in connector. Increased when
2382 * the connector, including its status, is changed.
2383 */
2384 u64 epoch_counter;
2385
2386 /**
2387 * @possible_encoders: Bit mask of encoders that can drive this
2388 * connector, drm_encoder_index() determines the index into the bitfield
2389 * and the bits are set with drm_connector_attach_encoder().
2390 */
2391 u32 possible_encoders;
2392
2393 /**
2394 * @encoder: Currently bound encoder driving this connector, if any.
2395 * Only really meaningful for non-atomic drivers. Atomic drivers should
2396 * instead look at &drm_connector_state.best_encoder, and in case they
2397 * need the CRTC driving this output, &drm_connector_state.crtc.
2398 */
2399 struct drm_encoder *encoder;
2400
2401 #define MAX_ELD_BYTES 128
2402 /** @eld: EDID-like data, if present, protected by @eld_mutex */
2403 uint8_t eld[MAX_ELD_BYTES];
2404 /** @eld_mutex: protection for concurrenct access to @eld */
2405 struct mutex eld_mutex;
2406
2407 /** @latency_present: AV delay info from ELD, if found */
2408 bool latency_present[2];
2409 /**
2410 * @video_latency: Video latency info from ELD, if found.
2411 * [0]: progressive, [1]: interlaced
2412 */
2413 int video_latency[2];
2414 /**
2415 * @audio_latency: audio latency info from ELD, if found
2416 * [0]: progressive, [1]: interlaced
2417 */
2418 int audio_latency[2];
2419
2420 /**
2421 * @ddc: associated ddc adapter.
2422 * A connector usually has its associated ddc adapter. If a driver uses
2423 * this field, then an appropriate symbolic link is created in connector
2424 * sysfs directory to make it easy for the user to tell which i2c
2425 * adapter is for a particular display.
2426 *
2427 * The field should be set by calling drm_connector_init_with_ddc().
2428 */
2429 struct i2c_adapter *ddc;
2430
2431 /**
2432 * @null_edid_counter: track sinks that give us all zeros for the EDID.
2433 * Needed to workaround some HW bugs where we get all 0s
2434 */
2435 int null_edid_counter;
2436
2437 /** @bad_edid_counter: track sinks that give us an EDID with invalid checksum */
2438 unsigned bad_edid_counter;
2439
2440 /**
2441 * @edid_corrupt: Indicates whether the last read EDID was corrupt. Used
2442 * in Displayport compliance testing - Displayport Link CTS Core 1.2
2443 * rev1.1 4.2.2.6
2444 */
2445 bool edid_corrupt;
2446 /**
2447 * @real_edid_checksum: real edid checksum for corrupted edid block.
2448 * Required in Displayport 1.4 compliance testing
2449 * rev1.1 4.2.2.6
2450 */
2451 u8 real_edid_checksum;
2452
2453 /** @debugfs_entry: debugfs directory for this connector */
2454 struct dentry *debugfs_entry;
2455
2456 /**
2457 * @state:
2458 *
2459 * Current atomic state for this connector.
2460 *
2461 * This is protected by &drm_mode_config.connection_mutex. Note that
2462 * nonblocking atomic commits access the current connector state without
2463 * taking locks. Either by going through the &struct drm_atomic_commit
2464 * pointers, see for_each_oldnew_connector_in_state(),
2465 * for_each_old_connector_in_state() and
2466 * for_each_new_connector_in_state(). Or through careful ordering of
2467 * atomic commit operations as implemented in the atomic helpers, see
2468 * &struct drm_crtc_commit.
2469 */
2470 struct drm_connector_state *state;
2471
2472 /* DisplayID bits. FIXME: Extract into a substruct? */
2473
2474 /**
2475 * @tile_blob_ptr:
2476 *
2477 * DRM blob property data for the tile property (used mostly by DP MST).
2478 * This is meant for screens which are driven through separate display
2479 * pipelines represented by &drm_crtc, which might not be running with
2480 * genlocked clocks. For tiled panels which are genlocked, like
2481 * dual-link LVDS or dual-link DSI, the driver should try to not expose
2482 * the tiling and virtualize both &drm_crtc and &drm_plane if needed.
2483 *
2484 * This should only be updated by calling
2485 * drm_connector_set_tile_property().
2486 */
2487 struct drm_property_blob *tile_blob_ptr;
2488
2489 /** @has_tile: is this connector connected to a tiled monitor */
2490 bool has_tile;
2491 /** @tile_group: tile group for the connected monitor */
2492 struct drm_tile_group *tile_group;
2493 /** @tile_is_single_monitor: whether the tile is one monitor housing */
2494 bool tile_is_single_monitor;
2495
2496 /** @num_h_tile: number of horizontal tiles in the tile group */
2497 /** @num_v_tile: number of vertical tiles in the tile group */
2498 uint8_t num_h_tile, num_v_tile;
2499 /** @tile_h_loc: horizontal location of this tile */
2500 /** @tile_v_loc: vertical location of this tile */
2501 uint8_t tile_h_loc, tile_v_loc;
2502 /** @tile_h_size: horizontal size of this tile. */
2503 /** @tile_v_size: vertical size of this tile. */
2504 uint16_t tile_h_size, tile_v_size;
2505
2506 /**
2507 * @free_node:
2508 *
2509 * List used only by &drm_connector_list_iter to be able to clean up a
2510 * connector from any context, in conjunction with
2511 * &drm_mode_config.connector_free_work.
2512 */
2513 struct llist_node free_node;
2514
2515 /**
2516 * @hdmi: HDMI-related variable and properties.
2517 */
2518 struct drm_connector_hdmi hdmi;
2519
2520 /**
2521 * @hdmi_audio: HDMI codec properties and non-DRM state.
2522 */
2523 struct drm_connector_hdmi_audio hdmi_audio;
2524
2525 /**
2526 * @cec: CEC-related data.
2527 */
2528 struct drm_connector_cec cec;
2529 };
2530
2531 #define obj_to_connector(x) container_of(x, struct drm_connector, base)
2532
2533 int drm_connector_init(struct drm_device *dev,
2534 struct drm_connector *connector,
2535 const struct drm_connector_funcs *funcs,
2536 int connector_type);
2537 int drm_connector_dynamic_init(struct drm_device *dev,
2538 struct drm_connector *connector,
2539 const struct drm_connector_funcs *funcs,
2540 int connector_type,
2541 struct i2c_adapter *ddc);
2542 int drm_connector_init_with_ddc(struct drm_device *dev,
2543 struct drm_connector *connector,
2544 const struct drm_connector_funcs *funcs,
2545 int connector_type,
2546 struct i2c_adapter *ddc);
2547 int drmm_connector_init(struct drm_device *dev,
2548 struct drm_connector *connector,
2549 const struct drm_connector_funcs *funcs,
2550 int connector_type,
2551 struct i2c_adapter *ddc);
2552 int drmm_connector_hdmi_init(struct drm_device *dev,
2553 struct drm_connector *connector,
2554 const char *vendor, const char *product,
2555 const struct drm_connector_funcs *funcs,
2556 const struct drm_connector_hdmi_funcs *hdmi_funcs,
2557 int connector_type,
2558 struct i2c_adapter *ddc,
2559 unsigned long supported_formats,
2560 unsigned int max_bpc);
2561 void drm_connector_attach_edid_property(struct drm_connector *connector);
2562 int drm_connector_register(struct drm_connector *connector);
2563 int drm_connector_dynamic_register(struct drm_connector *connector);
2564 void drm_connector_unregister(struct drm_connector *connector);
2565 int drm_connector_attach_encoder(struct drm_connector *connector,
2566 struct drm_encoder *encoder);
2567
2568 void drm_connector_cleanup(struct drm_connector *connector);
2569
drm_connector_index(const struct drm_connector * connector)2570 static inline unsigned int drm_connector_index(const struct drm_connector *connector)
2571 {
2572 return connector->index;
2573 }
2574
drm_connector_mask(const struct drm_connector * connector)2575 static inline u32 drm_connector_mask(const struct drm_connector *connector)
2576 {
2577 return 1 << connector->index;
2578 }
2579
2580 /**
2581 * drm_connector_lookup - lookup connector object
2582 * @dev: DRM device
2583 * @file_priv: drm file to check for lease against.
2584 * @id: connector object id
2585 *
2586 * This function looks up the connector object specified by id
2587 * add takes a reference to it.
2588 */
drm_connector_lookup(struct drm_device * dev,struct drm_file * file_priv,uint32_t id)2589 static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev,
2590 struct drm_file *file_priv,
2591 uint32_t id)
2592 {
2593 struct drm_mode_object *mo;
2594 mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CONNECTOR);
2595 return mo ? obj_to_connector(mo) : NULL;
2596 }
2597
2598 /**
2599 * drm_connector_get - acquire a connector reference
2600 * @connector: DRM connector
2601 *
2602 * This function increments the connector's refcount.
2603 */
drm_connector_get(struct drm_connector * connector)2604 static inline void drm_connector_get(struct drm_connector *connector)
2605 {
2606 drm_mode_object_get(&connector->base);
2607 }
2608
2609 /**
2610 * drm_connector_put - release a connector reference
2611 * @connector: DRM connector
2612 *
2613 * This function decrements the connector's reference count and frees the
2614 * object if the reference count drops to zero.
2615 */
drm_connector_put(struct drm_connector * connector)2616 static inline void drm_connector_put(struct drm_connector *connector)
2617 {
2618 drm_mode_object_put(&connector->base);
2619 }
2620
2621 /**
2622 * drm_connector_is_unregistered - has the connector been unregistered from
2623 * userspace?
2624 * @connector: DRM connector
2625 *
2626 * Checks whether or not @connector has been unregistered from userspace.
2627 *
2628 * Returns:
2629 * True if the connector was unregistered, false if the connector is
2630 * registered or has not yet been registered with userspace.
2631 */
2632 static inline bool
drm_connector_is_unregistered(struct drm_connector * connector)2633 drm_connector_is_unregistered(struct drm_connector *connector)
2634 {
2635 return READ_ONCE(connector->registration_state) ==
2636 DRM_CONNECTOR_UNREGISTERED;
2637 }
2638
2639 void drm_connector_oob_hotplug_event(struct fwnode_handle *connector_fwnode,
2640 enum drm_connector_status status);
2641 enum drm_connector_color_format
2642 drm_connector_get_color_format(const struct drm_connector_state *conn_state);
2643 const char *drm_get_connector_type_name(unsigned int connector_type);
2644 const char *drm_get_connector_status_name(enum drm_connector_status status);
2645 const char *drm_get_subpixel_order_name(enum subpixel_order order);
2646 const char *drm_get_dpms_name(int val);
2647 const char *drm_get_dvi_i_subconnector_name(int val);
2648 const char *drm_get_dvi_i_select_name(int val);
2649 const char *drm_get_tv_mode_name(int val);
2650 const char *drm_get_tv_subconnector_name(int val);
2651 const char *drm_get_tv_select_name(int val);
2652 const char *drm_get_dp_subconnector_name(int val);
2653 const char *drm_get_content_protection_name(int val);
2654 const char *drm_get_hdcp_content_type_name(int val);
2655
2656 int drm_get_tv_mode_from_name(const char *name, size_t len);
2657
2658 int drm_mode_create_dvi_i_properties(struct drm_device *dev);
2659 void drm_connector_attach_dp_subconnector_property(struct drm_connector *connector);
2660
2661 int drm_mode_create_tv_margin_properties(struct drm_device *dev);
2662 int drm_mode_create_tv_properties_legacy(struct drm_device *dev,
2663 unsigned int num_modes,
2664 const char * const modes[]);
2665 int drm_mode_create_tv_properties(struct drm_device *dev,
2666 unsigned int supported_tv_modes);
2667 void drm_connector_attach_tv_margin_properties(struct drm_connector *conn);
2668 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
2669 int drm_connector_attach_content_type_property(struct drm_connector *dev);
2670 int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
2671 u32 scaling_mode_mask);
2672 int drm_connector_attach_vrr_capable_property(
2673 struct drm_connector *connector);
2674 void drm_connector_attach_panel_type_property(struct drm_connector *connector);
2675 int drm_connector_attach_broadcast_rgb_property(struct drm_connector *connector);
2676 int drm_connector_attach_colorspace_property(struct drm_connector *connector);
2677 void drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector);
2678 bool drm_connector_atomic_hdr_metadata_equal(struct drm_connector_state *old_state,
2679 struct drm_connector_state *new_state);
2680 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
2681 int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector,
2682 u32 supported_colorspaces);
2683 int drm_mode_create_dp_colorspace_property(struct drm_connector *connector,
2684 u32 supported_colorspaces);
2685 int drm_mode_create_content_type_property(struct drm_device *dev);
2686 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
2687
2688 int drm_connector_set_path_property(struct drm_connector *connector,
2689 const char *path);
2690 int drm_connector_set_tile_property(struct drm_connector *connector);
2691 int drm_connector_update_edid_property(struct drm_connector *connector,
2692 const struct edid *edid);
2693 void drm_connector_set_link_status_property(struct drm_connector *connector,
2694 uint64_t link_status);
2695 void drm_connector_set_vrr_capable_property(
2696 struct drm_connector *connector, bool capable);
2697 int drm_connector_set_panel_orientation(
2698 struct drm_connector *connector,
2699 enum drm_panel_orientation panel_orientation);
2700 int drm_connector_set_panel_orientation_with_quirk(
2701 struct drm_connector *connector,
2702 enum drm_panel_orientation panel_orientation,
2703 int width, int height);
2704 int drm_connector_set_orientation_from_panel(
2705 struct drm_connector *connector,
2706 struct drm_panel *panel);
2707 int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
2708 int min, int max);
2709 void drm_connector_create_privacy_screen_properties(struct drm_connector *conn);
2710 void drm_connector_attach_privacy_screen_properties(struct drm_connector *conn);
2711 void drm_connector_attach_privacy_screen_provider(
2712 struct drm_connector *connector, struct drm_privacy_screen *priv);
2713 void drm_connector_update_privacy_screen(const struct drm_connector_state *connector_state);
2714
2715 /**
2716 * struct drm_tile_group - Tile group metadata
2717 * @refcount: reference count
2718 * @dev: DRM device
2719 * @id: tile group id exposed to userspace
2720 * @group_data: Sink-private data identifying this group
2721 *
2722 * @group_data corresponds to displayid vend/prod/serial for external screens
2723 * with an EDID.
2724 */
2725 struct drm_tile_group {
2726 struct kref refcount;
2727 struct drm_device *dev;
2728 int id;
2729 u8 group_data[9];
2730 };
2731
2732 struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
2733 const char topology_id[9]);
2734 struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev,
2735 const char topology_id[9]);
2736 void drm_mode_put_tile_group(struct drm_device *dev,
2737 struct drm_tile_group *tg);
2738
2739 /**
2740 * struct drm_connector_list_iter - connector_list iterator
2741 *
2742 * This iterator tracks state needed to be able to walk the connector_list
2743 * within struct drm_mode_config. Only use together with
2744 * drm_connector_list_iter_begin(), drm_connector_list_iter_end() and
2745 * drm_connector_list_iter_next() respectively the convenience macro
2746 * drm_for_each_connector_iter().
2747 *
2748 * Note that the return value of drm_connector_list_iter_next() is only valid
2749 * up to the next drm_connector_list_iter_next() or
2750 * drm_connector_list_iter_end() call. If you want to use the connector later,
2751 * then you need to grab your own reference first using drm_connector_get().
2752 */
2753 struct drm_connector_list_iter {
2754 /* private: */
2755 struct drm_device *dev;
2756 struct drm_connector *conn;
2757 };
2758
2759 void drm_connector_list_iter_begin(struct drm_device *dev,
2760 struct drm_connector_list_iter *iter);
2761 struct drm_connector *
2762 drm_connector_list_iter_next(struct drm_connector_list_iter *iter);
2763 void drm_connector_list_iter_end(struct drm_connector_list_iter *iter);
2764
2765 bool drm_connector_has_possible_encoder(struct drm_connector *connector,
2766 struct drm_encoder *encoder);
2767 const char *drm_get_colorspace_name(enum drm_colorspace colorspace);
2768
2769 int drm_connector_attach_color_format_property(struct drm_connector *connector,
2770 unsigned long supported_color_formats);
2771
2772 /**
2773 * drm_for_each_connector_iter - connector_list iterator macro
2774 * @connector: &struct drm_connector pointer used as cursor
2775 * @iter: &struct drm_connector_list_iter
2776 *
2777 * Note that @connector is only valid within the list body, if you want to use
2778 * @connector after calling drm_connector_list_iter_end() then you need to grab
2779 * your own reference first using drm_connector_get().
2780 */
2781 #define drm_for_each_connector_iter(connector, iter) \
2782 while ((connector = drm_connector_list_iter_next(iter)))
2783
2784 /**
2785 * drm_connector_for_each_possible_encoder - iterate connector's possible encoders
2786 * @connector: &struct drm_connector pointer
2787 * @encoder: &struct drm_encoder pointer used as cursor
2788 */
2789 #define drm_connector_for_each_possible_encoder(connector, encoder) \
2790 drm_for_each_encoder_mask(encoder, (connector)->dev, \
2791 (connector)->possible_encoders)
2792
2793 #endif
2794