152217195SDaniel Vetter /*
252217195SDaniel Vetter * Copyright (c) 2016 Intel Corporation
352217195SDaniel Vetter *
452217195SDaniel Vetter * Permission to use, copy, modify, distribute, and sell this software and its
552217195SDaniel Vetter * documentation for any purpose is hereby granted without fee, provided that
652217195SDaniel Vetter * the above copyright notice appear in all copies and that both that copyright
752217195SDaniel Vetter * notice and this permission notice appear in supporting documentation, and
852217195SDaniel Vetter * that the name of the copyright holders not be used in advertising or
952217195SDaniel Vetter * publicity pertaining to distribution of the software without specific,
1052217195SDaniel Vetter * written prior permission. The copyright holders make no representations
1152217195SDaniel Vetter * about the suitability of this software for any purpose. It is provided "as
1252217195SDaniel Vetter * is" without express or implied warranty.
1352217195SDaniel Vetter *
1452217195SDaniel Vetter * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1552217195SDaniel Vetter * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
1652217195SDaniel Vetter * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1752217195SDaniel Vetter * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
1852217195SDaniel Vetter * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
1952217195SDaniel Vetter * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
2052217195SDaniel Vetter * OF THIS SOFTWARE.
2152217195SDaniel Vetter */
2252217195SDaniel Vetter
2352217195SDaniel Vetter #ifndef __DRM_CONNECTOR_H__
2452217195SDaniel Vetter #define __DRM_CONNECTOR_H__
2552217195SDaniel Vetter
2652217195SDaniel Vetter #include <linux/list.h>
27ea497bb9SDaniel Vetter #include <linux/llist.h>
2852217195SDaniel Vetter #include <linux/ctype.h>
290e9f25d0SMaarten Lankhorst #include <linux/hdmi.h>
30334f74eeSHans de Goede #include <linux/notifier.h>
31949619f3SDaniel Vetter #include <drm/drm_mode_object.h>
32d78aa650SDaniel Vetter #include <drm/drm_util.h>
33c265f340SHarry Wentland #include <drm/drm_property.h>
3452217195SDaniel Vetter
35199e4e96SDaniel Vetter #include <uapi/drm/drm_mode.h>
36199e4e96SDaniel Vetter
3752217195SDaniel Vetter struct drm_connector_helper_funcs;
386c5ed5aeSMaarten Lankhorst struct drm_modeset_acquire_ctx;
3952217195SDaniel Vetter struct drm_device;
4052217195SDaniel Vetter struct drm_crtc;
4152217195SDaniel Vetter struct drm_encoder;
425e41b01aSHsin-Yi Wang struct drm_panel;
4352217195SDaniel Vetter struct drm_property;
4452217195SDaniel Vetter struct drm_property_blob;
45fceffb32SRob Clark struct drm_printer;
46334f74eeSHans de Goede struct drm_privacy_screen;
4752217195SDaniel Vetter struct edid;
48e1a29c6cSAndrzej Pietrasiewicz struct i2c_adapter;
4952217195SDaniel Vetter
5052217195SDaniel Vetter enum drm_connector_force {
5152217195SDaniel Vetter DRM_FORCE_UNSPECIFIED,
5252217195SDaniel Vetter DRM_FORCE_OFF,
5352217195SDaniel Vetter DRM_FORCE_ON, /* force on analog part normally */
5452217195SDaniel Vetter DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */
5552217195SDaniel Vetter };
5652217195SDaniel Vetter
57ae2a6da8SDaniel Vetter /**
58ae2a6da8SDaniel Vetter * enum drm_connector_status - status for a &drm_connector
59ae2a6da8SDaniel Vetter *
60ae2a6da8SDaniel Vetter * This enum is used to track the connector status. There are no separate
61ae2a6da8SDaniel Vetter * #defines for the uapi!
62ae2a6da8SDaniel Vetter */
6352217195SDaniel Vetter enum drm_connector_status {
64ae2a6da8SDaniel Vetter /**
65ae2a6da8SDaniel Vetter * @connector_status_connected: The connector is definitely connected to
66ae2a6da8SDaniel Vetter * a sink device, and can be enabled.
67ae2a6da8SDaniel Vetter */
6852217195SDaniel Vetter connector_status_connected = 1,
69ae2a6da8SDaniel Vetter /**
70ae2a6da8SDaniel Vetter * @connector_status_disconnected: The connector isn't connected to a
71ae2a6da8SDaniel Vetter * sink device which can be autodetect. For digital outputs like DP or
72ae2a6da8SDaniel Vetter * HDMI (which can be realiable probed) this means there's really
73ae2a6da8SDaniel Vetter * nothing there. It is driver-dependent whether a connector with this
74ae2a6da8SDaniel Vetter * status can be lit up or not.
75ae2a6da8SDaniel Vetter */
7652217195SDaniel Vetter connector_status_disconnected = 2,
77ae2a6da8SDaniel Vetter /**
78ae2a6da8SDaniel Vetter * @connector_status_unknown: The connector's status could not be
79ae2a6da8SDaniel Vetter * reliably detected. This happens when probing would either cause
80ae2a6da8SDaniel Vetter * flicker (like load-detection when the connector is in use), or when a
81ae2a6da8SDaniel Vetter * hardware resource isn't available (like when load-detection needs a
82ae2a6da8SDaniel Vetter * free CRTC). It should be possible to light up the connector with one
83ae2a6da8SDaniel Vetter * of the listed fallback modes. For default configuration userspace
84ae2a6da8SDaniel Vetter * should only try to light up connectors with unknown status when
85ae2a6da8SDaniel Vetter * there's not connector with @connector_status_connected.
86ae2a6da8SDaniel Vetter */
8752217195SDaniel Vetter connector_status_unknown = 3,
8852217195SDaniel Vetter };
8952217195SDaniel Vetter
9039b50c60SLyude Paul /**
91e9d2871fSMauro Carvalho Chehab * enum drm_connector_registration_state - userspace registration status for
9239b50c60SLyude Paul * a &drm_connector
9339b50c60SLyude Paul *
9439b50c60SLyude Paul * This enum is used to track the status of initializing a connector and
9539b50c60SLyude Paul * registering it with userspace, so that DRM can prevent bogus modesets on
9639b50c60SLyude Paul * connectors that no longer exist.
9739b50c60SLyude Paul */
9839b50c60SLyude Paul enum drm_connector_registration_state {
9939b50c60SLyude Paul /**
10039b50c60SLyude Paul * @DRM_CONNECTOR_INITIALIZING: The connector has just been created,
10139b50c60SLyude Paul * but has yet to be exposed to userspace. There should be no
10239b50c60SLyude Paul * additional restrictions to how the state of this connector may be
10339b50c60SLyude Paul * modified.
10439b50c60SLyude Paul */
10539b50c60SLyude Paul DRM_CONNECTOR_INITIALIZING = 0,
10639b50c60SLyude Paul
10739b50c60SLyude Paul /**
10839b50c60SLyude Paul * @DRM_CONNECTOR_REGISTERED: The connector has been fully initialized
10939b50c60SLyude Paul * and registered with sysfs, as such it has been exposed to
11039b50c60SLyude Paul * userspace. There should be no additional restrictions to how the
11139b50c60SLyude Paul * state of this connector may be modified.
11239b50c60SLyude Paul */
11339b50c60SLyude Paul DRM_CONNECTOR_REGISTERED = 1,
11439b50c60SLyude Paul
11539b50c60SLyude Paul /**
11639b50c60SLyude Paul * @DRM_CONNECTOR_UNREGISTERED: The connector has either been exposed
11739b50c60SLyude Paul * to userspace and has since been unregistered and removed from
11839b50c60SLyude Paul * userspace, or the connector was unregistered before it had a chance
11939b50c60SLyude Paul * to be exposed to userspace (e.g. still in the
12039b50c60SLyude Paul * @DRM_CONNECTOR_INITIALIZING state). When a connector is
12139b50c60SLyude Paul * unregistered, there are additional restrictions to how its state
12239b50c60SLyude Paul * may be modified:
12339b50c60SLyude Paul *
12439b50c60SLyude Paul * - An unregistered connector may only have its DPMS changed from
12539b50c60SLyude Paul * On->Off. Once DPMS is changed to Off, it may not be switched back
12639b50c60SLyude Paul * to On.
12739b50c60SLyude Paul * - Modesets are not allowed on unregistered connectors, unless they
12839b50c60SLyude Paul * would result in disabling its assigned CRTCs. This means
12939b50c60SLyude Paul * disabling a CRTC on an unregistered connector is OK, but enabling
13039b50c60SLyude Paul * one is not.
13139b50c60SLyude Paul * - Removing a CRTC from an unregistered connector is OK, but new
13239b50c60SLyude Paul * CRTCs may never be assigned to an unregistered connector.
13339b50c60SLyude Paul */
13439b50c60SLyude Paul DRM_CONNECTOR_UNREGISTERED = 2,
13539b50c60SLyude Paul };
13639b50c60SLyude Paul
13752217195SDaniel Vetter enum subpixel_order {
13852217195SDaniel Vetter SubPixelUnknown = 0,
13952217195SDaniel Vetter SubPixelHorizontalRGB,
14052217195SDaniel Vetter SubPixelHorizontalBGR,
14152217195SDaniel Vetter SubPixelVerticalRGB,
14252217195SDaniel Vetter SubPixelVerticalBGR,
14352217195SDaniel Vetter SubPixelNone,
144afa1c763SShashank Sharma
145afa1c763SShashank Sharma };
146afa1c763SShashank Sharma
14762c58af3SShashank Sharma /**
1487d63cd85SMaxime Ripard * enum drm_connector_tv_mode - Analog TV output mode
1497d63cd85SMaxime Ripard *
1507d63cd85SMaxime Ripard * This enum is used to indicate the TV output mode used on an analog TV
1517d63cd85SMaxime Ripard * connector.
1527d63cd85SMaxime Ripard *
1537d63cd85SMaxime Ripard * WARNING: The values of this enum is uABI since they're exposed in the
1547d63cd85SMaxime Ripard * "TV mode" connector property.
1557d63cd85SMaxime Ripard */
1567d63cd85SMaxime Ripard enum drm_connector_tv_mode {
1577d63cd85SMaxime Ripard /**
1587d63cd85SMaxime Ripard * @DRM_MODE_TV_MODE_NTSC: CCIR System M (aka 525-lines)
1597d63cd85SMaxime Ripard * together with the NTSC Color Encoding.
1607d63cd85SMaxime Ripard */
1617d63cd85SMaxime Ripard DRM_MODE_TV_MODE_NTSC,
1627d63cd85SMaxime Ripard
1637d63cd85SMaxime Ripard /**
1647d63cd85SMaxime Ripard * @DRM_MODE_TV_MODE_NTSC_443: Variant of
1657d63cd85SMaxime Ripard * @DRM_MODE_TV_MODE_NTSC. Uses a color subcarrier frequency
1667d63cd85SMaxime Ripard * of 4.43 MHz.
1677d63cd85SMaxime Ripard */
1687d63cd85SMaxime Ripard DRM_MODE_TV_MODE_NTSC_443,
1697d63cd85SMaxime Ripard
1707d63cd85SMaxime Ripard /**
1717d63cd85SMaxime Ripard * @DRM_MODE_TV_MODE_NTSC_J: Variant of @DRM_MODE_TV_MODE_NTSC
1727d63cd85SMaxime Ripard * used in Japan. Uses a black level equals to the blanking
1737d63cd85SMaxime Ripard * level.
1747d63cd85SMaxime Ripard */
1757d63cd85SMaxime Ripard DRM_MODE_TV_MODE_NTSC_J,
1767d63cd85SMaxime Ripard
1777d63cd85SMaxime Ripard /**
1787d63cd85SMaxime Ripard * @DRM_MODE_TV_MODE_PAL: CCIR System B together with the PAL
1797d63cd85SMaxime Ripard * color system.
1807d63cd85SMaxime Ripard */
1817d63cd85SMaxime Ripard DRM_MODE_TV_MODE_PAL,
1827d63cd85SMaxime Ripard
1837d63cd85SMaxime Ripard /**
1847d63cd85SMaxime Ripard * @DRM_MODE_TV_MODE_PAL_M: CCIR System M (aka 525-lines)
1857d63cd85SMaxime Ripard * together with the PAL color encoding
1867d63cd85SMaxime Ripard */
1877d63cd85SMaxime Ripard DRM_MODE_TV_MODE_PAL_M,
1887d63cd85SMaxime Ripard
1897d63cd85SMaxime Ripard /**
1907d63cd85SMaxime Ripard * @DRM_MODE_TV_MODE_PAL_N: CCIR System N together with the PAL
1917d63cd85SMaxime Ripard * color encoding. It uses 625 lines, but has a color subcarrier
1927d63cd85SMaxime Ripard * frequency of 3.58MHz, the SECAM color space, and narrower
1937d63cd85SMaxime Ripard * channels compared to most of the other PAL variants.
1947d63cd85SMaxime Ripard */
1957d63cd85SMaxime Ripard DRM_MODE_TV_MODE_PAL_N,
1967d63cd85SMaxime Ripard
1977d63cd85SMaxime Ripard /**
1987d63cd85SMaxime Ripard * @DRM_MODE_TV_MODE_SECAM: CCIR System B together with the
1997d63cd85SMaxime Ripard * SECAM color system.
2007d63cd85SMaxime Ripard */
2017d63cd85SMaxime Ripard DRM_MODE_TV_MODE_SECAM,
2027d63cd85SMaxime Ripard
2036fa9df2bSJani Nikula /**
2046fa9df2bSJani Nikula * @DRM_MODE_TV_MODE_MAX: Number of analog TV output modes.
2056fa9df2bSJani Nikula *
2066fa9df2bSJani Nikula * Internal implementation detail; this is not uABI.
2076fa9df2bSJani Nikula */
2087d63cd85SMaxime Ripard DRM_MODE_TV_MODE_MAX,
2097d63cd85SMaxime Ripard };
2107d63cd85SMaxime Ripard
2117d63cd85SMaxime Ripard /**
21262c58af3SShashank Sharma * struct drm_scrambling: sink's scrambling support.
21362c58af3SShashank Sharma */
21462c58af3SShashank Sharma struct drm_scrambling {
21562c58af3SShashank Sharma /**
21662c58af3SShashank Sharma * @supported: scrambling supported for rates > 340 Mhz.
21762c58af3SShashank Sharma */
21862c58af3SShashank Sharma bool supported;
21962c58af3SShashank Sharma /**
22062c58af3SShashank Sharma * @low_rates: scrambling supported for rates <= 340 Mhz.
22162c58af3SShashank Sharma */
22262c58af3SShashank Sharma bool low_rates;
22362c58af3SShashank Sharma };
22462c58af3SShashank Sharma
225afa1c763SShashank Sharma /*
226afa1c763SShashank Sharma * struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink
227afa1c763SShashank Sharma *
228afa1c763SShashank Sharma * Provides SCDC register support and capabilities related information on a
229afa1c763SShashank Sharma * HDMI 2.0 sink. In case of a HDMI 1.4 sink, all parameter must be 0.
230afa1c763SShashank Sharma */
231afa1c763SShashank Sharma struct drm_scdc {
232afa1c763SShashank Sharma /**
233afa1c763SShashank Sharma * @supported: status control & data channel present.
234afa1c763SShashank Sharma */
235afa1c763SShashank Sharma bool supported;
236afa1c763SShashank Sharma /**
237afa1c763SShashank Sharma * @read_request: sink is capable of generating scdc read request.
238afa1c763SShashank Sharma */
239afa1c763SShashank Sharma bool read_request;
24062c58af3SShashank Sharma /**
24162c58af3SShashank Sharma * @scrambling: sink's scrambling capabilities
24262c58af3SShashank Sharma */
24362c58af3SShashank Sharma struct drm_scrambling scrambling;
244afa1c763SShashank Sharma };
245afa1c763SShashank Sharma
24676ee7b90SAnkit Nautiyal /**
24776ee7b90SAnkit Nautiyal * struct drm_hdmi_dsc_cap - DSC capabilities of HDMI sink
24876ee7b90SAnkit Nautiyal *
24976ee7b90SAnkit Nautiyal * Describes the DSC support provided by HDMI 2.1 sink.
25076ee7b90SAnkit Nautiyal * The information is fetched fom additional HFVSDB blocks defined
25176ee7b90SAnkit Nautiyal * for HDMI 2.1.
25276ee7b90SAnkit Nautiyal */
25376ee7b90SAnkit Nautiyal struct drm_hdmi_dsc_cap {
25476ee7b90SAnkit Nautiyal /** @v_1p2: flag for dsc1.2 version support by sink */
25576ee7b90SAnkit Nautiyal bool v_1p2;
25676ee7b90SAnkit Nautiyal
25776ee7b90SAnkit Nautiyal /** @native_420: Does sink support DSC with 4:2:0 compression */
25876ee7b90SAnkit Nautiyal bool native_420;
25976ee7b90SAnkit Nautiyal
26076ee7b90SAnkit Nautiyal /**
26176ee7b90SAnkit Nautiyal * @all_bpp: Does sink support all bpp with 4:4:4: or 4:2:2
26276ee7b90SAnkit Nautiyal * compressed formats
26376ee7b90SAnkit Nautiyal */
26476ee7b90SAnkit Nautiyal bool all_bpp;
26576ee7b90SAnkit Nautiyal
26676ee7b90SAnkit Nautiyal /**
26776ee7b90SAnkit Nautiyal * @bpc_supported: compressed bpc supported by sink : 10, 12 or 16 bpc
26876ee7b90SAnkit Nautiyal */
26976ee7b90SAnkit Nautiyal u8 bpc_supported;
27076ee7b90SAnkit Nautiyal
27176ee7b90SAnkit Nautiyal /** @max_slices: maximum number of Horizontal slices supported by */
27276ee7b90SAnkit Nautiyal u8 max_slices;
27376ee7b90SAnkit Nautiyal
27476ee7b90SAnkit Nautiyal /** @clk_per_slice : max pixel clock in MHz supported per slice */
27576ee7b90SAnkit Nautiyal int clk_per_slice;
27676ee7b90SAnkit Nautiyal
27776ee7b90SAnkit Nautiyal /** @max_lanes : dsc max lanes supported for Fixed rate Link training */
27876ee7b90SAnkit Nautiyal u8 max_lanes;
27976ee7b90SAnkit Nautiyal
28076ee7b90SAnkit Nautiyal /** @max_frl_rate_per_lane : maximum frl rate with DSC per lane */
28176ee7b90SAnkit Nautiyal u8 max_frl_rate_per_lane;
28276ee7b90SAnkit Nautiyal
28376ee7b90SAnkit Nautiyal /** @total_chunk_kbytes: max size of chunks in KBs supported per line*/
28476ee7b90SAnkit Nautiyal u8 total_chunk_kbytes;
28576ee7b90SAnkit Nautiyal };
28662c58af3SShashank Sharma
287afa1c763SShashank Sharma /**
288afa1c763SShashank Sharma * struct drm_hdmi_info - runtime information about the connected HDMI sink
289afa1c763SShashank Sharma *
290afa1c763SShashank Sharma * Describes if a given display supports advanced HDMI 2.0 features.
291afa1c763SShashank Sharma * This information is available in CEA-861-F extension blocks (like HF-VSDB).
292afa1c763SShashank Sharma */
293afa1c763SShashank Sharma struct drm_hdmi_info {
29486cc921cSShashank Sharma /** @scdc: sink's scdc support and capabilities */
295afa1c763SShashank Sharma struct drm_scdc scdc;
296d8523153SShashank Sharma
297d8523153SShashank Sharma /**
298d8523153SShashank Sharma * @y420_vdb_modes: bitmap of modes which can support ycbcr420
299919dfb78SThomas Anderson * output only (not normal RGB/YCBCR444/422 outputs). The max VIC
300919dfb78SThomas Anderson * defined by the CEA-861-G spec is 219, so the size is 256 bits to map
301919dfb78SThomas Anderson * up to 256 VICs.
302d8523153SShashank Sharma */
303919dfb78SThomas Anderson unsigned long y420_vdb_modes[BITS_TO_LONGS(256)];
304832d4f2fSShashank Sharma
305832d4f2fSShashank Sharma /**
306832d4f2fSShashank Sharma * @y420_cmdb_modes: bitmap of modes which can support ycbcr420
307919dfb78SThomas Anderson * output also, along with normal HDMI outputs. The max VIC defined by
308919dfb78SThomas Anderson * the CEA-861-G spec is 219, so the size is 256 bits to map up to 256
309919dfb78SThomas Anderson * VICs.
310832d4f2fSShashank Sharma */
311919dfb78SThomas Anderson unsigned long y420_cmdb_modes[BITS_TO_LONGS(256)];
312832d4f2fSShashank Sharma
313e6a9a2c3SShashank Sharma /** @y420_dc_modes: bitmap of deep color support index */
314e6a9a2c3SShashank Sharma u8 y420_dc_modes;
3154499d488SSwati Sharma
3164499d488SSwati Sharma /** @max_frl_rate_per_lane: support fixed rate link */
3174499d488SSwati Sharma u8 max_frl_rate_per_lane;
3184499d488SSwati Sharma
3194499d488SSwati Sharma /** @max_lanes: supported by sink */
3204499d488SSwati Sharma u8 max_lanes;
32176ee7b90SAnkit Nautiyal
32276ee7b90SAnkit Nautiyal /** @dsc_cap: DSC capabilities of the sink */
32376ee7b90SAnkit Nautiyal struct drm_hdmi_dsc_cap dsc_cap;
32452217195SDaniel Vetter };
32552217195SDaniel Vetter
326b3c6c8bfSDaniel Vetter /**
32740ee6fbeSManasi Navare * enum drm_link_status - connector's link_status property value
32840ee6fbeSManasi Navare *
32940ee6fbeSManasi Navare * This enum is used as the connector's link status property value.
33040ee6fbeSManasi Navare * It is set to the values defined in uapi.
33141232c1bSManasi Navare *
33241232c1bSManasi Navare * @DRM_LINK_STATUS_GOOD: DP Link is Good as a result of successful
33341232c1bSManasi Navare * link training
33441232c1bSManasi Navare * @DRM_LINK_STATUS_BAD: DP Link is BAD as a result of link training
33541232c1bSManasi Navare * failure
33640ee6fbeSManasi Navare */
33740ee6fbeSManasi Navare enum drm_link_status {
33840ee6fbeSManasi Navare DRM_LINK_STATUS_GOOD = DRM_MODE_LINK_STATUS_GOOD,
33940ee6fbeSManasi Navare DRM_LINK_STATUS_BAD = DRM_MODE_LINK_STATUS_BAD,
34040ee6fbeSManasi Navare };
34140ee6fbeSManasi Navare
34240ee6fbeSManasi Navare /**
3438d70f395SHans de Goede * enum drm_panel_orientation - panel_orientation info for &drm_display_info
3448d70f395SHans de Goede *
3458d70f395SHans de Goede * This enum is used to track the (LCD) panel orientation. There are no
3468d70f395SHans de Goede * separate #defines for the uapi!
3478d70f395SHans de Goede *
3488d70f395SHans de Goede * @DRM_MODE_PANEL_ORIENTATION_UNKNOWN: The drm driver has not provided any
3498d70f395SHans de Goede * panel orientation information (normal
3508d70f395SHans de Goede * for non panels) in this case the "panel
3518d70f395SHans de Goede * orientation" connector prop will not be
3528d70f395SHans de Goede * attached.
3538d70f395SHans de Goede * @DRM_MODE_PANEL_ORIENTATION_NORMAL: The top side of the panel matches the
3548d70f395SHans de Goede * top side of the device's casing.
3558d70f395SHans de Goede * @DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP: The top side of the panel matches the
3568d70f395SHans de Goede * bottom side of the device's casing, iow
3578d70f395SHans de Goede * the panel is mounted upside-down.
3588d70f395SHans de Goede * @DRM_MODE_PANEL_ORIENTATION_LEFT_UP: The left side of the panel matches the
3598d70f395SHans de Goede * top side of the device's casing.
3608d70f395SHans de Goede * @DRM_MODE_PANEL_ORIENTATION_RIGHT_UP: The right side of the panel matches the
3618d70f395SHans de Goede * top side of the device's casing.
3628d70f395SHans de Goede */
3638d70f395SHans de Goede enum drm_panel_orientation {
3648d70f395SHans de Goede DRM_MODE_PANEL_ORIENTATION_UNKNOWN = -1,
3658d70f395SHans de Goede DRM_MODE_PANEL_ORIENTATION_NORMAL = 0,
3668d70f395SHans de Goede DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP,
3678d70f395SHans de Goede DRM_MODE_PANEL_ORIENTATION_LEFT_UP,
3688d70f395SHans de Goede DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
3698d70f395SHans de Goede };
3708d70f395SHans de Goede
371a1d11d1eSManasi Navare /**
372a1d11d1eSManasi Navare * struct drm_monitor_range_info - Panel's Monitor range in EDID for
373a1d11d1eSManasi Navare * &drm_display_info
374a1d11d1eSManasi Navare *
375a1d11d1eSManasi Navare * This struct is used to store a frequency range supported by panel
376a1d11d1eSManasi Navare * as parsed from EDID's detailed monitor range descriptor block.
377a1d11d1eSManasi Navare *
378a1d11d1eSManasi Navare * @min_vfreq: This is the min supported refresh rate in Hz from
379a1d11d1eSManasi Navare * EDID's detailed monitor range.
380a1d11d1eSManasi Navare * @max_vfreq: This is the max supported refresh rate in Hz from
381a1d11d1eSManasi Navare * EDID's detailed monitor range
382a1d11d1eSManasi Navare */
383a1d11d1eSManasi Navare struct drm_monitor_range_info {
384c7943bb3SVille Syrjälä u16 min_vfreq;
385c7943bb3SVille Syrjälä u16 max_vfreq;
386a1d11d1eSManasi Navare };
387a1d11d1eSManasi Navare
388107fe904SRajat Jain /**
38982068edeSJouni Högander * struct drm_luminance_range_info - Panel's luminance range for
39082068edeSJouni Högander * &drm_display_info. Calculated using data in EDID
39182068edeSJouni Högander *
39282068edeSJouni Högander * This struct is used to store a luminance range supported by panel
39382068edeSJouni Högander * as calculated using data from EDID's static hdr metadata.
39482068edeSJouni Högander *
39582068edeSJouni Högander * @min_luminance: This is the min supported luminance value
39682068edeSJouni Högander *
39782068edeSJouni Högander * @max_luminance: This is the max supported luminance value
39882068edeSJouni Högander */
39982068edeSJouni Högander struct drm_luminance_range_info {
40082068edeSJouni Högander u32 min_luminance;
40182068edeSJouni Högander u32 max_luminance;
40282068edeSJouni Högander };
40382068edeSJouni Högander
40482068edeSJouni Högander /**
405107fe904SRajat Jain * enum drm_privacy_screen_status - privacy screen status
406107fe904SRajat Jain *
407107fe904SRajat Jain * This enum is used to track and control the state of the integrated privacy
408107fe904SRajat Jain * screen present on some display panels, via the "privacy-screen sw-state"
409107fe904SRajat Jain * and "privacy-screen hw-state" properties. Note the _LOCKED enum values
410107fe904SRajat Jain * are only valid for the "privacy-screen hw-state" property.
411107fe904SRajat Jain *
412107fe904SRajat Jain * @PRIVACY_SCREEN_DISABLED:
413107fe904SRajat Jain * The privacy-screen on the panel is disabled
414107fe904SRajat Jain * @PRIVACY_SCREEN_ENABLED:
415107fe904SRajat Jain * The privacy-screen on the panel is enabled
416107fe904SRajat Jain * @PRIVACY_SCREEN_DISABLED_LOCKED:
417107fe904SRajat Jain * The privacy-screen on the panel is disabled and locked (cannot be changed)
418107fe904SRajat Jain * @PRIVACY_SCREEN_ENABLED_LOCKED:
419107fe904SRajat Jain * The privacy-screen on the panel is enabled and locked (cannot be changed)
420107fe904SRajat Jain */
421107fe904SRajat Jain enum drm_privacy_screen_status {
422107fe904SRajat Jain PRIVACY_SCREEN_DISABLED = 0,
423107fe904SRajat Jain PRIVACY_SCREEN_ENABLED,
424107fe904SRajat Jain PRIVACY_SCREEN_DISABLED_LOCKED,
425107fe904SRajat Jain PRIVACY_SCREEN_ENABLED_LOCKED,
426107fe904SRajat Jain };
427107fe904SRajat Jain
428f96c61feSJoshua Ashton /**
429f96c61feSJoshua Ashton * enum drm_colorspace - color space
430f96c61feSJoshua Ashton *
431f96c61feSJoshua Ashton * This enum is a consolidated colorimetry list supported by HDMI and
432d2c6a405SUma Shankar * DP protocol standard. The respective connectors will register
433d2c6a405SUma Shankar * a property with the subset of this list (supported by that
434d2c6a405SUma Shankar * respective protocol). Userspace will set the colorspace through
435d2c6a405SUma Shankar * a colorspace property which will be created and exposed to
436d2c6a405SUma Shankar * userspace.
437f96c61feSJoshua Ashton *
438f96c61feSJoshua Ashton * DP definitions come from the DP v2.0 spec
439f96c61feSJoshua Ashton * HDMI definitions come from the CTA-861-H spec
440f96c61feSJoshua Ashton *
441f96c61feSJoshua Ashton * A note on YCC and RGB variants:
442f96c61feSJoshua Ashton *
443f96c61feSJoshua Ashton * Since userspace is not aware of the encoding on the wire
444f96c61feSJoshua Ashton * (RGB or YCbCr), drivers are free to pick the appropriate
445f96c61feSJoshua Ashton * variant, regardless of what userspace selects. E.g., if
446f96c61feSJoshua Ashton * BT2020_RGB is selected by userspace a driver will pick
447f96c61feSJoshua Ashton * BT2020_YCC if the encoding on the wire is YUV444 or YUV420.
448f96c61feSJoshua Ashton *
449f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_DEFAULT:
450f96c61feSJoshua Ashton * Driver specific behavior.
451f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_NO_DATA:
452f96c61feSJoshua Ashton * Driver specific behavior.
453f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_SMPTE_170M_YCC:
454f96c61feSJoshua Ashton * (HDMI)
455f96c61feSJoshua Ashton * SMPTE ST 170M colorimetry format
456f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_BT709_YCC:
457f96c61feSJoshua Ashton * (HDMI, DP)
458f96c61feSJoshua Ashton * ITU-R BT.709 colorimetry format
459f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_XVYCC_601:
460f96c61feSJoshua Ashton * (HDMI, DP)
461f96c61feSJoshua Ashton * xvYCC601 colorimetry format
462f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_XVYCC_709:
463f96c61feSJoshua Ashton * (HDMI, DP)
464f96c61feSJoshua Ashton * xvYCC709 colorimetry format
465f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_SYCC_601:
466f96c61feSJoshua Ashton * (HDMI, DP)
467f96c61feSJoshua Ashton * sYCC601 colorimetry format
468f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_OPYCC_601:
469f96c61feSJoshua Ashton * (HDMI, DP)
470f96c61feSJoshua Ashton * opYCC601 colorimetry format
471f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_OPRGB:
472f96c61feSJoshua Ashton * (HDMI, DP)
473f96c61feSJoshua Ashton * opRGB colorimetry format
474f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_BT2020_CYCC:
475f96c61feSJoshua Ashton * (HDMI, DP)
476f96c61feSJoshua Ashton * ITU-R BT.2020 Y'c C'bc C'rc (constant luminance) colorimetry format
477f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_BT2020_RGB:
478f96c61feSJoshua Ashton * (HDMI, DP)
479f96c61feSJoshua Ashton * ITU-R BT.2020 R' G' B' colorimetry format
480f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_BT2020_YCC:
481f96c61feSJoshua Ashton * (HDMI, DP)
482f96c61feSJoshua Ashton * ITU-R BT.2020 Y' C'b C'r colorimetry format
483f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65:
484f96c61feSJoshua Ashton * (HDMI)
485f96c61feSJoshua Ashton * SMPTE ST 2113 P3D65 colorimetry format
486f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER:
487f96c61feSJoshua Ashton * (HDMI)
488f96c61feSJoshua Ashton * SMPTE ST 2113 P3DCI colorimetry format
489f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED:
490f96c61feSJoshua Ashton * (DP)
491f96c61feSJoshua Ashton * RGB wide gamut fixed point colorimetry format
492f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT:
493f96c61feSJoshua Ashton * (DP)
494f96c61feSJoshua Ashton * RGB wide gamut floating point
495f96c61feSJoshua Ashton * (scRGB (IEC 61966-2-2)) colorimetry format
496f96c61feSJoshua Ashton * @DRM_MODE_COLORIMETRY_BT601_YCC:
497f96c61feSJoshua Ashton * (DP)
498f96c61feSJoshua Ashton * ITU-R BT.601 colorimetry format
499f96c61feSJoshua Ashton * The DP spec does not say whether this is the 525 or the 625
500f96c61feSJoshua Ashton * line version.
501d2c6a405SUma Shankar */
5021626761eSHarry Wentland enum drm_colorspace {
503d2c6a405SUma Shankar /* For Default case, driver will set the colorspace */
5041626761eSHarry Wentland DRM_MODE_COLORIMETRY_DEFAULT = 0,
505d2c6a405SUma Shankar /* CEA 861 Normal Colorimetry options */
5061626761eSHarry Wentland DRM_MODE_COLORIMETRY_NO_DATA = 0,
5071626761eSHarry Wentland DRM_MODE_COLORIMETRY_SMPTE_170M_YCC = 1,
5081626761eSHarry Wentland DRM_MODE_COLORIMETRY_BT709_YCC = 2,
509d2c6a405SUma Shankar /* CEA 861 Extended Colorimetry Options */
5101626761eSHarry Wentland DRM_MODE_COLORIMETRY_XVYCC_601 = 3,
5111626761eSHarry Wentland DRM_MODE_COLORIMETRY_XVYCC_709 = 4,
5121626761eSHarry Wentland DRM_MODE_COLORIMETRY_SYCC_601 = 5,
5131626761eSHarry Wentland DRM_MODE_COLORIMETRY_OPYCC_601 = 6,
5141626761eSHarry Wentland DRM_MODE_COLORIMETRY_OPRGB = 7,
5151626761eSHarry Wentland DRM_MODE_COLORIMETRY_BT2020_CYCC = 8,
5161626761eSHarry Wentland DRM_MODE_COLORIMETRY_BT2020_RGB = 9,
5171626761eSHarry Wentland DRM_MODE_COLORIMETRY_BT2020_YCC = 10,
518d2c6a405SUma Shankar /* Additional Colorimetry extension added as part of CTA 861.G */
5191626761eSHarry Wentland DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65 = 11,
5201626761eSHarry Wentland DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER = 12,
52145cf0e91SGwan-gyeong Mun /* Additional Colorimetry Options added for DP 1.4a VSC Colorimetry Format */
5221626761eSHarry Wentland DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED = 13,
5231626761eSHarry Wentland DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT = 14,
5241626761eSHarry Wentland DRM_MODE_COLORIMETRY_BT601_YCC = 15,
525c627087cSHarry Wentland /* not a valid value; merely used for counting */
526c627087cSHarry Wentland DRM_MODE_COLORIMETRY_COUNT
5271626761eSHarry Wentland };
528d2c6a405SUma Shankar
5298d70f395SHans de Goede /**
530a0970e87SLaurent Pinchart * enum drm_bus_flags - bus_flags info for &drm_display_info
531a0970e87SLaurent Pinchart *
532a0970e87SLaurent Pinchart * This enum defines signal polarities and clock edge information for signals on
533a0970e87SLaurent Pinchart * a bus as bitmask flags.
534a0970e87SLaurent Pinchart *
535a0970e87SLaurent Pinchart * The clock edge information is conveyed by two sets of symbols,
536a0970e87SLaurent Pinchart * DRM_BUS_FLAGS_*_DRIVE_\* and DRM_BUS_FLAGS_*_SAMPLE_\*. When this enum is
537a0970e87SLaurent Pinchart * used to describe a bus from the point of view of the transmitter, the
538a0970e87SLaurent Pinchart * \*_DRIVE_\* flags should be used. When used from the point of view of the
539a0970e87SLaurent Pinchart * receiver, the \*_SAMPLE_\* flags should be used. The \*_DRIVE_\* and
540a0970e87SLaurent Pinchart * \*_SAMPLE_\* flags alias each other, with the \*_SAMPLE_POSEDGE and
541a0970e87SLaurent Pinchart * \*_SAMPLE_NEGEDGE flags being equal to \*_DRIVE_NEGEDGE and \*_DRIVE_POSEDGE
542a0970e87SLaurent Pinchart * respectively. This simplifies code as signals are usually sampled on the
543a0970e87SLaurent Pinchart * opposite edge of the driving edge. Transmitters and receivers may however
544a0970e87SLaurent Pinchart * need to take other signal timings into account to convert between driving
545a0970e87SLaurent Pinchart * and sample edges.
546a0970e87SLaurent Pinchart */
547a0970e87SLaurent Pinchart enum drm_bus_flags {
54892703c71SSam Ravnborg /**
54992703c71SSam Ravnborg * @DRM_BUS_FLAG_DE_LOW:
55092703c71SSam Ravnborg *
55192703c71SSam Ravnborg * The Data Enable signal is active low
55292703c71SSam Ravnborg */
553a0970e87SLaurent Pinchart DRM_BUS_FLAG_DE_LOW = BIT(0),
55492703c71SSam Ravnborg
55592703c71SSam Ravnborg /**
55692703c71SSam Ravnborg * @DRM_BUS_FLAG_DE_HIGH:
55792703c71SSam Ravnborg *
55892703c71SSam Ravnborg * The Data Enable signal is active high
55992703c71SSam Ravnborg */
560a0970e87SLaurent Pinchart DRM_BUS_FLAG_DE_HIGH = BIT(1),
56192703c71SSam Ravnborg
56292703c71SSam Ravnborg /**
56392703c71SSam Ravnborg * @DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE:
56492703c71SSam Ravnborg *
56592703c71SSam Ravnborg * Data is driven on the rising edge of the pixel clock
56692703c71SSam Ravnborg */
567aa9d4081SSam Ravnborg DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE = BIT(2),
56892703c71SSam Ravnborg
56992703c71SSam Ravnborg /**
57092703c71SSam Ravnborg * @DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE:
57192703c71SSam Ravnborg *
57292703c71SSam Ravnborg * Data is driven on the falling edge of the pixel clock
57392703c71SSam Ravnborg */
574aa9d4081SSam Ravnborg DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE = BIT(3),
57592703c71SSam Ravnborg
57692703c71SSam Ravnborg /**
57792703c71SSam Ravnborg * @DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE:
57892703c71SSam Ravnborg *
57992703c71SSam Ravnborg * Data is sampled on the rising edge of the pixel clock
58092703c71SSam Ravnborg */
581aa9d4081SSam Ravnborg DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE = DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
58292703c71SSam Ravnborg
58392703c71SSam Ravnborg /**
58492703c71SSam Ravnborg * @DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE:
58592703c71SSam Ravnborg *
58692703c71SSam Ravnborg * Data is sampled on the falling edge of the pixel clock
58792703c71SSam Ravnborg */
588aa9d4081SSam Ravnborg DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
58992703c71SSam Ravnborg
59092703c71SSam Ravnborg /**
59192703c71SSam Ravnborg * @DRM_BUS_FLAG_DATA_MSB_TO_LSB:
59292703c71SSam Ravnborg *
59392703c71SSam Ravnborg * Data is transmitted MSB to LSB on the bus
59492703c71SSam Ravnborg */
595a0970e87SLaurent Pinchart DRM_BUS_FLAG_DATA_MSB_TO_LSB = BIT(4),
59692703c71SSam Ravnborg
59792703c71SSam Ravnborg /**
59892703c71SSam Ravnborg * @DRM_BUS_FLAG_DATA_LSB_TO_MSB:
59992703c71SSam Ravnborg *
60092703c71SSam Ravnborg * Data is transmitted LSB to MSB on the bus
60192703c71SSam Ravnborg */
602a0970e87SLaurent Pinchart DRM_BUS_FLAG_DATA_LSB_TO_MSB = BIT(5),
60392703c71SSam Ravnborg
60492703c71SSam Ravnborg /**
60592703c71SSam Ravnborg * @DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE:
60692703c71SSam Ravnborg *
60792703c71SSam Ravnborg * Sync signals are driven on the rising edge of the pixel clock
60892703c71SSam Ravnborg */
609aa9d4081SSam Ravnborg DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE = BIT(6),
61092703c71SSam Ravnborg
61192703c71SSam Ravnborg /**
61292703c71SSam Ravnborg * @DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE:
61392703c71SSam Ravnborg *
61492703c71SSam Ravnborg * Sync signals are driven on the falling edge of the pixel clock
61592703c71SSam Ravnborg */
616aa9d4081SSam Ravnborg DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE = BIT(7),
61792703c71SSam Ravnborg
61892703c71SSam Ravnborg /**
61992703c71SSam Ravnborg * @DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE:
62092703c71SSam Ravnborg *
62192703c71SSam Ravnborg * Sync signals are sampled on the rising edge of the pixel clock
62292703c71SSam Ravnborg */
623aa9d4081SSam Ravnborg DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE = DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE,
62492703c71SSam Ravnborg
62592703c71SSam Ravnborg /**
62692703c71SSam Ravnborg * @DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE:
62792703c71SSam Ravnborg *
62892703c71SSam Ravnborg * Sync signals are sampled on the falling edge of the pixel clock
62992703c71SSam Ravnborg */
630aa9d4081SSam Ravnborg DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE = DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,
63192703c71SSam Ravnborg
63292703c71SSam Ravnborg /**
63392703c71SSam Ravnborg * @DRM_BUS_FLAG_SHARP_SIGNALS:
63492703c71SSam Ravnborg *
63592703c71SSam Ravnborg * Set if the Sharp-specific signals (SPL, CLS, PS, REV) must be used
63692703c71SSam Ravnborg */
637f9a763d2SPaul Cercueil DRM_BUS_FLAG_SHARP_SIGNALS = BIT(8),
638a0970e87SLaurent Pinchart };
639a0970e87SLaurent Pinchart
640a0970e87SLaurent Pinchart /**
641b3c6c8bfSDaniel Vetter * struct drm_display_info - runtime data about the connected sink
642b3c6c8bfSDaniel Vetter *
643b3c6c8bfSDaniel Vetter * Describes a given display (e.g. CRT or flat panel) and its limitations. For
644b3c6c8bfSDaniel Vetter * fixed display sinks like built-in panels there's not much difference between
645ea0dd85aSDaniel Vetter * this and &struct drm_connector. But for sinks with a real cable this
646b3c6c8bfSDaniel Vetter * structure is meant to describe all the things at the other end of the cable.
647b3c6c8bfSDaniel Vetter *
648b3c6c8bfSDaniel Vetter * For sinks which provide an EDID this can be filled out by calling
649b3c6c8bfSDaniel Vetter * drm_add_edid_modes().
65052217195SDaniel Vetter */
65152217195SDaniel Vetter struct drm_display_info {
652b3c6c8bfSDaniel Vetter /**
653b3c6c8bfSDaniel Vetter * @width_mm: Physical width in mm.
654b3c6c8bfSDaniel Vetter */
65552217195SDaniel Vetter unsigned int width_mm;
656a9ab81d9SVille Syrjälä
657b3c6c8bfSDaniel Vetter /**
658b3c6c8bfSDaniel Vetter * @height_mm: Physical height in mm.
659b3c6c8bfSDaniel Vetter */
66052217195SDaniel Vetter unsigned int height_mm;
66152217195SDaniel Vetter
662b3c6c8bfSDaniel Vetter /**
663b3c6c8bfSDaniel Vetter * @bpc: Maximum bits per color channel. Used by HDMI and DP outputs.
664b3c6c8bfSDaniel Vetter */
66552217195SDaniel Vetter unsigned int bpc;
66652217195SDaniel Vetter
667b3c6c8bfSDaniel Vetter /**
668b3c6c8bfSDaniel Vetter * @subpixel_order: Subpixel order of LCD panels.
669b3c6c8bfSDaniel Vetter */
67052217195SDaniel Vetter enum subpixel_order subpixel_order;
67152217195SDaniel Vetter
67252217195SDaniel Vetter #define DRM_COLOR_FORMAT_RGB444 (1<<0)
673c03d0b52SMaxime Ripard #define DRM_COLOR_FORMAT_YCBCR444 (1<<1)
674c03d0b52SMaxime Ripard #define DRM_COLOR_FORMAT_YCBCR422 (1<<2)
675c03d0b52SMaxime Ripard #define DRM_COLOR_FORMAT_YCBCR420 (1<<3)
67652217195SDaniel Vetter
677b3c6c8bfSDaniel Vetter /**
6788d70f395SHans de Goede * @panel_orientation: Read only connector property for built-in panels,
6798d70f395SHans de Goede * indicating the orientation of the panel vs the device's casing.
6808d70f395SHans de Goede * drm_connector_init() sets this to DRM_MODE_PANEL_ORIENTATION_UNKNOWN.
6818d70f395SHans de Goede * When not UNKNOWN this gets used by the drm_fb_helpers to rotate the
6828d70f395SHans de Goede * fb to compensate and gets exported as prop to userspace.
6838d70f395SHans de Goede */
6848d70f395SHans de Goede int panel_orientation;
6858d70f395SHans de Goede
6868d70f395SHans de Goede /**
687b3c6c8bfSDaniel Vetter * @color_formats: HDMI Color formats, selects between RGB and YCrCb
688b3c6c8bfSDaniel Vetter * modes. Used DRM_COLOR_FORMAT\_ defines, which are _not_ the same ones
689b3c6c8bfSDaniel Vetter * as used to describe the pixel format in framebuffers, and also don't
690b3c6c8bfSDaniel Vetter * match the formats in @bus_formats which are shared with v4l.
691b3c6c8bfSDaniel Vetter */
69252217195SDaniel Vetter u32 color_formats;
69352217195SDaniel Vetter
694b3c6c8bfSDaniel Vetter /**
695b3c6c8bfSDaniel Vetter * @bus_formats: Pixel data format on the wire, somewhat redundant with
696b3c6c8bfSDaniel Vetter * @color_formats. Array of size @num_bus_formats encoded using
697b3c6c8bfSDaniel Vetter * MEDIA_BUS_FMT\_ defines shared with v4l and media drivers.
698b3c6c8bfSDaniel Vetter */
69952217195SDaniel Vetter const u32 *bus_formats;
700b3c6c8bfSDaniel Vetter /**
701b3c6c8bfSDaniel Vetter * @num_bus_formats: Size of @bus_formats array.
702b3c6c8bfSDaniel Vetter */
70352217195SDaniel Vetter unsigned int num_bus_formats;
70452217195SDaniel Vetter
705b3c6c8bfSDaniel Vetter /**
706b3c6c8bfSDaniel Vetter * @bus_flags: Additional information (like pixel signal polarity) for
707a0970e87SLaurent Pinchart * the pixel data on the bus, using &enum drm_bus_flags values
708a0970e87SLaurent Pinchart * DRM_BUS_FLAGS\_.
709b3c6c8bfSDaniel Vetter */
71052217195SDaniel Vetter u32 bus_flags;
71152217195SDaniel Vetter
712b3c6c8bfSDaniel Vetter /**
7132a272ca9SVille Syrjälä * @max_tmds_clock: Maximum TMDS clock rate supported by the
7142a272ca9SVille Syrjälä * sink in kHz. 0 means undefined.
7152a272ca9SVille Syrjälä */
7162a272ca9SVille Syrjälä int max_tmds_clock;
7172a272ca9SVille Syrjälä
7182a272ca9SVille Syrjälä /**
7192a272ca9SVille Syrjälä * @dvi_dual: Dual-link DVI sink?
7202a272ca9SVille Syrjälä */
7212a272ca9SVille Syrjälä bool dvi_dual;
7222a272ca9SVille Syrjälä
7232a272ca9SVille Syrjälä /**
724a92d083dSLaurent Pinchart * @is_hdmi: True if the sink is an HDMI device.
725a92d083dSLaurent Pinchart *
726a92d083dSLaurent Pinchart * This field shall be used instead of calling
727a92d083dSLaurent Pinchart * drm_detect_hdmi_monitor() when possible.
728a92d083dSLaurent Pinchart */
729a92d083dSLaurent Pinchart bool is_hdmi;
730a92d083dSLaurent Pinchart
731a92d083dSLaurent Pinchart /**
7320374ffa5SJani Nikula * @has_audio: True if the sink supports audio.
7330374ffa5SJani Nikula *
7340374ffa5SJani Nikula * This field shall be used instead of calling
7350374ffa5SJani Nikula * drm_detect_monitor_audio() when possible.
7360374ffa5SJani Nikula */
7370374ffa5SJani Nikula bool has_audio;
7380374ffa5SJani Nikula
7390374ffa5SJani Nikula /**
740f1781e9bSVille Syrjälä * @has_hdmi_infoframe: Does the sink support the HDMI infoframe?
741f1781e9bSVille Syrjälä */
742f1781e9bSVille Syrjälä bool has_hdmi_infoframe;
743f1781e9bSVille Syrjälä
744f1781e9bSVille Syrjälä /**
7451581b2dfSVille Syrjälä * @rgb_quant_range_selectable: Does the sink support selecting
7461581b2dfSVille Syrjälä * the RGB quantization range?
7471581b2dfSVille Syrjälä */
7481581b2dfSVille Syrjälä bool rgb_quant_range_selectable;
7491581b2dfSVille Syrjälä
7501581b2dfSVille Syrjälä /**
751dca384a3SMaxime Ripard * @edid_hdmi_rgb444_dc_modes: Mask of supported hdmi deep color modes
7524adc33f3SMaxime Ripard * in RGB 4:4:4. Even more stuff redundant with @bus_formats.
753b3c6c8bfSDaniel Vetter */
7544adc33f3SMaxime Ripard u8 edid_hdmi_rgb444_dc_modes;
7554adc33f3SMaxime Ripard
7564adc33f3SMaxime Ripard /**
757dca384a3SMaxime Ripard * @edid_hdmi_ycbcr444_dc_modes: Mask of supported hdmi deep color
7584adc33f3SMaxime Ripard * modes in YCbCr 4:4:4. Even more stuff redundant with @bus_formats.
7594adc33f3SMaxime Ripard */
7604adc33f3SMaxime Ripard u8 edid_hdmi_ycbcr444_dc_modes;
76152217195SDaniel Vetter
762b3c6c8bfSDaniel Vetter /**
763b3c6c8bfSDaniel Vetter * @cea_rev: CEA revision of the HDMI sink.
764b3c6c8bfSDaniel Vetter */
76552217195SDaniel Vetter u8 cea_rev;
766afa1c763SShashank Sharma
767afa1c763SShashank Sharma /**
768afa1c763SShashank Sharma * @hdmi: advance features of a HDMI sink.
769afa1c763SShashank Sharma */
770afa1c763SShashank Sharma struct drm_hdmi_info hdmi;
77166660d4cSDave Airlie
77266660d4cSDave Airlie /**
77366660d4cSDave Airlie * @non_desktop: Non desktop display (HMD).
77466660d4cSDave Airlie */
77566660d4cSDave Airlie bool non_desktop;
776a1d11d1eSManasi Navare
777a1d11d1eSManasi Navare /**
778a1d11d1eSManasi Navare * @monitor_range: Frequency range supported by monitor range descriptor
779a1d11d1eSManasi Navare */
780a1d11d1eSManasi Navare struct drm_monitor_range_info monitor_range;
78118a9cbbeSJani Nikula
78218a9cbbeSJani Nikula /**
78382068edeSJouni Högander * @luminance_range: Luminance range supported by panel
78482068edeSJouni Högander */
78582068edeSJouni Högander struct drm_luminance_range_info luminance_range;
78682068edeSJouni Högander
78782068edeSJouni Högander /**
78818a9cbbeSJani Nikula * @mso_stream_count: eDP Multi-SST Operation (MSO) stream count from
78918a9cbbeSJani Nikula * the DisplayID VESA vendor block. 0 for conventional Single-Stream
79018a9cbbeSJani Nikula * Transport (SST), or 2 or 4 MSO streams.
79118a9cbbeSJani Nikula */
79218a9cbbeSJani Nikula u8 mso_stream_count;
79318a9cbbeSJani Nikula
79418a9cbbeSJani Nikula /**
79518a9cbbeSJani Nikula * @mso_pixel_overlap: eDP MSO segment pixel overlap, 0-8 pixels.
79618a9cbbeSJani Nikula */
79718a9cbbeSJani Nikula u8 mso_pixel_overlap;
798aa193f7eSHamza Mahfooz
799aa193f7eSHamza Mahfooz /**
800aa193f7eSHamza Mahfooz * @max_dsc_bpp: Maximum DSC target bitrate, if it is set to 0 the
801aa193f7eSHamza Mahfooz * monitor's default value is used instead.
802aa193f7eSHamza Mahfooz */
803aa193f7eSHamza Mahfooz u32 max_dsc_bpp;
804c3292ab5SJani Nikula
805c3292ab5SJani Nikula /**
806c3292ab5SJani Nikula * @vics: Array of vics_len VICs. Internal to EDID parsing.
807c3292ab5SJani Nikula */
808c3292ab5SJani Nikula u8 *vics;
809c3292ab5SJani Nikula
810c3292ab5SJani Nikula /**
811c3292ab5SJani Nikula * @vics_len: Number of elements in vics. Internal to EDID parsing.
812c3292ab5SJani Nikula */
813c3292ab5SJani Nikula int vics_len;
814783dedc5SJani Nikula
815783dedc5SJani Nikula /**
816783dedc5SJani Nikula * @quirks: EDID based quirks. Internal to EDID parsing.
817783dedc5SJani Nikula */
818783dedc5SJani Nikula u32 quirks;
81952217195SDaniel Vetter };
82052217195SDaniel Vetter
821b3c6c8bfSDaniel Vetter int drm_display_info_set_bus_formats(struct drm_display_info *info,
822b3c6c8bfSDaniel Vetter const u32 *formats,
823b3c6c8bfSDaniel Vetter unsigned int num_formats);
824b3c6c8bfSDaniel Vetter
82552217195SDaniel Vetter /**
82622045e8eSMaxime Ripard * struct drm_connector_tv_margins - TV connector related margins
82722045e8eSMaxime Ripard *
82822045e8eSMaxime Ripard * Describes the margins in pixels to put around the image on TV
82922045e8eSMaxime Ripard * connectors to deal with overscan.
83022045e8eSMaxime Ripard */
83122045e8eSMaxime Ripard struct drm_connector_tv_margins {
83222045e8eSMaxime Ripard /**
83322045e8eSMaxime Ripard * @bottom: Bottom margin in pixels.
83422045e8eSMaxime Ripard */
83522045e8eSMaxime Ripard unsigned int bottom;
83622045e8eSMaxime Ripard
83722045e8eSMaxime Ripard /**
83822045e8eSMaxime Ripard * @left: Left margin in pixels.
83922045e8eSMaxime Ripard */
84022045e8eSMaxime Ripard unsigned int left;
84122045e8eSMaxime Ripard
84222045e8eSMaxime Ripard /**
84322045e8eSMaxime Ripard * @right: Right margin in pixels.
84422045e8eSMaxime Ripard */
84522045e8eSMaxime Ripard unsigned int right;
84622045e8eSMaxime Ripard
84722045e8eSMaxime Ripard /**
84822045e8eSMaxime Ripard * @top: Top margin in pixels.
84922045e8eSMaxime Ripard */
85022045e8eSMaxime Ripard unsigned int top;
85122045e8eSMaxime Ripard };
85222045e8eSMaxime Ripard
85322045e8eSMaxime Ripard /**
854299a16b1SBoris Brezillon * struct drm_tv_connector_state - TV connector related states
855d0236008SMaxime Ripard * @select_subconnector: selected subconnector
856941731a2SMaxime Ripard * @subconnector: detected subconnector
85722045e8eSMaxime Ripard * @margins: TV margins
8581fd4a5a3SMaxime Ripard * @legacy_mode: Legacy TV mode, driver specific value
8597d63cd85SMaxime Ripard * @mode: TV mode
860299a16b1SBoris Brezillon * @brightness: brightness in percent
861299a16b1SBoris Brezillon * @contrast: contrast in percent
862299a16b1SBoris Brezillon * @flicker_reduction: flicker reduction in percent
863299a16b1SBoris Brezillon * @overscan: overscan in percent
864299a16b1SBoris Brezillon * @saturation: saturation in percent
865299a16b1SBoris Brezillon * @hue: hue in percent
866299a16b1SBoris Brezillon */
867299a16b1SBoris Brezillon struct drm_tv_connector_state {
868d0236008SMaxime Ripard enum drm_mode_subconnector select_subconnector;
869941731a2SMaxime Ripard enum drm_mode_subconnector subconnector;
87022045e8eSMaxime Ripard struct drm_connector_tv_margins margins;
8711fd4a5a3SMaxime Ripard unsigned int legacy_mode;
8727d63cd85SMaxime Ripard unsigned int mode;
873299a16b1SBoris Brezillon unsigned int brightness;
874299a16b1SBoris Brezillon unsigned int contrast;
875299a16b1SBoris Brezillon unsigned int flicker_reduction;
876299a16b1SBoris Brezillon unsigned int overscan;
877299a16b1SBoris Brezillon unsigned int saturation;
878299a16b1SBoris Brezillon unsigned int hue;
879299a16b1SBoris Brezillon };
880299a16b1SBoris Brezillon
881299a16b1SBoris Brezillon /**
88252217195SDaniel Vetter * struct drm_connector_state - mutable connector state
88352217195SDaniel Vetter */
88452217195SDaniel Vetter struct drm_connector_state {
885aab999a6SDaniel Vetter /** @connector: backpointer to the connector */
88652217195SDaniel Vetter struct drm_connector *connector;
88752217195SDaniel Vetter
888afb21ea6SDaniel Vetter /**
889afb21ea6SDaniel Vetter * @crtc: CRTC to connect connector to, NULL if disabled.
890afb21ea6SDaniel Vetter *
891afb21ea6SDaniel Vetter * Do not change this directly, use drm_atomic_set_crtc_for_connector()
892afb21ea6SDaniel Vetter * instead.
893afb21ea6SDaniel Vetter */
894afb21ea6SDaniel Vetter struct drm_crtc *crtc;
89552217195SDaniel Vetter
896aab999a6SDaniel Vetter /**
897aab999a6SDaniel Vetter * @best_encoder:
898aab999a6SDaniel Vetter *
899aab999a6SDaniel Vetter * Used by the atomic helpers to select the encoder, through the
900aab999a6SDaniel Vetter * &drm_connector_helper_funcs.atomic_best_encoder or
901aab999a6SDaniel Vetter * &drm_connector_helper_funcs.best_encoder callbacks.
90227edadf6SDaniel Vetter *
9031b27fbddSLaurent Pinchart * This is also used in the atomic helpers to map encoders to their
9041b27fbddSLaurent Pinchart * current and previous connectors, see
90512db36bcSSean Paul * drm_atomic_get_old_connector_for_encoder() and
90612db36bcSSean Paul * drm_atomic_get_new_connector_for_encoder().
9071b27fbddSLaurent Pinchart *
90827edadf6SDaniel Vetter * NOTE: Atomic drivers must fill this out (either themselves or through
90927edadf6SDaniel Vetter * helpers), for otherwise the GETCONNECTOR and GETENCODER IOCTLs will
91027edadf6SDaniel Vetter * not return correct data to userspace.
911aab999a6SDaniel Vetter */
91252217195SDaniel Vetter struct drm_encoder *best_encoder;
91352217195SDaniel Vetter
91440ee6fbeSManasi Navare /**
91540ee6fbeSManasi Navare * @link_status: Connector link_status to keep track of whether link is
91640ee6fbeSManasi Navare * GOOD or BAD to notify userspace if retraining is necessary.
91740ee6fbeSManasi Navare */
91840ee6fbeSManasi Navare enum drm_link_status link_status;
91940ee6fbeSManasi Navare
920aab999a6SDaniel Vetter /** @state: backpointer to global drm_atomic_state */
92152217195SDaniel Vetter struct drm_atomic_state *state;
922299a16b1SBoris Brezillon
92321a01abbSMaarten Lankhorst /**
92421a01abbSMaarten Lankhorst * @commit: Tracks the pending commit to prevent use-after-free conditions.
92521a01abbSMaarten Lankhorst *
92621a01abbSMaarten Lankhorst * Is only set when @crtc is NULL.
92721a01abbSMaarten Lankhorst */
92821a01abbSMaarten Lankhorst struct drm_crtc_commit *commit;
92921a01abbSMaarten Lankhorst
930aab999a6SDaniel Vetter /** @tv: TV connector state */
931299a16b1SBoris Brezillon struct drm_tv_connector_state tv;
9320e9f25d0SMaarten Lankhorst
9330e9f25d0SMaarten Lankhorst /**
9341452c25bSSean Paul * @self_refresh_aware:
9351452c25bSSean Paul *
9361452c25bSSean Paul * This tracks whether a connector is aware of the self refresh state.
9371452c25bSSean Paul * It should be set to true for those connector implementations which
9381452c25bSSean Paul * understand the self refresh state. This is needed since the crtc
9391452c25bSSean Paul * registers the self refresh helpers and it doesn't know if the
9401452c25bSSean Paul * connectors downstream have implemented self refresh entry/exit.
9411452c25bSSean Paul *
9421452c25bSSean Paul * Drivers should set this to true in atomic_check if they know how to
9431452c25bSSean Paul * handle self_refresh requests.
9441452c25bSSean Paul */
9451452c25bSSean Paul bool self_refresh_aware;
9461452c25bSSean Paul
9471452c25bSSean Paul /**
9480e9f25d0SMaarten Lankhorst * @picture_aspect_ratio: Connector property to control the
9490e9f25d0SMaarten Lankhorst * HDMI infoframe aspect ratio setting.
9500e9f25d0SMaarten Lankhorst *
9518f6e1e22SMaarten Lankhorst * The %DRM_MODE_PICTURE_ASPECT_\* values much match the
9520e9f25d0SMaarten Lankhorst * values for &enum hdmi_picture_aspect
9530e9f25d0SMaarten Lankhorst */
9540e9f25d0SMaarten Lankhorst enum hdmi_picture_aspect picture_aspect_ratio;
9558f6e1e22SMaarten Lankhorst
9568f6e1e22SMaarten Lankhorst /**
95750525c33SStanislav Lisovskiy * @content_type: Connector property to control the
95850525c33SStanislav Lisovskiy * HDMI infoframe content type setting.
95950525c33SStanislav Lisovskiy * The %DRM_MODE_CONTENT_TYPE_\* values much
96050525c33SStanislav Lisovskiy * match the values.
96150525c33SStanislav Lisovskiy */
96250525c33SStanislav Lisovskiy unsigned int content_type;
96350525c33SStanislav Lisovskiy
96450525c33SStanislav Lisovskiy /**
9657672dbbaSRamalingam C * @hdcp_content_type: Connector property to pass the type of
9667672dbbaSRamalingam C * protected content. This is most commonly used for HDCP.
9677672dbbaSRamalingam C */
9687672dbbaSRamalingam C unsigned int hdcp_content_type;
9697672dbbaSRamalingam C
9707672dbbaSRamalingam C /**
9718f6e1e22SMaarten Lankhorst * @scaling_mode: Connector property to control the
9728f6e1e22SMaarten Lankhorst * upscaling, mostly used for built-in panels.
9738f6e1e22SMaarten Lankhorst */
9748f6e1e22SMaarten Lankhorst unsigned int scaling_mode;
97524557865SSean Paul
97624557865SSean Paul /**
97724557865SSean Paul * @content_protection: Connector property to request content
97824557865SSean Paul * protection. This is most commonly used for HDCP.
97924557865SSean Paul */
98024557865SSean Paul unsigned int content_protection;
981935774cdSBrian Starkey
982935774cdSBrian Starkey /**
983d2c6a405SUma Shankar * @colorspace: State variable for Connector property to request
984d2c6a405SUma Shankar * colorspace change on Sink. This is most commonly used to switch
985d2c6a405SUma Shankar * to wider color gamuts like BT2020.
986d2c6a405SUma Shankar */
9871626761eSHarry Wentland enum drm_colorspace colorspace;
988d2c6a405SUma Shankar
989d2c6a405SUma Shankar /**
990935774cdSBrian Starkey * @writeback_job: Writeback job for writeback connectors
991935774cdSBrian Starkey *
992b13cc8ddSBrian Starkey * Holds the framebuffer and out-fence for a writeback connector. As
993b13cc8ddSBrian Starkey * the writeback completion may be asynchronous to the normal commit
994b13cc8ddSBrian Starkey * cycle, the writeback job lifetime is managed separately from the
995b13cc8ddSBrian Starkey * normal atomic state by this object.
996935774cdSBrian Starkey *
997935774cdSBrian Starkey * See also: drm_writeback_queue_job() and
998935774cdSBrian Starkey * drm_writeback_signal_completion()
999935774cdSBrian Starkey */
1000935774cdSBrian Starkey struct drm_writeback_job *writeback_job;
100147e22ff1SRadhakrishna Sripada
100247e22ff1SRadhakrishna Sripada /**
100347e22ff1SRadhakrishna Sripada * @max_requested_bpc: Connector property to limit the maximum bit
100447e22ff1SRadhakrishna Sripada * depth of the pixels.
100547e22ff1SRadhakrishna Sripada */
100647e22ff1SRadhakrishna Sripada u8 max_requested_bpc;
100747e22ff1SRadhakrishna Sripada
100847e22ff1SRadhakrishna Sripada /**
100947e22ff1SRadhakrishna Sripada * @max_bpc: Connector max_bpc based on the requested max_bpc property
101047e22ff1SRadhakrishna Sripada * and the connector bpc limitations obtained from edid.
101147e22ff1SRadhakrishna Sripada */
101247e22ff1SRadhakrishna Sripada u8 max_bpc;
1013fbb5d035SUma Shankar
1014fbb5d035SUma Shankar /**
1015107fe904SRajat Jain * @privacy_screen_sw_state: See :ref:`Standard Connector
1016107fe904SRajat Jain * Properties<standard_connector_properties>`
1017107fe904SRajat Jain */
1018107fe904SRajat Jain enum drm_privacy_screen_status privacy_screen_sw_state;
1019107fe904SRajat Jain
1020107fe904SRajat Jain /**
1021fbb5d035SUma Shankar * @hdr_output_metadata:
1022fbb5d035SUma Shankar * DRM blob property for HDR output metadata
1023fbb5d035SUma Shankar */
1024fbb5d035SUma Shankar struct drm_property_blob *hdr_output_metadata;
102552217195SDaniel Vetter };
102652217195SDaniel Vetter
102752217195SDaniel Vetter /**
102852217195SDaniel Vetter * struct drm_connector_funcs - control connectors on a given device
102952217195SDaniel Vetter *
103052217195SDaniel Vetter * Each CRTC may have one or more connectors attached to it. The functions
103152217195SDaniel Vetter * below allow the core DRM code to control connectors, enumerate available modes,
103252217195SDaniel Vetter * etc.
103352217195SDaniel Vetter */
103452217195SDaniel Vetter struct drm_connector_funcs {
103552217195SDaniel Vetter /**
103652217195SDaniel Vetter * @dpms:
103752217195SDaniel Vetter *
103852217195SDaniel Vetter * Legacy entry point to set the per-connector DPMS state. Legacy DPMS
103952217195SDaniel Vetter * is exposed as a standard property on the connector, but diverted to
104052217195SDaniel Vetter * this callback in the drm core. Note that atomic drivers don't
104152217195SDaniel Vetter * implement the 4 level DPMS support on the connector any more, but
104252217195SDaniel Vetter * instead only have an on/off "ACTIVE" property on the CRTC object.
104352217195SDaniel Vetter *
1044144a7999SDaniel Vetter * This hook is not used by atomic drivers, remapping of the legacy DPMS
1045144a7999SDaniel Vetter * property is entirely handled in the DRM core.
104652217195SDaniel Vetter *
104752217195SDaniel Vetter * RETURNS:
104852217195SDaniel Vetter *
104952217195SDaniel Vetter * 0 on success or a negative error code on failure.
105052217195SDaniel Vetter */
105152217195SDaniel Vetter int (*dpms)(struct drm_connector *connector, int mode);
105252217195SDaniel Vetter
105352217195SDaniel Vetter /**
105452217195SDaniel Vetter * @reset:
105552217195SDaniel Vetter *
105652217195SDaniel Vetter * Reset connector hardware and software state to off. This function isn't
105752217195SDaniel Vetter * called by the core directly, only through drm_mode_config_reset().
105852217195SDaniel Vetter * It's not a helper hook only for historical reasons.
105952217195SDaniel Vetter *
106052217195SDaniel Vetter * Atomic drivers can use drm_atomic_helper_connector_reset() to reset
106152217195SDaniel Vetter * atomic state using this hook.
106252217195SDaniel Vetter */
106352217195SDaniel Vetter void (*reset)(struct drm_connector *connector);
106452217195SDaniel Vetter
106552217195SDaniel Vetter /**
106652217195SDaniel Vetter * @detect:
106752217195SDaniel Vetter *
106852217195SDaniel Vetter * Check to see if anything is attached to the connector. The parameter
106952217195SDaniel Vetter * force is set to false whilst polling, true when checking the
107052217195SDaniel Vetter * connector due to a user request. force can be used by the driver to
107152217195SDaniel Vetter * avoid expensive, destructive operations during automated probing.
107252217195SDaniel Vetter *
1073949f0886SLaurent Pinchart * This callback is optional, if not implemented the connector will be
1074949f0886SLaurent Pinchart * considered as always being attached.
1075949f0886SLaurent Pinchart *
107652217195SDaniel Vetter * FIXME:
107752217195SDaniel Vetter *
107852217195SDaniel Vetter * Note that this hook is only called by the probe helper. It's not in
107952217195SDaniel Vetter * the helper library vtable purely for historical reasons. The only DRM
108052217195SDaniel Vetter * core entry point to probe connector state is @fill_modes.
108152217195SDaniel Vetter *
10826c5ed5aeSMaarten Lankhorst * Note that the helper library will already hold
10836c5ed5aeSMaarten Lankhorst * &drm_mode_config.connection_mutex. Drivers which need to grab additional
10846c5ed5aeSMaarten Lankhorst * locks to avoid races with concurrent modeset changes need to use
10856c5ed5aeSMaarten Lankhorst * &drm_connector_helper_funcs.detect_ctx instead.
10866c5ed5aeSMaarten Lankhorst *
1087bacbab58SMaxime Ripard * Also note that this callback can be called no matter the
1088bacbab58SMaxime Ripard * state the connector is in. Drivers that need the underlying
1089bacbab58SMaxime Ripard * device to be powered to perform the detection will first need
1090bacbab58SMaxime Ripard * to make sure it's been properly enabled.
1091bacbab58SMaxime Ripard *
109252217195SDaniel Vetter * RETURNS:
109352217195SDaniel Vetter *
109452217195SDaniel Vetter * drm_connector_status indicating the connector's status.
109552217195SDaniel Vetter */
109652217195SDaniel Vetter enum drm_connector_status (*detect)(struct drm_connector *connector,
109752217195SDaniel Vetter bool force);
109852217195SDaniel Vetter
109952217195SDaniel Vetter /**
110052217195SDaniel Vetter * @force:
110152217195SDaniel Vetter *
110252217195SDaniel Vetter * This function is called to update internal encoder state when the
110352217195SDaniel Vetter * connector is forced to a certain state by userspace, either through
110452217195SDaniel Vetter * the sysfs interfaces or on the kernel cmdline. In that case the
110552217195SDaniel Vetter * @detect callback isn't called.
110652217195SDaniel Vetter *
110752217195SDaniel Vetter * FIXME:
110852217195SDaniel Vetter *
110952217195SDaniel Vetter * Note that this hook is only called by the probe helper. It's not in
111052217195SDaniel Vetter * the helper library vtable purely for historical reasons. The only DRM
111152217195SDaniel Vetter * core entry point to probe connector state is @fill_modes.
111252217195SDaniel Vetter */
111352217195SDaniel Vetter void (*force)(struct drm_connector *connector);
111452217195SDaniel Vetter
111552217195SDaniel Vetter /**
111652217195SDaniel Vetter * @fill_modes:
111752217195SDaniel Vetter *
111852217195SDaniel Vetter * Entry point for output detection and basic mode validation. The
111952217195SDaniel Vetter * driver should reprobe the output if needed (e.g. when hotplug
1120d574528aSDaniel Vetter * handling is unreliable), add all detected modes to &drm_connector.modes
112152217195SDaniel Vetter * and filter out any the device can't support in any configuration. It
112252217195SDaniel Vetter * also needs to filter out any modes wider or higher than the
112352217195SDaniel Vetter * parameters max_width and max_height indicate.
112452217195SDaniel Vetter *
112552217195SDaniel Vetter * The drivers must also prune any modes no longer valid from
1126d574528aSDaniel Vetter * &drm_connector.modes. Furthermore it must update
1127d574528aSDaniel Vetter * &drm_connector.status and &drm_connector.edid. If no EDID has been
1128d574528aSDaniel Vetter * received for this output connector->edid must be NULL.
112952217195SDaniel Vetter *
113052217195SDaniel Vetter * Drivers using the probe helpers should use
113192e1d263SDaniel Vetter * drm_helper_probe_single_connector_modes() to implement this
113252217195SDaniel Vetter * function.
113352217195SDaniel Vetter *
113452217195SDaniel Vetter * RETURNS:
113552217195SDaniel Vetter *
1136d574528aSDaniel Vetter * The number of modes detected and filled into &drm_connector.modes.
113752217195SDaniel Vetter */
113852217195SDaniel Vetter int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
113952217195SDaniel Vetter
114052217195SDaniel Vetter /**
114152217195SDaniel Vetter * @set_property:
114252217195SDaniel Vetter *
114352217195SDaniel Vetter * This is the legacy entry point to update a property attached to the
114452217195SDaniel Vetter * connector.
114552217195SDaniel Vetter *
114652217195SDaniel Vetter * This callback is optional if the driver does not support any legacy
1147144a7999SDaniel Vetter * driver-private properties. For atomic drivers it is not used because
1148144a7999SDaniel Vetter * property handling is done entirely in the DRM core.
114952217195SDaniel Vetter *
115052217195SDaniel Vetter * RETURNS:
115152217195SDaniel Vetter *
115252217195SDaniel Vetter * 0 on success or a negative error code on failure.
115352217195SDaniel Vetter */
115452217195SDaniel Vetter int (*set_property)(struct drm_connector *connector, struct drm_property *property,
115552217195SDaniel Vetter uint64_t val);
115652217195SDaniel Vetter
115752217195SDaniel Vetter /**
115852217195SDaniel Vetter * @late_register:
115952217195SDaniel Vetter *
116052217195SDaniel Vetter * This optional hook can be used to register additional userspace
116152217195SDaniel Vetter * interfaces attached to the connector, light backlight control, i2c,
116252217195SDaniel Vetter * DP aux or similar interfaces. It is called late in the driver load
116352217195SDaniel Vetter * sequence from drm_connector_register() when registering all the
116452217195SDaniel Vetter * core drm connector interfaces. Everything added from this callback
116552217195SDaniel Vetter * should be unregistered in the early_unregister callback.
116652217195SDaniel Vetter *
1167d574528aSDaniel Vetter * This is called while holding &drm_connector.mutex.
1168e73ab00eSDaniel Vetter *
116952217195SDaniel Vetter * Returns:
117052217195SDaniel Vetter *
117152217195SDaniel Vetter * 0 on success, or a negative error code on failure.
117252217195SDaniel Vetter */
117352217195SDaniel Vetter int (*late_register)(struct drm_connector *connector);
117452217195SDaniel Vetter
117552217195SDaniel Vetter /**
117652217195SDaniel Vetter * @early_unregister:
117752217195SDaniel Vetter *
117852217195SDaniel Vetter * This optional hook should be used to unregister the additional
117952217195SDaniel Vetter * userspace interfaces attached to the connector from
1180621a9993SGrazvydas Ignotas * late_register(). It is called from drm_connector_unregister(),
118152217195SDaniel Vetter * early in the driver unload sequence to disable userspace access
118252217195SDaniel Vetter * before data structures are torndown.
1183e73ab00eSDaniel Vetter *
1184d574528aSDaniel Vetter * This is called while holding &drm_connector.mutex.
118552217195SDaniel Vetter */
118652217195SDaniel Vetter void (*early_unregister)(struct drm_connector *connector);
118752217195SDaniel Vetter
118852217195SDaniel Vetter /**
118952217195SDaniel Vetter * @destroy:
119052217195SDaniel Vetter *
119152217195SDaniel Vetter * Clean up connector resources. This is called at driver unload time
119252217195SDaniel Vetter * through drm_mode_config_cleanup(). It can also be called at runtime
119352217195SDaniel Vetter * when a connector is being hot-unplugged for drivers that support
119452217195SDaniel Vetter * connector hotplugging (e.g. DisplayPort MST).
119552217195SDaniel Vetter */
119652217195SDaniel Vetter void (*destroy)(struct drm_connector *connector);
119752217195SDaniel Vetter
119852217195SDaniel Vetter /**
119952217195SDaniel Vetter * @atomic_duplicate_state:
120052217195SDaniel Vetter *
120152217195SDaniel Vetter * Duplicate the current atomic state for this connector and return it.
1202621a9993SGrazvydas Ignotas * The core and helpers guarantee that any atomic state duplicated with
120352217195SDaniel Vetter * this hook and still owned by the caller (i.e. not transferred to the
1204d574528aSDaniel Vetter * driver by calling &drm_mode_config_funcs.atomic_commit) will be
1205d574528aSDaniel Vetter * cleaned up by calling the @atomic_destroy_state hook in this
1206d574528aSDaniel Vetter * structure.
120752217195SDaniel Vetter *
1208ba1f665fSHaneen Mohammed * This callback is mandatory for atomic drivers.
1209ba1f665fSHaneen Mohammed *
1210ea0dd85aSDaniel Vetter * Atomic drivers which don't subclass &struct drm_connector_state should use
121152217195SDaniel Vetter * drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the
121252217195SDaniel Vetter * state structure to extend it with driver-private state should use
121352217195SDaniel Vetter * __drm_atomic_helper_connector_duplicate_state() to make sure shared state is
121452217195SDaniel Vetter * duplicated in a consistent fashion across drivers.
121552217195SDaniel Vetter *
1216d574528aSDaniel Vetter * It is an error to call this hook before &drm_connector.state has been
121752217195SDaniel Vetter * initialized correctly.
121852217195SDaniel Vetter *
121952217195SDaniel Vetter * NOTE:
122052217195SDaniel Vetter *
122152217195SDaniel Vetter * If the duplicate state references refcounted resources this hook must
122252217195SDaniel Vetter * acquire a reference for each of them. The driver must release these
122352217195SDaniel Vetter * references again in @atomic_destroy_state.
122452217195SDaniel Vetter *
122552217195SDaniel Vetter * RETURNS:
122652217195SDaniel Vetter *
122752217195SDaniel Vetter * Duplicated atomic state or NULL when the allocation failed.
122852217195SDaniel Vetter */
122952217195SDaniel Vetter struct drm_connector_state *(*atomic_duplicate_state)(struct drm_connector *connector);
123052217195SDaniel Vetter
123152217195SDaniel Vetter /**
123252217195SDaniel Vetter * @atomic_destroy_state:
123352217195SDaniel Vetter *
123452217195SDaniel Vetter * Destroy a state duplicated with @atomic_duplicate_state and release
123552217195SDaniel Vetter * or unreference all resources it references
1236ba1f665fSHaneen Mohammed *
1237ba1f665fSHaneen Mohammed * This callback is mandatory for atomic drivers.
123852217195SDaniel Vetter */
123952217195SDaniel Vetter void (*atomic_destroy_state)(struct drm_connector *connector,
124052217195SDaniel Vetter struct drm_connector_state *state);
124152217195SDaniel Vetter
124252217195SDaniel Vetter /**
124352217195SDaniel Vetter * @atomic_set_property:
124452217195SDaniel Vetter *
124552217195SDaniel Vetter * Decode a driver-private property value and store the decoded value
124652217195SDaniel Vetter * into the passed-in state structure. Since the atomic core decodes all
124752217195SDaniel Vetter * standardized properties (even for extensions beyond the core set of
124852217195SDaniel Vetter * properties which might not be implemented by all drivers) this
124952217195SDaniel Vetter * requires drivers to subclass the state structure.
125052217195SDaniel Vetter *
125152217195SDaniel Vetter * Such driver-private properties should really only be implemented for
125252217195SDaniel Vetter * truly hardware/vendor specific state. Instead it is preferred to
125352217195SDaniel Vetter * standardize atomic extension and decode the properties used to expose
125452217195SDaniel Vetter * such an extension in the core.
125552217195SDaniel Vetter *
125652217195SDaniel Vetter * Do not call this function directly, use
125752217195SDaniel Vetter * drm_atomic_connector_set_property() instead.
125852217195SDaniel Vetter *
125952217195SDaniel Vetter * This callback is optional if the driver does not support any
126052217195SDaniel Vetter * driver-private atomic properties.
126152217195SDaniel Vetter *
126252217195SDaniel Vetter * NOTE:
126352217195SDaniel Vetter *
126452217195SDaniel Vetter * This function is called in the state assembly phase of atomic
126552217195SDaniel Vetter * modesets, which can be aborted for any reason (including on
126652217195SDaniel Vetter * userspace's request to just check whether a configuration would be
126752217195SDaniel Vetter * possible). Drivers MUST NOT touch any persistent state (hardware or
126852217195SDaniel Vetter * software) or data structures except the passed in @state parameter.
126952217195SDaniel Vetter *
127052217195SDaniel Vetter * Also since userspace controls in which order properties are set this
127152217195SDaniel Vetter * function must not do any input validation (since the state update is
127252217195SDaniel Vetter * incomplete and hence likely inconsistent). Instead any such input
127352217195SDaniel Vetter * validation must be done in the various atomic_check callbacks.
127452217195SDaniel Vetter *
127552217195SDaniel Vetter * RETURNS:
127652217195SDaniel Vetter *
127752217195SDaniel Vetter * 0 if the property has been found, -EINVAL if the property isn't
127852217195SDaniel Vetter * implemented by the driver (which shouldn't ever happen, the core only
127952217195SDaniel Vetter * asks for properties attached to this connector). No other validation
128052217195SDaniel Vetter * is allowed by the driver. The core already checks that the property
128152217195SDaniel Vetter * value is within the range (integer, valid enum value, ...) the driver
128252217195SDaniel Vetter * set when registering the property.
128352217195SDaniel Vetter */
128452217195SDaniel Vetter int (*atomic_set_property)(struct drm_connector *connector,
128552217195SDaniel Vetter struct drm_connector_state *state,
128652217195SDaniel Vetter struct drm_property *property,
128752217195SDaniel Vetter uint64_t val);
128852217195SDaniel Vetter
128952217195SDaniel Vetter /**
129052217195SDaniel Vetter * @atomic_get_property:
129152217195SDaniel Vetter *
129252217195SDaniel Vetter * Reads out the decoded driver-private property. This is used to
129352217195SDaniel Vetter * implement the GETCONNECTOR IOCTL.
129452217195SDaniel Vetter *
129552217195SDaniel Vetter * Do not call this function directly, use
129652217195SDaniel Vetter * drm_atomic_connector_get_property() instead.
129752217195SDaniel Vetter *
129852217195SDaniel Vetter * This callback is optional if the driver does not support any
129952217195SDaniel Vetter * driver-private atomic properties.
130052217195SDaniel Vetter *
130152217195SDaniel Vetter * RETURNS:
130252217195SDaniel Vetter *
130352217195SDaniel Vetter * 0 on success, -EINVAL if the property isn't implemented by the
130452217195SDaniel Vetter * driver (which shouldn't ever happen, the core only asks for
130552217195SDaniel Vetter * properties attached to this connector).
130652217195SDaniel Vetter */
130752217195SDaniel Vetter int (*atomic_get_property)(struct drm_connector *connector,
130852217195SDaniel Vetter const struct drm_connector_state *state,
130952217195SDaniel Vetter struct drm_property *property,
131052217195SDaniel Vetter uint64_t *val);
1311fceffb32SRob Clark
1312fceffb32SRob Clark /**
1313fceffb32SRob Clark * @atomic_print_state:
1314fceffb32SRob Clark *
1315ea0dd85aSDaniel Vetter * If driver subclasses &struct drm_connector_state, it should implement
1316fceffb32SRob Clark * this optional hook for printing additional driver specific state.
1317fceffb32SRob Clark *
1318fceffb32SRob Clark * Do not call this directly, use drm_atomic_connector_print_state()
1319fceffb32SRob Clark * instead.
1320fceffb32SRob Clark */
1321fceffb32SRob Clark void (*atomic_print_state)(struct drm_printer *p,
1322fceffb32SRob Clark const struct drm_connector_state *state);
132372ad4968SHans de Goede
132472ad4968SHans de Goede /**
132572ad4968SHans de Goede * @oob_hotplug_event:
132672ad4968SHans de Goede *
132772ad4968SHans de Goede * This will get called when a hotplug-event for a drm-connector
132872ad4968SHans de Goede * has been received from a source outside the display driver / device.
132972ad4968SHans de Goede */
133072ad4968SHans de Goede void (*oob_hotplug_event)(struct drm_connector *connector);
13312509969aSDouglas Anderson
13322509969aSDouglas Anderson /**
13332509969aSDouglas Anderson * @debugfs_init:
13342509969aSDouglas Anderson *
13352509969aSDouglas Anderson * Allows connectors to create connector-specific debugfs files.
13362509969aSDouglas Anderson */
13372509969aSDouglas Anderson void (*debugfs_init)(struct drm_connector *connector, struct dentry *root);
133852217195SDaniel Vetter };
133952217195SDaniel Vetter
1340772cd52cSMaxime Ripard /**
1341772cd52cSMaxime Ripard * struct drm_cmdline_mode - DRM Mode passed through the kernel command-line
1342772cd52cSMaxime Ripard *
1343772cd52cSMaxime Ripard * Each connector can have an initial mode with additional options
1344772cd52cSMaxime Ripard * passed through the kernel command line. This structure allows to
1345772cd52cSMaxime Ripard * express those parameters and will be filled by the command-line
1346772cd52cSMaxime Ripard * parser.
1347772cd52cSMaxime Ripard */
134852217195SDaniel Vetter struct drm_cmdline_mode {
1349772cd52cSMaxime Ripard /**
13503aeeb13dSMaxime Ripard * @name:
13513aeeb13dSMaxime Ripard *
13523aeeb13dSMaxime Ripard * Name of the mode.
13533aeeb13dSMaxime Ripard */
13543aeeb13dSMaxime Ripard char name[DRM_DISPLAY_MODE_LEN];
13553aeeb13dSMaxime Ripard
13563aeeb13dSMaxime Ripard /**
1357772cd52cSMaxime Ripard * @specified:
1358772cd52cSMaxime Ripard *
1359772cd52cSMaxime Ripard * Has a mode been read from the command-line?
1360772cd52cSMaxime Ripard */
136152217195SDaniel Vetter bool specified;
1362772cd52cSMaxime Ripard
1363772cd52cSMaxime Ripard /**
1364772cd52cSMaxime Ripard * @refresh_specified:
1365772cd52cSMaxime Ripard *
1366772cd52cSMaxime Ripard * Did the mode have a preferred refresh rate?
1367772cd52cSMaxime Ripard */
136852217195SDaniel Vetter bool refresh_specified;
1369772cd52cSMaxime Ripard
1370772cd52cSMaxime Ripard /**
1371772cd52cSMaxime Ripard * @bpp_specified:
1372772cd52cSMaxime Ripard *
1373772cd52cSMaxime Ripard * Did the mode have a preferred BPP?
1374772cd52cSMaxime Ripard */
137552217195SDaniel Vetter bool bpp_specified;
1376772cd52cSMaxime Ripard
1377772cd52cSMaxime Ripard /**
13780e308efeSMaxime Ripard * @pixel_clock:
13790e308efeSMaxime Ripard *
13800e308efeSMaxime Ripard * Pixel Clock in kHz. Optional.
13810e308efeSMaxime Ripard */
13820e308efeSMaxime Ripard unsigned int pixel_clock;
13830e308efeSMaxime Ripard
13840e308efeSMaxime Ripard /**
1385772cd52cSMaxime Ripard * @xres:
1386772cd52cSMaxime Ripard *
1387772cd52cSMaxime Ripard * Active resolution on the X axis, in pixels.
1388772cd52cSMaxime Ripard */
1389772cd52cSMaxime Ripard int xres;
1390772cd52cSMaxime Ripard
1391772cd52cSMaxime Ripard /**
1392772cd52cSMaxime Ripard * @yres:
1393772cd52cSMaxime Ripard *
1394772cd52cSMaxime Ripard * Active resolution on the Y axis, in pixels.
1395772cd52cSMaxime Ripard */
1396772cd52cSMaxime Ripard int yres;
1397772cd52cSMaxime Ripard
1398772cd52cSMaxime Ripard /**
1399772cd52cSMaxime Ripard * @bpp:
1400772cd52cSMaxime Ripard *
1401772cd52cSMaxime Ripard * Bits per pixels for the mode.
1402772cd52cSMaxime Ripard */
140352217195SDaniel Vetter int bpp;
1404772cd52cSMaxime Ripard
1405772cd52cSMaxime Ripard /**
1406772cd52cSMaxime Ripard * @refresh:
1407772cd52cSMaxime Ripard *
1408772cd52cSMaxime Ripard * Refresh rate, in Hertz.
1409772cd52cSMaxime Ripard */
141052217195SDaniel Vetter int refresh;
1411772cd52cSMaxime Ripard
1412772cd52cSMaxime Ripard /**
1413772cd52cSMaxime Ripard * @rb:
1414772cd52cSMaxime Ripard *
1415772cd52cSMaxime Ripard * Do we need to use reduced blanking?
1416772cd52cSMaxime Ripard */
141752217195SDaniel Vetter bool rb;
1418772cd52cSMaxime Ripard
1419772cd52cSMaxime Ripard /**
1420772cd52cSMaxime Ripard * @interlace:
1421772cd52cSMaxime Ripard *
1422772cd52cSMaxime Ripard * The mode is interlaced.
1423772cd52cSMaxime Ripard */
142452217195SDaniel Vetter bool interlace;
1425772cd52cSMaxime Ripard
1426772cd52cSMaxime Ripard /**
1427772cd52cSMaxime Ripard * @cvt:
1428772cd52cSMaxime Ripard *
1429772cd52cSMaxime Ripard * The timings will be calculated using the VESA Coordinated
1430772cd52cSMaxime Ripard * Video Timings instead of looking up the mode from a table.
1431772cd52cSMaxime Ripard */
143252217195SDaniel Vetter bool cvt;
1433772cd52cSMaxime Ripard
1434772cd52cSMaxime Ripard /**
1435772cd52cSMaxime Ripard * @margins:
1436772cd52cSMaxime Ripard *
1437772cd52cSMaxime Ripard * Add margins to the mode calculation (1.8% of xres rounded
1438772cd52cSMaxime Ripard * down to 8 pixels and 1.8% of yres).
1439772cd52cSMaxime Ripard */
144052217195SDaniel Vetter bool margins;
1441772cd52cSMaxime Ripard
1442772cd52cSMaxime Ripard /**
1443772cd52cSMaxime Ripard * @force:
1444772cd52cSMaxime Ripard *
1445772cd52cSMaxime Ripard * Ignore the hotplug state of the connector, and force its
1446772cd52cSMaxime Ripard * state to one of the DRM_FORCE_* values.
1447772cd52cSMaxime Ripard */
144852217195SDaniel Vetter enum drm_connector_force force;
14491bf4e092SMaxime Ripard
14501bf4e092SMaxime Ripard /**
14511bf4e092SMaxime Ripard * @rotation_reflection:
14521bf4e092SMaxime Ripard *
14531bf4e092SMaxime Ripard * Initial rotation and reflection of the mode setup from the
14541bf4e092SMaxime Ripard * command line. See DRM_MODE_ROTATE_* and
14551bf4e092SMaxime Ripard * DRM_MODE_REFLECT_*. The only rotations supported are
14561bf4e092SMaxime Ripard * DRM_MODE_ROTATE_0 and DRM_MODE_ROTATE_180.
14571bf4e092SMaxime Ripard */
14581bf4e092SMaxime Ripard unsigned int rotation_reflection;
14593d46a300SMaxime Ripard
14603d46a300SMaxime Ripard /**
14614e7a4a6fSHans de Goede * @panel_orientation:
14624e7a4a6fSHans de Goede *
14634e7a4a6fSHans de Goede * drm-connector "panel orientation" property override value,
14644e7a4a6fSHans de Goede * DRM_MODE_PANEL_ORIENTATION_UNKNOWN if not set.
14654e7a4a6fSHans de Goede */
14664e7a4a6fSHans de Goede enum drm_panel_orientation panel_orientation;
14674e7a4a6fSHans de Goede
14684e7a4a6fSHans de Goede /**
14693d46a300SMaxime Ripard * @tv_margins: TV margins to apply to the mode.
14703d46a300SMaxime Ripard */
14713d46a300SMaxime Ripard struct drm_connector_tv_margins tv_margins;
1472e691c999SMaxime Ripard
1473e691c999SMaxime Ripard /**
1474e691c999SMaxime Ripard * @tv_mode: TV mode standard. See DRM_MODE_TV_MODE_*.
1475e691c999SMaxime Ripard */
1476e691c999SMaxime Ripard enum drm_connector_tv_mode tv_mode;
1477e691c999SMaxime Ripard
1478e691c999SMaxime Ripard /**
1479e691c999SMaxime Ripard * @tv_mode_specified:
1480e691c999SMaxime Ripard *
1481e691c999SMaxime Ripard * Did the mode have a preferred TV mode?
1482e691c999SMaxime Ripard */
1483e691c999SMaxime Ripard bool tv_mode_specified;
148452217195SDaniel Vetter };
148552217195SDaniel Vetter
148652217195SDaniel Vetter /**
148752217195SDaniel Vetter * struct drm_connector - central DRM connector control structure
148852217195SDaniel Vetter *
148952217195SDaniel Vetter * Each connector may be connected to one or more CRTCs, or may be clonable by
149052217195SDaniel Vetter * another connector if they can share a CRTC. Each connector also has a specific
149152217195SDaniel Vetter * position in the broader display (referred to as a 'screen' though it could
149252217195SDaniel Vetter * span multiple monitors).
149352217195SDaniel Vetter */
149452217195SDaniel Vetter struct drm_connector {
149592e1d263SDaniel Vetter /** @dev: parent DRM device */
149652217195SDaniel Vetter struct drm_device *dev;
149792e1d263SDaniel Vetter /** @kdev: kernel device for sysfs attributes */
149852217195SDaniel Vetter struct device *kdev;
149992e1d263SDaniel Vetter /** @attr: sysfs attributes */
150052217195SDaniel Vetter struct device_attribute *attr;
150148c429c6SHans de Goede /**
150248c429c6SHans de Goede * @fwnode: associated fwnode supplied by platform firmware
150348c429c6SHans de Goede *
150448c429c6SHans de Goede * Drivers can set this to associate a fwnode with a connector, drivers
150548c429c6SHans de Goede * are expected to get a reference on the fwnode when setting this.
150648c429c6SHans de Goede * drm_connector_cleanup() will call fwnode_handle_put() on this.
150748c429c6SHans de Goede */
150848c429c6SHans de Goede struct fwnode_handle *fwnode;
150992e1d263SDaniel Vetter
151092e1d263SDaniel Vetter /**
151192e1d263SDaniel Vetter * @head:
151292e1d263SDaniel Vetter *
151392e1d263SDaniel Vetter * List of all connectors on a @dev, linked from
151492e1d263SDaniel Vetter * &drm_mode_config.connector_list. Protected by
151592e1d263SDaniel Vetter * &drm_mode_config.connector_list_lock, but please only use
151692e1d263SDaniel Vetter * &drm_connector_list_iter to walk this list.
151792e1d263SDaniel Vetter */
151852217195SDaniel Vetter struct list_head head;
151952217195SDaniel Vetter
15203d3f7c1eSHans de Goede /**
15213d3f7c1eSHans de Goede * @global_connector_list_entry:
15223d3f7c1eSHans de Goede *
15233d3f7c1eSHans de Goede * Connector entry in the global connector-list, used by
15243d3f7c1eSHans de Goede * drm_connector_find_by_fwnode().
15253d3f7c1eSHans de Goede */
15263d3f7c1eSHans de Goede struct list_head global_connector_list_entry;
15273d3f7c1eSHans de Goede
152892e1d263SDaniel Vetter /** @base: base KMS object */
152952217195SDaniel Vetter struct drm_mode_object base;
153052217195SDaniel Vetter
153192e1d263SDaniel Vetter /** @name: human readable name, can be overwritten by the driver */
153252217195SDaniel Vetter char *name;
153352217195SDaniel Vetter
153452217195SDaniel Vetter /**
1535e73ab00eSDaniel Vetter * @mutex: Lock for general connector state, but currently only protects
1536d574528aSDaniel Vetter * @registered. Most of the connector state is still protected by
1537d574528aSDaniel Vetter * &drm_mode_config.mutex.
1538e73ab00eSDaniel Vetter */
1539e73ab00eSDaniel Vetter struct mutex mutex;
1540e73ab00eSDaniel Vetter
1541e73ab00eSDaniel Vetter /**
154252217195SDaniel Vetter * @index: Compacted connector index, which matches the position inside
154352217195SDaniel Vetter * the mode_config.list for drivers not supporting hot-add/removing. Can
154452217195SDaniel Vetter * be used as an array index. It is invariant over the lifetime of the
154552217195SDaniel Vetter * connector.
154652217195SDaniel Vetter */
154752217195SDaniel Vetter unsigned index;
154852217195SDaniel Vetter
154992e1d263SDaniel Vetter /**
155092e1d263SDaniel Vetter * @connector_type:
155192e1d263SDaniel Vetter * one of the DRM_MODE_CONNECTOR_<foo> types from drm_mode.h
155292e1d263SDaniel Vetter */
155352217195SDaniel Vetter int connector_type;
155492e1d263SDaniel Vetter /** @connector_type_id: index into connector type enum */
155552217195SDaniel Vetter int connector_type_id;
155692e1d263SDaniel Vetter /**
155792e1d263SDaniel Vetter * @interlace_allowed:
155892e1d263SDaniel Vetter * Can this connector handle interlaced modes? Only used by
155992e1d263SDaniel Vetter * drm_helper_probe_single_connector_modes() for mode filtering.
156092e1d263SDaniel Vetter */
156152217195SDaniel Vetter bool interlace_allowed;
156292e1d263SDaniel Vetter /**
156392e1d263SDaniel Vetter * @doublescan_allowed:
156492e1d263SDaniel Vetter * Can this connector handle doublescan? Only used by
156592e1d263SDaniel Vetter * drm_helper_probe_single_connector_modes() for mode filtering.
156692e1d263SDaniel Vetter */
156752217195SDaniel Vetter bool doublescan_allowed;
156892e1d263SDaniel Vetter /**
156992e1d263SDaniel Vetter * @stereo_allowed:
157092e1d263SDaniel Vetter * Can this connector handle stereo modes? Only used by
157192e1d263SDaniel Vetter * drm_helper_probe_single_connector_modes() for mode filtering.
157292e1d263SDaniel Vetter */
157352217195SDaniel Vetter bool stereo_allowed;
1574d8523153SShashank Sharma
1575d8523153SShashank Sharma /**
1576d8523153SShashank Sharma * @ycbcr_420_allowed : This bool indicates if this connector is
1577d8523153SShashank Sharma * capable of handling YCBCR 420 output. While parsing the EDID
15781e55a53aSMatt Roper * blocks it's very helpful to know if the source is capable of
1579d8523153SShashank Sharma * handling YCBCR 420 outputs.
1580d8523153SShashank Sharma */
1581d8523153SShashank Sharma bool ycbcr_420_allowed;
1582d8523153SShashank Sharma
1583e73ab00eSDaniel Vetter /**
158439b50c60SLyude Paul * @registration_state: Is this connector initializing, exposed
158539b50c60SLyude Paul * (registered) with userspace, or unregistered?
158639b50c60SLyude Paul *
1587e73ab00eSDaniel Vetter * Protected by @mutex.
1588e73ab00eSDaniel Vetter */
158939b50c60SLyude Paul enum drm_connector_registration_state registration_state;
159091eefc05SDaniel Vetter
159191eefc05SDaniel Vetter /**
159291eefc05SDaniel Vetter * @modes:
159391eefc05SDaniel Vetter * Modes available on this connector (from fill_modes() + user).
1594d574528aSDaniel Vetter * Protected by &drm_mode_config.mutex.
159591eefc05SDaniel Vetter */
1596d574528aSDaniel Vetter struct list_head modes;
159752217195SDaniel Vetter
159891eefc05SDaniel Vetter /**
159991eefc05SDaniel Vetter * @status:
160091eefc05SDaniel Vetter * One of the drm_connector_status enums (connected, not, or unknown).
1601d574528aSDaniel Vetter * Protected by &drm_mode_config.mutex.
160291eefc05SDaniel Vetter */
160352217195SDaniel Vetter enum drm_connector_status status;
160452217195SDaniel Vetter
160591eefc05SDaniel Vetter /**
160691eefc05SDaniel Vetter * @probed_modes:
160791eefc05SDaniel Vetter * These are modes added by probing with DDC or the BIOS, before
160891eefc05SDaniel Vetter * filtering is applied. Used by the probe helpers. Protected by
1609d574528aSDaniel Vetter * &drm_mode_config.mutex.
161091eefc05SDaniel Vetter */
161152217195SDaniel Vetter struct list_head probed_modes;
161252217195SDaniel Vetter
1613ae2a6da8SDaniel Vetter /**
1614ae2a6da8SDaniel Vetter * @display_info: Display information is filled from EDID information
1615ae2a6da8SDaniel Vetter * when a display is detected. For non hot-pluggable displays such as
1616ae2a6da8SDaniel Vetter * flat panels in embedded systems, the driver should initialize the
1617d574528aSDaniel Vetter * &drm_display_info.width_mm and &drm_display_info.height_mm fields
1618d574528aSDaniel Vetter * with the physical size of the display.
161991eefc05SDaniel Vetter *
1620d574528aSDaniel Vetter * Protected by &drm_mode_config.mutex.
1621ae2a6da8SDaniel Vetter */
162252217195SDaniel Vetter struct drm_display_info display_info;
162392e1d263SDaniel Vetter
162492e1d263SDaniel Vetter /** @funcs: connector control functions */
162552217195SDaniel Vetter const struct drm_connector_funcs *funcs;
162652217195SDaniel Vetter
162792e1d263SDaniel Vetter /**
162892e1d263SDaniel Vetter * @edid_blob_ptr: DRM property containing EDID if present. Protected by
162992e1d263SDaniel Vetter * &drm_mode_config.mutex. This should be updated only by calling
1630c555f023SDaniel Vetter * drm_connector_update_edid_property().
163192e1d263SDaniel Vetter */
163252217195SDaniel Vetter struct drm_property_blob *edid_blob_ptr;
163392e1d263SDaniel Vetter
163492e1d263SDaniel Vetter /** @properties: property tracking for this connector */
163552217195SDaniel Vetter struct drm_object_properties properties;
163652217195SDaniel Vetter
163792e1d263SDaniel Vetter /**
163892e1d263SDaniel Vetter * @scaling_mode_property: Optional atomic property to control the
163992e1d263SDaniel Vetter * upscaling. See drm_connector_attach_content_protection_property().
164092e1d263SDaniel Vetter */
16418f6e1e22SMaarten Lankhorst struct drm_property *scaling_mode_property;
16428f6e1e22SMaarten Lankhorst
164352217195SDaniel Vetter /**
1644ba1b0f6cSNicholas Kazlauskas * @vrr_capable_property: Optional property to help userspace
1645ba1b0f6cSNicholas Kazlauskas * query hardware support for variable refresh rate on a connector.
1646ba1b0f6cSNicholas Kazlauskas * connector. Drivers can add the property to a connector by
1647ba1b0f6cSNicholas Kazlauskas * calling drm_connector_attach_vrr_capable_property().
1648ba1b0f6cSNicholas Kazlauskas *
1649ba1b0f6cSNicholas Kazlauskas * This should be updated only by calling
1650ba1b0f6cSNicholas Kazlauskas * drm_connector_set_vrr_capable_property().
1651ba1b0f6cSNicholas Kazlauskas */
1652ba1b0f6cSNicholas Kazlauskas struct drm_property *vrr_capable_property;
1653ba1b0f6cSNicholas Kazlauskas
1654ba1b0f6cSNicholas Kazlauskas /**
1655d2c6a405SUma Shankar * @colorspace_property: Connector property to set the suitable
1656d2c6a405SUma Shankar * colorspace supported by the sink.
1657d2c6a405SUma Shankar */
1658d2c6a405SUma Shankar struct drm_property *colorspace_property;
1659d2c6a405SUma Shankar
1660d2c6a405SUma Shankar /**
166152217195SDaniel Vetter * @path_blob_ptr:
166252217195SDaniel Vetter *
166392e1d263SDaniel Vetter * DRM blob property data for the DP MST path property. This should only
166497e14fbeSDaniel Vetter * be updated by calling drm_connector_set_path_property().
166552217195SDaniel Vetter */
166652217195SDaniel Vetter struct drm_property_blob *path_blob_ptr;
166752217195SDaniel Vetter
166847e22ff1SRadhakrishna Sripada /**
166947e22ff1SRadhakrishna Sripada * @max_bpc_property: Default connector property for the max bpc to be
167047e22ff1SRadhakrishna Sripada * driven out of the connector.
167147e22ff1SRadhakrishna Sripada */
167247e22ff1SRadhakrishna Sripada struct drm_property *max_bpc_property;
167347e22ff1SRadhakrishna Sripada
1674334f74eeSHans de Goede /** @privacy_screen: drm_privacy_screen for this connector, or NULL. */
1675334f74eeSHans de Goede struct drm_privacy_screen *privacy_screen;
1676334f74eeSHans de Goede
1677334f74eeSHans de Goede /** @privacy_screen_notifier: privacy-screen notifier_block */
1678334f74eeSHans de Goede struct notifier_block privacy_screen_notifier;
1679334f74eeSHans de Goede
1680107fe904SRajat Jain /**
1681107fe904SRajat Jain * @privacy_screen_sw_state_property: Optional atomic property for the
1682107fe904SRajat Jain * connector to control the integrated privacy screen.
1683107fe904SRajat Jain */
1684107fe904SRajat Jain struct drm_property *privacy_screen_sw_state_property;
1685107fe904SRajat Jain
1686107fe904SRajat Jain /**
1687107fe904SRajat Jain * @privacy_screen_hw_state_property: Optional atomic property for the
1688107fe904SRajat Jain * connector to report the actual integrated privacy screen state.
1689107fe904SRajat Jain */
1690107fe904SRajat Jain struct drm_property *privacy_screen_hw_state_property;
1691107fe904SRajat Jain
169252217195SDaniel Vetter #define DRM_CONNECTOR_POLL_HPD (1 << 0)
169352217195SDaniel Vetter #define DRM_CONNECTOR_POLL_CONNECT (1 << 1)
169452217195SDaniel Vetter #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
169552217195SDaniel Vetter
1696ae2a6da8SDaniel Vetter /**
1697ae2a6da8SDaniel Vetter * @polled:
1698ae2a6da8SDaniel Vetter *
1699ae2a6da8SDaniel Vetter * Connector polling mode, a combination of
1700ae2a6da8SDaniel Vetter *
1701ae2a6da8SDaniel Vetter * DRM_CONNECTOR_POLL_HPD
1702ae2a6da8SDaniel Vetter * The connector generates hotplug events and doesn't need to be
1703ae2a6da8SDaniel Vetter * periodically polled. The CONNECT and DISCONNECT flags must not
1704ae2a6da8SDaniel Vetter * be set together with the HPD flag.
1705ae2a6da8SDaniel Vetter *
1706ae2a6da8SDaniel Vetter * DRM_CONNECTOR_POLL_CONNECT
1707ae2a6da8SDaniel Vetter * Periodically poll the connector for connection.
1708ae2a6da8SDaniel Vetter *
1709ae2a6da8SDaniel Vetter * DRM_CONNECTOR_POLL_DISCONNECT
171092e1d263SDaniel Vetter * Periodically poll the connector for disconnection, without
171192e1d263SDaniel Vetter * causing flickering even when the connector is in use. DACs should
171292e1d263SDaniel Vetter * rarely do this without a lot of testing.
1713ae2a6da8SDaniel Vetter *
1714ae2a6da8SDaniel Vetter * Set to 0 for connectors that don't support connection status
1715ae2a6da8SDaniel Vetter * discovery.
1716ae2a6da8SDaniel Vetter */
1717ae2a6da8SDaniel Vetter uint8_t polled;
171852217195SDaniel Vetter
171992e1d263SDaniel Vetter /**
172092e1d263SDaniel Vetter * @dpms: Current dpms state. For legacy drivers the
172192e1d263SDaniel Vetter * &drm_connector_funcs.dpms callback must update this. For atomic
172292e1d263SDaniel Vetter * drivers, this is handled by the core atomic code, and drivers must
172392e1d263SDaniel Vetter * only take &drm_crtc_state.active into account.
172492e1d263SDaniel Vetter */
172552217195SDaniel Vetter int dpms;
172652217195SDaniel Vetter
172792e1d263SDaniel Vetter /** @helper_private: mid-layer private data */
172852217195SDaniel Vetter const struct drm_connector_helper_funcs *helper_private;
172952217195SDaniel Vetter
173092e1d263SDaniel Vetter /** @cmdline_mode: mode line parsed from the kernel cmdline for this connector */
173152217195SDaniel Vetter struct drm_cmdline_mode cmdline_mode;
173292e1d263SDaniel Vetter /** @force: a DRM_FORCE_<foo> state for forced mode sets */
173352217195SDaniel Vetter enum drm_connector_force force;
173490b575f5SJani Nikula
17356aa145bcSJani Nikula /**
173690b575f5SJani Nikula * @edid_override: Override EDID set via debugfs.
173790b575f5SJani Nikula *
173890b575f5SJani Nikula * Do not modify or access outside of the drm_edid_override_* family of
173990b575f5SJani Nikula * functions.
17406aa145bcSJani Nikula */
174190b575f5SJani Nikula const struct drm_edid *edid_override;
174290b575f5SJani Nikula
174390b575f5SJani Nikula /**
174490b575f5SJani Nikula * @edid_override_mutex: Protect access to edid_override.
174590b575f5SJani Nikula */
174690b575f5SJani Nikula struct mutex edid_override_mutex;
174790b575f5SJani Nikula
17485186421cSStanislav Lisovskiy /** @epoch_counter: used to detect any other changes in connector, besides status */
17495186421cSStanislav Lisovskiy u64 epoch_counter;
175052217195SDaniel Vetter
175192e1d263SDaniel Vetter /**
175262afb4adSJosé Roberto de Souza * @possible_encoders: Bit mask of encoders that can drive this
175362afb4adSJosé Roberto de Souza * connector, drm_encoder_index() determines the index into the bitfield
175462afb4adSJosé Roberto de Souza * and the bits are set with drm_connector_attach_encoder().
175592e1d263SDaniel Vetter */
175662afb4adSJosé Roberto de Souza u32 possible_encoders;
175792e1d263SDaniel Vetter
17582e2b96efSDaniel Vetter /**
17592e2b96efSDaniel Vetter * @encoder: Currently bound encoder driving this connector, if any.
17602e2b96efSDaniel Vetter * Only really meaningful for non-atomic drivers. Atomic drivers should
17612e2b96efSDaniel Vetter * instead look at &drm_connector_state.best_encoder, and in case they
17622e2b96efSDaniel Vetter * need the CRTC driving this output, &drm_connector_state.crtc.
17632e2b96efSDaniel Vetter */
17642e2b96efSDaniel Vetter struct drm_encoder *encoder;
176552217195SDaniel Vetter
176652217195SDaniel Vetter #define MAX_ELD_BYTES 128
1767*f2196ad7SDmitry Baryshkov /** @eld: EDID-like data, if present, protected by @eld_mutex */
176852217195SDaniel Vetter uint8_t eld[MAX_ELD_BYTES];
1769*f2196ad7SDmitry Baryshkov /** @eld_mutex: protection for concurrenct access to @eld */
1770*f2196ad7SDmitry Baryshkov struct mutex eld_mutex;
1771*f2196ad7SDmitry Baryshkov
177292e1d263SDaniel Vetter /** @latency_present: AV delay info from ELD, if found */
177352217195SDaniel Vetter bool latency_present[2];
177492e1d263SDaniel Vetter /**
177592e1d263SDaniel Vetter * @video_latency: Video latency info from ELD, if found.
177692e1d263SDaniel Vetter * [0]: progressive, [1]: interlaced
177792e1d263SDaniel Vetter */
177892e1d263SDaniel Vetter int video_latency[2];
177992e1d263SDaniel Vetter /**
178092e1d263SDaniel Vetter * @audio_latency: audio latency info from ELD, if found
178192e1d263SDaniel Vetter * [0]: progressive, [1]: interlaced
178292e1d263SDaniel Vetter */
178352217195SDaniel Vetter int audio_latency[2];
1784e1a29c6cSAndrzej Pietrasiewicz
1785e1a29c6cSAndrzej Pietrasiewicz /**
1786e1a29c6cSAndrzej Pietrasiewicz * @ddc: associated ddc adapter.
1787e1a29c6cSAndrzej Pietrasiewicz * A connector usually has its associated ddc adapter. If a driver uses
1788e1a29c6cSAndrzej Pietrasiewicz * this field, then an appropriate symbolic link is created in connector
1789e1a29c6cSAndrzej Pietrasiewicz * sysfs directory to make it easy for the user to tell which i2c
1790e1a29c6cSAndrzej Pietrasiewicz * adapter is for a particular display.
1791100163dfSAndrzej Pietrasiewicz *
1792100163dfSAndrzej Pietrasiewicz * The field should be set by calling drm_connector_init_with_ddc().
1793e1a29c6cSAndrzej Pietrasiewicz */
1794e1a29c6cSAndrzej Pietrasiewicz struct i2c_adapter *ddc;
1795e1a29c6cSAndrzej Pietrasiewicz
179692e1d263SDaniel Vetter /**
179792e1d263SDaniel Vetter * @null_edid_counter: track sinks that give us all zeros for the EDID.
179892e1d263SDaniel Vetter * Needed to workaround some HW bugs where we get all 0s
179992e1d263SDaniel Vetter */
180092e1d263SDaniel Vetter int null_edid_counter;
180192e1d263SDaniel Vetter
180292e1d263SDaniel Vetter /** @bad_edid_counter: track sinks that give us an EDID with invalid checksum */
180352217195SDaniel Vetter unsigned bad_edid_counter;
180452217195SDaniel Vetter
180592e1d263SDaniel Vetter /**
180692e1d263SDaniel Vetter * @edid_corrupt: Indicates whether the last read EDID was corrupt. Used
180792e1d263SDaniel Vetter * in Displayport compliance testing - Displayport Link CTS Core 1.2
180892e1d263SDaniel Vetter * rev1.1 4.2.2.6
180952217195SDaniel Vetter */
181052217195SDaniel Vetter bool edid_corrupt;
1811e11f5bd8SJerry (Fangzhi) Zuo /**
1812e11f5bd8SJerry (Fangzhi) Zuo * @real_edid_checksum: real edid checksum for corrupted edid block.
1813e11f5bd8SJerry (Fangzhi) Zuo * Required in Displayport 1.4 compliance testing
1814e11f5bd8SJerry (Fangzhi) Zuo * rev1.1 4.2.2.6
1815e11f5bd8SJerry (Fangzhi) Zuo */
1816e11f5bd8SJerry (Fangzhi) Zuo u8 real_edid_checksum;
181752217195SDaniel Vetter
181892e1d263SDaniel Vetter /** @debugfs_entry: debugfs directory for this connector */
181952217195SDaniel Vetter struct dentry *debugfs_entry;
182052217195SDaniel Vetter
1821c9e42b72SDaniel Vetter /**
1822c9e42b72SDaniel Vetter * @state:
1823c9e42b72SDaniel Vetter *
1824c9e42b72SDaniel Vetter * Current atomic state for this connector.
1825c9e42b72SDaniel Vetter *
182692e1d263SDaniel Vetter * This is protected by &drm_mode_config.connection_mutex. Note that
1827c9e42b72SDaniel Vetter * nonblocking atomic commits access the current connector state without
1828c9e42b72SDaniel Vetter * taking locks. Either by going through the &struct drm_atomic_state
182977ac3b00SMaarten Lankhorst * pointers, see for_each_oldnew_connector_in_state(),
1830c9e42b72SDaniel Vetter * for_each_old_connector_in_state() and
1831c9e42b72SDaniel Vetter * for_each_new_connector_in_state(). Or through careful ordering of
1832c9e42b72SDaniel Vetter * atomic commit operations as implemented in the atomic helpers, see
1833c9e42b72SDaniel Vetter * &struct drm_crtc_commit.
1834c9e42b72SDaniel Vetter */
183552217195SDaniel Vetter struct drm_connector_state *state;
183652217195SDaniel Vetter
183792e1d263SDaniel Vetter /* DisplayID bits. FIXME: Extract into a substruct? */
183892e1d263SDaniel Vetter
183992e1d263SDaniel Vetter /**
184092e1d263SDaniel Vetter * @tile_blob_ptr:
184192e1d263SDaniel Vetter *
184292e1d263SDaniel Vetter * DRM blob property data for the tile property (used mostly by DP MST).
184392e1d263SDaniel Vetter * This is meant for screens which are driven through separate display
184492e1d263SDaniel Vetter * pipelines represented by &drm_crtc, which might not be running with
184592e1d263SDaniel Vetter * genlocked clocks. For tiled panels which are genlocked, like
184692e1d263SDaniel Vetter * dual-link LVDS or dual-link DSI, the driver should try to not expose
184792e1d263SDaniel Vetter * the tiling and virtualize both &drm_crtc and &drm_plane if needed.
184892e1d263SDaniel Vetter *
184992e1d263SDaniel Vetter * This should only be updated by calling
185097e14fbeSDaniel Vetter * drm_connector_set_tile_property().
185192e1d263SDaniel Vetter */
185292e1d263SDaniel Vetter struct drm_property_blob *tile_blob_ptr;
185392e1d263SDaniel Vetter
185492e1d263SDaniel Vetter /** @has_tile: is this connector connected to a tiled monitor */
185552217195SDaniel Vetter bool has_tile;
185692e1d263SDaniel Vetter /** @tile_group: tile group for the connected monitor */
185752217195SDaniel Vetter struct drm_tile_group *tile_group;
185892e1d263SDaniel Vetter /** @tile_is_single_monitor: whether the tile is one monitor housing */
185952217195SDaniel Vetter bool tile_is_single_monitor;
186052217195SDaniel Vetter
186192e1d263SDaniel Vetter /** @num_h_tile: number of horizontal tiles in the tile group */
186292e1d263SDaniel Vetter /** @num_v_tile: number of vertical tiles in the tile group */
186352217195SDaniel Vetter uint8_t num_h_tile, num_v_tile;
186492e1d263SDaniel Vetter /** @tile_h_loc: horizontal location of this tile */
186592e1d263SDaniel Vetter /** @tile_v_loc: vertical location of this tile */
186652217195SDaniel Vetter uint8_t tile_h_loc, tile_v_loc;
186792e1d263SDaniel Vetter /** @tile_h_size: horizontal size of this tile. */
186892e1d263SDaniel Vetter /** @tile_v_size: vertical size of this tile. */
186952217195SDaniel Vetter uint16_t tile_h_size, tile_v_size;
1870a703c550SDaniel Vetter
1871a703c550SDaniel Vetter /**
1872ea497bb9SDaniel Vetter * @free_node:
1873a703c550SDaniel Vetter *
187492e1d263SDaniel Vetter * List used only by &drm_connector_list_iter to be able to clean up a
1875ea497bb9SDaniel Vetter * connector from any context, in conjunction with
1876ea497bb9SDaniel Vetter * &drm_mode_config.connector_free_work.
1877a703c550SDaniel Vetter */
1878ea497bb9SDaniel Vetter struct llist_node free_node;
1879fbb5d035SUma Shankar
1880a09db883SUma Shankar /** @hdr_sink_metadata: HDR Metadata Information read from sink */
1881fbb5d035SUma Shankar struct hdr_sink_metadata hdr_sink_metadata;
188252217195SDaniel Vetter };
188352217195SDaniel Vetter
188452217195SDaniel Vetter #define obj_to_connector(x) container_of(x, struct drm_connector, base)
188552217195SDaniel Vetter
188652217195SDaniel Vetter int drm_connector_init(struct drm_device *dev,
188752217195SDaniel Vetter struct drm_connector *connector,
188852217195SDaniel Vetter const struct drm_connector_funcs *funcs,
188952217195SDaniel Vetter int connector_type);
1890100163dfSAndrzej Pietrasiewicz int drm_connector_init_with_ddc(struct drm_device *dev,
1891100163dfSAndrzej Pietrasiewicz struct drm_connector *connector,
1892100163dfSAndrzej Pietrasiewicz const struct drm_connector_funcs *funcs,
1893100163dfSAndrzej Pietrasiewicz int connector_type,
1894100163dfSAndrzej Pietrasiewicz struct i2c_adapter *ddc);
189535a3b82fSMaxime Ripard int drmm_connector_init(struct drm_device *dev,
189635a3b82fSMaxime Ripard struct drm_connector *connector,
189735a3b82fSMaxime Ripard const struct drm_connector_funcs *funcs,
189835a3b82fSMaxime Ripard int connector_type,
189935a3b82fSMaxime Ripard struct i2c_adapter *ddc);
19006b7e2d5cSGerd Hoffmann void drm_connector_attach_edid_property(struct drm_connector *connector);
190152217195SDaniel Vetter int drm_connector_register(struct drm_connector *connector);
190252217195SDaniel Vetter void drm_connector_unregister(struct drm_connector *connector);
1903cde4c44dSDaniel Vetter int drm_connector_attach_encoder(struct drm_connector *connector,
190452217195SDaniel Vetter struct drm_encoder *encoder);
190552217195SDaniel Vetter
190652217195SDaniel Vetter void drm_connector_cleanup(struct drm_connector *connector);
190773705732SVille Syrjälä
drm_connector_index(const struct drm_connector * connector)190873705732SVille Syrjälä static inline unsigned int drm_connector_index(const struct drm_connector *connector)
190952217195SDaniel Vetter {
191052217195SDaniel Vetter return connector->index;
191152217195SDaniel Vetter }
191252217195SDaniel Vetter
drm_connector_mask(const struct drm_connector * connector)191373705732SVille Syrjälä static inline u32 drm_connector_mask(const struct drm_connector *connector)
191473705732SVille Syrjälä {
191573705732SVille Syrjälä return 1 << connector->index;
191673705732SVille Syrjälä }
191773705732SVille Syrjälä
191852217195SDaniel Vetter /**
191952217195SDaniel Vetter * drm_connector_lookup - lookup connector object
192052217195SDaniel Vetter * @dev: DRM device
1921e7e62c7eSDave Airlie * @file_priv: drm file to check for lease against.
192252217195SDaniel Vetter * @id: connector object id
192352217195SDaniel Vetter *
192452217195SDaniel Vetter * This function looks up the connector object specified by id
192552217195SDaniel Vetter * add takes a reference to it.
192652217195SDaniel Vetter */
drm_connector_lookup(struct drm_device * dev,struct drm_file * file_priv,uint32_t id)192752217195SDaniel Vetter static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev,
1928418da172SKeith Packard struct drm_file *file_priv,
192952217195SDaniel Vetter uint32_t id)
193052217195SDaniel Vetter {
193152217195SDaniel Vetter struct drm_mode_object *mo;
1932418da172SKeith Packard mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CONNECTOR);
193352217195SDaniel Vetter return mo ? obj_to_connector(mo) : NULL;
193452217195SDaniel Vetter }
193552217195SDaniel Vetter
193652217195SDaniel Vetter /**
1937ad093607SThierry Reding * drm_connector_get - acquire a connector reference
1938ad093607SThierry Reding * @connector: DRM connector
193952217195SDaniel Vetter *
194052217195SDaniel Vetter * This function increments the connector's refcount.
194152217195SDaniel Vetter */
drm_connector_get(struct drm_connector * connector)1942ad093607SThierry Reding static inline void drm_connector_get(struct drm_connector *connector)
194352217195SDaniel Vetter {
1944ad093607SThierry Reding drm_mode_object_get(&connector->base);
194552217195SDaniel Vetter }
194652217195SDaniel Vetter
194752217195SDaniel Vetter /**
1948ad093607SThierry Reding * drm_connector_put - release a connector reference
1949ad093607SThierry Reding * @connector: DRM connector
195052217195SDaniel Vetter *
1951ad093607SThierry Reding * This function decrements the connector's reference count and frees the
1952ad093607SThierry Reding * object if the reference count drops to zero.
1953ad093607SThierry Reding */
drm_connector_put(struct drm_connector * connector)1954ad093607SThierry Reding static inline void drm_connector_put(struct drm_connector *connector)
1955ad093607SThierry Reding {
1956ad093607SThierry Reding drm_mode_object_put(&connector->base);
1957ad093607SThierry Reding }
1958ad093607SThierry Reding
1959ad093607SThierry Reding /**
196039b50c60SLyude Paul * drm_connector_is_unregistered - has the connector been unregistered from
196139b50c60SLyude Paul * userspace?
196239b50c60SLyude Paul * @connector: DRM connector
196339b50c60SLyude Paul *
196439b50c60SLyude Paul * Checks whether or not @connector has been unregistered from userspace.
196539b50c60SLyude Paul *
196639b50c60SLyude Paul * Returns:
196739b50c60SLyude Paul * True if the connector was unregistered, false if the connector is
196839b50c60SLyude Paul * registered or has not yet been registered with userspace.
196939b50c60SLyude Paul */
197039b50c60SLyude Paul static inline bool
drm_connector_is_unregistered(struct drm_connector * connector)197139b50c60SLyude Paul drm_connector_is_unregistered(struct drm_connector *connector)
197239b50c60SLyude Paul {
197339b50c60SLyude Paul return READ_ONCE(connector->registration_state) ==
197439b50c60SLyude Paul DRM_CONNECTOR_UNREGISTERED;
197539b50c60SLyude Paul }
197639b50c60SLyude Paul
197772ad4968SHans de Goede void drm_connector_oob_hotplug_event(struct fwnode_handle *connector_fwnode);
1978b35f90f2SLaurent Pinchart const char *drm_get_connector_type_name(unsigned int connector_type);
197952217195SDaniel Vetter const char *drm_get_connector_status_name(enum drm_connector_status status);
198052217195SDaniel Vetter const char *drm_get_subpixel_order_name(enum subpixel_order order);
198152217195SDaniel Vetter const char *drm_get_dpms_name(int val);
198252217195SDaniel Vetter const char *drm_get_dvi_i_subconnector_name(int val);
198352217195SDaniel Vetter const char *drm_get_dvi_i_select_name(int val);
19847d63cd85SMaxime Ripard const char *drm_get_tv_mode_name(int val);
198552217195SDaniel Vetter const char *drm_get_tv_subconnector_name(int val);
198652217195SDaniel Vetter const char *drm_get_tv_select_name(int val);
1987e5b92773SOleg Vasilev const char *drm_get_dp_subconnector_name(int val);
198824557865SSean Paul const char *drm_get_content_protection_name(int val);
19897672dbbaSRamalingam C const char *drm_get_hdcp_content_type_name(int val);
199052217195SDaniel Vetter
1991d4613e3eSMaxime Ripard int drm_get_tv_mode_from_name(const char *name, size_t len);
1992d4613e3eSMaxime Ripard
199352217195SDaniel Vetter int drm_mode_create_dvi_i_properties(struct drm_device *dev);
1994e5b92773SOleg Vasilev void drm_connector_attach_dp_subconnector_property(struct drm_connector *connector);
1995e5b92773SOleg Vasilev
19966c4f52dcSBoris Brezillon int drm_mode_create_tv_margin_properties(struct drm_device *dev);
199780ed86d4SMaxime Ripard int drm_mode_create_tv_properties_legacy(struct drm_device *dev,
199852217195SDaniel Vetter unsigned int num_modes,
199952217195SDaniel Vetter const char * const modes[]);
20007d63cd85SMaxime Ripard int drm_mode_create_tv_properties(struct drm_device *dev,
20017d63cd85SMaxime Ripard unsigned int supported_tv_modes);
20026c4f52dcSBoris Brezillon void drm_connector_attach_tv_margin_properties(struct drm_connector *conn);
200352217195SDaniel Vetter int drm_mode_create_scaling_mode_property(struct drm_device *dev);
200450525c33SStanislav Lisovskiy int drm_connector_attach_content_type_property(struct drm_connector *dev);
20058f6e1e22SMaarten Lankhorst int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
20068f6e1e22SMaarten Lankhorst u32 scaling_mode_mask);
2007ba1b0f6cSNicholas Kazlauskas int drm_connector_attach_vrr_capable_property(
2008ba1b0f6cSNicholas Kazlauskas struct drm_connector *connector);
200921f79128SMaxime Ripard int drm_connector_attach_colorspace_property(struct drm_connector *connector);
2010e057b52cSMaxime Ripard int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector);
201172921cdfSMaxime Ripard bool drm_connector_atomic_hdr_metadata_equal(struct drm_connector_state *old_state,
201272921cdfSMaxime Ripard struct drm_connector_state *new_state);
201352217195SDaniel Vetter int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
2014c265f340SHarry Wentland int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector,
2015c265f340SHarry Wentland u32 supported_colorspaces);
2016c265f340SHarry Wentland int drm_mode_create_dp_colorspace_property(struct drm_connector *connector,
2017c265f340SHarry Wentland u32 supported_colorspaces);
201850525c33SStanislav Lisovskiy int drm_mode_create_content_type_property(struct drm_device *dev);
201952217195SDaniel Vetter int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
202052217195SDaniel Vetter
202197e14fbeSDaniel Vetter int drm_connector_set_path_property(struct drm_connector *connector,
202252217195SDaniel Vetter const char *path);
202397e14fbeSDaniel Vetter int drm_connector_set_tile_property(struct drm_connector *connector);
2024c555f023SDaniel Vetter int drm_connector_update_edid_property(struct drm_connector *connector,
202552217195SDaniel Vetter const struct edid *edid);
202697e14fbeSDaniel Vetter void drm_connector_set_link_status_property(struct drm_connector *connector,
202740ee6fbeSManasi Navare uint64_t link_status);
2028ba1b0f6cSNicholas Kazlauskas void drm_connector_set_vrr_capable_property(
2029ba1b0f6cSNicholas Kazlauskas struct drm_connector *connector, bool capable);
203069654c63SDerek Basehore int drm_connector_set_panel_orientation(
203169654c63SDerek Basehore struct drm_connector *connector,
203269654c63SDerek Basehore enum drm_panel_orientation panel_orientation);
203369654c63SDerek Basehore int drm_connector_set_panel_orientation_with_quirk(
203469654c63SDerek Basehore struct drm_connector *connector,
203569654c63SDerek Basehore enum drm_panel_orientation panel_orientation,
203669654c63SDerek Basehore int width, int height);
20375e41b01aSHsin-Yi Wang int drm_connector_set_orientation_from_panel(
20385e41b01aSHsin-Yi Wang struct drm_connector *connector,
20395e41b01aSHsin-Yi Wang struct drm_panel *panel);
204047e22ff1SRadhakrishna Sripada int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
204147e22ff1SRadhakrishna Sripada int min, int max);
2042107fe904SRajat Jain void drm_connector_create_privacy_screen_properties(struct drm_connector *conn);
2043107fe904SRajat Jain void drm_connector_attach_privacy_screen_properties(struct drm_connector *conn);
2044334f74eeSHans de Goede void drm_connector_attach_privacy_screen_provider(
2045334f74eeSHans de Goede struct drm_connector *connector, struct drm_privacy_screen *priv);
2046334f74eeSHans de Goede void drm_connector_update_privacy_screen(const struct drm_connector_state *connector_state);
2047afb21ea6SDaniel Vetter
2048afb21ea6SDaniel Vetter /**
20499498c19bSDaniel Vetter * struct drm_tile_group - Tile group metadata
20509498c19bSDaniel Vetter * @refcount: reference count
20519498c19bSDaniel Vetter * @dev: DRM device
20529498c19bSDaniel Vetter * @id: tile group id exposed to userspace
20539498c19bSDaniel Vetter * @group_data: Sink-private data identifying this group
20549498c19bSDaniel Vetter *
20559498c19bSDaniel Vetter * @group_data corresponds to displayid vend/prod/serial for external screens
20569498c19bSDaniel Vetter * with an EDID.
20579498c19bSDaniel Vetter */
20589498c19bSDaniel Vetter struct drm_tile_group {
20599498c19bSDaniel Vetter struct kref refcount;
20609498c19bSDaniel Vetter struct drm_device *dev;
20619498c19bSDaniel Vetter int id;
20629498c19bSDaniel Vetter u8 group_data[8];
20639498c19bSDaniel Vetter };
20649498c19bSDaniel Vetter
20659498c19bSDaniel Vetter struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
2066267ea759SVille Syrjälä const char topology[8]);
20679498c19bSDaniel Vetter struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev,
2068267ea759SVille Syrjälä const char topology[8]);
20699498c19bSDaniel Vetter void drm_mode_put_tile_group(struct drm_device *dev,
20709498c19bSDaniel Vetter struct drm_tile_group *tg);
20719498c19bSDaniel Vetter
20729498c19bSDaniel Vetter /**
2073613051daSDaniel Vetter * struct drm_connector_list_iter - connector_list iterator
2074613051daSDaniel Vetter *
2075613051daSDaniel Vetter * This iterator tracks state needed to be able to walk the connector_list
2076613051daSDaniel Vetter * within struct drm_mode_config. Only use together with
2077b982dab1SThierry Reding * drm_connector_list_iter_begin(), drm_connector_list_iter_end() and
2078613051daSDaniel Vetter * drm_connector_list_iter_next() respectively the convenience macro
2079613051daSDaniel Vetter * drm_for_each_connector_iter().
208033e1fc06SSimon Ser *
208133e1fc06SSimon Ser * Note that the return value of drm_connector_list_iter_next() is only valid
208233e1fc06SSimon Ser * up to the next drm_connector_list_iter_next() or
208333e1fc06SSimon Ser * drm_connector_list_iter_end() call. If you want to use the connector later,
208433e1fc06SSimon Ser * then you need to grab your own reference first using drm_connector_get().
2085613051daSDaniel Vetter */
2086613051daSDaniel Vetter struct drm_connector_list_iter {
2087613051daSDaniel Vetter /* private: */
2088613051daSDaniel Vetter struct drm_device *dev;
2089613051daSDaniel Vetter struct drm_connector *conn;
2090613051daSDaniel Vetter };
2091613051daSDaniel Vetter
2092b982dab1SThierry Reding void drm_connector_list_iter_begin(struct drm_device *dev,
2093613051daSDaniel Vetter struct drm_connector_list_iter *iter);
2094613051daSDaniel Vetter struct drm_connector *
2095613051daSDaniel Vetter drm_connector_list_iter_next(struct drm_connector_list_iter *iter);
2096b982dab1SThierry Reding void drm_connector_list_iter_end(struct drm_connector_list_iter *iter);
2097613051daSDaniel Vetter
209838cb8d96SVille Syrjälä bool drm_connector_has_possible_encoder(struct drm_connector *connector,
209938cb8d96SVille Syrjälä struct drm_encoder *encoder);
2100035d53e0SHarry Wentland const char *drm_get_colorspace_name(enum drm_colorspace colorspace);
210138cb8d96SVille Syrjälä
2102613051daSDaniel Vetter /**
2103613051daSDaniel Vetter * drm_for_each_connector_iter - connector_list iterator macro
2104ea0dd85aSDaniel Vetter * @connector: &struct drm_connector pointer used as cursor
2105ea0dd85aSDaniel Vetter * @iter: &struct drm_connector_list_iter
2106613051daSDaniel Vetter *
2107613051daSDaniel Vetter * Note that @connector is only valid within the list body, if you want to use
2108b982dab1SThierry Reding * @connector after calling drm_connector_list_iter_end() then you need to grab
21095e851c9dSGabriel Krisman Bertazi * your own reference first using drm_connector_get().
2110613051daSDaniel Vetter */
2111613051daSDaniel Vetter #define drm_for_each_connector_iter(connector, iter) \
2112613051daSDaniel Vetter while ((connector = drm_connector_list_iter_next(iter)))
2113613051daSDaniel Vetter
211483aefbb8SVille Syrjälä /**
211583aefbb8SVille Syrjälä * drm_connector_for_each_possible_encoder - iterate connector's possible encoders
211683aefbb8SVille Syrjälä * @connector: &struct drm_connector pointer
211783aefbb8SVille Syrjälä * @encoder: &struct drm_encoder pointer used as cursor
211883aefbb8SVille Syrjälä */
211962afb4adSJosé Roberto de Souza #define drm_connector_for_each_possible_encoder(connector, encoder) \
212062afb4adSJosé Roberto de Souza drm_for_each_encoder_mask(encoder, (connector)->dev, \
212162afb4adSJosé Roberto de Souza (connector)->possible_encoders)
212283aefbb8SVille Syrjälä
212352217195SDaniel Vetter #endif
2124