xref: /openbmc/linux/include/drm/drm_connector.h (revision 9fa48a24)
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 
34 #include <uapi/drm/drm_mode.h>
35 
36 struct drm_connector_helper_funcs;
37 struct drm_modeset_acquire_ctx;
38 struct drm_device;
39 struct drm_crtc;
40 struct drm_encoder;
41 struct drm_panel;
42 struct drm_property;
43 struct drm_property_blob;
44 struct drm_printer;
45 struct drm_privacy_screen;
46 struct edid;
47 struct i2c_adapter;
48 
49 enum drm_connector_force {
50 	DRM_FORCE_UNSPECIFIED,
51 	DRM_FORCE_OFF,
52 	DRM_FORCE_ON,         /* force on analog part normally */
53 	DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */
54 };
55 
56 /**
57  * enum drm_connector_status - status for a &drm_connector
58  *
59  * This enum is used to track the connector status. There are no separate
60  * #defines for the uapi!
61  */
62 enum drm_connector_status {
63 	/**
64 	 * @connector_status_connected: The connector is definitely connected to
65 	 * a sink device, and can be enabled.
66 	 */
67 	connector_status_connected = 1,
68 	/**
69 	 * @connector_status_disconnected: The connector isn't connected to a
70 	 * sink device which can be autodetect. For digital outputs like DP or
71 	 * HDMI (which can be realiable probed) this means there's really
72 	 * nothing there. It is driver-dependent whether a connector with this
73 	 * status can be lit up or not.
74 	 */
75 	connector_status_disconnected = 2,
76 	/**
77 	 * @connector_status_unknown: The connector's status could not be
78 	 * reliably detected. This happens when probing would either cause
79 	 * flicker (like load-detection when the connector is in use), or when a
80 	 * hardware resource isn't available (like when load-detection needs a
81 	 * free CRTC). It should be possible to light up the connector with one
82 	 * of the listed fallback modes. For default configuration userspace
83 	 * should only try to light up connectors with unknown status when
84 	 * there's not connector with @connector_status_connected.
85 	 */
86 	connector_status_unknown = 3,
87 };
88 
89 /**
90  * enum drm_connector_registration_state - userspace registration status for
91  * a &drm_connector
92  *
93  * This enum is used to track the status of initializing a connector and
94  * registering it with userspace, so that DRM can prevent bogus modesets on
95  * connectors that no longer exist.
96  */
97 enum drm_connector_registration_state {
98 	/**
99 	 * @DRM_CONNECTOR_INITIALIZING: The connector has just been created,
100 	 * but has yet to be exposed to userspace. There should be no
101 	 * additional restrictions to how the state of this connector may be
102 	 * modified.
103 	 */
104 	DRM_CONNECTOR_INITIALIZING = 0,
105 
106 	/**
107 	 * @DRM_CONNECTOR_REGISTERED: The connector has been fully initialized
108 	 * and registered with sysfs, as such it has been exposed to
109 	 * userspace. There should be no additional restrictions to how the
110 	 * state of this connector may be modified.
111 	 */
112 	DRM_CONNECTOR_REGISTERED = 1,
113 
114 	/**
115 	 * @DRM_CONNECTOR_UNREGISTERED: The connector has either been exposed
116 	 * to userspace and has since been unregistered and removed from
117 	 * userspace, or the connector was unregistered before it had a chance
118 	 * to be exposed to userspace (e.g. still in the
119 	 * @DRM_CONNECTOR_INITIALIZING state). When a connector is
120 	 * unregistered, there are additional restrictions to how its state
121 	 * may be modified:
122 	 *
123 	 * - An unregistered connector may only have its DPMS changed from
124 	 *   On->Off. Once DPMS is changed to Off, it may not be switched back
125 	 *   to On.
126 	 * - Modesets are not allowed on unregistered connectors, unless they
127 	 *   would result in disabling its assigned CRTCs. This means
128 	 *   disabling a CRTC on an unregistered connector is OK, but enabling
129 	 *   one is not.
130 	 * - Removing a CRTC from an unregistered connector is OK, but new
131 	 *   CRTCs may never be assigned to an unregistered connector.
132 	 */
133 	DRM_CONNECTOR_UNREGISTERED = 2,
134 };
135 
136 enum subpixel_order {
137 	SubPixelUnknown = 0,
138 	SubPixelHorizontalRGB,
139 	SubPixelHorizontalBGR,
140 	SubPixelVerticalRGB,
141 	SubPixelVerticalBGR,
142 	SubPixelNone,
143 
144 };
145 
146 /**
147  * enum drm_connector_tv_mode - Analog TV output mode
148  *
149  * This enum is used to indicate the TV output mode used on an analog TV
150  * connector.
151  *
152  * WARNING: The values of this enum is uABI since they're exposed in the
153  * "TV mode" connector property.
154  */
155 enum drm_connector_tv_mode {
156 	/**
157 	 * @DRM_MODE_TV_MODE_NTSC: CCIR System M (aka 525-lines)
158 	 * together with the NTSC Color Encoding.
159 	 */
160 	DRM_MODE_TV_MODE_NTSC,
161 
162 	/**
163 	 * @DRM_MODE_TV_MODE_NTSC_443: Variant of
164 	 * @DRM_MODE_TV_MODE_NTSC. Uses a color subcarrier frequency
165 	 * of 4.43 MHz.
166 	 */
167 	DRM_MODE_TV_MODE_NTSC_443,
168 
169 	/**
170 	 * @DRM_MODE_TV_MODE_NTSC_J: Variant of @DRM_MODE_TV_MODE_NTSC
171 	 * used in Japan. Uses a black level equals to the blanking
172 	 * level.
173 	 */
174 	DRM_MODE_TV_MODE_NTSC_J,
175 
176 	/**
177 	 * @DRM_MODE_TV_MODE_PAL: CCIR System B together with the PAL
178 	 * color system.
179 	 */
180 	DRM_MODE_TV_MODE_PAL,
181 
182 	/**
183 	 * @DRM_MODE_TV_MODE_PAL_M: CCIR System M (aka 525-lines)
184 	 * together with the PAL color encoding
185 	 */
186 	DRM_MODE_TV_MODE_PAL_M,
187 
188 	/**
189 	 * @DRM_MODE_TV_MODE_PAL_N: CCIR System N together with the PAL
190 	 * color encoding. It uses 625 lines, but has a color subcarrier
191 	 * frequency of 3.58MHz, the SECAM color space, and narrower
192 	 * channels compared to most of the other PAL variants.
193 	 */
194 	DRM_MODE_TV_MODE_PAL_N,
195 
196 	/**
197 	 * @DRM_MODE_TV_MODE_SECAM: CCIR System B together with the
198 	 * SECAM color system.
199 	 */
200 	DRM_MODE_TV_MODE_SECAM,
201 
202 	DRM_MODE_TV_MODE_MAX,
203 };
204 
205 /**
206  * struct drm_scrambling: sink's scrambling support.
207  */
208 struct drm_scrambling {
209 	/**
210 	 * @supported: scrambling supported for rates > 340 Mhz.
211 	 */
212 	bool supported;
213 	/**
214 	 * @low_rates: scrambling supported for rates <= 340 Mhz.
215 	 */
216 	bool low_rates;
217 };
218 
219 /*
220  * struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink
221  *
222  * Provides SCDC register support and capabilities related information on a
223  * HDMI 2.0 sink. In case of a HDMI 1.4 sink, all parameter must be 0.
224  */
225 struct drm_scdc {
226 	/**
227 	 * @supported: status control & data channel present.
228 	 */
229 	bool supported;
230 	/**
231 	 * @read_request: sink is capable of generating scdc read request.
232 	 */
233 	bool read_request;
234 	/**
235 	 * @scrambling: sink's scrambling capabilities
236 	 */
237 	struct drm_scrambling scrambling;
238 };
239 
240 /**
241  * struct drm_hdmi_dsc_cap - DSC capabilities of HDMI sink
242  *
243  * Describes the DSC support provided by HDMI 2.1 sink.
244  * The information is fetched fom additional HFVSDB blocks defined
245  * for HDMI 2.1.
246  */
247 struct drm_hdmi_dsc_cap {
248 	/** @v_1p2: flag for dsc1.2 version support by sink */
249 	bool v_1p2;
250 
251 	/** @native_420: Does sink support DSC with 4:2:0 compression */
252 	bool native_420;
253 
254 	/**
255 	 * @all_bpp: Does sink support all bpp with 4:4:4: or 4:2:2
256 	 * compressed formats
257 	 */
258 	bool all_bpp;
259 
260 	/**
261 	 * @bpc_supported: compressed bpc supported by sink : 10, 12 or 16 bpc
262 	 */
263 	u8 bpc_supported;
264 
265 	/** @max_slices: maximum number of Horizontal slices supported by */
266 	u8 max_slices;
267 
268 	/** @clk_per_slice : max pixel clock in MHz supported per slice */
269 	int clk_per_slice;
270 
271 	/** @max_lanes : dsc max lanes supported for Fixed rate Link training */
272 	u8 max_lanes;
273 
274 	/** @max_frl_rate_per_lane : maximum frl rate with DSC per lane */
275 	u8 max_frl_rate_per_lane;
276 
277 	/** @total_chunk_kbytes: max size of chunks in KBs supported per line*/
278 	u8 total_chunk_kbytes;
279 };
280 
281 /**
282  * struct drm_hdmi_info - runtime information about the connected HDMI sink
283  *
284  * Describes if a given display supports advanced HDMI 2.0 features.
285  * This information is available in CEA-861-F extension blocks (like HF-VSDB).
286  */
287 struct drm_hdmi_info {
288 	/** @scdc: sink's scdc support and capabilities */
289 	struct drm_scdc scdc;
290 
291 	/**
292 	 * @y420_vdb_modes: bitmap of modes which can support ycbcr420
293 	 * output only (not normal RGB/YCBCR444/422 outputs). The max VIC
294 	 * defined by the CEA-861-G spec is 219, so the size is 256 bits to map
295 	 * up to 256 VICs.
296 	 */
297 	unsigned long y420_vdb_modes[BITS_TO_LONGS(256)];
298 
299 	/**
300 	 * @y420_cmdb_modes: bitmap of modes which can support ycbcr420
301 	 * output also, along with normal HDMI outputs. The max VIC defined by
302 	 * the CEA-861-G spec is 219, so the size is 256 bits to map up to 256
303 	 * VICs.
304 	 */
305 	unsigned long y420_cmdb_modes[BITS_TO_LONGS(256)];
306 
307 	/** @y420_dc_modes: bitmap of deep color support index */
308 	u8 y420_dc_modes;
309 
310 	/** @max_frl_rate_per_lane: support fixed rate link */
311 	u8 max_frl_rate_per_lane;
312 
313 	/** @max_lanes: supported by sink */
314 	u8 max_lanes;
315 
316 	/** @dsc_cap: DSC capabilities of the sink */
317 	struct drm_hdmi_dsc_cap dsc_cap;
318 };
319 
320 /**
321  * enum drm_link_status - connector's link_status property value
322  *
323  * This enum is used as the connector's link status property value.
324  * It is set to the values defined in uapi.
325  *
326  * @DRM_LINK_STATUS_GOOD: DP Link is Good as a result of successful
327  *                        link training
328  * @DRM_LINK_STATUS_BAD: DP Link is BAD as a result of link training
329  *                       failure
330  */
331 enum drm_link_status {
332 	DRM_LINK_STATUS_GOOD = DRM_MODE_LINK_STATUS_GOOD,
333 	DRM_LINK_STATUS_BAD = DRM_MODE_LINK_STATUS_BAD,
334 };
335 
336 /**
337  * enum drm_panel_orientation - panel_orientation info for &drm_display_info
338  *
339  * This enum is used to track the (LCD) panel orientation. There are no
340  * separate #defines for the uapi!
341  *
342  * @DRM_MODE_PANEL_ORIENTATION_UNKNOWN: The drm driver has not provided any
343  *					panel orientation information (normal
344  *					for non panels) in this case the "panel
345  *					orientation" connector prop will not be
346  *					attached.
347  * @DRM_MODE_PANEL_ORIENTATION_NORMAL:	The top side of the panel matches the
348  *					top side of the device's casing.
349  * @DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP: The top side of the panel matches the
350  *					bottom side of the device's casing, iow
351  *					the panel is mounted upside-down.
352  * @DRM_MODE_PANEL_ORIENTATION_LEFT_UP:	The left side of the panel matches the
353  *					top side of the device's casing.
354  * @DRM_MODE_PANEL_ORIENTATION_RIGHT_UP: The right side of the panel matches the
355  *					top side of the device's casing.
356  */
357 enum drm_panel_orientation {
358 	DRM_MODE_PANEL_ORIENTATION_UNKNOWN = -1,
359 	DRM_MODE_PANEL_ORIENTATION_NORMAL = 0,
360 	DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP,
361 	DRM_MODE_PANEL_ORIENTATION_LEFT_UP,
362 	DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
363 };
364 
365 /**
366  * struct drm_monitor_range_info - Panel's Monitor range in EDID for
367  * &drm_display_info
368  *
369  * This struct is used to store a frequency range supported by panel
370  * as parsed from EDID's detailed monitor range descriptor block.
371  *
372  * @min_vfreq: This is the min supported refresh rate in Hz from
373  *             EDID's detailed monitor range.
374  * @max_vfreq: This is the max supported refresh rate in Hz from
375  *             EDID's detailed monitor range
376  */
377 struct drm_monitor_range_info {
378 	u16 min_vfreq;
379 	u16 max_vfreq;
380 };
381 
382 /**
383  * struct drm_luminance_range_info - Panel's luminance range for
384  * &drm_display_info. Calculated using data in EDID
385  *
386  * This struct is used to store a luminance range supported by panel
387  * as calculated using data from EDID's static hdr metadata.
388  *
389  * @min_luminance: This is the min supported luminance value
390  *
391  * @max_luminance: This is the max supported luminance value
392  */
393 struct drm_luminance_range_info {
394 	u32 min_luminance;
395 	u32 max_luminance;
396 };
397 
398 /**
399  * enum drm_privacy_screen_status - privacy screen status
400  *
401  * This enum is used to track and control the state of the integrated privacy
402  * screen present on some display panels, via the "privacy-screen sw-state"
403  * and "privacy-screen hw-state" properties. Note the _LOCKED enum values
404  * are only valid for the "privacy-screen hw-state" property.
405  *
406  * @PRIVACY_SCREEN_DISABLED:
407  *  The privacy-screen on the panel is disabled
408  * @PRIVACY_SCREEN_ENABLED:
409  *  The privacy-screen on the panel is enabled
410  * @PRIVACY_SCREEN_DISABLED_LOCKED:
411  *  The privacy-screen on the panel is disabled and locked (cannot be changed)
412  * @PRIVACY_SCREEN_ENABLED_LOCKED:
413  *  The privacy-screen on the panel is enabled and locked (cannot be changed)
414  */
415 enum drm_privacy_screen_status {
416 	PRIVACY_SCREEN_DISABLED = 0,
417 	PRIVACY_SCREEN_ENABLED,
418 	PRIVACY_SCREEN_DISABLED_LOCKED,
419 	PRIVACY_SCREEN_ENABLED_LOCKED,
420 };
421 
422 /*
423  * This is a consolidated colorimetry list supported by HDMI and
424  * DP protocol standard. The respective connectors will register
425  * a property with the subset of this list (supported by that
426  * respective protocol). Userspace will set the colorspace through
427  * a colorspace property which will be created and exposed to
428  * userspace.
429  */
430 
431 /* For Default case, driver will set the colorspace */
432 #define DRM_MODE_COLORIMETRY_DEFAULT			0
433 /* CEA 861 Normal Colorimetry options */
434 #define DRM_MODE_COLORIMETRY_NO_DATA			0
435 #define DRM_MODE_COLORIMETRY_SMPTE_170M_YCC		1
436 #define DRM_MODE_COLORIMETRY_BT709_YCC			2
437 /* CEA 861 Extended Colorimetry Options */
438 #define DRM_MODE_COLORIMETRY_XVYCC_601			3
439 #define DRM_MODE_COLORIMETRY_XVYCC_709			4
440 #define DRM_MODE_COLORIMETRY_SYCC_601			5
441 #define DRM_MODE_COLORIMETRY_OPYCC_601			6
442 #define DRM_MODE_COLORIMETRY_OPRGB			7
443 #define DRM_MODE_COLORIMETRY_BT2020_CYCC		8
444 #define DRM_MODE_COLORIMETRY_BT2020_RGB			9
445 #define DRM_MODE_COLORIMETRY_BT2020_YCC			10
446 /* Additional Colorimetry extension added as part of CTA 861.G */
447 #define DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65		11
448 #define DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER		12
449 /* Additional Colorimetry Options added for DP 1.4a VSC Colorimetry Format */
450 #define DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED		13
451 #define DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT		14
452 #define DRM_MODE_COLORIMETRY_BT601_YCC			15
453 
454 /**
455  * enum drm_bus_flags - bus_flags info for &drm_display_info
456  *
457  * This enum defines signal polarities and clock edge information for signals on
458  * a bus as bitmask flags.
459  *
460  * The clock edge information is conveyed by two sets of symbols,
461  * DRM_BUS_FLAGS_*_DRIVE_\* and DRM_BUS_FLAGS_*_SAMPLE_\*. When this enum is
462  * used to describe a bus from the point of view of the transmitter, the
463  * \*_DRIVE_\* flags should be used. When used from the point of view of the
464  * receiver, the \*_SAMPLE_\* flags should be used. The \*_DRIVE_\* and
465  * \*_SAMPLE_\* flags alias each other, with the \*_SAMPLE_POSEDGE and
466  * \*_SAMPLE_NEGEDGE flags being equal to \*_DRIVE_NEGEDGE and \*_DRIVE_POSEDGE
467  * respectively. This simplifies code as signals are usually sampled on the
468  * opposite edge of the driving edge. Transmitters and receivers may however
469  * need to take other signal timings into account to convert between driving
470  * and sample edges.
471  */
472 enum drm_bus_flags {
473 	/**
474 	 * @DRM_BUS_FLAG_DE_LOW:
475 	 *
476 	 * The Data Enable signal is active low
477 	 */
478 	DRM_BUS_FLAG_DE_LOW = BIT(0),
479 
480 	/**
481 	 * @DRM_BUS_FLAG_DE_HIGH:
482 	 *
483 	 * The Data Enable signal is active high
484 	 */
485 	DRM_BUS_FLAG_DE_HIGH = BIT(1),
486 
487 	/**
488 	 * @DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE:
489 	 *
490 	 * Data is driven on the rising edge of the pixel clock
491 	 */
492 	DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE = BIT(2),
493 
494 	/**
495 	 * @DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE:
496 	 *
497 	 * Data is driven on the falling edge of the pixel clock
498 	 */
499 	DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE = BIT(3),
500 
501 	/**
502 	 * @DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE:
503 	 *
504 	 * Data is sampled on the rising edge of the pixel clock
505 	 */
506 	DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE = DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
507 
508 	/**
509 	 * @DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE:
510 	 *
511 	 * Data is sampled on the falling edge of the pixel clock
512 	 */
513 	DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
514 
515 	/**
516 	 * @DRM_BUS_FLAG_DATA_MSB_TO_LSB:
517 	 *
518 	 * Data is transmitted MSB to LSB on the bus
519 	 */
520 	DRM_BUS_FLAG_DATA_MSB_TO_LSB = BIT(4),
521 
522 	/**
523 	 * @DRM_BUS_FLAG_DATA_LSB_TO_MSB:
524 	 *
525 	 * Data is transmitted LSB to MSB on the bus
526 	 */
527 	DRM_BUS_FLAG_DATA_LSB_TO_MSB = BIT(5),
528 
529 	/**
530 	 * @DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE:
531 	 *
532 	 * Sync signals are driven on the rising edge of the pixel clock
533 	 */
534 	DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE = BIT(6),
535 
536 	/**
537 	 * @DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE:
538 	 *
539 	 * Sync signals are driven on the falling edge of the pixel clock
540 	 */
541 	DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE = BIT(7),
542 
543 	/**
544 	 * @DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE:
545 	 *
546 	 * Sync signals are sampled on the rising edge of the pixel clock
547 	 */
548 	DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE = DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE,
549 
550 	/**
551 	 * @DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE:
552 	 *
553 	 * Sync signals are sampled on the falling edge of the pixel clock
554 	 */
555 	DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE = DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,
556 
557 	/**
558 	 * @DRM_BUS_FLAG_SHARP_SIGNALS:
559 	 *
560 	 *  Set if the Sharp-specific signals (SPL, CLS, PS, REV) must be used
561 	 */
562 	DRM_BUS_FLAG_SHARP_SIGNALS = BIT(8),
563 };
564 
565 /**
566  * struct drm_display_info - runtime data about the connected sink
567  *
568  * Describes a given display (e.g. CRT or flat panel) and its limitations. For
569  * fixed display sinks like built-in panels there's not much difference between
570  * this and &struct drm_connector. But for sinks with a real cable this
571  * structure is meant to describe all the things at the other end of the cable.
572  *
573  * For sinks which provide an EDID this can be filled out by calling
574  * drm_add_edid_modes().
575  */
576 struct drm_display_info {
577 	/**
578 	 * @width_mm: Physical width in mm.
579 	 */
580 	unsigned int width_mm;
581 
582 	/**
583 	 * @height_mm: Physical height in mm.
584 	 */
585 	unsigned int height_mm;
586 
587 	/**
588 	 * @bpc: Maximum bits per color channel. Used by HDMI and DP outputs.
589 	 */
590 	unsigned int bpc;
591 
592 	/**
593 	 * @subpixel_order: Subpixel order of LCD panels.
594 	 */
595 	enum subpixel_order subpixel_order;
596 
597 #define DRM_COLOR_FORMAT_RGB444		(1<<0)
598 #define DRM_COLOR_FORMAT_YCBCR444	(1<<1)
599 #define DRM_COLOR_FORMAT_YCBCR422	(1<<2)
600 #define DRM_COLOR_FORMAT_YCBCR420	(1<<3)
601 
602 	/**
603 	 * @panel_orientation: Read only connector property for built-in panels,
604 	 * indicating the orientation of the panel vs the device's casing.
605 	 * drm_connector_init() sets this to DRM_MODE_PANEL_ORIENTATION_UNKNOWN.
606 	 * When not UNKNOWN this gets used by the drm_fb_helpers to rotate the
607 	 * fb to compensate and gets exported as prop to userspace.
608 	 */
609 	int panel_orientation;
610 
611 	/**
612 	 * @color_formats: HDMI Color formats, selects between RGB and YCrCb
613 	 * modes. Used DRM_COLOR_FORMAT\_ defines, which are _not_ the same ones
614 	 * as used to describe the pixel format in framebuffers, and also don't
615 	 * match the formats in @bus_formats which are shared with v4l.
616 	 */
617 	u32 color_formats;
618 
619 	/**
620 	 * @bus_formats: Pixel data format on the wire, somewhat redundant with
621 	 * @color_formats. Array of size @num_bus_formats encoded using
622 	 * MEDIA_BUS_FMT\_ defines shared with v4l and media drivers.
623 	 */
624 	const u32 *bus_formats;
625 	/**
626 	 * @num_bus_formats: Size of @bus_formats array.
627 	 */
628 	unsigned int num_bus_formats;
629 
630 	/**
631 	 * @bus_flags: Additional information (like pixel signal polarity) for
632 	 * the pixel data on the bus, using &enum drm_bus_flags values
633 	 * DRM_BUS_FLAGS\_.
634 	 */
635 	u32 bus_flags;
636 
637 	/**
638 	 * @max_tmds_clock: Maximum TMDS clock rate supported by the
639 	 * sink in kHz. 0 means undefined.
640 	 */
641 	int max_tmds_clock;
642 
643 	/**
644 	 * @dvi_dual: Dual-link DVI sink?
645 	 */
646 	bool dvi_dual;
647 
648 	/**
649 	 * @is_hdmi: True if the sink is an HDMI device.
650 	 *
651 	 * This field shall be used instead of calling
652 	 * drm_detect_hdmi_monitor() when possible.
653 	 */
654 	bool is_hdmi;
655 
656 	/**
657 	 * @has_hdmi_infoframe: Does the sink support the HDMI infoframe?
658 	 */
659 	bool has_hdmi_infoframe;
660 
661 	/**
662 	 * @rgb_quant_range_selectable: Does the sink support selecting
663 	 * the RGB quantization range?
664 	 */
665 	bool rgb_quant_range_selectable;
666 
667 	/**
668 	 * @edid_hdmi_rgb444_dc_modes: Mask of supported hdmi deep color modes
669 	 * in RGB 4:4:4. Even more stuff redundant with @bus_formats.
670 	 */
671 	u8 edid_hdmi_rgb444_dc_modes;
672 
673 	/**
674 	 * @edid_hdmi_ycbcr444_dc_modes: Mask of supported hdmi deep color
675 	 * modes in YCbCr 4:4:4. Even more stuff redundant with @bus_formats.
676 	 */
677 	u8 edid_hdmi_ycbcr444_dc_modes;
678 
679 	/**
680 	 * @cea_rev: CEA revision of the HDMI sink.
681 	 */
682 	u8 cea_rev;
683 
684 	/**
685 	 * @hdmi: advance features of a HDMI sink.
686 	 */
687 	struct drm_hdmi_info hdmi;
688 
689 	/**
690 	 * @non_desktop: Non desktop display (HMD).
691 	 */
692 	bool non_desktop;
693 
694 	/**
695 	 * @monitor_range: Frequency range supported by monitor range descriptor
696 	 */
697 	struct drm_monitor_range_info monitor_range;
698 
699 	/**
700 	 * @luminance_range: Luminance range supported by panel
701 	 */
702 	struct drm_luminance_range_info luminance_range;
703 
704 	/**
705 	 * @mso_stream_count: eDP Multi-SST Operation (MSO) stream count from
706 	 * the DisplayID VESA vendor block. 0 for conventional Single-Stream
707 	 * Transport (SST), or 2 or 4 MSO streams.
708 	 */
709 	u8 mso_stream_count;
710 
711 	/**
712 	 * @mso_pixel_overlap: eDP MSO segment pixel overlap, 0-8 pixels.
713 	 */
714 	u8 mso_pixel_overlap;
715 
716 	/**
717 	 * @max_dsc_bpp: Maximum DSC target bitrate, if it is set to 0 the
718 	 * monitor's default value is used instead.
719 	 */
720 	u32 max_dsc_bpp;
721 
722 	/**
723 	 * @vics: Array of vics_len VICs. Internal to EDID parsing.
724 	 */
725 	u8 *vics;
726 
727 	/**
728 	 * @vics_len: Number of elements in vics. Internal to EDID parsing.
729 	 */
730 	int vics_len;
731 
732 	/**
733 	 * @quirks: EDID based quirks. Internal to EDID parsing.
734 	 */
735 	u32 quirks;
736 };
737 
738 int drm_display_info_set_bus_formats(struct drm_display_info *info,
739 				     const u32 *formats,
740 				     unsigned int num_formats);
741 
742 /**
743  * struct drm_connector_tv_margins - TV connector related margins
744  *
745  * Describes the margins in pixels to put around the image on TV
746  * connectors to deal with overscan.
747  */
748 struct drm_connector_tv_margins {
749 	/**
750 	 * @bottom: Bottom margin in pixels.
751 	 */
752 	unsigned int bottom;
753 
754 	/**
755 	 * @left: Left margin in pixels.
756 	 */
757 	unsigned int left;
758 
759 	/**
760 	 * @right: Right margin in pixels.
761 	 */
762 	unsigned int right;
763 
764 	/**
765 	 * @top: Top margin in pixels.
766 	 */
767 	unsigned int top;
768 };
769 
770 /**
771  * struct drm_tv_connector_state - TV connector related states
772  * @select_subconnector: selected subconnector
773  * @subconnector: detected subconnector
774  * @margins: TV margins
775  * @legacy_mode: Legacy TV mode, driver specific value
776  * @mode: TV mode
777  * @brightness: brightness in percent
778  * @contrast: contrast in percent
779  * @flicker_reduction: flicker reduction in percent
780  * @overscan: overscan in percent
781  * @saturation: saturation in percent
782  * @hue: hue in percent
783  */
784 struct drm_tv_connector_state {
785 	enum drm_mode_subconnector select_subconnector;
786 	enum drm_mode_subconnector subconnector;
787 	struct drm_connector_tv_margins margins;
788 	unsigned int legacy_mode;
789 	unsigned int mode;
790 	unsigned int brightness;
791 	unsigned int contrast;
792 	unsigned int flicker_reduction;
793 	unsigned int overscan;
794 	unsigned int saturation;
795 	unsigned int hue;
796 };
797 
798 /**
799  * struct drm_connector_state - mutable connector state
800  */
801 struct drm_connector_state {
802 	/** @connector: backpointer to the connector */
803 	struct drm_connector *connector;
804 
805 	/**
806 	 * @crtc: CRTC to connect connector to, NULL if disabled.
807 	 *
808 	 * Do not change this directly, use drm_atomic_set_crtc_for_connector()
809 	 * instead.
810 	 */
811 	struct drm_crtc *crtc;
812 
813 	/**
814 	 * @best_encoder:
815 	 *
816 	 * Used by the atomic helpers to select the encoder, through the
817 	 * &drm_connector_helper_funcs.atomic_best_encoder or
818 	 * &drm_connector_helper_funcs.best_encoder callbacks.
819 	 *
820 	 * This is also used in the atomic helpers to map encoders to their
821 	 * current and previous connectors, see
822 	 * drm_atomic_get_old_connector_for_encoder() and
823 	 * drm_atomic_get_new_connector_for_encoder().
824 	 *
825 	 * NOTE: Atomic drivers must fill this out (either themselves or through
826 	 * helpers), for otherwise the GETCONNECTOR and GETENCODER IOCTLs will
827 	 * not return correct data to userspace.
828 	 */
829 	struct drm_encoder *best_encoder;
830 
831 	/**
832 	 * @link_status: Connector link_status to keep track of whether link is
833 	 * GOOD or BAD to notify userspace if retraining is necessary.
834 	 */
835 	enum drm_link_status link_status;
836 
837 	/** @state: backpointer to global drm_atomic_state */
838 	struct drm_atomic_state *state;
839 
840 	/**
841 	 * @commit: Tracks the pending commit to prevent use-after-free conditions.
842 	 *
843 	 * Is only set when @crtc is NULL.
844 	 */
845 	struct drm_crtc_commit *commit;
846 
847 	/** @tv: TV connector state */
848 	struct drm_tv_connector_state tv;
849 
850 	/**
851 	 * @self_refresh_aware:
852 	 *
853 	 * This tracks whether a connector is aware of the self refresh state.
854 	 * It should be set to true for those connector implementations which
855 	 * understand the self refresh state. This is needed since the crtc
856 	 * registers the self refresh helpers and it doesn't know if the
857 	 * connectors downstream have implemented self refresh entry/exit.
858 	 *
859 	 * Drivers should set this to true in atomic_check if they know how to
860 	 * handle self_refresh requests.
861 	 */
862 	bool self_refresh_aware;
863 
864 	/**
865 	 * @picture_aspect_ratio: Connector property to control the
866 	 * HDMI infoframe aspect ratio setting.
867 	 *
868 	 * The %DRM_MODE_PICTURE_ASPECT_\* values much match the
869 	 * values for &enum hdmi_picture_aspect
870 	 */
871 	enum hdmi_picture_aspect picture_aspect_ratio;
872 
873 	/**
874 	 * @content_type: Connector property to control the
875 	 * HDMI infoframe content type setting.
876 	 * The %DRM_MODE_CONTENT_TYPE_\* values much
877 	 * match the values.
878 	 */
879 	unsigned int content_type;
880 
881 	/**
882 	 * @hdcp_content_type: Connector property to pass the type of
883 	 * protected content. This is most commonly used for HDCP.
884 	 */
885 	unsigned int hdcp_content_type;
886 
887 	/**
888 	 * @scaling_mode: Connector property to control the
889 	 * upscaling, mostly used for built-in panels.
890 	 */
891 	unsigned int scaling_mode;
892 
893 	/**
894 	 * @content_protection: Connector property to request content
895 	 * protection. This is most commonly used for HDCP.
896 	 */
897 	unsigned int content_protection;
898 
899 	/**
900 	 * @colorspace: State variable for Connector property to request
901 	 * colorspace change on Sink. This is most commonly used to switch
902 	 * to wider color gamuts like BT2020.
903 	 */
904 	u32 colorspace;
905 
906 	/**
907 	 * @writeback_job: Writeback job for writeback connectors
908 	 *
909 	 * Holds the framebuffer and out-fence for a writeback connector. As
910 	 * the writeback completion may be asynchronous to the normal commit
911 	 * cycle, the writeback job lifetime is managed separately from the
912 	 * normal atomic state by this object.
913 	 *
914 	 * See also: drm_writeback_queue_job() and
915 	 * drm_writeback_signal_completion()
916 	 */
917 	struct drm_writeback_job *writeback_job;
918 
919 	/**
920 	 * @max_requested_bpc: Connector property to limit the maximum bit
921 	 * depth of the pixels.
922 	 */
923 	u8 max_requested_bpc;
924 
925 	/**
926 	 * @max_bpc: Connector max_bpc based on the requested max_bpc property
927 	 * and the connector bpc limitations obtained from edid.
928 	 */
929 	u8 max_bpc;
930 
931 	/**
932 	 * @privacy_screen_sw_state: See :ref:`Standard Connector
933 	 * Properties<standard_connector_properties>`
934 	 */
935 	enum drm_privacy_screen_status privacy_screen_sw_state;
936 
937 	/**
938 	 * @hdr_output_metadata:
939 	 * DRM blob property for HDR output metadata
940 	 */
941 	struct drm_property_blob *hdr_output_metadata;
942 };
943 
944 /**
945  * struct drm_connector_funcs - control connectors on a given device
946  *
947  * Each CRTC may have one or more connectors attached to it.  The functions
948  * below allow the core DRM code to control connectors, enumerate available modes,
949  * etc.
950  */
951 struct drm_connector_funcs {
952 	/**
953 	 * @dpms:
954 	 *
955 	 * Legacy entry point to set the per-connector DPMS state. Legacy DPMS
956 	 * is exposed as a standard property on the connector, but diverted to
957 	 * this callback in the drm core. Note that atomic drivers don't
958 	 * implement the 4 level DPMS support on the connector any more, but
959 	 * instead only have an on/off "ACTIVE" property on the CRTC object.
960 	 *
961 	 * This hook is not used by atomic drivers, remapping of the legacy DPMS
962 	 * property is entirely handled in the DRM core.
963 	 *
964 	 * RETURNS:
965 	 *
966 	 * 0 on success or a negative error code on failure.
967 	 */
968 	int (*dpms)(struct drm_connector *connector, int mode);
969 
970 	/**
971 	 * @reset:
972 	 *
973 	 * Reset connector hardware and software state to off. This function isn't
974 	 * called by the core directly, only through drm_mode_config_reset().
975 	 * It's not a helper hook only for historical reasons.
976 	 *
977 	 * Atomic drivers can use drm_atomic_helper_connector_reset() to reset
978 	 * atomic state using this hook.
979 	 */
980 	void (*reset)(struct drm_connector *connector);
981 
982 	/**
983 	 * @detect:
984 	 *
985 	 * Check to see if anything is attached to the connector. The parameter
986 	 * force is set to false whilst polling, true when checking the
987 	 * connector due to a user request. force can be used by the driver to
988 	 * avoid expensive, destructive operations during automated probing.
989 	 *
990 	 * This callback is optional, if not implemented the connector will be
991 	 * considered as always being attached.
992 	 *
993 	 * FIXME:
994 	 *
995 	 * Note that this hook is only called by the probe helper. It's not in
996 	 * the helper library vtable purely for historical reasons. The only DRM
997 	 * core	entry point to probe connector state is @fill_modes.
998 	 *
999 	 * Note that the helper library will already hold
1000 	 * &drm_mode_config.connection_mutex. Drivers which need to grab additional
1001 	 * locks to avoid races with concurrent modeset changes need to use
1002 	 * &drm_connector_helper_funcs.detect_ctx instead.
1003 	 *
1004 	 * Also note that this callback can be called no matter the
1005 	 * state the connector is in. Drivers that need the underlying
1006 	 * device to be powered to perform the detection will first need
1007 	 * to make sure it's been properly enabled.
1008 	 *
1009 	 * RETURNS:
1010 	 *
1011 	 * drm_connector_status indicating the connector's status.
1012 	 */
1013 	enum drm_connector_status (*detect)(struct drm_connector *connector,
1014 					    bool force);
1015 
1016 	/**
1017 	 * @force:
1018 	 *
1019 	 * This function is called to update internal encoder state when the
1020 	 * connector is forced to a certain state by userspace, either through
1021 	 * the sysfs interfaces or on the kernel cmdline. In that case the
1022 	 * @detect callback isn't called.
1023 	 *
1024 	 * FIXME:
1025 	 *
1026 	 * Note that this hook is only called by the probe helper. It's not in
1027 	 * the helper library vtable purely for historical reasons. The only DRM
1028 	 * core	entry point to probe connector state is @fill_modes.
1029 	 */
1030 	void (*force)(struct drm_connector *connector);
1031 
1032 	/**
1033 	 * @fill_modes:
1034 	 *
1035 	 * Entry point for output detection and basic mode validation. The
1036 	 * driver should reprobe the output if needed (e.g. when hotplug
1037 	 * handling is unreliable), add all detected modes to &drm_connector.modes
1038 	 * and filter out any the device can't support in any configuration. It
1039 	 * also needs to filter out any modes wider or higher than the
1040 	 * parameters max_width and max_height indicate.
1041 	 *
1042 	 * The drivers must also prune any modes no longer valid from
1043 	 * &drm_connector.modes. Furthermore it must update
1044 	 * &drm_connector.status and &drm_connector.edid.  If no EDID has been
1045 	 * received for this output connector->edid must be NULL.
1046 	 *
1047 	 * Drivers using the probe helpers should use
1048 	 * drm_helper_probe_single_connector_modes() to implement this
1049 	 * function.
1050 	 *
1051 	 * RETURNS:
1052 	 *
1053 	 * The number of modes detected and filled into &drm_connector.modes.
1054 	 */
1055 	int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
1056 
1057 	/**
1058 	 * @set_property:
1059 	 *
1060 	 * This is the legacy entry point to update a property attached to the
1061 	 * connector.
1062 	 *
1063 	 * This callback is optional if the driver does not support any legacy
1064 	 * driver-private properties. For atomic drivers it is not used because
1065 	 * property handling is done entirely in the DRM core.
1066 	 *
1067 	 * RETURNS:
1068 	 *
1069 	 * 0 on success or a negative error code on failure.
1070 	 */
1071 	int (*set_property)(struct drm_connector *connector, struct drm_property *property,
1072 			     uint64_t val);
1073 
1074 	/**
1075 	 * @late_register:
1076 	 *
1077 	 * This optional hook can be used to register additional userspace
1078 	 * interfaces attached to the connector, light backlight control, i2c,
1079 	 * DP aux or similar interfaces. It is called late in the driver load
1080 	 * sequence from drm_connector_register() when registering all the
1081 	 * core drm connector interfaces. Everything added from this callback
1082 	 * should be unregistered in the early_unregister callback.
1083 	 *
1084 	 * This is called while holding &drm_connector.mutex.
1085 	 *
1086 	 * Returns:
1087 	 *
1088 	 * 0 on success, or a negative error code on failure.
1089 	 */
1090 	int (*late_register)(struct drm_connector *connector);
1091 
1092 	/**
1093 	 * @early_unregister:
1094 	 *
1095 	 * This optional hook should be used to unregister the additional
1096 	 * userspace interfaces attached to the connector from
1097 	 * late_register(). It is called from drm_connector_unregister(),
1098 	 * early in the driver unload sequence to disable userspace access
1099 	 * before data structures are torndown.
1100 	 *
1101 	 * This is called while holding &drm_connector.mutex.
1102 	 */
1103 	void (*early_unregister)(struct drm_connector *connector);
1104 
1105 	/**
1106 	 * @destroy:
1107 	 *
1108 	 * Clean up connector resources. This is called at driver unload time
1109 	 * through drm_mode_config_cleanup(). It can also be called at runtime
1110 	 * when a connector is being hot-unplugged for drivers that support
1111 	 * connector hotplugging (e.g. DisplayPort MST).
1112 	 */
1113 	void (*destroy)(struct drm_connector *connector);
1114 
1115 	/**
1116 	 * @atomic_duplicate_state:
1117 	 *
1118 	 * Duplicate the current atomic state for this connector and return it.
1119 	 * The core and helpers guarantee that any atomic state duplicated with
1120 	 * this hook and still owned by the caller (i.e. not transferred to the
1121 	 * driver by calling &drm_mode_config_funcs.atomic_commit) will be
1122 	 * cleaned up by calling the @atomic_destroy_state hook in this
1123 	 * structure.
1124 	 *
1125 	 * This callback is mandatory for atomic drivers.
1126 	 *
1127 	 * Atomic drivers which don't subclass &struct drm_connector_state should use
1128 	 * drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the
1129 	 * state structure to extend it with driver-private state should use
1130 	 * __drm_atomic_helper_connector_duplicate_state() to make sure shared state is
1131 	 * duplicated in a consistent fashion across drivers.
1132 	 *
1133 	 * It is an error to call this hook before &drm_connector.state has been
1134 	 * initialized correctly.
1135 	 *
1136 	 * NOTE:
1137 	 *
1138 	 * If the duplicate state references refcounted resources this hook must
1139 	 * acquire a reference for each of them. The driver must release these
1140 	 * references again in @atomic_destroy_state.
1141 	 *
1142 	 * RETURNS:
1143 	 *
1144 	 * Duplicated atomic state or NULL when the allocation failed.
1145 	 */
1146 	struct drm_connector_state *(*atomic_duplicate_state)(struct drm_connector *connector);
1147 
1148 	/**
1149 	 * @atomic_destroy_state:
1150 	 *
1151 	 * Destroy a state duplicated with @atomic_duplicate_state and release
1152 	 * or unreference all resources it references
1153 	 *
1154 	 * This callback is mandatory for atomic drivers.
1155 	 */
1156 	void (*atomic_destroy_state)(struct drm_connector *connector,
1157 				     struct drm_connector_state *state);
1158 
1159 	/**
1160 	 * @atomic_set_property:
1161 	 *
1162 	 * Decode a driver-private property value and store the decoded value
1163 	 * into the passed-in state structure. Since the atomic core decodes all
1164 	 * standardized properties (even for extensions beyond the core set of
1165 	 * properties which might not be implemented by all drivers) this
1166 	 * requires drivers to subclass the state structure.
1167 	 *
1168 	 * Such driver-private properties should really only be implemented for
1169 	 * truly hardware/vendor specific state. Instead it is preferred to
1170 	 * standardize atomic extension and decode the properties used to expose
1171 	 * such an extension in the core.
1172 	 *
1173 	 * Do not call this function directly, use
1174 	 * drm_atomic_connector_set_property() instead.
1175 	 *
1176 	 * This callback is optional if the driver does not support any
1177 	 * driver-private atomic properties.
1178 	 *
1179 	 * NOTE:
1180 	 *
1181 	 * This function is called in the state assembly phase of atomic
1182 	 * modesets, which can be aborted for any reason (including on
1183 	 * userspace's request to just check whether a configuration would be
1184 	 * possible). Drivers MUST NOT touch any persistent state (hardware or
1185 	 * software) or data structures except the passed in @state parameter.
1186 	 *
1187 	 * Also since userspace controls in which order properties are set this
1188 	 * function must not do any input validation (since the state update is
1189 	 * incomplete and hence likely inconsistent). Instead any such input
1190 	 * validation must be done in the various atomic_check callbacks.
1191 	 *
1192 	 * RETURNS:
1193 	 *
1194 	 * 0 if the property has been found, -EINVAL if the property isn't
1195 	 * implemented by the driver (which shouldn't ever happen, the core only
1196 	 * asks for properties attached to this connector). No other validation
1197 	 * is allowed by the driver. The core already checks that the property
1198 	 * value is within the range (integer, valid enum value, ...) the driver
1199 	 * set when registering the property.
1200 	 */
1201 	int (*atomic_set_property)(struct drm_connector *connector,
1202 				   struct drm_connector_state *state,
1203 				   struct drm_property *property,
1204 				   uint64_t val);
1205 
1206 	/**
1207 	 * @atomic_get_property:
1208 	 *
1209 	 * Reads out the decoded driver-private property. This is used to
1210 	 * implement the GETCONNECTOR IOCTL.
1211 	 *
1212 	 * Do not call this function directly, use
1213 	 * drm_atomic_connector_get_property() instead.
1214 	 *
1215 	 * This callback is optional if the driver does not support any
1216 	 * driver-private atomic properties.
1217 	 *
1218 	 * RETURNS:
1219 	 *
1220 	 * 0 on success, -EINVAL if the property isn't implemented by the
1221 	 * driver (which shouldn't ever happen, the core only asks for
1222 	 * properties attached to this connector).
1223 	 */
1224 	int (*atomic_get_property)(struct drm_connector *connector,
1225 				   const struct drm_connector_state *state,
1226 				   struct drm_property *property,
1227 				   uint64_t *val);
1228 
1229 	/**
1230 	 * @atomic_print_state:
1231 	 *
1232 	 * If driver subclasses &struct drm_connector_state, it should implement
1233 	 * this optional hook for printing additional driver specific state.
1234 	 *
1235 	 * Do not call this directly, use drm_atomic_connector_print_state()
1236 	 * instead.
1237 	 */
1238 	void (*atomic_print_state)(struct drm_printer *p,
1239 				   const struct drm_connector_state *state);
1240 
1241 	/**
1242 	 * @oob_hotplug_event:
1243 	 *
1244 	 * This will get called when a hotplug-event for a drm-connector
1245 	 * has been received from a source outside the display driver / device.
1246 	 */
1247 	void (*oob_hotplug_event)(struct drm_connector *connector);
1248 
1249 	/**
1250 	 * @debugfs_init:
1251 	 *
1252 	 * Allows connectors to create connector-specific debugfs files.
1253 	 */
1254 	void (*debugfs_init)(struct drm_connector *connector, struct dentry *root);
1255 };
1256 
1257 /**
1258  * struct drm_cmdline_mode - DRM Mode passed through the kernel command-line
1259  *
1260  * Each connector can have an initial mode with additional options
1261  * passed through the kernel command line. This structure allows to
1262  * express those parameters and will be filled by the command-line
1263  * parser.
1264  */
1265 struct drm_cmdline_mode {
1266 	/**
1267 	 * @name:
1268 	 *
1269 	 * Name of the mode.
1270 	 */
1271 	char name[DRM_DISPLAY_MODE_LEN];
1272 
1273 	/**
1274 	 * @specified:
1275 	 *
1276 	 * Has a mode been read from the command-line?
1277 	 */
1278 	bool specified;
1279 
1280 	/**
1281 	 * @refresh_specified:
1282 	 *
1283 	 * Did the mode have a preferred refresh rate?
1284 	 */
1285 	bool refresh_specified;
1286 
1287 	/**
1288 	 * @bpp_specified:
1289 	 *
1290 	 * Did the mode have a preferred BPP?
1291 	 */
1292 	bool bpp_specified;
1293 
1294 	/**
1295 	 * @pixel_clock:
1296 	 *
1297 	 * Pixel Clock in kHz. Optional.
1298 	 */
1299 	unsigned int pixel_clock;
1300 
1301 	/**
1302 	 * @xres:
1303 	 *
1304 	 * Active resolution on the X axis, in pixels.
1305 	 */
1306 	int xres;
1307 
1308 	/**
1309 	 * @yres:
1310 	 *
1311 	 * Active resolution on the Y axis, in pixels.
1312 	 */
1313 	int yres;
1314 
1315 	/**
1316 	 * @bpp:
1317 	 *
1318 	 * Bits per pixels for the mode.
1319 	 */
1320 	int bpp;
1321 
1322 	/**
1323 	 * @refresh:
1324 	 *
1325 	 * Refresh rate, in Hertz.
1326 	 */
1327 	int refresh;
1328 
1329 	/**
1330 	 * @rb:
1331 	 *
1332 	 * Do we need to use reduced blanking?
1333 	 */
1334 	bool rb;
1335 
1336 	/**
1337 	 * @interlace:
1338 	 *
1339 	 * The mode is interlaced.
1340 	 */
1341 	bool interlace;
1342 
1343 	/**
1344 	 * @cvt:
1345 	 *
1346 	 * The timings will be calculated using the VESA Coordinated
1347 	 * Video Timings instead of looking up the mode from a table.
1348 	 */
1349 	bool cvt;
1350 
1351 	/**
1352 	 * @margins:
1353 	 *
1354 	 * Add margins to the mode calculation (1.8% of xres rounded
1355 	 * down to 8 pixels and 1.8% of yres).
1356 	 */
1357 	bool margins;
1358 
1359 	/**
1360 	 * @force:
1361 	 *
1362 	 * Ignore the hotplug state of the connector, and force its
1363 	 * state to one of the DRM_FORCE_* values.
1364 	 */
1365 	enum drm_connector_force force;
1366 
1367 	/**
1368 	 * @rotation_reflection:
1369 	 *
1370 	 * Initial rotation and reflection of the mode setup from the
1371 	 * command line. See DRM_MODE_ROTATE_* and
1372 	 * DRM_MODE_REFLECT_*. The only rotations supported are
1373 	 * DRM_MODE_ROTATE_0 and DRM_MODE_ROTATE_180.
1374 	 */
1375 	unsigned int rotation_reflection;
1376 
1377 	/**
1378 	 * @panel_orientation:
1379 	 *
1380 	 * drm-connector "panel orientation" property override value,
1381 	 * DRM_MODE_PANEL_ORIENTATION_UNKNOWN if not set.
1382 	 */
1383 	enum drm_panel_orientation panel_orientation;
1384 
1385 	/**
1386 	 * @tv_margins: TV margins to apply to the mode.
1387 	 */
1388 	struct drm_connector_tv_margins tv_margins;
1389 
1390 	/**
1391 	 * @tv_mode: TV mode standard. See DRM_MODE_TV_MODE_*.
1392 	 */
1393 	enum drm_connector_tv_mode tv_mode;
1394 
1395 	/**
1396 	 * @tv_mode_specified:
1397 	 *
1398 	 * Did the mode have a preferred TV mode?
1399 	 */
1400 	bool tv_mode_specified;
1401 };
1402 
1403 /**
1404  * struct drm_connector - central DRM connector control structure
1405  *
1406  * Each connector may be connected to one or more CRTCs, or may be clonable by
1407  * another connector if they can share a CRTC.  Each connector also has a specific
1408  * position in the broader display (referred to as a 'screen' though it could
1409  * span multiple monitors).
1410  */
1411 struct drm_connector {
1412 	/** @dev: parent DRM device */
1413 	struct drm_device *dev;
1414 	/** @kdev: kernel device for sysfs attributes */
1415 	struct device *kdev;
1416 	/** @attr: sysfs attributes */
1417 	struct device_attribute *attr;
1418 	/**
1419 	 * @fwnode: associated fwnode supplied by platform firmware
1420 	 *
1421 	 * Drivers can set this to associate a fwnode with a connector, drivers
1422 	 * are expected to get a reference on the fwnode when setting this.
1423 	 * drm_connector_cleanup() will call fwnode_handle_put() on this.
1424 	 */
1425 	struct fwnode_handle *fwnode;
1426 
1427 	/**
1428 	 * @head:
1429 	 *
1430 	 * List of all connectors on a @dev, linked from
1431 	 * &drm_mode_config.connector_list. Protected by
1432 	 * &drm_mode_config.connector_list_lock, but please only use
1433 	 * &drm_connector_list_iter to walk this list.
1434 	 */
1435 	struct list_head head;
1436 
1437 	/**
1438 	 * @global_connector_list_entry:
1439 	 *
1440 	 * Connector entry in the global connector-list, used by
1441 	 * drm_connector_find_by_fwnode().
1442 	 */
1443 	struct list_head global_connector_list_entry;
1444 
1445 	/** @base: base KMS object */
1446 	struct drm_mode_object base;
1447 
1448 	/** @name: human readable name, can be overwritten by the driver */
1449 	char *name;
1450 
1451 	/**
1452 	 * @mutex: Lock for general connector state, but currently only protects
1453 	 * @registered. Most of the connector state is still protected by
1454 	 * &drm_mode_config.mutex.
1455 	 */
1456 	struct mutex mutex;
1457 
1458 	/**
1459 	 * @index: Compacted connector index, which matches the position inside
1460 	 * the mode_config.list for drivers not supporting hot-add/removing. Can
1461 	 * be used as an array index. It is invariant over the lifetime of the
1462 	 * connector.
1463 	 */
1464 	unsigned index;
1465 
1466 	/**
1467 	 * @connector_type:
1468 	 * one of the DRM_MODE_CONNECTOR_<foo> types from drm_mode.h
1469 	 */
1470 	int connector_type;
1471 	/** @connector_type_id: index into connector type enum */
1472 	int connector_type_id;
1473 	/**
1474 	 * @interlace_allowed:
1475 	 * Can this connector handle interlaced modes? Only used by
1476 	 * drm_helper_probe_single_connector_modes() for mode filtering.
1477 	 */
1478 	bool interlace_allowed;
1479 	/**
1480 	 * @doublescan_allowed:
1481 	 * Can this connector handle doublescan? Only used by
1482 	 * drm_helper_probe_single_connector_modes() for mode filtering.
1483 	 */
1484 	bool doublescan_allowed;
1485 	/**
1486 	 * @stereo_allowed:
1487 	 * Can this connector handle stereo modes? Only used by
1488 	 * drm_helper_probe_single_connector_modes() for mode filtering.
1489 	 */
1490 	bool stereo_allowed;
1491 
1492 	/**
1493 	 * @ycbcr_420_allowed : This bool indicates if this connector is
1494 	 * capable of handling YCBCR 420 output. While parsing the EDID
1495 	 * blocks it's very helpful to know if the source is capable of
1496 	 * handling YCBCR 420 outputs.
1497 	 */
1498 	bool ycbcr_420_allowed;
1499 
1500 	/**
1501 	 * @registration_state: Is this connector initializing, exposed
1502 	 * (registered) with userspace, or unregistered?
1503 	 *
1504 	 * Protected by @mutex.
1505 	 */
1506 	enum drm_connector_registration_state registration_state;
1507 
1508 	/**
1509 	 * @modes:
1510 	 * Modes available on this connector (from fill_modes() + user).
1511 	 * Protected by &drm_mode_config.mutex.
1512 	 */
1513 	struct list_head modes;
1514 
1515 	/**
1516 	 * @status:
1517 	 * One of the drm_connector_status enums (connected, not, or unknown).
1518 	 * Protected by &drm_mode_config.mutex.
1519 	 */
1520 	enum drm_connector_status status;
1521 
1522 	/**
1523 	 * @probed_modes:
1524 	 * These are modes added by probing with DDC or the BIOS, before
1525 	 * filtering is applied. Used by the probe helpers. Protected by
1526 	 * &drm_mode_config.mutex.
1527 	 */
1528 	struct list_head probed_modes;
1529 
1530 	/**
1531 	 * @display_info: Display information is filled from EDID information
1532 	 * when a display is detected. For non hot-pluggable displays such as
1533 	 * flat panels in embedded systems, the driver should initialize the
1534 	 * &drm_display_info.width_mm and &drm_display_info.height_mm fields
1535 	 * with the physical size of the display.
1536 	 *
1537 	 * Protected by &drm_mode_config.mutex.
1538 	 */
1539 	struct drm_display_info display_info;
1540 
1541 	/** @funcs: connector control functions */
1542 	const struct drm_connector_funcs *funcs;
1543 
1544 	/**
1545 	 * @edid_blob_ptr: DRM property containing EDID if present. Protected by
1546 	 * &drm_mode_config.mutex. This should be updated only by calling
1547 	 * drm_connector_update_edid_property().
1548 	 */
1549 	struct drm_property_blob *edid_blob_ptr;
1550 
1551 	/** @properties: property tracking for this connector */
1552 	struct drm_object_properties properties;
1553 
1554 	/**
1555 	 * @scaling_mode_property: Optional atomic property to control the
1556 	 * upscaling. See drm_connector_attach_content_protection_property().
1557 	 */
1558 	struct drm_property *scaling_mode_property;
1559 
1560 	/**
1561 	 * @vrr_capable_property: Optional property to help userspace
1562 	 * query hardware support for variable refresh rate on a connector.
1563 	 * connector. Drivers can add the property to a connector by
1564 	 * calling drm_connector_attach_vrr_capable_property().
1565 	 *
1566 	 * This should be updated only by calling
1567 	 * drm_connector_set_vrr_capable_property().
1568 	 */
1569 	struct drm_property *vrr_capable_property;
1570 
1571 	/**
1572 	 * @colorspace_property: Connector property to set the suitable
1573 	 * colorspace supported by the sink.
1574 	 */
1575 	struct drm_property *colorspace_property;
1576 
1577 	/**
1578 	 * @path_blob_ptr:
1579 	 *
1580 	 * DRM blob property data for the DP MST path property. This should only
1581 	 * be updated by calling drm_connector_set_path_property().
1582 	 */
1583 	struct drm_property_blob *path_blob_ptr;
1584 
1585 	/**
1586 	 * @max_bpc_property: Default connector property for the max bpc to be
1587 	 * driven out of the connector.
1588 	 */
1589 	struct drm_property *max_bpc_property;
1590 
1591 	/** @privacy_screen: drm_privacy_screen for this connector, or NULL. */
1592 	struct drm_privacy_screen *privacy_screen;
1593 
1594 	/** @privacy_screen_notifier: privacy-screen notifier_block */
1595 	struct notifier_block privacy_screen_notifier;
1596 
1597 	/**
1598 	 * @privacy_screen_sw_state_property: Optional atomic property for the
1599 	 * connector to control the integrated privacy screen.
1600 	 */
1601 	struct drm_property *privacy_screen_sw_state_property;
1602 
1603 	/**
1604 	 * @privacy_screen_hw_state_property: Optional atomic property for the
1605 	 * connector to report the actual integrated privacy screen state.
1606 	 */
1607 	struct drm_property *privacy_screen_hw_state_property;
1608 
1609 #define DRM_CONNECTOR_POLL_HPD (1 << 0)
1610 #define DRM_CONNECTOR_POLL_CONNECT (1 << 1)
1611 #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
1612 
1613 	/**
1614 	 * @polled:
1615 	 *
1616 	 * Connector polling mode, a combination of
1617 	 *
1618 	 * DRM_CONNECTOR_POLL_HPD
1619 	 *     The connector generates hotplug events and doesn't need to be
1620 	 *     periodically polled. The CONNECT and DISCONNECT flags must not
1621 	 *     be set together with the HPD flag.
1622 	 *
1623 	 * DRM_CONNECTOR_POLL_CONNECT
1624 	 *     Periodically poll the connector for connection.
1625 	 *
1626 	 * DRM_CONNECTOR_POLL_DISCONNECT
1627 	 *     Periodically poll the connector for disconnection, without
1628 	 *     causing flickering even when the connector is in use. DACs should
1629 	 *     rarely do this without a lot of testing.
1630 	 *
1631 	 * Set to 0 for connectors that don't support connection status
1632 	 * discovery.
1633 	 */
1634 	uint8_t polled;
1635 
1636 	/**
1637 	 * @dpms: Current dpms state. For legacy drivers the
1638 	 * &drm_connector_funcs.dpms callback must update this. For atomic
1639 	 * drivers, this is handled by the core atomic code, and drivers must
1640 	 * only take &drm_crtc_state.active into account.
1641 	 */
1642 	int dpms;
1643 
1644 	/** @helper_private: mid-layer private data */
1645 	const struct drm_connector_helper_funcs *helper_private;
1646 
1647 	/** @cmdline_mode: mode line parsed from the kernel cmdline for this connector */
1648 	struct drm_cmdline_mode cmdline_mode;
1649 	/** @force: a DRM_FORCE_<foo> state for forced mode sets */
1650 	enum drm_connector_force force;
1651 
1652 	/**
1653 	 * @edid_override: Override EDID set via debugfs.
1654 	 *
1655 	 * Do not modify or access outside of the drm_edid_override_* family of
1656 	 * functions.
1657 	 */
1658 	const struct drm_edid *edid_override;
1659 
1660 	/**
1661 	 * @edid_override_mutex: Protect access to edid_override.
1662 	 */
1663 	struct mutex edid_override_mutex;
1664 
1665 	/** @epoch_counter: used to detect any other changes in connector, besides status */
1666 	u64 epoch_counter;
1667 
1668 	/**
1669 	 * @possible_encoders: Bit mask of encoders that can drive this
1670 	 * connector, drm_encoder_index() determines the index into the bitfield
1671 	 * and the bits are set with drm_connector_attach_encoder().
1672 	 */
1673 	u32 possible_encoders;
1674 
1675 	/**
1676 	 * @encoder: Currently bound encoder driving this connector, if any.
1677 	 * Only really meaningful for non-atomic drivers. Atomic drivers should
1678 	 * instead look at &drm_connector_state.best_encoder, and in case they
1679 	 * need the CRTC driving this output, &drm_connector_state.crtc.
1680 	 */
1681 	struct drm_encoder *encoder;
1682 
1683 #define MAX_ELD_BYTES	128
1684 	/** @eld: EDID-like data, if present */
1685 	uint8_t eld[MAX_ELD_BYTES];
1686 	/** @latency_present: AV delay info from ELD, if found */
1687 	bool latency_present[2];
1688 	/**
1689 	 * @video_latency: Video latency info from ELD, if found.
1690 	 * [0]: progressive, [1]: interlaced
1691 	 */
1692 	int video_latency[2];
1693 	/**
1694 	 * @audio_latency: audio latency info from ELD, if found
1695 	 * [0]: progressive, [1]: interlaced
1696 	 */
1697 	int audio_latency[2];
1698 
1699 	/**
1700 	 * @ddc: associated ddc adapter.
1701 	 * A connector usually has its associated ddc adapter. If a driver uses
1702 	 * this field, then an appropriate symbolic link is created in connector
1703 	 * sysfs directory to make it easy for the user to tell which i2c
1704 	 * adapter is for a particular display.
1705 	 *
1706 	 * The field should be set by calling drm_connector_init_with_ddc().
1707 	 */
1708 	struct i2c_adapter *ddc;
1709 
1710 	/**
1711 	 * @null_edid_counter: track sinks that give us all zeros for the EDID.
1712 	 * Needed to workaround some HW bugs where we get all 0s
1713 	 */
1714 	int null_edid_counter;
1715 
1716 	/** @bad_edid_counter: track sinks that give us an EDID with invalid checksum */
1717 	unsigned bad_edid_counter;
1718 
1719 	/**
1720 	 * @edid_corrupt: Indicates whether the last read EDID was corrupt. Used
1721 	 * in Displayport compliance testing - Displayport Link CTS Core 1.2
1722 	 * rev1.1 4.2.2.6
1723 	 */
1724 	bool edid_corrupt;
1725 	/**
1726 	 * @real_edid_checksum: real edid checksum for corrupted edid block.
1727 	 * Required in Displayport 1.4 compliance testing
1728 	 * rev1.1 4.2.2.6
1729 	 */
1730 	u8 real_edid_checksum;
1731 
1732 	/** @debugfs_entry: debugfs directory for this connector */
1733 	struct dentry *debugfs_entry;
1734 
1735 	/**
1736 	 * @state:
1737 	 *
1738 	 * Current atomic state for this connector.
1739 	 *
1740 	 * This is protected by &drm_mode_config.connection_mutex. Note that
1741 	 * nonblocking atomic commits access the current connector state without
1742 	 * taking locks. Either by going through the &struct drm_atomic_state
1743 	 * pointers, see for_each_oldnew_connector_in_state(),
1744 	 * for_each_old_connector_in_state() and
1745 	 * for_each_new_connector_in_state(). Or through careful ordering of
1746 	 * atomic commit operations as implemented in the atomic helpers, see
1747 	 * &struct drm_crtc_commit.
1748 	 */
1749 	struct drm_connector_state *state;
1750 
1751 	/* DisplayID bits. FIXME: Extract into a substruct? */
1752 
1753 	/**
1754 	 * @tile_blob_ptr:
1755 	 *
1756 	 * DRM blob property data for the tile property (used mostly by DP MST).
1757 	 * This is meant for screens which are driven through separate display
1758 	 * pipelines represented by &drm_crtc, which might not be running with
1759 	 * genlocked clocks. For tiled panels which are genlocked, like
1760 	 * dual-link LVDS or dual-link DSI, the driver should try to not expose
1761 	 * the tiling and virtualize both &drm_crtc and &drm_plane if needed.
1762 	 *
1763 	 * This should only be updated by calling
1764 	 * drm_connector_set_tile_property().
1765 	 */
1766 	struct drm_property_blob *tile_blob_ptr;
1767 
1768 	/** @has_tile: is this connector connected to a tiled monitor */
1769 	bool has_tile;
1770 	/** @tile_group: tile group for the connected monitor */
1771 	struct drm_tile_group *tile_group;
1772 	/** @tile_is_single_monitor: whether the tile is one monitor housing */
1773 	bool tile_is_single_monitor;
1774 
1775 	/** @num_h_tile: number of horizontal tiles in the tile group */
1776 	/** @num_v_tile: number of vertical tiles in the tile group */
1777 	uint8_t num_h_tile, num_v_tile;
1778 	/** @tile_h_loc: horizontal location of this tile */
1779 	/** @tile_v_loc: vertical location of this tile */
1780 	uint8_t tile_h_loc, tile_v_loc;
1781 	/** @tile_h_size: horizontal size of this tile. */
1782 	/** @tile_v_size: vertical size of this tile. */
1783 	uint16_t tile_h_size, tile_v_size;
1784 
1785 	/**
1786 	 * @free_node:
1787 	 *
1788 	 * List used only by &drm_connector_list_iter to be able to clean up a
1789 	 * connector from any context, in conjunction with
1790 	 * &drm_mode_config.connector_free_work.
1791 	 */
1792 	struct llist_node free_node;
1793 
1794 	/** @hdr_sink_metadata: HDR Metadata Information read from sink */
1795 	struct hdr_sink_metadata hdr_sink_metadata;
1796 };
1797 
1798 #define obj_to_connector(x) container_of(x, struct drm_connector, base)
1799 
1800 int drm_connector_init(struct drm_device *dev,
1801 		       struct drm_connector *connector,
1802 		       const struct drm_connector_funcs *funcs,
1803 		       int connector_type);
1804 int drm_connector_init_with_ddc(struct drm_device *dev,
1805 				struct drm_connector *connector,
1806 				const struct drm_connector_funcs *funcs,
1807 				int connector_type,
1808 				struct i2c_adapter *ddc);
1809 int drmm_connector_init(struct drm_device *dev,
1810 			struct drm_connector *connector,
1811 			const struct drm_connector_funcs *funcs,
1812 			int connector_type,
1813 			struct i2c_adapter *ddc);
1814 void drm_connector_attach_edid_property(struct drm_connector *connector);
1815 int drm_connector_register(struct drm_connector *connector);
1816 void drm_connector_unregister(struct drm_connector *connector);
1817 int drm_connector_attach_encoder(struct drm_connector *connector,
1818 				      struct drm_encoder *encoder);
1819 
1820 void drm_connector_cleanup(struct drm_connector *connector);
1821 
1822 static inline unsigned int drm_connector_index(const struct drm_connector *connector)
1823 {
1824 	return connector->index;
1825 }
1826 
1827 static inline u32 drm_connector_mask(const struct drm_connector *connector)
1828 {
1829 	return 1 << connector->index;
1830 }
1831 
1832 /**
1833  * drm_connector_lookup - lookup connector object
1834  * @dev: DRM device
1835  * @file_priv: drm file to check for lease against.
1836  * @id: connector object id
1837  *
1838  * This function looks up the connector object specified by id
1839  * add takes a reference to it.
1840  */
1841 static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev,
1842 		struct drm_file *file_priv,
1843 		uint32_t id)
1844 {
1845 	struct drm_mode_object *mo;
1846 	mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CONNECTOR);
1847 	return mo ? obj_to_connector(mo) : NULL;
1848 }
1849 
1850 /**
1851  * drm_connector_get - acquire a connector reference
1852  * @connector: DRM connector
1853  *
1854  * This function increments the connector's refcount.
1855  */
1856 static inline void drm_connector_get(struct drm_connector *connector)
1857 {
1858 	drm_mode_object_get(&connector->base);
1859 }
1860 
1861 /**
1862  * drm_connector_put - release a connector reference
1863  * @connector: DRM connector
1864  *
1865  * This function decrements the connector's reference count and frees the
1866  * object if the reference count drops to zero.
1867  */
1868 static inline void drm_connector_put(struct drm_connector *connector)
1869 {
1870 	drm_mode_object_put(&connector->base);
1871 }
1872 
1873 /**
1874  * drm_connector_is_unregistered - has the connector been unregistered from
1875  * userspace?
1876  * @connector: DRM connector
1877  *
1878  * Checks whether or not @connector has been unregistered from userspace.
1879  *
1880  * Returns:
1881  * True if the connector was unregistered, false if the connector is
1882  * registered or has not yet been registered with userspace.
1883  */
1884 static inline bool
1885 drm_connector_is_unregistered(struct drm_connector *connector)
1886 {
1887 	return READ_ONCE(connector->registration_state) ==
1888 		DRM_CONNECTOR_UNREGISTERED;
1889 }
1890 
1891 void drm_connector_oob_hotplug_event(struct fwnode_handle *connector_fwnode);
1892 const char *drm_get_connector_type_name(unsigned int connector_type);
1893 const char *drm_get_connector_status_name(enum drm_connector_status status);
1894 const char *drm_get_subpixel_order_name(enum subpixel_order order);
1895 const char *drm_get_dpms_name(int val);
1896 const char *drm_get_dvi_i_subconnector_name(int val);
1897 const char *drm_get_dvi_i_select_name(int val);
1898 const char *drm_get_tv_mode_name(int val);
1899 const char *drm_get_tv_subconnector_name(int val);
1900 const char *drm_get_tv_select_name(int val);
1901 const char *drm_get_dp_subconnector_name(int val);
1902 const char *drm_get_content_protection_name(int val);
1903 const char *drm_get_hdcp_content_type_name(int val);
1904 
1905 int drm_get_tv_mode_from_name(const char *name, size_t len);
1906 
1907 int drm_mode_create_dvi_i_properties(struct drm_device *dev);
1908 void drm_connector_attach_dp_subconnector_property(struct drm_connector *connector);
1909 
1910 int drm_mode_create_tv_margin_properties(struct drm_device *dev);
1911 int drm_mode_create_tv_properties_legacy(struct drm_device *dev,
1912 					 unsigned int num_modes,
1913 					 const char * const modes[]);
1914 int drm_mode_create_tv_properties(struct drm_device *dev,
1915 				  unsigned int supported_tv_modes);
1916 void drm_connector_attach_tv_margin_properties(struct drm_connector *conn);
1917 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
1918 int drm_connector_attach_content_type_property(struct drm_connector *dev);
1919 int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
1920 					       u32 scaling_mode_mask);
1921 int drm_connector_attach_vrr_capable_property(
1922 		struct drm_connector *connector);
1923 int drm_connector_attach_colorspace_property(struct drm_connector *connector);
1924 int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector);
1925 bool drm_connector_atomic_hdr_metadata_equal(struct drm_connector_state *old_state,
1926 					     struct drm_connector_state *new_state);
1927 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
1928 int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector);
1929 int drm_mode_create_dp_colorspace_property(struct drm_connector *connector);
1930 int drm_mode_create_content_type_property(struct drm_device *dev);
1931 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
1932 
1933 int drm_connector_set_path_property(struct drm_connector *connector,
1934 				    const char *path);
1935 int drm_connector_set_tile_property(struct drm_connector *connector);
1936 int drm_connector_update_edid_property(struct drm_connector *connector,
1937 				       const struct edid *edid);
1938 void drm_connector_set_link_status_property(struct drm_connector *connector,
1939 					    uint64_t link_status);
1940 void drm_connector_set_vrr_capable_property(
1941 		struct drm_connector *connector, bool capable);
1942 int drm_connector_set_panel_orientation(
1943 	struct drm_connector *connector,
1944 	enum drm_panel_orientation panel_orientation);
1945 int drm_connector_set_panel_orientation_with_quirk(
1946 	struct drm_connector *connector,
1947 	enum drm_panel_orientation panel_orientation,
1948 	int width, int height);
1949 int drm_connector_set_orientation_from_panel(
1950 	struct drm_connector *connector,
1951 	struct drm_panel *panel);
1952 int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
1953 					  int min, int max);
1954 void drm_connector_create_privacy_screen_properties(struct drm_connector *conn);
1955 void drm_connector_attach_privacy_screen_properties(struct drm_connector *conn);
1956 void drm_connector_attach_privacy_screen_provider(
1957 	struct drm_connector *connector, struct drm_privacy_screen *priv);
1958 void drm_connector_update_privacy_screen(const struct drm_connector_state *connector_state);
1959 
1960 /**
1961  * struct drm_tile_group - Tile group metadata
1962  * @refcount: reference count
1963  * @dev: DRM device
1964  * @id: tile group id exposed to userspace
1965  * @group_data: Sink-private data identifying this group
1966  *
1967  * @group_data corresponds to displayid vend/prod/serial for external screens
1968  * with an EDID.
1969  */
1970 struct drm_tile_group {
1971 	struct kref refcount;
1972 	struct drm_device *dev;
1973 	int id;
1974 	u8 group_data[8];
1975 };
1976 
1977 struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
1978 						  const char topology[8]);
1979 struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev,
1980 					       const char topology[8]);
1981 void drm_mode_put_tile_group(struct drm_device *dev,
1982 			     struct drm_tile_group *tg);
1983 
1984 /**
1985  * struct drm_connector_list_iter - connector_list iterator
1986  *
1987  * This iterator tracks state needed to be able to walk the connector_list
1988  * within struct drm_mode_config. Only use together with
1989  * drm_connector_list_iter_begin(), drm_connector_list_iter_end() and
1990  * drm_connector_list_iter_next() respectively the convenience macro
1991  * drm_for_each_connector_iter().
1992  *
1993  * Note that the return value of drm_connector_list_iter_next() is only valid
1994  * up to the next drm_connector_list_iter_next() or
1995  * drm_connector_list_iter_end() call. If you want to use the connector later,
1996  * then you need to grab your own reference first using drm_connector_get().
1997  */
1998 struct drm_connector_list_iter {
1999 /* private: */
2000 	struct drm_device *dev;
2001 	struct drm_connector *conn;
2002 };
2003 
2004 void drm_connector_list_iter_begin(struct drm_device *dev,
2005 				   struct drm_connector_list_iter *iter);
2006 struct drm_connector *
2007 drm_connector_list_iter_next(struct drm_connector_list_iter *iter);
2008 void drm_connector_list_iter_end(struct drm_connector_list_iter *iter);
2009 
2010 bool drm_connector_has_possible_encoder(struct drm_connector *connector,
2011 					struct drm_encoder *encoder);
2012 
2013 /**
2014  * drm_for_each_connector_iter - connector_list iterator macro
2015  * @connector: &struct drm_connector pointer used as cursor
2016  * @iter: &struct drm_connector_list_iter
2017  *
2018  * Note that @connector is only valid within the list body, if you want to use
2019  * @connector after calling drm_connector_list_iter_end() then you need to grab
2020  * your own reference first using drm_connector_get().
2021  */
2022 #define drm_for_each_connector_iter(connector, iter) \
2023 	while ((connector = drm_connector_list_iter_next(iter)))
2024 
2025 /**
2026  * drm_connector_for_each_possible_encoder - iterate connector's possible encoders
2027  * @connector: &struct drm_connector pointer
2028  * @encoder: &struct drm_encoder pointer used as cursor
2029  */
2030 #define drm_connector_for_each_possible_encoder(connector, encoder) \
2031 	drm_for_each_encoder_mask(encoder, (connector)->dev, \
2032 				  (connector)->possible_encoders)
2033 
2034 #endif
2035