2 * Copyright (c) 2016 Intel Corporation
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.
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
23 #ifndef __DRM_CONNECTOR_H__
24 #define __DRM_CONNECTOR_H__
26 #include <linux/list.h>
27 #include <linux/ctype.h>
28 #include <drm/drm_mode_object.h>
30 #include <uapi/drm/drm_mode.h>
34 struct drm_connector_helper_funcs
;
39 struct drm_property_blob
;
43 enum drm_connector_force
{
44 DRM_FORCE_UNSPECIFIED
,
46 DRM_FORCE_ON
, /* force on analog part normally */
47 DRM_FORCE_ON_DIGITAL
, /* for DVI-I use digital connector */
51 * enum drm_connector_status - status for a &drm_connector
53 * This enum is used to track the connector status. There are no separate
54 * #defines for the uapi!
56 enum drm_connector_status
{
58 * @connector_status_connected: The connector is definitely connected to
59 * a sink device, and can be enabled.
61 connector_status_connected
= 1,
63 * @connector_status_disconnected: The connector isn't connected to a
64 * sink device which can be autodetect. For digital outputs like DP or
65 * HDMI (which can be realiable probed) this means there's really
66 * nothing there. It is driver-dependent whether a connector with this
67 * status can be lit up or not.
69 connector_status_disconnected
= 2,
71 * @connector_status_unknown: The connector's status could not be
72 * reliably detected. This happens when probing would either cause
73 * flicker (like load-detection when the connector is in use), or when a
74 * hardware resource isn't available (like when load-detection needs a
75 * free CRTC). It should be possible to light up the connector with one
76 * of the listed fallback modes. For default configuration userspace
77 * should only try to light up connectors with unknown status when
78 * there's not connector with @connector_status_connected.
80 connector_status_unknown
= 3,
85 SubPixelHorizontalRGB
,
86 SubPixelHorizontalBGR
,
93 * enum drm_link_status - connector's link_status property value
95 * This enum is used as the connector's link status property value.
96 * It is set to the values defined in uapi.
98 enum drm_link_status
{
99 DRM_LINK_STATUS_GOOD
= DRM_MODE_LINK_STATUS_GOOD
,
100 DRM_LINK_STATUS_BAD
= DRM_MODE_LINK_STATUS_BAD
,
104 * struct drm_display_info - runtime data about the connected sink
106 * Describes a given display (e.g. CRT or flat panel) and its limitations. For
107 * fixed display sinks like built-in panels there's not much difference between
108 * this and &struct drm_connector. But for sinks with a real cable this
109 * structure is meant to describe all the things at the other end of the cable.
111 * For sinks which provide an EDID this can be filled out by calling
112 * drm_add_edid_modes().
114 struct drm_display_info
{
116 * @name: Name of the display.
118 char name
[DRM_DISPLAY_INFO_LEN
];
121 * @width_mm: Physical width in mm.
123 unsigned int width_mm
;
125 * @height_mm: Physical height in mm.
127 unsigned int height_mm
;
130 * @pixel_clock: Maximum pixel clock supported by the sink, in units of
131 * 100Hz. This mismatches the clock in &drm_display_mode (which is in
132 * kHZ), because that's what the EDID uses as base unit.
134 unsigned int pixel_clock
;
136 * @bpc: Maximum bits per color channel. Used by HDMI and DP outputs.
141 * @subpixel_order: Subpixel order of LCD panels.
143 enum subpixel_order subpixel_order
;
145 #define DRM_COLOR_FORMAT_RGB444 (1<<0)
146 #define DRM_COLOR_FORMAT_YCRCB444 (1<<1)
147 #define DRM_COLOR_FORMAT_YCRCB422 (1<<2)
150 * @color_formats: HDMI Color formats, selects between RGB and YCrCb
151 * modes. Used DRM_COLOR_FORMAT\_ defines, which are _not_ the same ones
152 * as used to describe the pixel format in framebuffers, and also don't
153 * match the formats in @bus_formats which are shared with v4l.
158 * @bus_formats: Pixel data format on the wire, somewhat redundant with
159 * @color_formats. Array of size @num_bus_formats encoded using
160 * MEDIA_BUS_FMT\_ defines shared with v4l and media drivers.
162 const u32
*bus_formats
;
164 * @num_bus_formats: Size of @bus_formats array.
166 unsigned int num_bus_formats
;
168 #define DRM_BUS_FLAG_DE_LOW (1<<0)
169 #define DRM_BUS_FLAG_DE_HIGH (1<<1)
170 /* drive data on pos. edge */
171 #define DRM_BUS_FLAG_PIXDATA_POSEDGE (1<<2)
172 /* drive data on neg. edge */
173 #define DRM_BUS_FLAG_PIXDATA_NEGEDGE (1<<3)
176 * @bus_flags: Additional information (like pixel signal polarity) for
177 * the pixel data on the bus, using DRM_BUS_FLAGS\_ defines.
182 * @max_tmds_clock: Maximum TMDS clock rate supported by the
183 * sink in kHz. 0 means undefined.
188 * @dvi_dual: Dual-link DVI sink?
193 * @edid_hdmi_dc_modes: Mask of supported hdmi deep color modes. Even
194 * more stuff redundant with @bus_formats.
196 u8 edid_hdmi_dc_modes
;
199 * @cea_rev: CEA revision of the HDMI sink.
204 int drm_display_info_set_bus_formats(struct drm_display_info
*info
,
206 unsigned int num_formats
);
209 * struct drm_tv_connector_state - TV connector related states
210 * @subconnector: selected subconnector
211 * @margins: left/right/top/bottom margins
213 * @brightness: brightness in percent
214 * @contrast: contrast in percent
215 * @flicker_reduction: flicker reduction in percent
216 * @overscan: overscan in percent
217 * @saturation: saturation in percent
218 * @hue: hue in percent
220 struct drm_tv_connector_state
{
221 enum drm_mode_subconnector subconnector
;
229 unsigned int brightness
;
230 unsigned int contrast
;
231 unsigned int flicker_reduction
;
232 unsigned int overscan
;
233 unsigned int saturation
;
238 * struct drm_connector_state - mutable connector state
239 * @connector: backpointer to the connector
240 * @best_encoder: can be used by helpers and drivers to select the encoder
241 * @state: backpointer to global drm_atomic_state
242 * @tv: TV connector state
244 struct drm_connector_state
{
245 struct drm_connector
*connector
;
248 * @crtc: CRTC to connect connector to, NULL if disabled.
250 * Do not change this directly, use drm_atomic_set_crtc_for_connector()
253 struct drm_crtc
*crtc
;
255 struct drm_encoder
*best_encoder
;
258 * @link_status: Connector link_status to keep track of whether link is
259 * GOOD or BAD to notify userspace if retraining is necessary.
261 enum drm_link_status link_status
;
263 struct drm_atomic_state
*state
;
265 struct drm_tv_connector_state tv
;
269 * struct drm_connector_funcs - control connectors on a given device
271 * Each CRTC may have one or more connectors attached to it. The functions
272 * below allow the core DRM code to control connectors, enumerate available modes,
275 struct drm_connector_funcs
{
279 * Legacy entry point to set the per-connector DPMS state. Legacy DPMS
280 * is exposed as a standard property on the connector, but diverted to
281 * this callback in the drm core. Note that atomic drivers don't
282 * implement the 4 level DPMS support on the connector any more, but
283 * instead only have an on/off "ACTIVE" property on the CRTC object.
285 * Drivers implementing atomic modeset should use
286 * drm_atomic_helper_connector_dpms() to implement this hook.
290 * 0 on success or a negative error code on failure.
292 int (*dpms
)(struct drm_connector
*connector
, int mode
);
297 * Reset connector hardware and software state to off. This function isn't
298 * called by the core directly, only through drm_mode_config_reset().
299 * It's not a helper hook only for historical reasons.
301 * Atomic drivers can use drm_atomic_helper_connector_reset() to reset
302 * atomic state using this hook.
304 void (*reset
)(struct drm_connector
*connector
);
309 * Check to see if anything is attached to the connector. The parameter
310 * force is set to false whilst polling, true when checking the
311 * connector due to a user request. force can be used by the driver to
312 * avoid expensive, destructive operations during automated probing.
314 * This callback is optional, if not implemented the connector will be
315 * considered as always being attached.
319 * Note that this hook is only called by the probe helper. It's not in
320 * the helper library vtable purely for historical reasons. The only DRM
321 * core entry point to probe connector state is @fill_modes.
325 * drm_connector_status indicating the connector's status.
327 enum drm_connector_status (*detect
)(struct drm_connector
*connector
,
333 * This function is called to update internal encoder state when the
334 * connector is forced to a certain state by userspace, either through
335 * the sysfs interfaces or on the kernel cmdline. In that case the
336 * @detect callback isn't called.
340 * Note that this hook is only called by the probe helper. It's not in
341 * the helper library vtable purely for historical reasons. The only DRM
342 * core entry point to probe connector state is @fill_modes.
344 void (*force
)(struct drm_connector
*connector
);
349 * Entry point for output detection and basic mode validation. The
350 * driver should reprobe the output if needed (e.g. when hotplug
351 * handling is unreliable), add all detected modes to &drm_connector.modes
352 * and filter out any the device can't support in any configuration. It
353 * also needs to filter out any modes wider or higher than the
354 * parameters max_width and max_height indicate.
356 * The drivers must also prune any modes no longer valid from
357 * &drm_connector.modes. Furthermore it must update
358 * &drm_connector.status and &drm_connector.edid. If no EDID has been
359 * received for this output connector->edid must be NULL.
361 * Drivers using the probe helpers should use
362 * drm_helper_probe_single_connector_modes() or
363 * drm_helper_probe_single_connector_modes_nomerge() to implement this
368 * The number of modes detected and filled into &drm_connector.modes.
370 int (*fill_modes
)(struct drm_connector
*connector
, uint32_t max_width
, uint32_t max_height
);
375 * This is the legacy entry point to update a property attached to the
378 * Drivers implementing atomic modeset should use
379 * drm_atomic_helper_connector_set_property() to implement this hook.
381 * This callback is optional if the driver does not support any legacy
382 * driver-private properties.
386 * 0 on success or a negative error code on failure.
388 int (*set_property
)(struct drm_connector
*connector
, struct drm_property
*property
,
394 * This optional hook can be used to register additional userspace
395 * interfaces attached to the connector, light backlight control, i2c,
396 * DP aux or similar interfaces. It is called late in the driver load
397 * sequence from drm_connector_register() when registering all the
398 * core drm connector interfaces. Everything added from this callback
399 * should be unregistered in the early_unregister callback.
401 * This is called while holding &drm_connector.mutex.
405 * 0 on success, or a negative error code on failure.
407 int (*late_register
)(struct drm_connector
*connector
);
412 * This optional hook should be used to unregister the additional
413 * userspace interfaces attached to the connector from
414 * late_register(). It is called from drm_connector_unregister(),
415 * early in the driver unload sequence to disable userspace access
416 * before data structures are torndown.
418 * This is called while holding &drm_connector.mutex.
420 void (*early_unregister
)(struct drm_connector
*connector
);
425 * Clean up connector resources. This is called at driver unload time
426 * through drm_mode_config_cleanup(). It can also be called at runtime
427 * when a connector is being hot-unplugged for drivers that support
428 * connector hotplugging (e.g. DisplayPort MST).
430 void (*destroy
)(struct drm_connector
*connector
);
433 * @atomic_duplicate_state:
435 * Duplicate the current atomic state for this connector and return it.
436 * The core and helpers guarantee that any atomic state duplicated with
437 * this hook and still owned by the caller (i.e. not transferred to the
438 * driver by calling &drm_mode_config_funcs.atomic_commit) will be
439 * cleaned up by calling the @atomic_destroy_state hook in this
442 * Atomic drivers which don't subclass &struct drm_connector_state should use
443 * drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the
444 * state structure to extend it with driver-private state should use
445 * __drm_atomic_helper_connector_duplicate_state() to make sure shared state is
446 * duplicated in a consistent fashion across drivers.
448 * It is an error to call this hook before &drm_connector.state has been
449 * initialized correctly.
453 * If the duplicate state references refcounted resources this hook must
454 * acquire a reference for each of them. The driver must release these
455 * references again in @atomic_destroy_state.
459 * Duplicated atomic state or NULL when the allocation failed.
461 struct drm_connector_state
*(*atomic_duplicate_state
)(struct drm_connector
*connector
);
464 * @atomic_destroy_state:
466 * Destroy a state duplicated with @atomic_duplicate_state and release
467 * or unreference all resources it references
469 void (*atomic_destroy_state
)(struct drm_connector
*connector
,
470 struct drm_connector_state
*state
);
473 * @atomic_set_property:
475 * Decode a driver-private property value and store the decoded value
476 * into the passed-in state structure. Since the atomic core decodes all
477 * standardized properties (even for extensions beyond the core set of
478 * properties which might not be implemented by all drivers) this
479 * requires drivers to subclass the state structure.
481 * Such driver-private properties should really only be implemented for
482 * truly hardware/vendor specific state. Instead it is preferred to
483 * standardize atomic extension and decode the properties used to expose
484 * such an extension in the core.
486 * Do not call this function directly, use
487 * drm_atomic_connector_set_property() instead.
489 * This callback is optional if the driver does not support any
490 * driver-private atomic properties.
494 * This function is called in the state assembly phase of atomic
495 * modesets, which can be aborted for any reason (including on
496 * userspace's request to just check whether a configuration would be
497 * possible). Drivers MUST NOT touch any persistent state (hardware or
498 * software) or data structures except the passed in @state parameter.
500 * Also since userspace controls in which order properties are set this
501 * function must not do any input validation (since the state update is
502 * incomplete and hence likely inconsistent). Instead any such input
503 * validation must be done in the various atomic_check callbacks.
507 * 0 if the property has been found, -EINVAL if the property isn't
508 * implemented by the driver (which shouldn't ever happen, the core only
509 * asks for properties attached to this connector). No other validation
510 * is allowed by the driver. The core already checks that the property
511 * value is within the range (integer, valid enum value, ...) the driver
512 * set when registering the property.
514 int (*atomic_set_property
)(struct drm_connector
*connector
,
515 struct drm_connector_state
*state
,
516 struct drm_property
*property
,
520 * @atomic_get_property:
522 * Reads out the decoded driver-private property. This is used to
523 * implement the GETCONNECTOR IOCTL.
525 * Do not call this function directly, use
526 * drm_atomic_connector_get_property() instead.
528 * This callback is optional if the driver does not support any
529 * driver-private atomic properties.
533 * 0 on success, -EINVAL if the property isn't implemented by the
534 * driver (which shouldn't ever happen, the core only asks for
535 * properties attached to this connector).
537 int (*atomic_get_property
)(struct drm_connector
*connector
,
538 const struct drm_connector_state
*state
,
539 struct drm_property
*property
,
543 * @atomic_print_state:
545 * If driver subclasses &struct drm_connector_state, it should implement
546 * this optional hook for printing additional driver specific state.
548 * Do not call this directly, use drm_atomic_connector_print_state()
551 void (*atomic_print_state
)(struct drm_printer
*p
,
552 const struct drm_connector_state
*state
);
555 /* mode specified on the command line */
556 struct drm_cmdline_mode
{
558 bool refresh_specified
;
567 enum drm_connector_force force
;
571 * struct drm_connector - central DRM connector control structure
572 * @dev: parent DRM device
573 * @kdev: kernel device for sysfs attributes
574 * @attr: sysfs attributes
575 * @head: list management
576 * @base: base KMS object
577 * @name: human readable name, can be overwritten by the driver
578 * @connector_type: one of the DRM_MODE_CONNECTOR_<foo> types from drm_mode.h
579 * @connector_type_id: index into connector type enum
580 * @interlace_allowed: can this connector handle interlaced modes?
581 * @doublescan_allowed: can this connector handle doublescan?
582 * @stereo_allowed: can this connector handle stereo modes?
583 * @funcs: connector control functions
584 * @edid_blob_ptr: DRM property containing EDID if present
585 * @properties: property tracking for this connector
586 * @dpms: current dpms state
587 * @helper_private: mid-layer private data
588 * @cmdline_mode: mode line parsed from the kernel cmdline for this connector
589 * @force: a DRM_FORCE_<foo> state for forced mode sets
590 * @override_edid: has the EDID been overwritten through debugfs for testing?
591 * @encoder_ids: valid encoders for this connector
592 * @encoder: encoder driving this connector, if any
593 * @eld: EDID-like data, if present
594 * @latency_present: AV delay info from ELD, if found
595 * @video_latency: video latency info from ELD, if found
596 * @audio_latency: audio latency info from ELD, if found
597 * @null_edid_counter: track sinks that give us all zeros for the EDID
598 * @bad_edid_counter: track sinks that give us an EDID with invalid checksum
599 * @edid_corrupt: indicates whether the last read EDID was corrupt
600 * @debugfs_entry: debugfs directory for this connector
601 * @state: current atomic state for this connector
602 * @has_tile: is this connector connected to a tiled monitor
603 * @tile_group: tile group for the connected monitor
604 * @tile_is_single_monitor: whether the tile is one monitor housing
605 * @num_h_tile: number of horizontal tiles in the tile group
606 * @num_v_tile: number of vertical tiles in the tile group
607 * @tile_h_loc: horizontal location of this tile
608 * @tile_v_loc: vertical location of this tile
609 * @tile_h_size: horizontal size of this tile.
610 * @tile_v_size: vertical size of this tile.
612 * Each connector may be connected to one or more CRTCs, or may be clonable by
613 * another connector if they can share a CRTC. Each connector also has a specific
614 * position in the broader display (referred to as a 'screen' though it could
615 * span multiple monitors).
617 struct drm_connector
{
618 struct drm_device
*dev
;
620 struct device_attribute
*attr
;
621 struct list_head head
;
623 struct drm_mode_object base
;
628 * @mutex: Lock for general connector state, but currently only protects
629 * @registered. Most of the connector state is still protected by
630 * &drm_mode_config.mutex.
635 * @index: Compacted connector index, which matches the position inside
636 * the mode_config.list for drivers not supporting hot-add/removing. Can
637 * be used as an array index. It is invariant over the lifetime of the
643 int connector_type_id
;
644 bool interlace_allowed
;
645 bool doublescan_allowed
;
648 * @registered: Is this connector exposed (registered) with userspace?
649 * Protected by @mutex.
655 * Modes available on this connector (from fill_modes() + user).
656 * Protected by &drm_mode_config.mutex.
658 struct list_head modes
;
662 * One of the drm_connector_status enums (connected, not, or unknown).
663 * Protected by &drm_mode_config.mutex.
665 enum drm_connector_status status
;
669 * These are modes added by probing with DDC or the BIOS, before
670 * filtering is applied. Used by the probe helpers. Protected by
671 * &drm_mode_config.mutex.
673 struct list_head probed_modes
;
676 * @display_info: Display information is filled from EDID information
677 * when a display is detected. For non hot-pluggable displays such as
678 * flat panels in embedded systems, the driver should initialize the
679 * &drm_display_info.width_mm and &drm_display_info.height_mm fields
680 * with the physical size of the display.
682 * Protected by &drm_mode_config.mutex.
684 struct drm_display_info display_info
;
685 const struct drm_connector_funcs
*funcs
;
687 struct drm_property_blob
*edid_blob_ptr
;
688 struct drm_object_properties properties
;
693 * DRM blob property data for the DP MST path property.
695 struct drm_property_blob
*path_blob_ptr
;
700 * DRM blob property data for the tile property (used mostly by DP MST).
701 * This is meant for screens which are driven through separate display
702 * pipelines represented by &drm_crtc, which might not be running with
703 * genlocked clocks. For tiled panels which are genlocked, like
704 * dual-link LVDS or dual-link DSI, the driver should try to not expose
705 * the tiling and virtualize both &drm_crtc and &drm_plane if needed.
707 struct drm_property_blob
*tile_blob_ptr
;
709 /* should we poll this connector for connects and disconnects */
710 /* hot plug detectable */
711 #define DRM_CONNECTOR_POLL_HPD (1 << 0)
712 /* poll for connections */
713 #define DRM_CONNECTOR_POLL_CONNECT (1 << 1)
714 /* can cleanly poll for disconnections without flickering the screen */
715 /* DACs should rarely do this without a lot of testing */
716 #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
721 * Connector polling mode, a combination of
723 * DRM_CONNECTOR_POLL_HPD
724 * The connector generates hotplug events and doesn't need to be
725 * periodically polled. The CONNECT and DISCONNECT flags must not
726 * be set together with the HPD flag.
728 * DRM_CONNECTOR_POLL_CONNECT
729 * Periodically poll the connector for connection.
731 * DRM_CONNECTOR_POLL_DISCONNECT
732 * Periodically poll the connector for disconnection.
734 * Set to 0 for connectors that don't support connection status
739 /* requested DPMS state */
742 const struct drm_connector_helper_funcs
*helper_private
;
744 /* forced on connector */
745 struct drm_cmdline_mode cmdline_mode
;
746 enum drm_connector_force force
;
749 #define DRM_CONNECTOR_MAX_ENCODER 3
750 uint32_t encoder_ids
[DRM_CONNECTOR_MAX_ENCODER
];
751 struct drm_encoder
*encoder
; /* currently active encoder */
753 #define MAX_ELD_BYTES 128
755 uint8_t eld
[MAX_ELD_BYTES
];
756 bool latency_present
[2];
757 int video_latency
[2]; /* [0]: progressive, [1]: interlaced */
758 int audio_latency
[2];
759 int null_edid_counter
; /* needed to workaround some HW bugs where we get all 0s */
760 unsigned bad_edid_counter
;
762 /* Flag for raw EDID header corruption - used in Displayport
763 * compliance testing - * Displayport Link CTS Core 1.2 rev1.1 4.2.2.6
767 struct dentry
*debugfs_entry
;
769 struct drm_connector_state
*state
;
773 struct drm_tile_group
*tile_group
;
774 bool tile_is_single_monitor
;
776 uint8_t num_h_tile
, num_v_tile
;
777 uint8_t tile_h_loc
, tile_v_loc
;
778 uint16_t tile_h_size
, tile_v_size
;
781 #define obj_to_connector(x) container_of(x, struct drm_connector, base)
783 int drm_connector_init(struct drm_device
*dev
,
784 struct drm_connector
*connector
,
785 const struct drm_connector_funcs
*funcs
,
787 int drm_connector_register(struct drm_connector
*connector
);
788 void drm_connector_unregister(struct drm_connector
*connector
);
789 int drm_mode_connector_attach_encoder(struct drm_connector
*connector
,
790 struct drm_encoder
*encoder
);
792 void drm_connector_cleanup(struct drm_connector
*connector
);
793 static inline unsigned drm_connector_index(struct drm_connector
*connector
)
795 return connector
->index
;
799 * drm_connector_lookup - lookup connector object
801 * @id: connector object id
803 * This function looks up the connector object specified by id
804 * add takes a reference to it.
806 static inline struct drm_connector
*drm_connector_lookup(struct drm_device
*dev
,
809 struct drm_mode_object
*mo
;
810 mo
= drm_mode_object_find(dev
, id
, DRM_MODE_OBJECT_CONNECTOR
);
811 return mo
? obj_to_connector(mo
) : NULL
;
815 * drm_connector_reference - incr the connector refcnt
816 * @connector: connector
818 * This function increments the connector's refcount.
820 static inline void drm_connector_reference(struct drm_connector
*connector
)
822 drm_mode_object_reference(&connector
->base
);
826 * drm_connector_unreference - unref a connector
827 * @connector: connector to unref
829 * This function decrements the connector's refcount and frees it if it drops to zero.
831 static inline void drm_connector_unreference(struct drm_connector
*connector
)
833 drm_mode_object_unreference(&connector
->base
);
836 const char *drm_get_connector_status_name(enum drm_connector_status status
);
837 const char *drm_get_subpixel_order_name(enum subpixel_order order
);
838 const char *drm_get_dpms_name(int val
);
839 const char *drm_get_dvi_i_subconnector_name(int val
);
840 const char *drm_get_dvi_i_select_name(int val
);
841 const char *drm_get_tv_subconnector_name(int val
);
842 const char *drm_get_tv_select_name(int val
);
844 int drm_mode_create_dvi_i_properties(struct drm_device
*dev
);
845 int drm_mode_create_tv_properties(struct drm_device
*dev
,
846 unsigned int num_modes
,
847 const char * const modes
[]);
848 int drm_mode_create_scaling_mode_property(struct drm_device
*dev
);
849 int drm_mode_create_aspect_ratio_property(struct drm_device
*dev
);
850 int drm_mode_create_suggested_offset_properties(struct drm_device
*dev
);
852 int drm_mode_connector_set_path_property(struct drm_connector
*connector
,
854 int drm_mode_connector_set_tile_property(struct drm_connector
*connector
);
855 int drm_mode_connector_update_edid_property(struct drm_connector
*connector
,
856 const struct edid
*edid
);
857 void drm_mode_connector_set_link_status_property(struct drm_connector
*connector
,
858 uint64_t link_status
);
861 * struct drm_tile_group - Tile group metadata
862 * @refcount: reference count
864 * @id: tile group id exposed to userspace
865 * @group_data: Sink-private data identifying this group
867 * @group_data corresponds to displayid vend/prod/serial for external screens
870 struct drm_tile_group
{
871 struct kref refcount
;
872 struct drm_device
*dev
;
877 struct drm_tile_group
*drm_mode_create_tile_group(struct drm_device
*dev
,
879 struct drm_tile_group
*drm_mode_get_tile_group(struct drm_device
*dev
,
881 void drm_mode_put_tile_group(struct drm_device
*dev
,
882 struct drm_tile_group
*tg
);
885 * drm_for_each_connector - iterate over all connectors
886 * @connector: the loop cursor
887 * @dev: the DRM device
889 * Iterate over all connectors of @dev.
893 * This iterator is not safe against hotadd/removal of connectors and is
894 * deprecated. Use drm_for_each_connector_iter() instead.
896 #define drm_for_each_connector(connector, dev) \
897 list_for_each_entry(connector, &(dev)->mode_config.connector_list, head)
900 * struct drm_connector_list_iter - connector_list iterator
902 * This iterator tracks state needed to be able to walk the connector_list
903 * within struct drm_mode_config. Only use together with
904 * drm_connector_list_iter_get(), drm_connector_list_iter_put() and
905 * drm_connector_list_iter_next() respectively the convenience macro
906 * drm_for_each_connector_iter().
908 struct drm_connector_list_iter
{
910 struct drm_device
*dev
;
911 struct drm_connector
*conn
;
914 void drm_connector_list_iter_get(struct drm_device
*dev
,
915 struct drm_connector_list_iter
*iter
);
916 struct drm_connector
*
917 drm_connector_list_iter_next(struct drm_connector_list_iter
*iter
);
918 void drm_connector_list_iter_put(struct drm_connector_list_iter
*iter
);
921 * drm_for_each_connector_iter - connector_list iterator macro
922 * @connector: &struct drm_connector pointer used as cursor
923 * @iter: &struct drm_connector_list_iter
925 * Note that @connector is only valid within the list body, if you want to use
926 * @connector after calling drm_connector_list_iter_put() then you need to grab
927 * your own reference first using drm_connector_reference().
929 #define drm_for_each_connector_iter(connector, iter) \
930 while ((connector = drm_connector_list_iter_next(iter)))