/*1* Copyright (c) 2016 Intel Corporation2*3* Permission to use, copy, modify, distribute, and sell this software and its4* documentation for any purpose is hereby granted without fee, provided that5* the above copyright notice appear in all copies and that both that copyright6* notice and this permission notice appear in supporting documentation, and7* that the name of the copyright holders not be used in advertising or8* publicity pertaining to distribution of the software without specific,9* written prior permission. The copyright holders make no representations10* about the suitability of this software for any purpose. It is provided "as11* is" without express or implied warranty.12*13* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,14* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO15* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR16* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,17* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER18* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE19* OF THIS SOFTWARE.20*/2122#ifndef __DRM_CONNECTOR_H__23#define __DRM_CONNECTOR_H__2425#include <linux/list.h>26#include <linux/llist.h>27#include <linux/ctype.h>28#include <linux/hdmi.h>29#include <linux/notifier.h>30#include <drm/drm_mode_object.h>31#include <drm/drm_util.h>32#include <drm/drm_property.h>3334#include <uapi/drm/drm_mode.h>3536struct drm_connector_helper_funcs;37struct drm_modeset_acquire_ctx;38struct drm_device;39struct drm_crtc;40struct drm_display_mode;41struct drm_encoder;42struct drm_panel;43struct drm_property;44struct drm_property_blob;45struct drm_printer;46struct drm_privacy_screen;47struct drm_edid;48struct edid;49struct hdmi_codec_daifmt;50struct hdmi_codec_params;51struct i2c_adapter;5253enum drm_connector_force {54DRM_FORCE_UNSPECIFIED,55DRM_FORCE_OFF,56DRM_FORCE_ON, /* force on analog part normally */57DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */58};5960/**61* enum drm_connector_status - status for a &drm_connector62*63* This enum is used to track the connector status. There are no separate64* #defines for the uapi!65*/66enum drm_connector_status {67/**68* @connector_status_connected: The connector is definitely connected to69* a sink device, and can be enabled.70*/71connector_status_connected = 1,72/**73* @connector_status_disconnected: The connector isn't connected to a74* sink device which can be autodetect. For digital outputs like DP or75* HDMI (which can be realiable probed) this means there's really76* nothing there. It is driver-dependent whether a connector with this77* status can be lit up or not.78*/79connector_status_disconnected = 2,80/**81* @connector_status_unknown: The connector's status could not be82* reliably detected. This happens when probing would either cause83* flicker (like load-detection when the connector is in use), or when a84* hardware resource isn't available (like when load-detection needs a85* free CRTC). It should be possible to light up the connector with one86* of the listed fallback modes. For default configuration userspace87* should only try to light up connectors with unknown status when88* there's not connector with @connector_status_connected.89*/90connector_status_unknown = 3,91};9293/**94* enum drm_connector_registration_state - userspace registration status for95* a &drm_connector96*97* This enum is used to track the status of initializing a connector and98* registering it with userspace, so that DRM can prevent bogus modesets on99* connectors that no longer exist.100*/101enum drm_connector_registration_state {102/**103* @DRM_CONNECTOR_INITIALIZING: The connector has just been created,104* but has yet to be exposed to userspace. There should be no105* additional restrictions to how the state of this connector may be106* modified.107*/108DRM_CONNECTOR_INITIALIZING = 0,109110/**111* @DRM_CONNECTOR_REGISTERED: The connector has been fully initialized112* and registered with sysfs, as such it has been exposed to113* userspace. There should be no additional restrictions to how the114* state of this connector may be modified.115*/116DRM_CONNECTOR_REGISTERED = 1,117118/**119* @DRM_CONNECTOR_UNREGISTERED: The connector has either been exposed120* to userspace and has since been unregistered and removed from121* userspace, or the connector was unregistered before it had a chance122* to be exposed to userspace (e.g. still in the123* @DRM_CONNECTOR_INITIALIZING state). When a connector is124* unregistered, there are additional restrictions to how its state125* may be modified:126*127* - An unregistered connector may only have its DPMS changed from128* On->Off. Once DPMS is changed to Off, it may not be switched back129* to On.130* - Modesets are not allowed on unregistered connectors, unless they131* would result in disabling its assigned CRTCs. This means132* disabling a CRTC on an unregistered connector is OK, but enabling133* one is not.134* - Removing a CRTC from an unregistered connector is OK, but new135* CRTCs may never be assigned to an unregistered connector.136*/137DRM_CONNECTOR_UNREGISTERED = 2,138};139140enum subpixel_order {141SubPixelUnknown = 0,142SubPixelHorizontalRGB,143SubPixelHorizontalBGR,144SubPixelVerticalRGB,145SubPixelVerticalBGR,146SubPixelNone,147148};149150/**151* enum drm_connector_tv_mode - Analog TV output mode152*153* This enum is used to indicate the TV output mode used on an analog TV154* connector.155*156* WARNING: The values of this enum is uABI since they're exposed in the157* "TV mode" connector property.158*/159enum drm_connector_tv_mode {160/**161* @DRM_MODE_TV_MODE_NTSC: CCIR System M (aka 525-lines)162* together with the NTSC Color Encoding.163*/164DRM_MODE_TV_MODE_NTSC,165166/**167* @DRM_MODE_TV_MODE_NTSC_443: Variant of168* @DRM_MODE_TV_MODE_NTSC. Uses a color subcarrier frequency169* of 4.43 MHz.170*/171DRM_MODE_TV_MODE_NTSC_443,172173/**174* @DRM_MODE_TV_MODE_NTSC_J: Variant of @DRM_MODE_TV_MODE_NTSC175* used in Japan. Uses a black level equals to the blanking176* level.177*/178DRM_MODE_TV_MODE_NTSC_J,179180/**181* @DRM_MODE_TV_MODE_PAL: CCIR System B together with the PAL182* color system.183*/184DRM_MODE_TV_MODE_PAL,185186/**187* @DRM_MODE_TV_MODE_PAL_M: CCIR System M (aka 525-lines)188* together with the PAL color encoding189*/190DRM_MODE_TV_MODE_PAL_M,191192/**193* @DRM_MODE_TV_MODE_PAL_N: CCIR System N together with the PAL194* color encoding. It uses 625 lines, but has a color subcarrier195* frequency of 3.58MHz, the SECAM color space, and narrower196* channels compared to most of the other PAL variants.197*/198DRM_MODE_TV_MODE_PAL_N,199200/**201* @DRM_MODE_TV_MODE_SECAM: CCIR System B together with the202* SECAM color system.203*/204DRM_MODE_TV_MODE_SECAM,205206/**207* @DRM_MODE_TV_MODE_MONOCHROME: Use timings appropriate to208* the DRM mode, including equalizing pulses for a 525-line209* or 625-line mode, with no pedestal or color encoding.210*/211DRM_MODE_TV_MODE_MONOCHROME,212213/**214* @DRM_MODE_TV_MODE_MAX: Number of analog TV output modes.215*216* Internal implementation detail; this is not uABI.217*/218DRM_MODE_TV_MODE_MAX,219};220221/**222* struct drm_scrambling: sink's scrambling support.223*/224struct drm_scrambling {225/**226* @supported: scrambling supported for rates > 340 Mhz.227*/228bool supported;229/**230* @low_rates: scrambling supported for rates <= 340 Mhz.231*/232bool low_rates;233};234235/*236* struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink237*238* Provides SCDC register support and capabilities related information on a239* HDMI 2.0 sink. In case of a HDMI 1.4 sink, all parameter must be 0.240*/241struct drm_scdc {242/**243* @supported: status control & data channel present.244*/245bool supported;246/**247* @read_request: sink is capable of generating scdc read request.248*/249bool read_request;250/**251* @scrambling: sink's scrambling capabilities252*/253struct drm_scrambling scrambling;254};255256/**257* struct drm_hdmi_dsc_cap - DSC capabilities of HDMI sink258*259* Describes the DSC support provided by HDMI 2.1 sink.260* The information is fetched fom additional HFVSDB blocks defined261* for HDMI 2.1.262*/263struct drm_hdmi_dsc_cap {264/** @v_1p2: flag for dsc1.2 version support by sink */265bool v_1p2;266267/** @native_420: Does sink support DSC with 4:2:0 compression */268bool native_420;269270/**271* @all_bpp: Does sink support all bpp with 4:4:4: or 4:2:2272* compressed formats273*/274bool all_bpp;275276/**277* @bpc_supported: compressed bpc supported by sink : 10, 12 or 16 bpc278*/279u8 bpc_supported;280281/** @max_slices: maximum number of Horizontal slices supported by */282u8 max_slices;283284/** @clk_per_slice : max pixel clock in MHz supported per slice */285int clk_per_slice;286287/** @max_lanes : dsc max lanes supported for Fixed rate Link training */288u8 max_lanes;289290/** @max_frl_rate_per_lane : maximum frl rate with DSC per lane */291u8 max_frl_rate_per_lane;292293/** @total_chunk_kbytes: max size of chunks in KBs supported per line*/294u8 total_chunk_kbytes;295};296297/**298* struct drm_hdmi_info - runtime information about the connected HDMI sink299*300* Describes if a given display supports advanced HDMI 2.0 features.301* This information is available in CEA-861-F extension blocks (like HF-VSDB).302*/303struct drm_hdmi_info {304/** @scdc: sink's scdc support and capabilities */305struct drm_scdc scdc;306307/**308* @y420_vdb_modes: bitmap of modes which can support ycbcr420309* output only (not normal RGB/YCBCR444/422 outputs). The max VIC310* defined by the CEA-861-G spec is 219, so the size is 256 bits to map311* up to 256 VICs.312*/313unsigned long y420_vdb_modes[BITS_TO_LONGS(256)];314315/**316* @y420_cmdb_modes: bitmap of modes which can support ycbcr420317* output also, along with normal HDMI outputs. The max VIC defined by318* the CEA-861-G spec is 219, so the size is 256 bits to map up to 256319* VICs.320*/321unsigned long y420_cmdb_modes[BITS_TO_LONGS(256)];322323/** @y420_dc_modes: bitmap of deep color support index */324u8 y420_dc_modes;325326/** @max_frl_rate_per_lane: support fixed rate link */327u8 max_frl_rate_per_lane;328329/** @max_lanes: supported by sink */330u8 max_lanes;331332/** @dsc_cap: DSC capabilities of the sink */333struct drm_hdmi_dsc_cap dsc_cap;334};335336/**337* enum drm_link_status - connector's link_status property value338*339* This enum is used as the connector's link status property value.340* It is set to the values defined in uapi.341*342* @DRM_LINK_STATUS_GOOD: DP Link is Good as a result of successful343* link training344* @DRM_LINK_STATUS_BAD: DP Link is BAD as a result of link training345* failure346*/347enum drm_link_status {348DRM_LINK_STATUS_GOOD = DRM_MODE_LINK_STATUS_GOOD,349DRM_LINK_STATUS_BAD = DRM_MODE_LINK_STATUS_BAD,350};351352/**353* enum drm_panel_orientation - panel_orientation info for &drm_display_info354*355* This enum is used to track the (LCD) panel orientation. There are no356* separate #defines for the uapi!357*358* @DRM_MODE_PANEL_ORIENTATION_UNKNOWN: The drm driver has not provided any359* panel orientation information (normal360* for non panels) in this case the "panel361* orientation" connector prop will not be362* attached.363* @DRM_MODE_PANEL_ORIENTATION_NORMAL: The top side of the panel matches the364* top side of the device's casing.365* @DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP: The top side of the panel matches the366* bottom side of the device's casing, iow367* the panel is mounted upside-down.368* @DRM_MODE_PANEL_ORIENTATION_LEFT_UP: The left side of the panel matches the369* top side of the device's casing.370* @DRM_MODE_PANEL_ORIENTATION_RIGHT_UP: The right side of the panel matches the371* top side of the device's casing.372*/373enum drm_panel_orientation {374DRM_MODE_PANEL_ORIENTATION_UNKNOWN = -1,375DRM_MODE_PANEL_ORIENTATION_NORMAL = 0,376DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP,377DRM_MODE_PANEL_ORIENTATION_LEFT_UP,378DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,379};380381/**382* enum drm_hdmi_broadcast_rgb - Broadcast RGB Selection for an HDMI @drm_connector383*/384enum drm_hdmi_broadcast_rgb {385/**386* @DRM_HDMI_BROADCAST_RGB_AUTO: The RGB range is selected387* automatically based on the mode.388*/389DRM_HDMI_BROADCAST_RGB_AUTO,390391/**392* @DRM_HDMI_BROADCAST_RGB_FULL: Full range RGB is forced.393*/394DRM_HDMI_BROADCAST_RGB_FULL,395396/**397* @DRM_HDMI_BROADCAST_RGB_LIMITED: Limited range RGB is forced.398*/399DRM_HDMI_BROADCAST_RGB_LIMITED,400};401402const char *403drm_hdmi_connector_get_broadcast_rgb_name(enum drm_hdmi_broadcast_rgb broadcast_rgb);404const char *405drm_hdmi_connector_get_output_format_name(enum hdmi_colorspace fmt);406407/**408* struct drm_monitor_range_info - Panel's Monitor range in EDID for409* &drm_display_info410*411* This struct is used to store a frequency range supported by panel412* as parsed from EDID's detailed monitor range descriptor block.413*414* @min_vfreq: This is the min supported refresh rate in Hz from415* EDID's detailed monitor range.416* @max_vfreq: This is the max supported refresh rate in Hz from417* EDID's detailed monitor range418*/419struct drm_monitor_range_info {420u16 min_vfreq;421u16 max_vfreq;422};423424/**425* struct drm_luminance_range_info - Panel's luminance range for426* &drm_display_info. Calculated using data in EDID427*428* This struct is used to store a luminance range supported by panel429* as calculated using data from EDID's static hdr metadata.430*431* @min_luminance: This is the min supported luminance value432*433* @max_luminance: This is the max supported luminance value434*/435struct drm_luminance_range_info {436u32 min_luminance;437u32 max_luminance;438};439440/**441* enum drm_privacy_screen_status - privacy screen status442*443* This enum is used to track and control the state of the integrated privacy444* screen present on some display panels, via the "privacy-screen sw-state"445* and "privacy-screen hw-state" properties. Note the _LOCKED enum values446* are only valid for the "privacy-screen hw-state" property.447*448* @PRIVACY_SCREEN_DISABLED:449* The privacy-screen on the panel is disabled450* @PRIVACY_SCREEN_ENABLED:451* The privacy-screen on the panel is enabled452* @PRIVACY_SCREEN_DISABLED_LOCKED:453* The privacy-screen on the panel is disabled and locked (cannot be changed)454* @PRIVACY_SCREEN_ENABLED_LOCKED:455* The privacy-screen on the panel is enabled and locked (cannot be changed)456*/457enum drm_privacy_screen_status {458PRIVACY_SCREEN_DISABLED = 0,459PRIVACY_SCREEN_ENABLED,460PRIVACY_SCREEN_DISABLED_LOCKED,461PRIVACY_SCREEN_ENABLED_LOCKED,462};463464/**465* enum drm_colorspace - color space466*467* This enum is a consolidated colorimetry list supported by HDMI and468* DP protocol standard. The respective connectors will register469* a property with the subset of this list (supported by that470* respective protocol). Userspace will set the colorspace through471* a colorspace property which will be created and exposed to472* userspace.473*474* DP definitions come from the DP v2.0 spec475* HDMI definitions come from the CTA-861-H spec476*477* @DRM_MODE_COLORIMETRY_DEFAULT:478* Driver specific behavior.479* @DRM_MODE_COLORIMETRY_NO_DATA:480* Driver specific behavior.481* @DRM_MODE_COLORIMETRY_SMPTE_170M_YCC:482* (HDMI)483* SMPTE ST 170M colorimetry format484* @DRM_MODE_COLORIMETRY_BT709_YCC:485* (HDMI, DP)486* ITU-R BT.709 colorimetry format487* @DRM_MODE_COLORIMETRY_XVYCC_601:488* (HDMI, DP)489* xvYCC601 colorimetry format490* @DRM_MODE_COLORIMETRY_XVYCC_709:491* (HDMI, DP)492* xvYCC709 colorimetry format493* @DRM_MODE_COLORIMETRY_SYCC_601:494* (HDMI, DP)495* sYCC601 colorimetry format496* @DRM_MODE_COLORIMETRY_OPYCC_601:497* (HDMI, DP)498* opYCC601 colorimetry format499* @DRM_MODE_COLORIMETRY_OPRGB:500* (HDMI, DP)501* opRGB colorimetry format502* @DRM_MODE_COLORIMETRY_BT2020_CYCC:503* (HDMI, DP)504* ITU-R BT.2020 Y'c C'bc C'rc (constant luminance) colorimetry format505* @DRM_MODE_COLORIMETRY_BT2020_RGB:506* (HDMI, DP)507* ITU-R BT.2020 R' G' B' colorimetry format508* @DRM_MODE_COLORIMETRY_BT2020_YCC:509* (HDMI, DP)510* ITU-R BT.2020 Y' C'b C'r colorimetry format511* @DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65:512* (HDMI)513* SMPTE ST 2113 P3D65 colorimetry format514* @DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER:515* (HDMI)516* SMPTE ST 2113 P3DCI colorimetry format517* @DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED:518* (DP)519* RGB wide gamut fixed point colorimetry format520* @DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT:521* (DP)522* RGB wide gamut floating point523* (scRGB (IEC 61966-2-2)) colorimetry format524* @DRM_MODE_COLORIMETRY_BT601_YCC:525* (DP)526* ITU-R BT.601 colorimetry format527* The DP spec does not say whether this is the 525 or the 625528* line version.529* @DRM_MODE_COLORIMETRY_COUNT:530* Not a valid value; merely used four counting531*/532enum drm_colorspace {533/* For Default case, driver will set the colorspace */534DRM_MODE_COLORIMETRY_DEFAULT = 0,535/* CEA 861 Normal Colorimetry options */536DRM_MODE_COLORIMETRY_NO_DATA = 0,537DRM_MODE_COLORIMETRY_SMPTE_170M_YCC = 1,538DRM_MODE_COLORIMETRY_BT709_YCC = 2,539/* CEA 861 Extended Colorimetry Options */540DRM_MODE_COLORIMETRY_XVYCC_601 = 3,541DRM_MODE_COLORIMETRY_XVYCC_709 = 4,542DRM_MODE_COLORIMETRY_SYCC_601 = 5,543DRM_MODE_COLORIMETRY_OPYCC_601 = 6,544DRM_MODE_COLORIMETRY_OPRGB = 7,545DRM_MODE_COLORIMETRY_BT2020_CYCC = 8,546DRM_MODE_COLORIMETRY_BT2020_RGB = 9,547DRM_MODE_COLORIMETRY_BT2020_YCC = 10,548/* Additional Colorimetry extension added as part of CTA 861.G */549DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65 = 11,550DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER = 12,551/* Additional Colorimetry Options added for DP 1.4a VSC Colorimetry Format */552DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED = 13,553DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT = 14,554DRM_MODE_COLORIMETRY_BT601_YCC = 15,555DRM_MODE_COLORIMETRY_COUNT556};557558/**559* enum drm_bus_flags - bus_flags info for &drm_display_info560*561* This enum defines signal polarities and clock edge information for signals on562* a bus as bitmask flags.563*564* The clock edge information is conveyed by two sets of symbols,565* DRM_BUS_FLAGS_*_DRIVE_\* and DRM_BUS_FLAGS_*_SAMPLE_\*. When this enum is566* used to describe a bus from the point of view of the transmitter, the567* \*_DRIVE_\* flags should be used. When used from the point of view of the568* receiver, the \*_SAMPLE_\* flags should be used. The \*_DRIVE_\* and569* \*_SAMPLE_\* flags alias each other, with the \*_SAMPLE_POSEDGE and570* \*_SAMPLE_NEGEDGE flags being equal to \*_DRIVE_NEGEDGE and \*_DRIVE_POSEDGE571* respectively. This simplifies code as signals are usually sampled on the572* opposite edge of the driving edge. Transmitters and receivers may however573* need to take other signal timings into account to convert between driving574* and sample edges.575*/576enum drm_bus_flags {577/**578* @DRM_BUS_FLAG_DE_LOW:579*580* The Data Enable signal is active low581*/582DRM_BUS_FLAG_DE_LOW = BIT(0),583584/**585* @DRM_BUS_FLAG_DE_HIGH:586*587* The Data Enable signal is active high588*/589DRM_BUS_FLAG_DE_HIGH = BIT(1),590591/**592* @DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE:593*594* Data is driven on the rising edge of the pixel clock595*/596DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE = BIT(2),597598/**599* @DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE:600*601* Data is driven on the falling edge of the pixel clock602*/603DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE = BIT(3),604605/**606* @DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE:607*608* Data is sampled on the rising edge of the pixel clock609*/610DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE = DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,611612/**613* @DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE:614*615* Data is sampled on the falling edge of the pixel clock616*/617DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,618619/**620* @DRM_BUS_FLAG_DATA_MSB_TO_LSB:621*622* Data is transmitted MSB to LSB on the bus623*/624DRM_BUS_FLAG_DATA_MSB_TO_LSB = BIT(4),625626/**627* @DRM_BUS_FLAG_DATA_LSB_TO_MSB:628*629* Data is transmitted LSB to MSB on the bus630*/631DRM_BUS_FLAG_DATA_LSB_TO_MSB = BIT(5),632633/**634* @DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE:635*636* Sync signals are driven on the rising edge of the pixel clock637*/638DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE = BIT(6),639640/**641* @DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE:642*643* Sync signals are driven on the falling edge of the pixel clock644*/645DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE = BIT(7),646647/**648* @DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE:649*650* Sync signals are sampled on the rising edge of the pixel clock651*/652DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE = DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE,653654/**655* @DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE:656*657* Sync signals are sampled on the falling edge of the pixel clock658*/659DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE = DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,660661/**662* @DRM_BUS_FLAG_SHARP_SIGNALS:663*664* Set if the Sharp-specific signals (SPL, CLS, PS, REV) must be used665*/666DRM_BUS_FLAG_SHARP_SIGNALS = BIT(8),667};668669/**670* struct drm_display_info - runtime data about the connected sink671*672* Describes a given display (e.g. CRT or flat panel) and its limitations. For673* fixed display sinks like built-in panels there's not much difference between674* this and &struct drm_connector. But for sinks with a real cable this675* structure is meant to describe all the things at the other end of the cable.676*677* For sinks which provide an EDID this can be filled out by calling678* drm_add_edid_modes().679*/680struct drm_display_info {681/**682* @width_mm: Physical width in mm.683*/684unsigned int width_mm;685686/**687* @height_mm: Physical height in mm.688*/689unsigned int height_mm;690691/**692* @bpc: Maximum bits per color channel. Used by HDMI and DP outputs.693*/694unsigned int bpc;695696/**697* @subpixel_order: Subpixel order of LCD panels.698*/699enum subpixel_order subpixel_order;700701#define DRM_COLOR_FORMAT_RGB444 (1<<0)702#define DRM_COLOR_FORMAT_YCBCR444 (1<<1)703#define DRM_COLOR_FORMAT_YCBCR422 (1<<2)704#define DRM_COLOR_FORMAT_YCBCR420 (1<<3)705706/**707* @panel_orientation: Read only connector property for built-in panels,708* indicating the orientation of the panel vs the device's casing.709* drm_connector_init() sets this to DRM_MODE_PANEL_ORIENTATION_UNKNOWN.710* When not UNKNOWN this gets used by the drm_fb_helpers to rotate the711* fb to compensate and gets exported as prop to userspace.712*/713int panel_orientation;714715/**716* @color_formats: HDMI Color formats, selects between RGB and YCrCb717* modes. Used DRM_COLOR_FORMAT\_ defines, which are _not_ the same ones718* as used to describe the pixel format in framebuffers, and also don't719* match the formats in @bus_formats which are shared with v4l.720*/721u32 color_formats;722723/**724* @bus_formats: Pixel data format on the wire, somewhat redundant with725* @color_formats. Array of size @num_bus_formats encoded using726* MEDIA_BUS_FMT\_ defines shared with v4l and media drivers.727*/728const u32 *bus_formats;729/**730* @num_bus_formats: Size of @bus_formats array.731*/732unsigned int num_bus_formats;733734/**735* @bus_flags: Additional information (like pixel signal polarity) for736* the pixel data on the bus, using &enum drm_bus_flags values737* DRM_BUS_FLAGS\_.738*/739u32 bus_flags;740741/**742* @max_tmds_clock: Maximum TMDS clock rate supported by the743* sink in kHz. 0 means undefined.744*/745int max_tmds_clock;746747/**748* @dvi_dual: Dual-link DVI sink?749*/750bool dvi_dual;751752/**753* @is_hdmi: True if the sink is an HDMI device.754*755* This field shall be used instead of calling756* drm_detect_hdmi_monitor() when possible.757*/758bool is_hdmi;759760/**761* @has_audio: True if the sink supports audio.762*763* This field shall be used instead of calling764* drm_detect_monitor_audio() when possible.765*/766bool has_audio;767768/**769* @has_hdmi_infoframe: Does the sink support the HDMI infoframe?770*/771bool has_hdmi_infoframe;772773/**774* @rgb_quant_range_selectable: Does the sink support selecting775* the RGB quantization range?776*/777bool rgb_quant_range_selectable;778779/**780* @edid_hdmi_rgb444_dc_modes: Mask of supported hdmi deep color modes781* in RGB 4:4:4. Even more stuff redundant with @bus_formats.782*/783u8 edid_hdmi_rgb444_dc_modes;784785/**786* @edid_hdmi_ycbcr444_dc_modes: Mask of supported hdmi deep color787* modes in YCbCr 4:4:4. Even more stuff redundant with @bus_formats.788*/789u8 edid_hdmi_ycbcr444_dc_modes;790791/**792* @cea_rev: CEA revision of the HDMI sink.793*/794u8 cea_rev;795796/**797* @hdmi: advance features of a HDMI sink.798*/799struct drm_hdmi_info hdmi;800801/**802* @hdr_sink_metadata: HDR Metadata Information read from sink803*/804struct hdr_sink_metadata hdr_sink_metadata;805806/**807* @non_desktop: Non desktop display (HMD).808*/809bool non_desktop;810811/**812* @monitor_range: Frequency range supported by monitor range descriptor813*/814struct drm_monitor_range_info monitor_range;815816/**817* @luminance_range: Luminance range supported by panel818*/819struct drm_luminance_range_info luminance_range;820821/**822* @mso_stream_count: eDP Multi-SST Operation (MSO) stream count from823* the DisplayID VESA vendor block. 0 for conventional Single-Stream824* Transport (SST), or 2 or 4 MSO streams.825*/826u8 mso_stream_count;827828/**829* @mso_pixel_overlap: eDP MSO segment pixel overlap, 0-8 pixels.830*/831u8 mso_pixel_overlap;832833/**834* @max_dsc_bpp: Maximum DSC target bitrate, if it is set to 0 the835* monitor's default value is used instead.836*/837u32 max_dsc_bpp;838839/**840* @vics: Array of vics_len VICs. Internal to EDID parsing.841*/842u8 *vics;843844/**845* @vics_len: Number of elements in vics. Internal to EDID parsing.846*/847int vics_len;848849/**850* @quirks: EDID based quirks. DRM core and drivers can query the851* @drm_edid_quirk quirks using drm_edid_has_quirk(), the rest of852* the quirks also tracked here are internal to EDID parsing.853*/854u32 quirks;855856/**857* @source_physical_address: Source Physical Address from HDMI858* Vendor-Specific Data Block, for CEC usage.859*860* Defaults to CEC_PHYS_ADDR_INVALID (0xffff).861*/862u16 source_physical_address;863};864865int drm_display_info_set_bus_formats(struct drm_display_info *info,866const u32 *formats,867unsigned int num_formats);868869/**870* struct drm_connector_tv_margins - TV connector related margins871*872* Describes the margins in pixels to put around the image on TV873* connectors to deal with overscan.874*/875struct drm_connector_tv_margins {876/**877* @bottom: Bottom margin in pixels.878*/879unsigned int bottom;880881/**882* @left: Left margin in pixels.883*/884unsigned int left;885886/**887* @right: Right margin in pixels.888*/889unsigned int right;890891/**892* @top: Top margin in pixels.893*/894unsigned int top;895};896897/**898* struct drm_tv_connector_state - TV connector related states899* @select_subconnector: selected subconnector900* @subconnector: detected subconnector901* @margins: TV margins902* @legacy_mode: Legacy TV mode, driver specific value903* @mode: TV mode904* @brightness: brightness in percent905* @contrast: contrast in percent906* @flicker_reduction: flicker reduction in percent907* @overscan: overscan in percent908* @saturation: saturation in percent909* @hue: hue in percent910*/911struct drm_tv_connector_state {912enum drm_mode_subconnector select_subconnector;913enum drm_mode_subconnector subconnector;914struct drm_connector_tv_margins margins;915unsigned int legacy_mode;916unsigned int mode;917unsigned int brightness;918unsigned int contrast;919unsigned int flicker_reduction;920unsigned int overscan;921unsigned int saturation;922unsigned int hue;923};924925/**926* struct drm_connector_hdmi_infoframe - HDMI Infoframe container927*/928struct drm_connector_hdmi_infoframe {929/**930* @data: HDMI Infoframe structure931*/932union hdmi_infoframe data;933934/**935* @set: Is the content of @data valid?936*/937bool set;938};939940/*941* struct drm_connector_hdmi_state - HDMI state container942*/943struct drm_connector_hdmi_state {944/**945* @broadcast_rgb: Connector property to pass the946* Broadcast RGB selection value.947*/948enum drm_hdmi_broadcast_rgb broadcast_rgb;949950/**951* @infoframes: HDMI Infoframes matching that state952*/953struct {954/**955* @avi: AVI Infoframes structure matching our956* state.957*/958struct drm_connector_hdmi_infoframe avi;959960/**961* @hdr_drm: DRM (Dynamic Range and Mastering)962* Infoframes structure matching our state.963*/964struct drm_connector_hdmi_infoframe hdr_drm;965966/**967* @spd: SPD Infoframes structure matching our968* state.969*/970struct drm_connector_hdmi_infoframe spd;971972/**973* @vendor: HDMI Vendor Infoframes structure974* matching our state.975*/976struct drm_connector_hdmi_infoframe hdmi;977} infoframes;978979/**980* @is_limited_range: Is the output supposed to use a limited981* RGB Quantization Range or not?982*/983bool is_limited_range;984985/**986* @output_bpc: Bits per color channel to output.987*/988unsigned int output_bpc;989990/**991* @output_format: Pixel format to output in.992*/993enum hdmi_colorspace output_format;994995/**996* @tmds_char_rate: TMDS Character Rate, in Hz.997*/998unsigned long long tmds_char_rate;999};10001001/**1002* struct drm_connector_state - mutable connector state1003*/1004struct drm_connector_state {1005/** @connector: backpointer to the connector */1006struct drm_connector *connector;10071008/**1009* @crtc: CRTC to connect connector to, NULL if disabled.1010*1011* Do not change this directly, use drm_atomic_set_crtc_for_connector()1012* instead.1013*/1014struct drm_crtc *crtc;10151016/**1017* @best_encoder:1018*1019* Used by the atomic helpers to select the encoder, through the1020* &drm_connector_helper_funcs.atomic_best_encoder or1021* &drm_connector_helper_funcs.best_encoder callbacks.1022*1023* This is also used in the atomic helpers to map encoders to their1024* current and previous connectors, see1025* drm_atomic_get_old_connector_for_encoder() and1026* drm_atomic_get_new_connector_for_encoder().1027*1028* NOTE: Atomic drivers must fill this out (either themselves or through1029* helpers), for otherwise the GETCONNECTOR and GETENCODER IOCTLs will1030* not return correct data to userspace.1031*/1032struct drm_encoder *best_encoder;10331034/**1035* @link_status: Connector link_status to keep track of whether link is1036* GOOD or BAD to notify userspace if retraining is necessary.1037*/1038enum drm_link_status link_status;10391040/** @state: backpointer to global drm_atomic_state */1041struct drm_atomic_state *state;10421043/**1044* @commit: Tracks the pending commit to prevent use-after-free conditions.1045*1046* Is only set when @crtc is NULL.1047*/1048struct drm_crtc_commit *commit;10491050/** @tv: TV connector state */1051struct drm_tv_connector_state tv;10521053/**1054* @self_refresh_aware:1055*1056* This tracks whether a connector is aware of the self refresh state.1057* It should be set to true for those connector implementations which1058* understand the self refresh state. This is needed since the crtc1059* registers the self refresh helpers and it doesn't know if the1060* connectors downstream have implemented self refresh entry/exit.1061*1062* Drivers should set this to true in atomic_check if they know how to1063* handle self_refresh requests.1064*/1065bool self_refresh_aware;10661067/**1068* @picture_aspect_ratio: Connector property to control the1069* HDMI infoframe aspect ratio setting.1070*1071* The %DRM_MODE_PICTURE_ASPECT_\* values much match the1072* values for &enum hdmi_picture_aspect1073*/1074enum hdmi_picture_aspect picture_aspect_ratio;10751076/**1077* @content_type: Connector property to control the1078* HDMI infoframe content type setting.1079* The %DRM_MODE_CONTENT_TYPE_\* values much1080* match the values.1081*/1082unsigned int content_type;10831084/**1085* @hdcp_content_type: Connector property to pass the type of1086* protected content. This is most commonly used for HDCP.1087*/1088unsigned int hdcp_content_type;10891090/**1091* @scaling_mode: Connector property to control the1092* upscaling, mostly used for built-in panels.1093*/1094unsigned int scaling_mode;10951096/**1097* @content_protection: Connector property to request content1098* protection. This is most commonly used for HDCP.1099*/1100unsigned int content_protection;11011102/**1103* @colorspace: State variable for Connector property to request1104* colorspace change on Sink. This is most commonly used to switch1105* to wider color gamuts like BT2020.1106*/1107enum drm_colorspace colorspace;11081109/**1110* @writeback_job: Writeback job for writeback connectors1111*1112* Holds the framebuffer and out-fence for a writeback connector. As1113* the writeback completion may be asynchronous to the normal commit1114* cycle, the writeback job lifetime is managed separately from the1115* normal atomic state by this object.1116*1117* See also: drm_writeback_queue_job() and1118* drm_writeback_signal_completion()1119*/1120struct drm_writeback_job *writeback_job;11211122/**1123* @max_requested_bpc: Connector property to limit the maximum bit1124* depth of the pixels.1125*/1126u8 max_requested_bpc;11271128/**1129* @max_bpc: Connector max_bpc based on the requested max_bpc property1130* and the connector bpc limitations obtained from edid.1131*/1132u8 max_bpc;11331134/**1135* @privacy_screen_sw_state: See :ref:`Standard Connector1136* Properties<standard_connector_properties>`1137*/1138enum drm_privacy_screen_status privacy_screen_sw_state;11391140/**1141* @hdr_output_metadata:1142* DRM blob property for HDR output metadata1143*/1144struct drm_property_blob *hdr_output_metadata;11451146/**1147* @hdmi: HDMI-related variable and properties. Filled by1148* @drm_atomic_helper_connector_hdmi_check().1149*/1150struct drm_connector_hdmi_state hdmi;1151};11521153struct drm_connector_hdmi_audio_funcs {1154/**1155* @startup:1156*1157* Called when ASoC starts an audio stream setup. The1158* @startup() is optional.1159*1160* Returns:1161* 0 on success, a negative error code otherwise1162*/1163int (*startup)(struct drm_connector *connector);11641165/**1166* @prepare:1167* Configures HDMI-encoder for audio stream. Can be called1168* multiple times for each setup. Mandatory.1169*1170* Returns:1171* 0 on success, a negative error code otherwise1172*/1173int (*prepare)(struct drm_connector *connector,1174struct hdmi_codec_daifmt *fmt,1175struct hdmi_codec_params *hparms);11761177/**1178* @shutdown:1179*1180* Shut down the audio stream. Mandatory.1181*1182* Returns:1183* 0 on success, a negative error code otherwise1184*/1185void (*shutdown)(struct drm_connector *connector);11861187/**1188* @mute_stream:1189*1190* Mute/unmute HDMI audio stream. The @mute_stream callback is1191* optional.1192*1193* Returns:1194* 0 on success, a negative error code otherwise1195*/1196int (*mute_stream)(struct drm_connector *connector,1197bool enable, int direction);1198};11991200void drm_connector_cec_phys_addr_invalidate(struct drm_connector *connector);1201void drm_connector_cec_phys_addr_set(struct drm_connector *connector);12021203/**1204* struct drm_connector_cec_funcs - drm_hdmi_connector control functions1205*/1206struct drm_connector_cec_funcs {1207/**1208* @phys_addr_invalidate: mark CEC physical address as invalid1209*1210* The callback to mark CEC physical address as invalid, abstracting1211* the operation.1212*/1213void (*phys_addr_invalidate)(struct drm_connector *connector);12141215/**1216* @phys_addr_set: set CEC physical address1217*1218* The callback to set CEC physical address, abstracting the operation.1219*/1220void (*phys_addr_set)(struct drm_connector *connector, u16 addr);1221};12221223/**1224* struct drm_connector_hdmi_funcs - drm_hdmi_connector control functions1225*/1226struct drm_connector_hdmi_funcs {1227/**1228* @tmds_char_rate_valid:1229*1230* This callback is invoked at atomic_check time to figure out1231* whether a particular TMDS character rate is supported by the1232* driver.1233*1234* The @tmds_char_rate_valid callback is optional.1235*1236* Returns:1237*1238* Either &drm_mode_status.MODE_OK or one of the failure reasons1239* in &enum drm_mode_status.1240*/1241enum drm_mode_status1242(*tmds_char_rate_valid)(const struct drm_connector *connector,1243const struct drm_display_mode *mode,1244unsigned long long tmds_rate);12451246/**1247* @clear_infoframe:1248*1249* This callback is invoked through1250* @drm_atomic_helper_connector_hdmi_update_infoframes during a1251* commit to clear the infoframes into the hardware. It will be1252* called multiple times, once for every disabled infoframe1253* type.1254*1255* The @clear_infoframe callback is optional.1256*1257* Returns:1258* 0 on success, a negative error code otherwise1259*/1260int (*clear_infoframe)(struct drm_connector *connector,1261enum hdmi_infoframe_type type);12621263/**1264* @write_infoframe:1265*1266* This callback is invoked through1267* @drm_atomic_helper_connector_hdmi_update_infoframes during a1268* commit to program the infoframes into the hardware. It will1269* be called multiple times, once for every updated infoframe1270* type.1271*1272* The @write_infoframe callback is mandatory.1273*1274* Returns:1275* 0 on success, a negative error code otherwise1276*/1277int (*write_infoframe)(struct drm_connector *connector,1278enum hdmi_infoframe_type type,1279const u8 *buffer, size_t len);12801281/**1282* @read_edid:1283*1284* This callback is used by the framework as a replacement for reading1285* the EDID from connector->ddc. It is still recommended to provide1286* connector->ddc instead of implementing this callback. Returned EDID1287* should be freed via the drm_edid_free().1288*1289* The @read_edid callback is optional.1290*1291* Returns:1292* Valid EDID on success, NULL in case of failure.1293*/1294const struct drm_edid *(*read_edid)(struct drm_connector *connector);1295};12961297/**1298* struct drm_connector_funcs - control connectors on a given device1299*1300* Each CRTC may have one or more connectors attached to it. The functions1301* below allow the core DRM code to control connectors, enumerate available modes,1302* etc.1303*/1304struct drm_connector_funcs {1305/**1306* @dpms:1307*1308* Legacy entry point to set the per-connector DPMS state. Legacy DPMS1309* is exposed as a standard property on the connector, but diverted to1310* this callback in the drm core. Note that atomic drivers don't1311* implement the 4 level DPMS support on the connector any more, but1312* instead only have an on/off "ACTIVE" property on the CRTC object.1313*1314* This hook is not used by atomic drivers, remapping of the legacy DPMS1315* property is entirely handled in the DRM core.1316*1317* RETURNS:1318*1319* 0 on success or a negative error code on failure.1320*/1321int (*dpms)(struct drm_connector *connector, int mode);13221323/**1324* @reset:1325*1326* Reset connector hardware and software state to off. This function isn't1327* called by the core directly, only through drm_mode_config_reset().1328* It's not a helper hook only for historical reasons.1329*1330* Atomic drivers can use drm_atomic_helper_connector_reset() to reset1331* atomic state using this hook.1332*/1333void (*reset)(struct drm_connector *connector);13341335/**1336* @detect:1337*1338* Check to see if anything is attached to the connector. The parameter1339* force is set to false whilst polling, true when checking the1340* connector due to a user request. force can be used by the driver to1341* avoid expensive, destructive operations during automated probing.1342*1343* This callback is optional, if not implemented the connector will be1344* considered as always being attached.1345*1346* FIXME:1347*1348* Note that this hook is only called by the probe helper. It's not in1349* the helper library vtable purely for historical reasons. The only DRM1350* core entry point to probe connector state is @fill_modes.1351*1352* Note that the helper library will already hold1353* &drm_mode_config.connection_mutex. Drivers which need to grab additional1354* locks to avoid races with concurrent modeset changes need to use1355* &drm_connector_helper_funcs.detect_ctx instead.1356*1357* Also note that this callback can be called no matter the1358* state the connector is in. Drivers that need the underlying1359* device to be powered to perform the detection will first need1360* to make sure it's been properly enabled.1361*1362* RETURNS:1363*1364* drm_connector_status indicating the connector's status.1365*/1366enum drm_connector_status (*detect)(struct drm_connector *connector,1367bool force);13681369/**1370* @force:1371*1372* This function is called to update internal encoder state when the1373* connector is forced to a certain state by userspace, either through1374* the sysfs interfaces or on the kernel cmdline. In that case the1375* @detect callback isn't called.1376*1377* FIXME:1378*1379* Note that this hook is only called by the probe helper. It's not in1380* the helper library vtable purely for historical reasons. The only DRM1381* core entry point to probe connector state is @fill_modes.1382*/1383void (*force)(struct drm_connector *connector);13841385/**1386* @fill_modes:1387*1388* Entry point for output detection and basic mode validation. The1389* driver should reprobe the output if needed (e.g. when hotplug1390* handling is unreliable), add all detected modes to &drm_connector.modes1391* and filter out any the device can't support in any configuration. It1392* also needs to filter out any modes wider or higher than the1393* parameters max_width and max_height indicate.1394*1395* The drivers must also prune any modes no longer valid from1396* &drm_connector.modes. Furthermore it must update1397* &drm_connector.status and &drm_connector.edid. If no EDID has been1398* received for this output connector->edid must be NULL.1399*1400* Drivers using the probe helpers should use1401* drm_helper_probe_single_connector_modes() to implement this1402* function.1403*1404* RETURNS:1405*1406* The number of modes detected and filled into &drm_connector.modes.1407*/1408int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);14091410/**1411* @set_property:1412*1413* This is the legacy entry point to update a property attached to the1414* connector.1415*1416* This callback is optional if the driver does not support any legacy1417* driver-private properties. For atomic drivers it is not used because1418* property handling is done entirely in the DRM core.1419*1420* RETURNS:1421*1422* 0 on success or a negative error code on failure.1423*/1424int (*set_property)(struct drm_connector *connector, struct drm_property *property,1425uint64_t val);14261427/**1428* @late_register:1429*1430* This optional hook can be used to register additional userspace1431* interfaces attached to the connector, light backlight control, i2c,1432* DP aux or similar interfaces. It is called late in the driver load1433* sequence from drm_connector_register() when registering all the1434* core drm connector interfaces. Everything added from this callback1435* should be unregistered in the early_unregister callback.1436*1437* This is called while holding &drm_connector.mutex.1438*1439* Returns:1440*1441* 0 on success, or a negative error code on failure.1442*/1443int (*late_register)(struct drm_connector *connector);14441445/**1446* @early_unregister:1447*1448* This optional hook should be used to unregister the additional1449* userspace interfaces attached to the connector from1450* late_register(). It is called from drm_connector_unregister(),1451* early in the driver unload sequence to disable userspace access1452* before data structures are torndown.1453*1454* This is called while holding &drm_connector.mutex.1455*/1456void (*early_unregister)(struct drm_connector *connector);14571458/**1459* @destroy:1460*1461* Clean up connector resources. This is called at driver unload time1462* through drm_mode_config_cleanup(). It can also be called at runtime1463* when a connector is being hot-unplugged for drivers that support1464* connector hotplugging (e.g. DisplayPort MST).1465*/1466void (*destroy)(struct drm_connector *connector);14671468/**1469* @atomic_duplicate_state:1470*1471* Duplicate the current atomic state for this connector and return it.1472* The core and helpers guarantee that any atomic state duplicated with1473* this hook and still owned by the caller (i.e. not transferred to the1474* driver by calling &drm_mode_config_funcs.atomic_commit) will be1475* cleaned up by calling the @atomic_destroy_state hook in this1476* structure.1477*1478* This callback is mandatory for atomic drivers.1479*1480* Atomic drivers which don't subclass &struct drm_connector_state should use1481* drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the1482* state structure to extend it with driver-private state should use1483* __drm_atomic_helper_connector_duplicate_state() to make sure shared state is1484* duplicated in a consistent fashion across drivers.1485*1486* It is an error to call this hook before &drm_connector.state has been1487* initialized correctly.1488*1489* NOTE:1490*1491* If the duplicate state references refcounted resources this hook must1492* acquire a reference for each of them. The driver must release these1493* references again in @atomic_destroy_state.1494*1495* RETURNS:1496*1497* Duplicated atomic state or NULL when the allocation failed.1498*/1499struct drm_connector_state *(*atomic_duplicate_state)(struct drm_connector *connector);15001501/**1502* @atomic_destroy_state:1503*1504* Destroy a state duplicated with @atomic_duplicate_state and release1505* or unreference all resources it references1506*1507* This callback is mandatory for atomic drivers.1508*/1509void (*atomic_destroy_state)(struct drm_connector *connector,1510struct drm_connector_state *state);15111512/**1513* @atomic_set_property:1514*1515* Decode a driver-private property value and store the decoded value1516* into the passed-in state structure. Since the atomic core decodes all1517* standardized properties (even for extensions beyond the core set of1518* properties which might not be implemented by all drivers) this1519* requires drivers to subclass the state structure.1520*1521* Such driver-private properties should really only be implemented for1522* truly hardware/vendor specific state. Instead it is preferred to1523* standardize atomic extension and decode the properties used to expose1524* such an extension in the core.1525*1526* Do not call this function directly, use1527* drm_atomic_connector_set_property() instead.1528*1529* This callback is optional if the driver does not support any1530* driver-private atomic properties.1531*1532* NOTE:1533*1534* This function is called in the state assembly phase of atomic1535* modesets, which can be aborted for any reason (including on1536* userspace's request to just check whether a configuration would be1537* possible). Drivers MUST NOT touch any persistent state (hardware or1538* software) or data structures except the passed in @state parameter.1539*1540* Also since userspace controls in which order properties are set this1541* function must not do any input validation (since the state update is1542* incomplete and hence likely inconsistent). Instead any such input1543* validation must be done in the various atomic_check callbacks.1544*1545* RETURNS:1546*1547* 0 if the property has been found, -EINVAL if the property isn't1548* implemented by the driver (which shouldn't ever happen, the core only1549* asks for properties attached to this connector). No other validation1550* is allowed by the driver. The core already checks that the property1551* value is within the range (integer, valid enum value, ...) the driver1552* set when registering the property.1553*/1554int (*atomic_set_property)(struct drm_connector *connector,1555struct drm_connector_state *state,1556struct drm_property *property,1557uint64_t val);15581559/**1560* @atomic_get_property:1561*1562* Reads out the decoded driver-private property. This is used to1563* implement the GETCONNECTOR IOCTL.1564*1565* Do not call this function directly, use1566* drm_atomic_connector_get_property() instead.1567*1568* This callback is optional if the driver does not support any1569* driver-private atomic properties.1570*1571* RETURNS:1572*1573* 0 on success, -EINVAL if the property isn't implemented by the1574* driver (which shouldn't ever happen, the core only asks for1575* properties attached to this connector).1576*/1577int (*atomic_get_property)(struct drm_connector *connector,1578const struct drm_connector_state *state,1579struct drm_property *property,1580uint64_t *val);15811582/**1583* @atomic_print_state:1584*1585* If driver subclasses &struct drm_connector_state, it should implement1586* this optional hook for printing additional driver specific state.1587*1588* Do not call this directly, use drm_atomic_connector_print_state()1589* instead.1590*/1591void (*atomic_print_state)(struct drm_printer *p,1592const struct drm_connector_state *state);15931594/**1595* @oob_hotplug_event:1596*1597* This will get called when a hotplug-event for a drm-connector1598* has been received from a source outside the display driver / device.1599*/1600void (*oob_hotplug_event)(struct drm_connector *connector,1601enum drm_connector_status status);16021603/**1604* @debugfs_init:1605*1606* Allows connectors to create connector-specific debugfs files.1607*/1608void (*debugfs_init)(struct drm_connector *connector, struct dentry *root);1609};16101611/**1612* struct drm_cmdline_mode - DRM Mode passed through the kernel command-line1613*1614* Each connector can have an initial mode with additional options1615* passed through the kernel command line. This structure allows to1616* express those parameters and will be filled by the command-line1617* parser.1618*/1619struct drm_cmdline_mode {1620/**1621* @name:1622*1623* Name of the mode.1624*/1625char name[DRM_DISPLAY_MODE_LEN];16261627/**1628* @specified:1629*1630* Has a mode been read from the command-line?1631*/1632bool specified;16331634/**1635* @refresh_specified:1636*1637* Did the mode have a preferred refresh rate?1638*/1639bool refresh_specified;16401641/**1642* @bpp_specified:1643*1644* Did the mode have a preferred BPP?1645*/1646bool bpp_specified;16471648/**1649* @pixel_clock:1650*1651* Pixel Clock in kHz. Optional.1652*/1653unsigned int pixel_clock;16541655/**1656* @xres:1657*1658* Active resolution on the X axis, in pixels.1659*/1660int xres;16611662/**1663* @yres:1664*1665* Active resolution on the Y axis, in pixels.1666*/1667int yres;16681669/**1670* @bpp:1671*1672* Bits per pixels for the mode.1673*/1674int bpp;16751676/**1677* @refresh:1678*1679* Refresh rate, in Hertz.1680*/1681int refresh;16821683/**1684* @rb:1685*1686* Do we need to use reduced blanking?1687*/1688bool rb;16891690/**1691* @interlace:1692*1693* The mode is interlaced.1694*/1695bool interlace;16961697/**1698* @cvt:1699*1700* The timings will be calculated using the VESA Coordinated1701* Video Timings instead of looking up the mode from a table.1702*/1703bool cvt;17041705/**1706* @margins:1707*1708* Add margins to the mode calculation (1.8% of xres rounded1709* down to 8 pixels and 1.8% of yres).1710*/1711bool margins;17121713/**1714* @force:1715*1716* Ignore the hotplug state of the connector, and force its1717* state to one of the DRM_FORCE_* values.1718*/1719enum drm_connector_force force;17201721/**1722* @rotation_reflection:1723*1724* Initial rotation and reflection of the mode setup from the1725* command line. See DRM_MODE_ROTATE_* and1726* DRM_MODE_REFLECT_*. The only rotations supported are1727* DRM_MODE_ROTATE_0 and DRM_MODE_ROTATE_180.1728*/1729unsigned int rotation_reflection;17301731/**1732* @panel_orientation:1733*1734* drm-connector "panel orientation" property override value,1735* DRM_MODE_PANEL_ORIENTATION_UNKNOWN if not set.1736*/1737enum drm_panel_orientation panel_orientation;17381739/**1740* @tv_margins: TV margins to apply to the mode.1741*/1742struct drm_connector_tv_margins tv_margins;17431744/**1745* @tv_mode: TV mode standard. See DRM_MODE_TV_MODE_*.1746*/1747enum drm_connector_tv_mode tv_mode;17481749/**1750* @tv_mode_specified:1751*1752* Did the mode have a preferred TV mode?1753*/1754bool tv_mode_specified;1755};17561757/**1758* struct drm_connector_hdmi_audio - DRM gemeric HDMI Codec-related structure1759*1760* HDMI drivers usually incorporate a HDMI Codec. This structure expresses the1761* generic HDMI Codec as used by the DRM HDMI Codec framework.1762*/1763struct drm_connector_hdmi_audio {1764/**1765* @funcs:1766*1767* Implementation of the HDMI codec functionality to be used by the DRM1768* HDMI Codec framework.1769*/1770const struct drm_connector_hdmi_audio_funcs *funcs;17711772/**1773* @codec_pdev:1774*1775* Platform device created to hold the HDMI Codec. It will be1776* automatically unregistered during drm_connector_cleanup().1777*/1778struct platform_device *codec_pdev;17791780/**1781* @lock:1782*1783* Mutex to protect @last_state, @plugged_cb and @plugged_cb_dev.1784*/1785struct mutex lock;17861787/**1788* @plugged_cb:1789*1790* Callback to be called when the HDMI sink get plugged to or unplugged1791* from this connector. This is assigned by the framework when1792* requested by the ASoC code.1793*/1794void (*plugged_cb)(struct device *dev, bool plugged);17951796/**1797* @plugged_cb_dev:1798*1799* The data for @plugged_cb(). It is being provided by the ASoC.1800*/1801struct device *plugged_cb_dev;18021803/**1804* @last_state:1805*1806* Last plugged state recored by the framework. It is used to correctly1807* report the state to @plugged_cb().1808*/1809bool last_state;18101811/**1812* @dai_port:1813*1814* The port in DT that is used for the Codec DAI.1815*/1816int dai_port;1817};18181819/*1820* struct drm_connector_hdmi - DRM Connector HDMI-related structure1821*/1822struct drm_connector_hdmi {1823#define DRM_CONNECTOR_HDMI_VENDOR_LEN 81824/**1825* @vendor: HDMI Controller Vendor Name1826*/1827unsigned char vendor[DRM_CONNECTOR_HDMI_VENDOR_LEN] __nonstring;18281829#define DRM_CONNECTOR_HDMI_PRODUCT_LEN 161830/**1831* @product: HDMI Controller Product Name1832*/1833unsigned char product[DRM_CONNECTOR_HDMI_PRODUCT_LEN] __nonstring;18341835/**1836* @supported_formats: Bitmask of @hdmi_colorspace1837* supported by the controller.1838*/1839unsigned long supported_formats;18401841/**1842* @funcs: HDMI connector Control Functions1843*/1844const struct drm_connector_hdmi_funcs *funcs;18451846/**1847* @infoframes: Current Infoframes output by the connector1848*/1849struct {1850/**1851* @lock: Mutex protecting against concurrent access to1852* the infoframes, most notably between KMS and ALSA.1853*/1854struct mutex lock;18551856/**1857* @audio: Current Audio Infoframes structure. Protected1858* by @lock.1859*/1860struct drm_connector_hdmi_infoframe audio;1861} infoframes;1862};18631864/**1865* struct drm_connector_cec - DRM Connector CEC-related structure1866*/1867struct drm_connector_cec {1868/**1869* @mutex: protects all fields in this structure.1870*/1871struct mutex mutex;18721873/**1874* @funcs: CEC Control Functions1875*/1876const struct drm_connector_cec_funcs *funcs;18771878/**1879* @data: CEC implementation-specific data1880*/1881void *data;1882};18831884/**1885* struct drm_connector - central DRM connector control structure1886*1887* Each connector may be connected to one or more CRTCs, or may be clonable by1888* another connector if they can share a CRTC. Each connector also has a specific1889* position in the broader display (referred to as a 'screen' though it could1890* span multiple monitors).1891*/1892struct drm_connector {1893/** @dev: parent DRM device */1894struct drm_device *dev;1895/** @kdev: kernel device for sysfs attributes */1896struct device *kdev;1897/** @attr: sysfs attributes */1898struct device_attribute *attr;1899/**1900* @fwnode: associated fwnode supplied by platform firmware1901*1902* Drivers can set this to associate a fwnode with a connector, drivers1903* are expected to get a reference on the fwnode when setting this.1904* drm_connector_cleanup() will call fwnode_handle_put() on this.1905*/1906struct fwnode_handle *fwnode;19071908/**1909* @head:1910*1911* List of all connectors on a @dev, linked from1912* &drm_mode_config.connector_list. Protected by1913* &drm_mode_config.connector_list_lock, but please only use1914* &drm_connector_list_iter to walk this list.1915*/1916struct list_head head;19171918/**1919* @global_connector_list_entry:1920*1921* Connector entry in the global connector-list, used by1922* drm_connector_find_by_fwnode().1923*/1924struct list_head global_connector_list_entry;19251926/** @base: base KMS object */1927struct drm_mode_object base;19281929/** @name: human readable name, can be overwritten by the driver */1930char *name;19311932/**1933* @mutex: Lock for general connector state, but currently only protects1934* @registered. Most of the connector state is still protected by1935* &drm_mode_config.mutex.1936*/1937struct mutex mutex;19381939/**1940* @index: Compacted connector index, which matches the position inside1941* the mode_config.list for drivers not supporting hot-add/removing. Can1942* be used as an array index. It is invariant over the lifetime of the1943* connector.1944*/1945unsigned index;19461947/**1948* @connector_type:1949* one of the DRM_MODE_CONNECTOR_<foo> types from drm_mode.h1950*/1951int connector_type;1952/** @connector_type_id: index into connector type enum */1953int connector_type_id;1954/**1955* @interlace_allowed:1956* Can this connector handle interlaced modes? Only used by1957* drm_helper_probe_single_connector_modes() for mode filtering.1958*/1959bool interlace_allowed;1960/**1961* @doublescan_allowed:1962* Can this connector handle doublescan? Only used by1963* drm_helper_probe_single_connector_modes() for mode filtering.1964*/1965bool doublescan_allowed;1966/**1967* @stereo_allowed:1968* Can this connector handle stereo modes? Only used by1969* drm_helper_probe_single_connector_modes() for mode filtering.1970*/1971bool stereo_allowed;19721973/**1974* @ycbcr_420_allowed : This bool indicates if this connector is1975* capable of handling YCBCR 420 output. While parsing the EDID1976* blocks it's very helpful to know if the source is capable of1977* handling YCBCR 420 outputs.1978*/1979bool ycbcr_420_allowed;19801981/**1982* @registration_state: Is this connector initializing, exposed1983* (registered) with userspace, or unregistered?1984*1985* Protected by @mutex.1986*/1987enum drm_connector_registration_state registration_state;19881989/**1990* @modes:1991* Modes available on this connector (from fill_modes() + user).1992* Protected by &drm_mode_config.mutex.1993*/1994struct list_head modes;19951996/**1997* @status:1998* One of the drm_connector_status enums (connected, not, or unknown).1999* Protected by &drm_mode_config.mutex.2000*/2001enum drm_connector_status status;20022003/**2004* @probed_modes:2005* These are modes added by probing with DDC or the BIOS, before2006* filtering is applied. Used by the probe helpers. Protected by2007* &drm_mode_config.mutex.2008*/2009struct list_head probed_modes;20102011/**2012* @display_info: Display information is filled from EDID information2013* when a display is detected. For non hot-pluggable displays such as2014* flat panels in embedded systems, the driver should initialize the2015* &drm_display_info.width_mm and &drm_display_info.height_mm fields2016* with the physical size of the display.2017*2018* Protected by &drm_mode_config.mutex.2019*/2020struct drm_display_info display_info;20212022/** @funcs: connector control functions */2023const struct drm_connector_funcs *funcs;20242025/**2026* @edid_blob_ptr: DRM property containing EDID if present. Protected by2027* &drm_mode_config.mutex.2028*2029* This must be updated only by calling drm_edid_connector_update() or2030* drm_connector_update_edid_property().2031*2032* This must not be used by drivers directly.2033*/2034struct drm_property_blob *edid_blob_ptr;20352036/** @properties: property tracking for this connector */2037struct drm_object_properties properties;20382039/**2040* @scaling_mode_property: Optional atomic property to control the2041* upscaling. See drm_connector_attach_content_protection_property().2042*/2043struct drm_property *scaling_mode_property;20442045/**2046* @vrr_capable_property: Optional property to help userspace2047* query hardware support for variable refresh rate on a connector.2048* connector. Drivers can add the property to a connector by2049* calling drm_connector_attach_vrr_capable_property().2050*2051* This should be updated only by calling2052* drm_connector_set_vrr_capable_property().2053*/2054struct drm_property *vrr_capable_property;20552056/**2057* @colorspace_property: Connector property to set the suitable2058* colorspace supported by the sink.2059*/2060struct drm_property *colorspace_property;20612062/**2063* @path_blob_ptr:2064*2065* DRM blob property data for the DP MST path property. This should only2066* be updated by calling drm_connector_set_path_property().2067*/2068struct drm_property_blob *path_blob_ptr;20692070/**2071* @max_bpc: Maximum bits per color channel the connector supports.2072*/2073unsigned int max_bpc;20742075/**2076* @max_bpc_property: Default connector property for the max bpc to be2077* driven out of the connector.2078*/2079struct drm_property *max_bpc_property;20802081/** @privacy_screen: drm_privacy_screen for this connector, or NULL. */2082struct drm_privacy_screen *privacy_screen;20832084/** @privacy_screen_notifier: privacy-screen notifier_block */2085struct notifier_block privacy_screen_notifier;20862087/**2088* @privacy_screen_sw_state_property: Optional atomic property for the2089* connector to control the integrated privacy screen.2090*/2091struct drm_property *privacy_screen_sw_state_property;20922093/**2094* @privacy_screen_hw_state_property: Optional atomic property for the2095* connector to report the actual integrated privacy screen state.2096*/2097struct drm_property *privacy_screen_hw_state_property;20982099/**2100* @broadcast_rgb_property: Connector property to set the2101* Broadcast RGB selection to output with.2102*/2103struct drm_property *broadcast_rgb_property;21042105#define DRM_CONNECTOR_POLL_HPD (1 << 0)2106#define DRM_CONNECTOR_POLL_CONNECT (1 << 1)2107#define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)21082109/**2110* @polled:2111*2112* Connector polling mode, a combination of2113*2114* DRM_CONNECTOR_POLL_HPD2115* The connector generates hotplug events and doesn't need to be2116* periodically polled. The CONNECT and DISCONNECT flags must not2117* be set together with the HPD flag.2118*2119* DRM_CONNECTOR_POLL_CONNECT2120* Periodically poll the connector for connection.2121*2122* DRM_CONNECTOR_POLL_DISCONNECT2123* Periodically poll the connector for disconnection, without2124* causing flickering even when the connector is in use. DACs should2125* rarely do this without a lot of testing.2126*2127* Set to 0 for connectors that don't support connection status2128* discovery.2129*/2130uint8_t polled;21312132/**2133* @dpms: Current dpms state. For legacy drivers the2134* &drm_connector_funcs.dpms callback must update this. For atomic2135* drivers, this is handled by the core atomic code, and drivers must2136* only take &drm_crtc_state.active into account.2137*/2138int dpms;21392140/** @helper_private: mid-layer private data */2141const struct drm_connector_helper_funcs *helper_private;21422143/** @cmdline_mode: mode line parsed from the kernel cmdline for this connector */2144struct drm_cmdline_mode cmdline_mode;2145/** @force: a DRM_FORCE_<foo> state for forced mode sets */2146enum drm_connector_force force;21472148/**2149* @edid_override: Override EDID set via debugfs.2150*2151* Do not modify or access outside of the drm_edid_override_* family of2152* functions.2153*/2154const struct drm_edid *edid_override;21552156/**2157* @edid_override_mutex: Protect access to edid_override.2158*/2159struct mutex edid_override_mutex;21602161/** @epoch_counter: used to detect any other changes in connector, besides status */2162u64 epoch_counter;21632164/**2165* @possible_encoders: Bit mask of encoders that can drive this2166* connector, drm_encoder_index() determines the index into the bitfield2167* and the bits are set with drm_connector_attach_encoder().2168*/2169u32 possible_encoders;21702171/**2172* @encoder: Currently bound encoder driving this connector, if any.2173* Only really meaningful for non-atomic drivers. Atomic drivers should2174* instead look at &drm_connector_state.best_encoder, and in case they2175* need the CRTC driving this output, &drm_connector_state.crtc.2176*/2177struct drm_encoder *encoder;21782179#define MAX_ELD_BYTES 1282180/** @eld: EDID-like data, if present, protected by @eld_mutex */2181uint8_t eld[MAX_ELD_BYTES];2182/** @eld_mutex: protection for concurrenct access to @eld */2183struct mutex eld_mutex;21842185/** @latency_present: AV delay info from ELD, if found */2186bool latency_present[2];2187/**2188* @video_latency: Video latency info from ELD, if found.2189* [0]: progressive, [1]: interlaced2190*/2191int video_latency[2];2192/**2193* @audio_latency: audio latency info from ELD, if found2194* [0]: progressive, [1]: interlaced2195*/2196int audio_latency[2];21972198/**2199* @ddc: associated ddc adapter.2200* A connector usually has its associated ddc adapter. If a driver uses2201* this field, then an appropriate symbolic link is created in connector2202* sysfs directory to make it easy for the user to tell which i2c2203* adapter is for a particular display.2204*2205* The field should be set by calling drm_connector_init_with_ddc().2206*/2207struct i2c_adapter *ddc;22082209/**2210* @null_edid_counter: track sinks that give us all zeros for the EDID.2211* Needed to workaround some HW bugs where we get all 0s2212*/2213int null_edid_counter;22142215/** @bad_edid_counter: track sinks that give us an EDID with invalid checksum */2216unsigned bad_edid_counter;22172218/**2219* @edid_corrupt: Indicates whether the last read EDID was corrupt. Used2220* in Displayport compliance testing - Displayport Link CTS Core 1.22221* rev1.1 4.2.2.62222*/2223bool edid_corrupt;2224/**2225* @real_edid_checksum: real edid checksum for corrupted edid block.2226* Required in Displayport 1.4 compliance testing2227* rev1.1 4.2.2.62228*/2229u8 real_edid_checksum;22302231/** @debugfs_entry: debugfs directory for this connector */2232struct dentry *debugfs_entry;22332234/**2235* @state:2236*2237* Current atomic state for this connector.2238*2239* This is protected by &drm_mode_config.connection_mutex. Note that2240* nonblocking atomic commits access the current connector state without2241* taking locks. Either by going through the &struct drm_atomic_state2242* pointers, see for_each_oldnew_connector_in_state(),2243* for_each_old_connector_in_state() and2244* for_each_new_connector_in_state(). Or through careful ordering of2245* atomic commit operations as implemented in the atomic helpers, see2246* &struct drm_crtc_commit.2247*/2248struct drm_connector_state *state;22492250/* DisplayID bits. FIXME: Extract into a substruct? */22512252/**2253* @tile_blob_ptr:2254*2255* DRM blob property data for the tile property (used mostly by DP MST).2256* This is meant for screens which are driven through separate display2257* pipelines represented by &drm_crtc, which might not be running with2258* genlocked clocks. For tiled panels which are genlocked, like2259* dual-link LVDS or dual-link DSI, the driver should try to not expose2260* the tiling and virtualize both &drm_crtc and &drm_plane if needed.2261*2262* This should only be updated by calling2263* drm_connector_set_tile_property().2264*/2265struct drm_property_blob *tile_blob_ptr;22662267/** @has_tile: is this connector connected to a tiled monitor */2268bool has_tile;2269/** @tile_group: tile group for the connected monitor */2270struct drm_tile_group *tile_group;2271/** @tile_is_single_monitor: whether the tile is one monitor housing */2272bool tile_is_single_monitor;22732274/** @num_h_tile: number of horizontal tiles in the tile group */2275/** @num_v_tile: number of vertical tiles in the tile group */2276uint8_t num_h_tile, num_v_tile;2277/** @tile_h_loc: horizontal location of this tile */2278/** @tile_v_loc: vertical location of this tile */2279uint8_t tile_h_loc, tile_v_loc;2280/** @tile_h_size: horizontal size of this tile. */2281/** @tile_v_size: vertical size of this tile. */2282uint16_t tile_h_size, tile_v_size;22832284/**2285* @free_node:2286*2287* List used only by &drm_connector_list_iter to be able to clean up a2288* connector from any context, in conjunction with2289* &drm_mode_config.connector_free_work.2290*/2291struct llist_node free_node;22922293/**2294* @hdmi: HDMI-related variable and properties.2295*/2296struct drm_connector_hdmi hdmi;22972298/**2299* @hdmi_audio: HDMI codec properties and non-DRM state.2300*/2301struct drm_connector_hdmi_audio hdmi_audio;23022303/**2304* @cec: CEC-related data.2305*/2306struct drm_connector_cec cec;2307};23082309#define obj_to_connector(x) container_of(x, struct drm_connector, base)23102311int drm_connector_init(struct drm_device *dev,2312struct drm_connector *connector,2313const struct drm_connector_funcs *funcs,2314int connector_type);2315int drm_connector_dynamic_init(struct drm_device *dev,2316struct drm_connector *connector,2317const struct drm_connector_funcs *funcs,2318int connector_type,2319struct i2c_adapter *ddc);2320int drm_connector_init_with_ddc(struct drm_device *dev,2321struct drm_connector *connector,2322const struct drm_connector_funcs *funcs,2323int connector_type,2324struct i2c_adapter *ddc);2325int drmm_connector_init(struct drm_device *dev,2326struct drm_connector *connector,2327const struct drm_connector_funcs *funcs,2328int connector_type,2329struct i2c_adapter *ddc);2330int drmm_connector_hdmi_init(struct drm_device *dev,2331struct drm_connector *connector,2332const char *vendor, const char *product,2333const struct drm_connector_funcs *funcs,2334const struct drm_connector_hdmi_funcs *hdmi_funcs,2335int connector_type,2336struct i2c_adapter *ddc,2337unsigned long supported_formats,2338unsigned int max_bpc);2339void drm_connector_attach_edid_property(struct drm_connector *connector);2340int drm_connector_register(struct drm_connector *connector);2341int drm_connector_dynamic_register(struct drm_connector *connector);2342void drm_connector_unregister(struct drm_connector *connector);2343int drm_connector_attach_encoder(struct drm_connector *connector,2344struct drm_encoder *encoder);23452346void drm_connector_cleanup(struct drm_connector *connector);23472348static inline unsigned int drm_connector_index(const struct drm_connector *connector)2349{2350return connector->index;2351}23522353static inline u32 drm_connector_mask(const struct drm_connector *connector)2354{2355return 1 << connector->index;2356}23572358/**2359* drm_connector_lookup - lookup connector object2360* @dev: DRM device2361* @file_priv: drm file to check for lease against.2362* @id: connector object id2363*2364* This function looks up the connector object specified by id2365* add takes a reference to it.2366*/2367static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev,2368struct drm_file *file_priv,2369uint32_t id)2370{2371struct drm_mode_object *mo;2372mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CONNECTOR);2373return mo ? obj_to_connector(mo) : NULL;2374}23752376/**2377* drm_connector_get - acquire a connector reference2378* @connector: DRM connector2379*2380* This function increments the connector's refcount.2381*/2382static inline void drm_connector_get(struct drm_connector *connector)2383{2384drm_mode_object_get(&connector->base);2385}23862387/**2388* drm_connector_put - release a connector reference2389* @connector: DRM connector2390*2391* This function decrements the connector's reference count and frees the2392* object if the reference count drops to zero.2393*/2394static inline void drm_connector_put(struct drm_connector *connector)2395{2396drm_mode_object_put(&connector->base);2397}23982399/**2400* drm_connector_is_unregistered - has the connector been unregistered from2401* userspace?2402* @connector: DRM connector2403*2404* Checks whether or not @connector has been unregistered from userspace.2405*2406* Returns:2407* True if the connector was unregistered, false if the connector is2408* registered or has not yet been registered with userspace.2409*/2410static inline bool2411drm_connector_is_unregistered(struct drm_connector *connector)2412{2413return READ_ONCE(connector->registration_state) ==2414DRM_CONNECTOR_UNREGISTERED;2415}24162417void drm_connector_oob_hotplug_event(struct fwnode_handle *connector_fwnode,2418enum drm_connector_status status);2419const char *drm_get_connector_type_name(unsigned int connector_type);2420const char *drm_get_connector_status_name(enum drm_connector_status status);2421const char *drm_get_subpixel_order_name(enum subpixel_order order);2422const char *drm_get_dpms_name(int val);2423const char *drm_get_dvi_i_subconnector_name(int val);2424const char *drm_get_dvi_i_select_name(int val);2425const char *drm_get_tv_mode_name(int val);2426const char *drm_get_tv_subconnector_name(int val);2427const char *drm_get_tv_select_name(int val);2428const char *drm_get_dp_subconnector_name(int val);2429const char *drm_get_content_protection_name(int val);2430const char *drm_get_hdcp_content_type_name(int val);24312432int drm_get_tv_mode_from_name(const char *name, size_t len);24332434int drm_mode_create_dvi_i_properties(struct drm_device *dev);2435void drm_connector_attach_dp_subconnector_property(struct drm_connector *connector);24362437int drm_mode_create_tv_margin_properties(struct drm_device *dev);2438int drm_mode_create_tv_properties_legacy(struct drm_device *dev,2439unsigned int num_modes,2440const char * const modes[]);2441int drm_mode_create_tv_properties(struct drm_device *dev,2442unsigned int supported_tv_modes);2443void drm_connector_attach_tv_margin_properties(struct drm_connector *conn);2444int drm_mode_create_scaling_mode_property(struct drm_device *dev);2445int drm_connector_attach_content_type_property(struct drm_connector *dev);2446int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,2447u32 scaling_mode_mask);2448int drm_connector_attach_vrr_capable_property(2449struct drm_connector *connector);2450int drm_connector_attach_broadcast_rgb_property(struct drm_connector *connector);2451int drm_connector_attach_colorspace_property(struct drm_connector *connector);2452int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector);2453bool drm_connector_atomic_hdr_metadata_equal(struct drm_connector_state *old_state,2454struct drm_connector_state *new_state);2455int drm_mode_create_aspect_ratio_property(struct drm_device *dev);2456int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector,2457u32 supported_colorspaces);2458int drm_mode_create_dp_colorspace_property(struct drm_connector *connector,2459u32 supported_colorspaces);2460int drm_mode_create_content_type_property(struct drm_device *dev);2461int drm_mode_create_suggested_offset_properties(struct drm_device *dev);24622463int drm_connector_set_path_property(struct drm_connector *connector,2464const char *path);2465int drm_connector_set_tile_property(struct drm_connector *connector);2466int drm_connector_update_edid_property(struct drm_connector *connector,2467const struct edid *edid);2468void drm_connector_set_link_status_property(struct drm_connector *connector,2469uint64_t link_status);2470void drm_connector_set_vrr_capable_property(2471struct drm_connector *connector, bool capable);2472int drm_connector_set_panel_orientation(2473struct drm_connector *connector,2474enum drm_panel_orientation panel_orientation);2475int drm_connector_set_panel_orientation_with_quirk(2476struct drm_connector *connector,2477enum drm_panel_orientation panel_orientation,2478int width, int height);2479int drm_connector_set_orientation_from_panel(2480struct drm_connector *connector,2481struct drm_panel *panel);2482int drm_connector_attach_max_bpc_property(struct drm_connector *connector,2483int min, int max);2484void drm_connector_create_privacy_screen_properties(struct drm_connector *conn);2485void drm_connector_attach_privacy_screen_properties(struct drm_connector *conn);2486void drm_connector_attach_privacy_screen_provider(2487struct drm_connector *connector, struct drm_privacy_screen *priv);2488void drm_connector_update_privacy_screen(const struct drm_connector_state *connector_state);24892490/**2491* struct drm_tile_group - Tile group metadata2492* @refcount: reference count2493* @dev: DRM device2494* @id: tile group id exposed to userspace2495* @group_data: Sink-private data identifying this group2496*2497* @group_data corresponds to displayid vend/prod/serial for external screens2498* with an EDID.2499*/2500struct drm_tile_group {2501struct kref refcount;2502struct drm_device *dev;2503int id;2504u8 group_data[8];2505};25062507struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,2508const char topology[8]);2509struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev,2510const char topology[8]);2511void drm_mode_put_tile_group(struct drm_device *dev,2512struct drm_tile_group *tg);25132514/**2515* struct drm_connector_list_iter - connector_list iterator2516*2517* This iterator tracks state needed to be able to walk the connector_list2518* within struct drm_mode_config. Only use together with2519* drm_connector_list_iter_begin(), drm_connector_list_iter_end() and2520* drm_connector_list_iter_next() respectively the convenience macro2521* drm_for_each_connector_iter().2522*2523* Note that the return value of drm_connector_list_iter_next() is only valid2524* up to the next drm_connector_list_iter_next() or2525* drm_connector_list_iter_end() call. If you want to use the connector later,2526* then you need to grab your own reference first using drm_connector_get().2527*/2528struct drm_connector_list_iter {2529/* private: */2530struct drm_device *dev;2531struct drm_connector *conn;2532};25332534void drm_connector_list_iter_begin(struct drm_device *dev,2535struct drm_connector_list_iter *iter);2536struct drm_connector *2537drm_connector_list_iter_next(struct drm_connector_list_iter *iter);2538void drm_connector_list_iter_end(struct drm_connector_list_iter *iter);25392540bool drm_connector_has_possible_encoder(struct drm_connector *connector,2541struct drm_encoder *encoder);2542const char *drm_get_colorspace_name(enum drm_colorspace colorspace);25432544/**2545* drm_for_each_connector_iter - connector_list iterator macro2546* @connector: &struct drm_connector pointer used as cursor2547* @iter: &struct drm_connector_list_iter2548*2549* Note that @connector is only valid within the list body, if you want to use2550* @connector after calling drm_connector_list_iter_end() then you need to grab2551* your own reference first using drm_connector_get().2552*/2553#define drm_for_each_connector_iter(connector, iter) \2554while ((connector = drm_connector_list_iter_next(iter)))25552556/**2557* drm_connector_for_each_possible_encoder - iterate connector's possible encoders2558* @connector: &struct drm_connector pointer2559* @encoder: &struct drm_encoder pointer used as cursor2560*/2561#define drm_connector_for_each_possible_encoder(connector, encoder) \2562drm_for_each_encoder_mask(encoder, (connector)->dev, \2563(connector)->possible_encoders)25642565#endif256625672568