1 1.5 riastrad /* $NetBSD: drm_connector.h,v 1.5 2021/12/19 12:44:04 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad /* 4 1.1 riastrad * Copyright (c) 2016 Intel Corporation 5 1.1 riastrad * 6 1.1 riastrad * Permission to use, copy, modify, distribute, and sell this software and its 7 1.1 riastrad * documentation for any purpose is hereby granted without fee, provided that 8 1.1 riastrad * the above copyright notice appear in all copies and that both that copyright 9 1.1 riastrad * notice and this permission notice appear in supporting documentation, and 10 1.1 riastrad * that the name of the copyright holders not be used in advertising or 11 1.1 riastrad * publicity pertaining to distribution of the software without specific, 12 1.1 riastrad * written prior permission. The copyright holders make no representations 13 1.1 riastrad * about the suitability of this software for any purpose. It is provided "as 14 1.1 riastrad * is" without express or implied warranty. 15 1.1 riastrad * 16 1.1 riastrad * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 17 1.1 riastrad * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 18 1.1 riastrad * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 19 1.1 riastrad * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 20 1.1 riastrad * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 21 1.1 riastrad * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 22 1.1 riastrad * OF THIS SOFTWARE. 23 1.1 riastrad */ 24 1.1 riastrad 25 1.1 riastrad #ifndef __DRM_CONNECTOR_H__ 26 1.1 riastrad #define __DRM_CONNECTOR_H__ 27 1.1 riastrad 28 1.1 riastrad #include <linux/list.h> 29 1.1 riastrad #include <linux/llist.h> 30 1.1 riastrad #include <linux/ctype.h> 31 1.1 riastrad #include <linux/hdmi.h> 32 1.1 riastrad #include <drm/drm_mode_object.h> 33 1.1 riastrad #include <drm/drm_util.h> 34 1.1 riastrad 35 1.1 riastrad #include <uapi/drm/drm_mode.h> 36 1.1 riastrad 37 1.1 riastrad struct drm_connector_helper_funcs; 38 1.1 riastrad struct drm_modeset_acquire_ctx; 39 1.1 riastrad struct drm_device; 40 1.1 riastrad struct drm_crtc; 41 1.1 riastrad struct drm_encoder; 42 1.1 riastrad struct drm_property; 43 1.1 riastrad struct drm_property_blob; 44 1.1 riastrad struct drm_printer; 45 1.1 riastrad struct edid; 46 1.1 riastrad struct i2c_adapter; 47 1.1 riastrad 48 1.1 riastrad enum drm_connector_force { 49 1.1 riastrad DRM_FORCE_UNSPECIFIED, 50 1.1 riastrad DRM_FORCE_OFF, 51 1.1 riastrad DRM_FORCE_ON, /* force on analog part normally */ 52 1.1 riastrad DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ 53 1.1 riastrad }; 54 1.1 riastrad 55 1.1 riastrad /** 56 1.1 riastrad * enum drm_connector_status - status for a &drm_connector 57 1.1 riastrad * 58 1.1 riastrad * This enum is used to track the connector status. There are no separate 59 1.1 riastrad * #defines for the uapi! 60 1.1 riastrad */ 61 1.1 riastrad enum drm_connector_status { 62 1.1 riastrad /** 63 1.1 riastrad * @connector_status_connected: The connector is definitely connected to 64 1.1 riastrad * a sink device, and can be enabled. 65 1.1 riastrad */ 66 1.1 riastrad connector_status_connected = 1, 67 1.1 riastrad /** 68 1.1 riastrad * @connector_status_disconnected: The connector isn't connected to a 69 1.1 riastrad * sink device which can be autodetect. For digital outputs like DP or 70 1.1 riastrad * HDMI (which can be realiable probed) this means there's really 71 1.1 riastrad * nothing there. It is driver-dependent whether a connector with this 72 1.1 riastrad * status can be lit up or not. 73 1.1 riastrad */ 74 1.1 riastrad connector_status_disconnected = 2, 75 1.1 riastrad /** 76 1.1 riastrad * @connector_status_unknown: The connector's status could not be 77 1.1 riastrad * reliably detected. This happens when probing would either cause 78 1.1 riastrad * flicker (like load-detection when the connector is in use), or when a 79 1.1 riastrad * hardware resource isn't available (like when load-detection needs a 80 1.1 riastrad * free CRTC). It should be possible to light up the connector with one 81 1.1 riastrad * of the listed fallback modes. For default configuration userspace 82 1.1 riastrad * should only try to light up connectors with unknown status when 83 1.1 riastrad * there's not connector with @connector_status_connected. 84 1.1 riastrad */ 85 1.1 riastrad connector_status_unknown = 3, 86 1.1 riastrad }; 87 1.1 riastrad 88 1.1 riastrad /** 89 1.1 riastrad * enum drm_connector_registration_status - userspace registration status for 90 1.1 riastrad * a &drm_connector 91 1.1 riastrad * 92 1.1 riastrad * This enum is used to track the status of initializing a connector and 93 1.1 riastrad * registering it with userspace, so that DRM can prevent bogus modesets on 94 1.1 riastrad * connectors that no longer exist. 95 1.1 riastrad */ 96 1.1 riastrad enum drm_connector_registration_state { 97 1.1 riastrad /** 98 1.1 riastrad * @DRM_CONNECTOR_INITIALIZING: The connector has just been created, 99 1.1 riastrad * but has yet to be exposed to userspace. There should be no 100 1.1 riastrad * additional restrictions to how the state of this connector may be 101 1.1 riastrad * modified. 102 1.1 riastrad */ 103 1.1 riastrad DRM_CONNECTOR_INITIALIZING = 0, 104 1.1 riastrad 105 1.1 riastrad /** 106 1.1 riastrad * @DRM_CONNECTOR_REGISTERED: The connector has been fully initialized 107 1.1 riastrad * and registered with sysfs, as such it has been exposed to 108 1.1 riastrad * userspace. There should be no additional restrictions to how the 109 1.1 riastrad * state of this connector may be modified. 110 1.1 riastrad */ 111 1.1 riastrad DRM_CONNECTOR_REGISTERED = 1, 112 1.1 riastrad 113 1.1 riastrad /** 114 1.1 riastrad * @DRM_CONNECTOR_UNREGISTERED: The connector has either been exposed 115 1.1 riastrad * to userspace and has since been unregistered and removed from 116 1.1 riastrad * userspace, or the connector was unregistered before it had a chance 117 1.1 riastrad * to be exposed to userspace (e.g. still in the 118 1.1 riastrad * @DRM_CONNECTOR_INITIALIZING state). When a connector is 119 1.1 riastrad * unregistered, there are additional restrictions to how its state 120 1.1 riastrad * may be modified: 121 1.1 riastrad * 122 1.1 riastrad * - An unregistered connector may only have its DPMS changed from 123 1.1 riastrad * On->Off. Once DPMS is changed to Off, it may not be switched back 124 1.1 riastrad * to On. 125 1.1 riastrad * - Modesets are not allowed on unregistered connectors, unless they 126 1.1 riastrad * would result in disabling its assigned CRTCs. This means 127 1.1 riastrad * disabling a CRTC on an unregistered connector is OK, but enabling 128 1.1 riastrad * one is not. 129 1.1 riastrad * - Removing a CRTC from an unregistered connector is OK, but new 130 1.1 riastrad * CRTCs may never be assigned to an unregistered connector. 131 1.1 riastrad */ 132 1.1 riastrad DRM_CONNECTOR_UNREGISTERED = 2, 133 1.1 riastrad }; 134 1.1 riastrad 135 1.1 riastrad enum subpixel_order { 136 1.1 riastrad SubPixelUnknown = 0, 137 1.1 riastrad SubPixelHorizontalRGB, 138 1.1 riastrad SubPixelHorizontalBGR, 139 1.1 riastrad SubPixelVerticalRGB, 140 1.1 riastrad SubPixelVerticalBGR, 141 1.1 riastrad SubPixelNone, 142 1.1 riastrad 143 1.1 riastrad }; 144 1.1 riastrad 145 1.1 riastrad /** 146 1.1 riastrad * struct drm_scrambling: sink's scrambling support. 147 1.1 riastrad */ 148 1.1 riastrad struct drm_scrambling { 149 1.1 riastrad /** 150 1.1 riastrad * @supported: scrambling supported for rates > 340 Mhz. 151 1.1 riastrad */ 152 1.1 riastrad bool supported; 153 1.1 riastrad /** 154 1.1 riastrad * @low_rates: scrambling supported for rates <= 340 Mhz. 155 1.1 riastrad */ 156 1.1 riastrad bool low_rates; 157 1.1 riastrad }; 158 1.1 riastrad 159 1.1 riastrad /* 160 1.1 riastrad * struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink 161 1.1 riastrad * 162 1.1 riastrad * Provides SCDC register support and capabilities related information on a 163 1.1 riastrad * HDMI 2.0 sink. In case of a HDMI 1.4 sink, all parameter must be 0. 164 1.1 riastrad */ 165 1.1 riastrad struct drm_scdc { 166 1.1 riastrad /** 167 1.1 riastrad * @supported: status control & data channel present. 168 1.1 riastrad */ 169 1.1 riastrad bool supported; 170 1.1 riastrad /** 171 1.1 riastrad * @read_request: sink is capable of generating scdc read request. 172 1.1 riastrad */ 173 1.1 riastrad bool read_request; 174 1.1 riastrad /** 175 1.1 riastrad * @scrambling: sink's scrambling capabilities 176 1.1 riastrad */ 177 1.1 riastrad struct drm_scrambling scrambling; 178 1.1 riastrad }; 179 1.1 riastrad 180 1.1 riastrad 181 1.1 riastrad /** 182 1.1 riastrad * struct drm_hdmi_info - runtime information about the connected HDMI sink 183 1.1 riastrad * 184 1.1 riastrad * Describes if a given display supports advanced HDMI 2.0 features. 185 1.1 riastrad * This information is available in CEA-861-F extension blocks (like HF-VSDB). 186 1.1 riastrad */ 187 1.1 riastrad struct drm_hdmi_info { 188 1.1 riastrad /** @scdc: sink's scdc support and capabilities */ 189 1.1 riastrad struct drm_scdc scdc; 190 1.1 riastrad 191 1.1 riastrad /** 192 1.1 riastrad * @y420_vdb_modes: bitmap of modes which can support ycbcr420 193 1.1 riastrad * output only (not normal RGB/YCBCR444/422 outputs). The max VIC 194 1.1 riastrad * defined by the CEA-861-G spec is 219, so the size is 256 bits to map 195 1.1 riastrad * up to 256 VICs. 196 1.1 riastrad */ 197 1.1 riastrad unsigned long y420_vdb_modes[BITS_TO_LONGS(256)]; 198 1.1 riastrad 199 1.1 riastrad /** 200 1.1 riastrad * @y420_cmdb_modes: bitmap of modes which can support ycbcr420 201 1.1 riastrad * output also, along with normal HDMI outputs. The max VIC defined by 202 1.1 riastrad * the CEA-861-G spec is 219, so the size is 256 bits to map up to 256 203 1.1 riastrad * VICs. 204 1.1 riastrad */ 205 1.1 riastrad unsigned long y420_cmdb_modes[BITS_TO_LONGS(256)]; 206 1.1 riastrad 207 1.1 riastrad /** @y420_cmdb_map: bitmap of SVD index, to extraxt vcb modes */ 208 1.1 riastrad u64 y420_cmdb_map; 209 1.1 riastrad 210 1.1 riastrad /** @y420_dc_modes: bitmap of deep color support index */ 211 1.1 riastrad u8 y420_dc_modes; 212 1.1 riastrad }; 213 1.1 riastrad 214 1.1 riastrad /** 215 1.1 riastrad * enum drm_link_status - connector's link_status property value 216 1.1 riastrad * 217 1.1 riastrad * This enum is used as the connector's link status property value. 218 1.1 riastrad * It is set to the values defined in uapi. 219 1.1 riastrad * 220 1.1 riastrad * @DRM_LINK_STATUS_GOOD: DP Link is Good as a result of successful 221 1.1 riastrad * link training 222 1.1 riastrad * @DRM_LINK_STATUS_BAD: DP Link is BAD as a result of link training 223 1.1 riastrad * failure 224 1.1 riastrad */ 225 1.1 riastrad enum drm_link_status { 226 1.1 riastrad DRM_LINK_STATUS_GOOD = DRM_MODE_LINK_STATUS_GOOD, 227 1.1 riastrad DRM_LINK_STATUS_BAD = DRM_MODE_LINK_STATUS_BAD, 228 1.1 riastrad }; 229 1.1 riastrad 230 1.1 riastrad /** 231 1.1 riastrad * enum drm_panel_orientation - panel_orientation info for &drm_display_info 232 1.1 riastrad * 233 1.1 riastrad * This enum is used to track the (LCD) panel orientation. There are no 234 1.1 riastrad * separate #defines for the uapi! 235 1.1 riastrad * 236 1.1 riastrad * @DRM_MODE_PANEL_ORIENTATION_UNKNOWN: The drm driver has not provided any 237 1.1 riastrad * panel orientation information (normal 238 1.1 riastrad * for non panels) in this case the "panel 239 1.1 riastrad * orientation" connector prop will not be 240 1.1 riastrad * attached. 241 1.1 riastrad * @DRM_MODE_PANEL_ORIENTATION_NORMAL: The top side of the panel matches the 242 1.1 riastrad * top side of the device's casing. 243 1.1 riastrad * @DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP: The top side of the panel matches the 244 1.1 riastrad * bottom side of the device's casing, iow 245 1.1 riastrad * the panel is mounted upside-down. 246 1.1 riastrad * @DRM_MODE_PANEL_ORIENTATION_LEFT_UP: The left side of the panel matches the 247 1.1 riastrad * top side of the device's casing. 248 1.1 riastrad * @DRM_MODE_PANEL_ORIENTATION_RIGHT_UP: The right side of the panel matches the 249 1.1 riastrad * top side of the device's casing. 250 1.1 riastrad */ 251 1.1 riastrad enum drm_panel_orientation { 252 1.1 riastrad DRM_MODE_PANEL_ORIENTATION_UNKNOWN = -1, 253 1.1 riastrad DRM_MODE_PANEL_ORIENTATION_NORMAL = 0, 254 1.1 riastrad DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, 255 1.1 riastrad DRM_MODE_PANEL_ORIENTATION_LEFT_UP, 256 1.1 riastrad DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, 257 1.1 riastrad }; 258 1.1 riastrad 259 1.1 riastrad /* 260 1.1 riastrad * This is a consolidated colorimetry list supported by HDMI and 261 1.1 riastrad * DP protocol standard. The respective connectors will register 262 1.1 riastrad * a property with the subset of this list (supported by that 263 1.1 riastrad * respective protocol). Userspace will set the colorspace through 264 1.1 riastrad * a colorspace property which will be created and exposed to 265 1.1 riastrad * userspace. 266 1.1 riastrad */ 267 1.1 riastrad 268 1.1 riastrad /* For Default case, driver will set the colorspace */ 269 1.1 riastrad #define DRM_MODE_COLORIMETRY_DEFAULT 0 270 1.1 riastrad /* CEA 861 Normal Colorimetry options */ 271 1.1 riastrad #define DRM_MODE_COLORIMETRY_NO_DATA 0 272 1.1 riastrad #define DRM_MODE_COLORIMETRY_SMPTE_170M_YCC 1 273 1.1 riastrad #define DRM_MODE_COLORIMETRY_BT709_YCC 2 274 1.1 riastrad /* CEA 861 Extended Colorimetry Options */ 275 1.1 riastrad #define DRM_MODE_COLORIMETRY_XVYCC_601 3 276 1.1 riastrad #define DRM_MODE_COLORIMETRY_XVYCC_709 4 277 1.1 riastrad #define DRM_MODE_COLORIMETRY_SYCC_601 5 278 1.1 riastrad #define DRM_MODE_COLORIMETRY_OPYCC_601 6 279 1.1 riastrad #define DRM_MODE_COLORIMETRY_OPRGB 7 280 1.1 riastrad #define DRM_MODE_COLORIMETRY_BT2020_CYCC 8 281 1.1 riastrad #define DRM_MODE_COLORIMETRY_BT2020_RGB 9 282 1.1 riastrad #define DRM_MODE_COLORIMETRY_BT2020_YCC 10 283 1.1 riastrad /* Additional Colorimetry extension added as part of CTA 861.G */ 284 1.1 riastrad #define DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65 11 285 1.1 riastrad #define DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER 12 286 1.1 riastrad /* Additional Colorimetry Options added for DP 1.4a VSC Colorimetry Format */ 287 1.1 riastrad #define DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED 13 288 1.1 riastrad #define DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT 14 289 1.1 riastrad #define DRM_MODE_COLORIMETRY_BT601_YCC 15 290 1.1 riastrad 291 1.1 riastrad /** 292 1.1 riastrad * enum drm_bus_flags - bus_flags info for &drm_display_info 293 1.1 riastrad * 294 1.1 riastrad * This enum defines signal polarities and clock edge information for signals on 295 1.1 riastrad * a bus as bitmask flags. 296 1.1 riastrad * 297 1.1 riastrad * The clock edge information is conveyed by two sets of symbols, 298 1.1 riastrad * DRM_BUS_FLAGS_*_DRIVE_\* and DRM_BUS_FLAGS_*_SAMPLE_\*. When this enum is 299 1.1 riastrad * used to describe a bus from the point of view of the transmitter, the 300 1.1 riastrad * \*_DRIVE_\* flags should be used. When used from the point of view of the 301 1.1 riastrad * receiver, the \*_SAMPLE_\* flags should be used. The \*_DRIVE_\* and 302 1.1 riastrad * \*_SAMPLE_\* flags alias each other, with the \*_SAMPLE_POSEDGE and 303 1.1 riastrad * \*_SAMPLE_NEGEDGE flags being equal to \*_DRIVE_NEGEDGE and \*_DRIVE_POSEDGE 304 1.1 riastrad * respectively. This simplifies code as signals are usually sampled on the 305 1.1 riastrad * opposite edge of the driving edge. Transmitters and receivers may however 306 1.1 riastrad * need to take other signal timings into account to convert between driving 307 1.1 riastrad * and sample edges. 308 1.1 riastrad * 309 1.1 riastrad * @DRM_BUS_FLAG_DE_LOW: The Data Enable signal is active low 310 1.1 riastrad * @DRM_BUS_FLAG_DE_HIGH: The Data Enable signal is active high 311 1.1 riastrad * @DRM_BUS_FLAG_PIXDATA_POSEDGE: Legacy value, do not use 312 1.1 riastrad * @DRM_BUS_FLAG_PIXDATA_NEGEDGE: Legacy value, do not use 313 1.1 riastrad * @DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE: Data is driven on the rising edge of 314 1.1 riastrad * the pixel clock 315 1.1 riastrad * @DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE: Data is driven on the falling edge of 316 1.1 riastrad * the pixel clock 317 1.1 riastrad * @DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE: Data is sampled on the rising edge of 318 1.1 riastrad * the pixel clock 319 1.1 riastrad * @DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE: Data is sampled on the falling edge of 320 1.1 riastrad * the pixel clock 321 1.1 riastrad * @DRM_BUS_FLAG_DATA_MSB_TO_LSB: Data is transmitted MSB to LSB on the bus 322 1.1 riastrad * @DRM_BUS_FLAG_DATA_LSB_TO_MSB: Data is transmitted LSB to MSB on the bus 323 1.1 riastrad * @DRM_BUS_FLAG_SYNC_POSEDGE: Legacy value, do not use 324 1.1 riastrad * @DRM_BUS_FLAG_SYNC_NEGEDGE: Legacy value, do not use 325 1.1 riastrad * @DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE: Sync signals are driven on the rising 326 1.1 riastrad * edge of the pixel clock 327 1.1 riastrad * @DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE: Sync signals are driven on the falling 328 1.1 riastrad * edge of the pixel clock 329 1.1 riastrad * @DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE: Sync signals are sampled on the rising 330 1.1 riastrad * edge of the pixel clock 331 1.1 riastrad * @DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE: Sync signals are sampled on the falling 332 1.1 riastrad * edge of the pixel clock 333 1.1 riastrad * @DRM_BUS_FLAG_SHARP_SIGNALS: Set if the Sharp-specific signals 334 1.1 riastrad * (SPL, CLS, PS, REV) must be used 335 1.1 riastrad */ 336 1.1 riastrad enum drm_bus_flags { 337 1.1 riastrad DRM_BUS_FLAG_DE_LOW = BIT(0), 338 1.1 riastrad DRM_BUS_FLAG_DE_HIGH = BIT(1), 339 1.1 riastrad DRM_BUS_FLAG_PIXDATA_POSEDGE = BIT(2), 340 1.1 riastrad DRM_BUS_FLAG_PIXDATA_NEGEDGE = BIT(3), 341 1.1 riastrad DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE = DRM_BUS_FLAG_PIXDATA_POSEDGE, 342 1.1 riastrad DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE = DRM_BUS_FLAG_PIXDATA_NEGEDGE, 343 1.1 riastrad DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE = DRM_BUS_FLAG_PIXDATA_NEGEDGE, 344 1.1 riastrad DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE = DRM_BUS_FLAG_PIXDATA_POSEDGE, 345 1.1 riastrad DRM_BUS_FLAG_DATA_MSB_TO_LSB = BIT(4), 346 1.1 riastrad DRM_BUS_FLAG_DATA_LSB_TO_MSB = BIT(5), 347 1.1 riastrad DRM_BUS_FLAG_SYNC_POSEDGE = BIT(6), 348 1.1 riastrad DRM_BUS_FLAG_SYNC_NEGEDGE = BIT(7), 349 1.1 riastrad DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE = DRM_BUS_FLAG_SYNC_POSEDGE, 350 1.1 riastrad DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE = DRM_BUS_FLAG_SYNC_NEGEDGE, 351 1.1 riastrad DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE = DRM_BUS_FLAG_SYNC_NEGEDGE, 352 1.1 riastrad DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE = DRM_BUS_FLAG_SYNC_POSEDGE, 353 1.1 riastrad DRM_BUS_FLAG_SHARP_SIGNALS = BIT(8), 354 1.1 riastrad }; 355 1.1 riastrad 356 1.1 riastrad /** 357 1.1 riastrad * struct drm_display_info - runtime data about the connected sink 358 1.1 riastrad * 359 1.1 riastrad * Describes a given display (e.g. CRT or flat panel) and its limitations. For 360 1.1 riastrad * fixed display sinks like built-in panels there's not much difference between 361 1.1 riastrad * this and &struct drm_connector. But for sinks with a real cable this 362 1.1 riastrad * structure is meant to describe all the things at the other end of the cable. 363 1.1 riastrad * 364 1.1 riastrad * For sinks which provide an EDID this can be filled out by calling 365 1.1 riastrad * drm_add_edid_modes(). 366 1.1 riastrad */ 367 1.1 riastrad struct drm_display_info { 368 1.1 riastrad /** 369 1.1 riastrad * @width_mm: Physical width in mm. 370 1.1 riastrad */ 371 1.1 riastrad unsigned int width_mm; 372 1.1 riastrad 373 1.1 riastrad /** 374 1.1 riastrad * @height_mm: Physical height in mm. 375 1.1 riastrad */ 376 1.1 riastrad unsigned int height_mm; 377 1.1 riastrad 378 1.1 riastrad /** 379 1.1 riastrad * @bpc: Maximum bits per color channel. Used by HDMI and DP outputs. 380 1.1 riastrad */ 381 1.1 riastrad unsigned int bpc; 382 1.1 riastrad 383 1.1 riastrad /** 384 1.1 riastrad * @subpixel_order: Subpixel order of LCD panels. 385 1.1 riastrad */ 386 1.1 riastrad enum subpixel_order subpixel_order; 387 1.1 riastrad 388 1.1 riastrad #define DRM_COLOR_FORMAT_RGB444 (1<<0) 389 1.1 riastrad #define DRM_COLOR_FORMAT_YCRCB444 (1<<1) 390 1.1 riastrad #define DRM_COLOR_FORMAT_YCRCB422 (1<<2) 391 1.1 riastrad #define DRM_COLOR_FORMAT_YCRCB420 (1<<3) 392 1.1 riastrad 393 1.1 riastrad /** 394 1.1 riastrad * @panel_orientation: Read only connector property for built-in panels, 395 1.1 riastrad * indicating the orientation of the panel vs the device's casing. 396 1.1 riastrad * drm_connector_init() sets this to DRM_MODE_PANEL_ORIENTATION_UNKNOWN. 397 1.1 riastrad * When not UNKNOWN this gets used by the drm_fb_helpers to rotate the 398 1.1 riastrad * fb to compensate and gets exported as prop to userspace. 399 1.1 riastrad */ 400 1.1 riastrad int panel_orientation; 401 1.1 riastrad 402 1.1 riastrad /** 403 1.1 riastrad * @color_formats: HDMI Color formats, selects between RGB and YCrCb 404 1.1 riastrad * modes. Used DRM_COLOR_FORMAT\_ defines, which are _not_ the same ones 405 1.1 riastrad * as used to describe the pixel format in framebuffers, and also don't 406 1.1 riastrad * match the formats in @bus_formats which are shared with v4l. 407 1.1 riastrad */ 408 1.1 riastrad u32 color_formats; 409 1.1 riastrad 410 1.1 riastrad /** 411 1.1 riastrad * @bus_formats: Pixel data format on the wire, somewhat redundant with 412 1.1 riastrad * @color_formats. Array of size @num_bus_formats encoded using 413 1.1 riastrad * MEDIA_BUS_FMT\_ defines shared with v4l and media drivers. 414 1.1 riastrad */ 415 1.4 riastrad u32 *bus_formats; 416 1.1 riastrad /** 417 1.1 riastrad * @num_bus_formats: Size of @bus_formats array. 418 1.1 riastrad */ 419 1.1 riastrad unsigned int num_bus_formats; 420 1.1 riastrad 421 1.1 riastrad /** 422 1.1 riastrad * @bus_flags: Additional information (like pixel signal polarity) for 423 1.1 riastrad * the pixel data on the bus, using &enum drm_bus_flags values 424 1.1 riastrad * DRM_BUS_FLAGS\_. 425 1.1 riastrad */ 426 1.1 riastrad u32 bus_flags; 427 1.1 riastrad 428 1.1 riastrad /** 429 1.1 riastrad * @max_tmds_clock: Maximum TMDS clock rate supported by the 430 1.1 riastrad * sink in kHz. 0 means undefined. 431 1.1 riastrad */ 432 1.1 riastrad int max_tmds_clock; 433 1.1 riastrad 434 1.1 riastrad /** 435 1.1 riastrad * @dvi_dual: Dual-link DVI sink? 436 1.1 riastrad */ 437 1.1 riastrad bool dvi_dual; 438 1.1 riastrad 439 1.1 riastrad /** 440 1.1 riastrad * @has_hdmi_infoframe: Does the sink support the HDMI infoframe? 441 1.1 riastrad */ 442 1.1 riastrad bool has_hdmi_infoframe; 443 1.1 riastrad 444 1.1 riastrad /** 445 1.1 riastrad * @rgb_quant_range_selectable: Does the sink support selecting 446 1.1 riastrad * the RGB quantization range? 447 1.1 riastrad */ 448 1.1 riastrad bool rgb_quant_range_selectable; 449 1.1 riastrad 450 1.1 riastrad /** 451 1.1 riastrad * @edid_hdmi_dc_modes: Mask of supported hdmi deep color modes. Even 452 1.1 riastrad * more stuff redundant with @bus_formats. 453 1.1 riastrad */ 454 1.1 riastrad u8 edid_hdmi_dc_modes; 455 1.1 riastrad 456 1.1 riastrad /** 457 1.1 riastrad * @cea_rev: CEA revision of the HDMI sink. 458 1.1 riastrad */ 459 1.1 riastrad u8 cea_rev; 460 1.1 riastrad 461 1.1 riastrad /** 462 1.1 riastrad * @hdmi: advance features of a HDMI sink. 463 1.1 riastrad */ 464 1.1 riastrad struct drm_hdmi_info hdmi; 465 1.1 riastrad 466 1.1 riastrad /** 467 1.1 riastrad * @non_desktop: Non desktop display (HMD). 468 1.1 riastrad */ 469 1.1 riastrad bool non_desktop; 470 1.1 riastrad }; 471 1.1 riastrad 472 1.1 riastrad int drm_display_info_set_bus_formats(struct drm_display_info *info, 473 1.1 riastrad const u32 *formats, 474 1.1 riastrad unsigned int num_formats); 475 1.1 riastrad 476 1.1 riastrad /** 477 1.1 riastrad * struct drm_connector_tv_margins - TV connector related margins 478 1.1 riastrad * 479 1.1 riastrad * Describes the margins in pixels to put around the image on TV 480 1.1 riastrad * connectors to deal with overscan. 481 1.1 riastrad */ 482 1.1 riastrad struct drm_connector_tv_margins { 483 1.1 riastrad /** 484 1.1 riastrad * @bottom: Bottom margin in pixels. 485 1.1 riastrad */ 486 1.1 riastrad unsigned int bottom; 487 1.1 riastrad 488 1.1 riastrad /** 489 1.1 riastrad * @left: Left margin in pixels. 490 1.1 riastrad */ 491 1.1 riastrad unsigned int left; 492 1.1 riastrad 493 1.1 riastrad /** 494 1.1 riastrad * @right: Right margin in pixels. 495 1.1 riastrad */ 496 1.1 riastrad unsigned int right; 497 1.1 riastrad 498 1.1 riastrad /** 499 1.1 riastrad * @top: Top margin in pixels. 500 1.1 riastrad */ 501 1.1 riastrad unsigned int top; 502 1.1 riastrad }; 503 1.1 riastrad 504 1.1 riastrad /** 505 1.1 riastrad * struct drm_tv_connector_state - TV connector related states 506 1.1 riastrad * @subconnector: selected subconnector 507 1.1 riastrad * @margins: TV margins 508 1.1 riastrad * @mode: TV mode 509 1.1 riastrad * @brightness: brightness in percent 510 1.1 riastrad * @contrast: contrast in percent 511 1.1 riastrad * @flicker_reduction: flicker reduction in percent 512 1.1 riastrad * @overscan: overscan in percent 513 1.1 riastrad * @saturation: saturation in percent 514 1.1 riastrad * @hue: hue in percent 515 1.1 riastrad */ 516 1.1 riastrad struct drm_tv_connector_state { 517 1.1 riastrad enum drm_mode_subconnector subconnector; 518 1.1 riastrad struct drm_connector_tv_margins margins; 519 1.1 riastrad unsigned int mode; 520 1.1 riastrad unsigned int brightness; 521 1.1 riastrad unsigned int contrast; 522 1.1 riastrad unsigned int flicker_reduction; 523 1.1 riastrad unsigned int overscan; 524 1.1 riastrad unsigned int saturation; 525 1.1 riastrad unsigned int hue; 526 1.1 riastrad }; 527 1.1 riastrad 528 1.1 riastrad /** 529 1.1 riastrad * struct drm_connector_state - mutable connector state 530 1.1 riastrad */ 531 1.1 riastrad struct drm_connector_state { 532 1.1 riastrad /** @connector: backpointer to the connector */ 533 1.1 riastrad struct drm_connector *connector; 534 1.1 riastrad 535 1.1 riastrad /** 536 1.1 riastrad * @crtc: CRTC to connect connector to, NULL if disabled. 537 1.1 riastrad * 538 1.1 riastrad * Do not change this directly, use drm_atomic_set_crtc_for_connector() 539 1.1 riastrad * instead. 540 1.1 riastrad */ 541 1.1 riastrad struct drm_crtc *crtc; 542 1.1 riastrad 543 1.1 riastrad /** 544 1.1 riastrad * @best_encoder: 545 1.1 riastrad * 546 1.1 riastrad * Used by the atomic helpers to select the encoder, through the 547 1.1 riastrad * &drm_connector_helper_funcs.atomic_best_encoder or 548 1.1 riastrad * &drm_connector_helper_funcs.best_encoder callbacks. 549 1.1 riastrad * 550 1.1 riastrad * This is also used in the atomic helpers to map encoders to their 551 1.1 riastrad * current and previous connectors, see 552 1.1 riastrad * drm_atomic_get_old_connector_for_encoder() and 553 1.1 riastrad * drm_atomic_get_new_connector_for_encoder(). 554 1.1 riastrad * 555 1.1 riastrad * NOTE: Atomic drivers must fill this out (either themselves or through 556 1.1 riastrad * helpers), for otherwise the GETCONNECTOR and GETENCODER IOCTLs will 557 1.1 riastrad * not return correct data to userspace. 558 1.1 riastrad */ 559 1.1 riastrad struct drm_encoder *best_encoder; 560 1.1 riastrad 561 1.1 riastrad /** 562 1.1 riastrad * @link_status: Connector link_status to keep track of whether link is 563 1.1 riastrad * GOOD or BAD to notify userspace if retraining is necessary. 564 1.1 riastrad */ 565 1.1 riastrad enum drm_link_status link_status; 566 1.1 riastrad 567 1.1 riastrad /** @state: backpointer to global drm_atomic_state */ 568 1.1 riastrad struct drm_atomic_state *state; 569 1.1 riastrad 570 1.1 riastrad /** 571 1.1 riastrad * @commit: Tracks the pending commit to prevent use-after-free conditions. 572 1.1 riastrad * 573 1.1 riastrad * Is only set when @crtc is NULL. 574 1.1 riastrad */ 575 1.1 riastrad struct drm_crtc_commit *commit; 576 1.1 riastrad 577 1.1 riastrad /** @tv: TV connector state */ 578 1.1 riastrad struct drm_tv_connector_state tv; 579 1.1 riastrad 580 1.1 riastrad /** 581 1.1 riastrad * @self_refresh_aware: 582 1.1 riastrad * 583 1.1 riastrad * This tracks whether a connector is aware of the self refresh state. 584 1.1 riastrad * It should be set to true for those connector implementations which 585 1.1 riastrad * understand the self refresh state. This is needed since the crtc 586 1.1 riastrad * registers the self refresh helpers and it doesn't know if the 587 1.1 riastrad * connectors downstream have implemented self refresh entry/exit. 588 1.1 riastrad * 589 1.1 riastrad * Drivers should set this to true in atomic_check if they know how to 590 1.1 riastrad * handle self_refresh requests. 591 1.1 riastrad */ 592 1.1 riastrad bool self_refresh_aware; 593 1.1 riastrad 594 1.1 riastrad /** 595 1.1 riastrad * @picture_aspect_ratio: Connector property to control the 596 1.1 riastrad * HDMI infoframe aspect ratio setting. 597 1.1 riastrad * 598 1.1 riastrad * The %DRM_MODE_PICTURE_ASPECT_\* values much match the 599 1.1 riastrad * values for &enum hdmi_picture_aspect 600 1.1 riastrad */ 601 1.1 riastrad enum hdmi_picture_aspect picture_aspect_ratio; 602 1.1 riastrad 603 1.1 riastrad /** 604 1.1 riastrad * @content_type: Connector property to control the 605 1.1 riastrad * HDMI infoframe content type setting. 606 1.1 riastrad * The %DRM_MODE_CONTENT_TYPE_\* values much 607 1.1 riastrad * match the values. 608 1.1 riastrad */ 609 1.1 riastrad unsigned int content_type; 610 1.1 riastrad 611 1.1 riastrad /** 612 1.1 riastrad * @hdcp_content_type: Connector property to pass the type of 613 1.1 riastrad * protected content. This is most commonly used for HDCP. 614 1.1 riastrad */ 615 1.1 riastrad unsigned int hdcp_content_type; 616 1.1 riastrad 617 1.1 riastrad /** 618 1.1 riastrad * @scaling_mode: Connector property to control the 619 1.1 riastrad * upscaling, mostly used for built-in panels. 620 1.1 riastrad */ 621 1.1 riastrad unsigned int scaling_mode; 622 1.1 riastrad 623 1.1 riastrad /** 624 1.1 riastrad * @content_protection: Connector property to request content 625 1.1 riastrad * protection. This is most commonly used for HDCP. 626 1.1 riastrad */ 627 1.1 riastrad unsigned int content_protection; 628 1.1 riastrad 629 1.1 riastrad /** 630 1.1 riastrad * @colorspace: State variable for Connector property to request 631 1.1 riastrad * colorspace change on Sink. This is most commonly used to switch 632 1.1 riastrad * to wider color gamuts like BT2020. 633 1.1 riastrad */ 634 1.1 riastrad u32 colorspace; 635 1.1 riastrad 636 1.1 riastrad /** 637 1.1 riastrad * @writeback_job: Writeback job for writeback connectors 638 1.1 riastrad * 639 1.1 riastrad * Holds the framebuffer and out-fence for a writeback connector. As 640 1.1 riastrad * the writeback completion may be asynchronous to the normal commit 641 1.1 riastrad * cycle, the writeback job lifetime is managed separately from the 642 1.1 riastrad * normal atomic state by this object. 643 1.1 riastrad * 644 1.1 riastrad * See also: drm_writeback_queue_job() and 645 1.1 riastrad * drm_writeback_signal_completion() 646 1.1 riastrad */ 647 1.1 riastrad struct drm_writeback_job *writeback_job; 648 1.1 riastrad 649 1.1 riastrad /** 650 1.1 riastrad * @max_requested_bpc: Connector property to limit the maximum bit 651 1.1 riastrad * depth of the pixels. 652 1.1 riastrad */ 653 1.1 riastrad u8 max_requested_bpc; 654 1.1 riastrad 655 1.1 riastrad /** 656 1.1 riastrad * @max_bpc: Connector max_bpc based on the requested max_bpc property 657 1.1 riastrad * and the connector bpc limitations obtained from edid. 658 1.1 riastrad */ 659 1.1 riastrad u8 max_bpc; 660 1.1 riastrad 661 1.1 riastrad /** 662 1.1 riastrad * @hdr_output_metadata: 663 1.1 riastrad * DRM blob property for HDR output metadata 664 1.1 riastrad */ 665 1.1 riastrad struct drm_property_blob *hdr_output_metadata; 666 1.1 riastrad }; 667 1.1 riastrad 668 1.1 riastrad /** 669 1.1 riastrad * struct drm_connector_funcs - control connectors on a given device 670 1.1 riastrad * 671 1.1 riastrad * Each CRTC may have one or more connectors attached to it. The functions 672 1.1 riastrad * below allow the core DRM code to control connectors, enumerate available modes, 673 1.1 riastrad * etc. 674 1.1 riastrad */ 675 1.1 riastrad struct drm_connector_funcs { 676 1.1 riastrad /** 677 1.1 riastrad * @dpms: 678 1.1 riastrad * 679 1.1 riastrad * Legacy entry point to set the per-connector DPMS state. Legacy DPMS 680 1.1 riastrad * is exposed as a standard property on the connector, but diverted to 681 1.1 riastrad * this callback in the drm core. Note that atomic drivers don't 682 1.1 riastrad * implement the 4 level DPMS support on the connector any more, but 683 1.1 riastrad * instead only have an on/off "ACTIVE" property on the CRTC object. 684 1.1 riastrad * 685 1.1 riastrad * This hook is not used by atomic drivers, remapping of the legacy DPMS 686 1.1 riastrad * property is entirely handled in the DRM core. 687 1.1 riastrad * 688 1.1 riastrad * RETURNS: 689 1.1 riastrad * 690 1.1 riastrad * 0 on success or a negative error code on failure. 691 1.1 riastrad */ 692 1.1 riastrad int (*dpms)(struct drm_connector *connector, int mode); 693 1.1 riastrad 694 1.1 riastrad /** 695 1.1 riastrad * @reset: 696 1.1 riastrad * 697 1.1 riastrad * Reset connector hardware and software state to off. This function isn't 698 1.1 riastrad * called by the core directly, only through drm_mode_config_reset(). 699 1.1 riastrad * It's not a helper hook only for historical reasons. 700 1.1 riastrad * 701 1.1 riastrad * Atomic drivers can use drm_atomic_helper_connector_reset() to reset 702 1.1 riastrad * atomic state using this hook. 703 1.1 riastrad */ 704 1.1 riastrad void (*reset)(struct drm_connector *connector); 705 1.1 riastrad 706 1.1 riastrad /** 707 1.1 riastrad * @detect: 708 1.1 riastrad * 709 1.1 riastrad * Check to see if anything is attached to the connector. The parameter 710 1.1 riastrad * force is set to false whilst polling, true when checking the 711 1.1 riastrad * connector due to a user request. force can be used by the driver to 712 1.1 riastrad * avoid expensive, destructive operations during automated probing. 713 1.1 riastrad * 714 1.1 riastrad * This callback is optional, if not implemented the connector will be 715 1.1 riastrad * considered as always being attached. 716 1.1 riastrad * 717 1.1 riastrad * FIXME: 718 1.1 riastrad * 719 1.1 riastrad * Note that this hook is only called by the probe helper. It's not in 720 1.1 riastrad * the helper library vtable purely for historical reasons. The only DRM 721 1.1 riastrad * core entry point to probe connector state is @fill_modes. 722 1.1 riastrad * 723 1.1 riastrad * Note that the helper library will already hold 724 1.1 riastrad * &drm_mode_config.connection_mutex. Drivers which need to grab additional 725 1.1 riastrad * locks to avoid races with concurrent modeset changes need to use 726 1.1 riastrad * &drm_connector_helper_funcs.detect_ctx instead. 727 1.1 riastrad * 728 1.1 riastrad * RETURNS: 729 1.1 riastrad * 730 1.1 riastrad * drm_connector_status indicating the connector's status. 731 1.1 riastrad */ 732 1.1 riastrad enum drm_connector_status (*detect)(struct drm_connector *connector, 733 1.1 riastrad bool force); 734 1.1 riastrad 735 1.1 riastrad /** 736 1.1 riastrad * @force: 737 1.1 riastrad * 738 1.1 riastrad * This function is called to update internal encoder state when the 739 1.1 riastrad * connector is forced to a certain state by userspace, either through 740 1.1 riastrad * the sysfs interfaces or on the kernel cmdline. In that case the 741 1.1 riastrad * @detect callback isn't called. 742 1.1 riastrad * 743 1.1 riastrad * FIXME: 744 1.1 riastrad * 745 1.1 riastrad * Note that this hook is only called by the probe helper. It's not in 746 1.1 riastrad * the helper library vtable purely for historical reasons. The only DRM 747 1.1 riastrad * core entry point to probe connector state is @fill_modes. 748 1.1 riastrad */ 749 1.1 riastrad void (*force)(struct drm_connector *connector); 750 1.1 riastrad 751 1.1 riastrad /** 752 1.1 riastrad * @fill_modes: 753 1.1 riastrad * 754 1.1 riastrad * Entry point for output detection and basic mode validation. The 755 1.1 riastrad * driver should reprobe the output if needed (e.g. when hotplug 756 1.1 riastrad * handling is unreliable), add all detected modes to &drm_connector.modes 757 1.1 riastrad * and filter out any the device can't support in any configuration. It 758 1.1 riastrad * also needs to filter out any modes wider or higher than the 759 1.1 riastrad * parameters max_width and max_height indicate. 760 1.1 riastrad * 761 1.1 riastrad * The drivers must also prune any modes no longer valid from 762 1.1 riastrad * &drm_connector.modes. Furthermore it must update 763 1.1 riastrad * &drm_connector.status and &drm_connector.edid. If no EDID has been 764 1.1 riastrad * received for this output connector->edid must be NULL. 765 1.1 riastrad * 766 1.1 riastrad * Drivers using the probe helpers should use 767 1.1 riastrad * drm_helper_probe_single_connector_modes() to implement this 768 1.1 riastrad * function. 769 1.1 riastrad * 770 1.1 riastrad * RETURNS: 771 1.1 riastrad * 772 1.1 riastrad * The number of modes detected and filled into &drm_connector.modes. 773 1.1 riastrad */ 774 1.1 riastrad int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); 775 1.1 riastrad 776 1.1 riastrad /** 777 1.1 riastrad * @set_property: 778 1.1 riastrad * 779 1.1 riastrad * This is the legacy entry point to update a property attached to the 780 1.1 riastrad * connector. 781 1.1 riastrad * 782 1.1 riastrad * This callback is optional if the driver does not support any legacy 783 1.1 riastrad * driver-private properties. For atomic drivers it is not used because 784 1.1 riastrad * property handling is done entirely in the DRM core. 785 1.1 riastrad * 786 1.1 riastrad * RETURNS: 787 1.1 riastrad * 788 1.1 riastrad * 0 on success or a negative error code on failure. 789 1.1 riastrad */ 790 1.1 riastrad int (*set_property)(struct drm_connector *connector, struct drm_property *property, 791 1.1 riastrad uint64_t val); 792 1.1 riastrad 793 1.1 riastrad /** 794 1.1 riastrad * @late_register: 795 1.1 riastrad * 796 1.1 riastrad * This optional hook can be used to register additional userspace 797 1.1 riastrad * interfaces attached to the connector, light backlight control, i2c, 798 1.1 riastrad * DP aux or similar interfaces. It is called late in the driver load 799 1.1 riastrad * sequence from drm_connector_register() when registering all the 800 1.1 riastrad * core drm connector interfaces. Everything added from this callback 801 1.1 riastrad * should be unregistered in the early_unregister callback. 802 1.1 riastrad * 803 1.1 riastrad * This is called while holding &drm_connector.mutex. 804 1.1 riastrad * 805 1.1 riastrad * Returns: 806 1.1 riastrad * 807 1.1 riastrad * 0 on success, or a negative error code on failure. 808 1.1 riastrad */ 809 1.1 riastrad int (*late_register)(struct drm_connector *connector); 810 1.1 riastrad 811 1.1 riastrad /** 812 1.1 riastrad * @early_unregister: 813 1.1 riastrad * 814 1.1 riastrad * This optional hook should be used to unregister the additional 815 1.1 riastrad * userspace interfaces attached to the connector from 816 1.1 riastrad * late_register(). It is called from drm_connector_unregister(), 817 1.1 riastrad * early in the driver unload sequence to disable userspace access 818 1.1 riastrad * before data structures are torndown. 819 1.1 riastrad * 820 1.1 riastrad * This is called while holding &drm_connector.mutex. 821 1.1 riastrad */ 822 1.1 riastrad void (*early_unregister)(struct drm_connector *connector); 823 1.1 riastrad 824 1.1 riastrad /** 825 1.1 riastrad * @destroy: 826 1.1 riastrad * 827 1.1 riastrad * Clean up connector resources. This is called at driver unload time 828 1.1 riastrad * through drm_mode_config_cleanup(). It can also be called at runtime 829 1.1 riastrad * when a connector is being hot-unplugged for drivers that support 830 1.1 riastrad * connector hotplugging (e.g. DisplayPort MST). 831 1.1 riastrad */ 832 1.1 riastrad void (*destroy)(struct drm_connector *connector); 833 1.1 riastrad 834 1.1 riastrad /** 835 1.1 riastrad * @atomic_duplicate_state: 836 1.1 riastrad * 837 1.1 riastrad * Duplicate the current atomic state for this connector and return it. 838 1.1 riastrad * The core and helpers guarantee that any atomic state duplicated with 839 1.1 riastrad * this hook and still owned by the caller (i.e. not transferred to the 840 1.1 riastrad * driver by calling &drm_mode_config_funcs.atomic_commit) will be 841 1.1 riastrad * cleaned up by calling the @atomic_destroy_state hook in this 842 1.1 riastrad * structure. 843 1.1 riastrad * 844 1.1 riastrad * This callback is mandatory for atomic drivers. 845 1.1 riastrad * 846 1.1 riastrad * Atomic drivers which don't subclass &struct drm_connector_state should use 847 1.1 riastrad * drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the 848 1.1 riastrad * state structure to extend it with driver-private state should use 849 1.1 riastrad * __drm_atomic_helper_connector_duplicate_state() to make sure shared state is 850 1.1 riastrad * duplicated in a consistent fashion across drivers. 851 1.1 riastrad * 852 1.1 riastrad * It is an error to call this hook before &drm_connector.state has been 853 1.1 riastrad * initialized correctly. 854 1.1 riastrad * 855 1.1 riastrad * NOTE: 856 1.1 riastrad * 857 1.1 riastrad * If the duplicate state references refcounted resources this hook must 858 1.1 riastrad * acquire a reference for each of them. The driver must release these 859 1.1 riastrad * references again in @atomic_destroy_state. 860 1.1 riastrad * 861 1.1 riastrad * RETURNS: 862 1.1 riastrad * 863 1.1 riastrad * Duplicated atomic state or NULL when the allocation failed. 864 1.1 riastrad */ 865 1.1 riastrad struct drm_connector_state *(*atomic_duplicate_state)(struct drm_connector *connector); 866 1.1 riastrad 867 1.1 riastrad /** 868 1.1 riastrad * @atomic_destroy_state: 869 1.1 riastrad * 870 1.1 riastrad * Destroy a state duplicated with @atomic_duplicate_state and release 871 1.1 riastrad * or unreference all resources it references 872 1.1 riastrad * 873 1.1 riastrad * This callback is mandatory for atomic drivers. 874 1.1 riastrad */ 875 1.1 riastrad void (*atomic_destroy_state)(struct drm_connector *connector, 876 1.1 riastrad struct drm_connector_state *state); 877 1.1 riastrad 878 1.1 riastrad /** 879 1.1 riastrad * @atomic_set_property: 880 1.1 riastrad * 881 1.1 riastrad * Decode a driver-private property value and store the decoded value 882 1.1 riastrad * into the passed-in state structure. Since the atomic core decodes all 883 1.1 riastrad * standardized properties (even for extensions beyond the core set of 884 1.1 riastrad * properties which might not be implemented by all drivers) this 885 1.1 riastrad * requires drivers to subclass the state structure. 886 1.1 riastrad * 887 1.1 riastrad * Such driver-private properties should really only be implemented for 888 1.1 riastrad * truly hardware/vendor specific state. Instead it is preferred to 889 1.1 riastrad * standardize atomic extension and decode the properties used to expose 890 1.1 riastrad * such an extension in the core. 891 1.1 riastrad * 892 1.1 riastrad * Do not call this function directly, use 893 1.1 riastrad * drm_atomic_connector_set_property() instead. 894 1.1 riastrad * 895 1.1 riastrad * This callback is optional if the driver does not support any 896 1.1 riastrad * driver-private atomic properties. 897 1.1 riastrad * 898 1.1 riastrad * NOTE: 899 1.1 riastrad * 900 1.1 riastrad * This function is called in the state assembly phase of atomic 901 1.1 riastrad * modesets, which can be aborted for any reason (including on 902 1.1 riastrad * userspace's request to just check whether a configuration would be 903 1.1 riastrad * possible). Drivers MUST NOT touch any persistent state (hardware or 904 1.1 riastrad * software) or data structures except the passed in @state parameter. 905 1.1 riastrad * 906 1.1 riastrad * Also since userspace controls in which order properties are set this 907 1.1 riastrad * function must not do any input validation (since the state update is 908 1.1 riastrad * incomplete and hence likely inconsistent). Instead any such input 909 1.1 riastrad * validation must be done in the various atomic_check callbacks. 910 1.1 riastrad * 911 1.1 riastrad * RETURNS: 912 1.1 riastrad * 913 1.1 riastrad * 0 if the property has been found, -EINVAL if the property isn't 914 1.1 riastrad * implemented by the driver (which shouldn't ever happen, the core only 915 1.1 riastrad * asks for properties attached to this connector). No other validation 916 1.1 riastrad * is allowed by the driver. The core already checks that the property 917 1.1 riastrad * value is within the range (integer, valid enum value, ...) the driver 918 1.1 riastrad * set when registering the property. 919 1.1 riastrad */ 920 1.1 riastrad int (*atomic_set_property)(struct drm_connector *connector, 921 1.1 riastrad struct drm_connector_state *state, 922 1.1 riastrad struct drm_property *property, 923 1.1 riastrad uint64_t val); 924 1.1 riastrad 925 1.1 riastrad /** 926 1.1 riastrad * @atomic_get_property: 927 1.1 riastrad * 928 1.1 riastrad * Reads out the decoded driver-private property. This is used to 929 1.1 riastrad * implement the GETCONNECTOR IOCTL. 930 1.1 riastrad * 931 1.1 riastrad * Do not call this function directly, use 932 1.1 riastrad * drm_atomic_connector_get_property() instead. 933 1.1 riastrad * 934 1.1 riastrad * This callback is optional if the driver does not support any 935 1.1 riastrad * driver-private atomic properties. 936 1.1 riastrad * 937 1.1 riastrad * RETURNS: 938 1.1 riastrad * 939 1.1 riastrad * 0 on success, -EINVAL if the property isn't implemented by the 940 1.1 riastrad * driver (which shouldn't ever happen, the core only asks for 941 1.1 riastrad * properties attached to this connector). 942 1.1 riastrad */ 943 1.1 riastrad int (*atomic_get_property)(struct drm_connector *connector, 944 1.1 riastrad const struct drm_connector_state *state, 945 1.1 riastrad struct drm_property *property, 946 1.1 riastrad uint64_t *val); 947 1.1 riastrad 948 1.1 riastrad /** 949 1.1 riastrad * @atomic_print_state: 950 1.1 riastrad * 951 1.1 riastrad * If driver subclasses &struct drm_connector_state, it should implement 952 1.1 riastrad * this optional hook for printing additional driver specific state. 953 1.1 riastrad * 954 1.1 riastrad * Do not call this directly, use drm_atomic_connector_print_state() 955 1.1 riastrad * instead. 956 1.1 riastrad */ 957 1.1 riastrad void (*atomic_print_state)(struct drm_printer *p, 958 1.1 riastrad const struct drm_connector_state *state); 959 1.1 riastrad }; 960 1.1 riastrad 961 1.1 riastrad /** 962 1.1 riastrad * struct drm_cmdline_mode - DRM Mode passed through the kernel command-line 963 1.1 riastrad * 964 1.1 riastrad * Each connector can have an initial mode with additional options 965 1.1 riastrad * passed through the kernel command line. This structure allows to 966 1.1 riastrad * express those parameters and will be filled by the command-line 967 1.1 riastrad * parser. 968 1.1 riastrad */ 969 1.1 riastrad struct drm_cmdline_mode { 970 1.1 riastrad /** 971 1.1 riastrad * @name: 972 1.1 riastrad * 973 1.1 riastrad * Name of the mode. 974 1.1 riastrad */ 975 1.1 riastrad char name[DRM_DISPLAY_MODE_LEN]; 976 1.1 riastrad 977 1.1 riastrad /** 978 1.1 riastrad * @specified: 979 1.1 riastrad * 980 1.1 riastrad * Has a mode been read from the command-line? 981 1.1 riastrad */ 982 1.1 riastrad bool specified; 983 1.1 riastrad 984 1.1 riastrad /** 985 1.1 riastrad * @refresh_specified: 986 1.1 riastrad * 987 1.1 riastrad * Did the mode have a preferred refresh rate? 988 1.1 riastrad */ 989 1.1 riastrad bool refresh_specified; 990 1.1 riastrad 991 1.1 riastrad /** 992 1.1 riastrad * @bpp_specified: 993 1.1 riastrad * 994 1.1 riastrad * Did the mode have a preferred BPP? 995 1.1 riastrad */ 996 1.1 riastrad bool bpp_specified; 997 1.1 riastrad 998 1.1 riastrad /** 999 1.1 riastrad * @xres: 1000 1.1 riastrad * 1001 1.1 riastrad * Active resolution on the X axis, in pixels. 1002 1.1 riastrad */ 1003 1.1 riastrad int xres; 1004 1.1 riastrad 1005 1.1 riastrad /** 1006 1.1 riastrad * @yres: 1007 1.1 riastrad * 1008 1.1 riastrad * Active resolution on the Y axis, in pixels. 1009 1.1 riastrad */ 1010 1.1 riastrad int yres; 1011 1.1 riastrad 1012 1.1 riastrad /** 1013 1.1 riastrad * @bpp: 1014 1.1 riastrad * 1015 1.1 riastrad * Bits per pixels for the mode. 1016 1.1 riastrad */ 1017 1.1 riastrad int bpp; 1018 1.1 riastrad 1019 1.1 riastrad /** 1020 1.1 riastrad * @refresh: 1021 1.1 riastrad * 1022 1.1 riastrad * Refresh rate, in Hertz. 1023 1.1 riastrad */ 1024 1.1 riastrad int refresh; 1025 1.1 riastrad 1026 1.1 riastrad /** 1027 1.1 riastrad * @rb: 1028 1.1 riastrad * 1029 1.1 riastrad * Do we need to use reduced blanking? 1030 1.1 riastrad */ 1031 1.1 riastrad bool rb; 1032 1.1 riastrad 1033 1.1 riastrad /** 1034 1.1 riastrad * @interlace: 1035 1.1 riastrad * 1036 1.1 riastrad * The mode is interlaced. 1037 1.1 riastrad */ 1038 1.1 riastrad bool interlace; 1039 1.1 riastrad 1040 1.1 riastrad /** 1041 1.1 riastrad * @cvt: 1042 1.1 riastrad * 1043 1.1 riastrad * The timings will be calculated using the VESA Coordinated 1044 1.1 riastrad * Video Timings instead of looking up the mode from a table. 1045 1.1 riastrad */ 1046 1.1 riastrad bool cvt; 1047 1.1 riastrad 1048 1.1 riastrad /** 1049 1.1 riastrad * @margins: 1050 1.1 riastrad * 1051 1.1 riastrad * Add margins to the mode calculation (1.8% of xres rounded 1052 1.1 riastrad * down to 8 pixels and 1.8% of yres). 1053 1.1 riastrad */ 1054 1.1 riastrad bool margins; 1055 1.1 riastrad 1056 1.1 riastrad /** 1057 1.1 riastrad * @force: 1058 1.1 riastrad * 1059 1.1 riastrad * Ignore the hotplug state of the connector, and force its 1060 1.1 riastrad * state to one of the DRM_FORCE_* values. 1061 1.1 riastrad */ 1062 1.1 riastrad enum drm_connector_force force; 1063 1.1 riastrad 1064 1.1 riastrad /** 1065 1.1 riastrad * @rotation_reflection: 1066 1.1 riastrad * 1067 1.1 riastrad * Initial rotation and reflection of the mode setup from the 1068 1.1 riastrad * command line. See DRM_MODE_ROTATE_* and 1069 1.1 riastrad * DRM_MODE_REFLECT_*. The only rotations supported are 1070 1.1 riastrad * DRM_MODE_ROTATE_0 and DRM_MODE_ROTATE_180. 1071 1.1 riastrad */ 1072 1.1 riastrad unsigned int rotation_reflection; 1073 1.1 riastrad 1074 1.1 riastrad /** 1075 1.1 riastrad * @panel_orientation: 1076 1.1 riastrad * 1077 1.1 riastrad * drm-connector "panel orientation" property override value, 1078 1.1 riastrad * DRM_MODE_PANEL_ORIENTATION_UNKNOWN if not set. 1079 1.1 riastrad */ 1080 1.1 riastrad enum drm_panel_orientation panel_orientation; 1081 1.1 riastrad 1082 1.1 riastrad /** 1083 1.1 riastrad * @tv_margins: TV margins to apply to the mode. 1084 1.1 riastrad */ 1085 1.1 riastrad struct drm_connector_tv_margins tv_margins; 1086 1.1 riastrad }; 1087 1.1 riastrad 1088 1.1 riastrad /** 1089 1.1 riastrad * struct drm_connector - central DRM connector control structure 1090 1.1 riastrad * 1091 1.1 riastrad * Each connector may be connected to one or more CRTCs, or may be clonable by 1092 1.1 riastrad * another connector if they can share a CRTC. Each connector also has a specific 1093 1.1 riastrad * position in the broader display (referred to as a 'screen' though it could 1094 1.1 riastrad * span multiple monitors). 1095 1.1 riastrad */ 1096 1.1 riastrad struct drm_connector { 1097 1.1 riastrad /** @dev: parent DRM device */ 1098 1.1 riastrad struct drm_device *dev; 1099 1.1 riastrad /** @kdev: kernel device for sysfs attributes */ 1100 1.1 riastrad struct device *kdev; 1101 1.1 riastrad /** @attr: sysfs attributes */ 1102 1.1 riastrad struct device_attribute *attr; 1103 1.1 riastrad 1104 1.1 riastrad /** 1105 1.1 riastrad * @head: 1106 1.1 riastrad * 1107 1.1 riastrad * List of all connectors on a @dev, linked from 1108 1.1 riastrad * &drm_mode_config.connector_list. Protected by 1109 1.1 riastrad * &drm_mode_config.connector_list_lock, but please only use 1110 1.1 riastrad * &drm_connector_list_iter to walk this list. 1111 1.1 riastrad */ 1112 1.1 riastrad struct list_head head; 1113 1.1 riastrad 1114 1.1 riastrad /** @base: base KMS object */ 1115 1.1 riastrad struct drm_mode_object base; 1116 1.1 riastrad 1117 1.1 riastrad /** @name: human readable name, can be overwritten by the driver */ 1118 1.1 riastrad char *name; 1119 1.1 riastrad 1120 1.1 riastrad /** 1121 1.1 riastrad * @mutex: Lock for general connector state, but currently only protects 1122 1.1 riastrad * @registered. Most of the connector state is still protected by 1123 1.1 riastrad * &drm_mode_config.mutex. 1124 1.1 riastrad */ 1125 1.1 riastrad struct mutex mutex; 1126 1.1 riastrad 1127 1.1 riastrad /** 1128 1.1 riastrad * @index: Compacted connector index, which matches the position inside 1129 1.1 riastrad * the mode_config.list for drivers not supporting hot-add/removing. Can 1130 1.1 riastrad * be used as an array index. It is invariant over the lifetime of the 1131 1.1 riastrad * connector. 1132 1.1 riastrad */ 1133 1.1 riastrad unsigned index; 1134 1.1 riastrad 1135 1.1 riastrad /** 1136 1.1 riastrad * @connector_type: 1137 1.1 riastrad * one of the DRM_MODE_CONNECTOR_<foo> types from drm_mode.h 1138 1.1 riastrad */ 1139 1.1 riastrad int connector_type; 1140 1.1 riastrad /** @connector_type_id: index into connector type enum */ 1141 1.1 riastrad int connector_type_id; 1142 1.1 riastrad /** 1143 1.1 riastrad * @interlace_allowed: 1144 1.1 riastrad * Can this connector handle interlaced modes? Only used by 1145 1.1 riastrad * drm_helper_probe_single_connector_modes() for mode filtering. 1146 1.1 riastrad */ 1147 1.1 riastrad bool interlace_allowed; 1148 1.1 riastrad /** 1149 1.1 riastrad * @doublescan_allowed: 1150 1.1 riastrad * Can this connector handle doublescan? Only used by 1151 1.1 riastrad * drm_helper_probe_single_connector_modes() for mode filtering. 1152 1.1 riastrad */ 1153 1.1 riastrad bool doublescan_allowed; 1154 1.1 riastrad /** 1155 1.1 riastrad * @stereo_allowed: 1156 1.1 riastrad * Can this connector handle stereo modes? Only used by 1157 1.1 riastrad * drm_helper_probe_single_connector_modes() for mode filtering. 1158 1.1 riastrad */ 1159 1.1 riastrad bool stereo_allowed; 1160 1.1 riastrad 1161 1.1 riastrad /** 1162 1.1 riastrad * @ycbcr_420_allowed : This bool indicates if this connector is 1163 1.1 riastrad * capable of handling YCBCR 420 output. While parsing the EDID 1164 1.1 riastrad * blocks it's very helpful to know if the source is capable of 1165 1.1 riastrad * handling YCBCR 420 outputs. 1166 1.1 riastrad */ 1167 1.1 riastrad bool ycbcr_420_allowed; 1168 1.1 riastrad 1169 1.1 riastrad /** 1170 1.1 riastrad * @registration_state: Is this connector initializing, exposed 1171 1.1 riastrad * (registered) with userspace, or unregistered? 1172 1.1 riastrad * 1173 1.1 riastrad * Protected by @mutex. 1174 1.1 riastrad */ 1175 1.1 riastrad enum drm_connector_registration_state registration_state; 1176 1.1 riastrad 1177 1.1 riastrad /** 1178 1.1 riastrad * @modes: 1179 1.1 riastrad * Modes available on this connector (from fill_modes() + user). 1180 1.1 riastrad * Protected by &drm_mode_config.mutex. 1181 1.1 riastrad */ 1182 1.1 riastrad struct list_head modes; 1183 1.1 riastrad 1184 1.1 riastrad /** 1185 1.1 riastrad * @status: 1186 1.1 riastrad * One of the drm_connector_status enums (connected, not, or unknown). 1187 1.1 riastrad * Protected by &drm_mode_config.mutex. 1188 1.1 riastrad */ 1189 1.1 riastrad enum drm_connector_status status; 1190 1.1 riastrad 1191 1.1 riastrad /** 1192 1.1 riastrad * @probed_modes: 1193 1.1 riastrad * These are modes added by probing with DDC or the BIOS, before 1194 1.1 riastrad * filtering is applied. Used by the probe helpers. Protected by 1195 1.1 riastrad * &drm_mode_config.mutex. 1196 1.1 riastrad */ 1197 1.1 riastrad struct list_head probed_modes; 1198 1.1 riastrad 1199 1.1 riastrad /** 1200 1.1 riastrad * @display_info: Display information is filled from EDID information 1201 1.1 riastrad * when a display is detected. For non hot-pluggable displays such as 1202 1.1 riastrad * flat panels in embedded systems, the driver should initialize the 1203 1.1 riastrad * &drm_display_info.width_mm and &drm_display_info.height_mm fields 1204 1.1 riastrad * with the physical size of the display. 1205 1.1 riastrad * 1206 1.1 riastrad * Protected by &drm_mode_config.mutex. 1207 1.1 riastrad */ 1208 1.1 riastrad struct drm_display_info display_info; 1209 1.1 riastrad 1210 1.1 riastrad /** @funcs: connector control functions */ 1211 1.1 riastrad const struct drm_connector_funcs *funcs; 1212 1.1 riastrad 1213 1.1 riastrad /** 1214 1.1 riastrad * @edid_blob_ptr: DRM property containing EDID if present. Protected by 1215 1.1 riastrad * &drm_mode_config.mutex. This should be updated only by calling 1216 1.1 riastrad * drm_connector_update_edid_property(). 1217 1.1 riastrad */ 1218 1.1 riastrad struct drm_property_blob *edid_blob_ptr; 1219 1.1 riastrad 1220 1.1 riastrad /** @properties: property tracking for this connector */ 1221 1.1 riastrad struct drm_object_properties properties; 1222 1.1 riastrad 1223 1.1 riastrad /** 1224 1.1 riastrad * @scaling_mode_property: Optional atomic property to control the 1225 1.1 riastrad * upscaling. See drm_connector_attach_content_protection_property(). 1226 1.1 riastrad */ 1227 1.1 riastrad struct drm_property *scaling_mode_property; 1228 1.1 riastrad 1229 1.1 riastrad /** 1230 1.1 riastrad * @vrr_capable_property: Optional property to help userspace 1231 1.1 riastrad * query hardware support for variable refresh rate on a connector. 1232 1.1 riastrad * connector. Drivers can add the property to a connector by 1233 1.1 riastrad * calling drm_connector_attach_vrr_capable_property(). 1234 1.1 riastrad * 1235 1.1 riastrad * This should be updated only by calling 1236 1.1 riastrad * drm_connector_set_vrr_capable_property(). 1237 1.1 riastrad */ 1238 1.1 riastrad struct drm_property *vrr_capable_property; 1239 1.1 riastrad 1240 1.1 riastrad /** 1241 1.1 riastrad * @colorspace_property: Connector property to set the suitable 1242 1.1 riastrad * colorspace supported by the sink. 1243 1.1 riastrad */ 1244 1.1 riastrad struct drm_property *colorspace_property; 1245 1.1 riastrad 1246 1.1 riastrad /** 1247 1.1 riastrad * @path_blob_ptr: 1248 1.1 riastrad * 1249 1.1 riastrad * DRM blob property data for the DP MST path property. This should only 1250 1.1 riastrad * be updated by calling drm_connector_set_path_property(). 1251 1.1 riastrad */ 1252 1.1 riastrad struct drm_property_blob *path_blob_ptr; 1253 1.1 riastrad 1254 1.1 riastrad /** 1255 1.1 riastrad * @max_bpc_property: Default connector property for the max bpc to be 1256 1.1 riastrad * driven out of the connector. 1257 1.1 riastrad */ 1258 1.1 riastrad struct drm_property *max_bpc_property; 1259 1.1 riastrad 1260 1.1 riastrad #define DRM_CONNECTOR_POLL_HPD (1 << 0) 1261 1.1 riastrad #define DRM_CONNECTOR_POLL_CONNECT (1 << 1) 1262 1.1 riastrad #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2) 1263 1.1 riastrad 1264 1.1 riastrad /** 1265 1.1 riastrad * @polled: 1266 1.1 riastrad * 1267 1.1 riastrad * Connector polling mode, a combination of 1268 1.1 riastrad * 1269 1.1 riastrad * DRM_CONNECTOR_POLL_HPD 1270 1.1 riastrad * The connector generates hotplug events and doesn't need to be 1271 1.1 riastrad * periodically polled. The CONNECT and DISCONNECT flags must not 1272 1.1 riastrad * be set together with the HPD flag. 1273 1.1 riastrad * 1274 1.1 riastrad * DRM_CONNECTOR_POLL_CONNECT 1275 1.1 riastrad * Periodically poll the connector for connection. 1276 1.1 riastrad * 1277 1.1 riastrad * DRM_CONNECTOR_POLL_DISCONNECT 1278 1.1 riastrad * Periodically poll the connector for disconnection, without 1279 1.1 riastrad * causing flickering even when the connector is in use. DACs should 1280 1.1 riastrad * rarely do this without a lot of testing. 1281 1.1 riastrad * 1282 1.1 riastrad * Set to 0 for connectors that don't support connection status 1283 1.1 riastrad * discovery. 1284 1.1 riastrad */ 1285 1.1 riastrad uint8_t polled; 1286 1.1 riastrad 1287 1.1 riastrad /** 1288 1.1 riastrad * @dpms: Current dpms state. For legacy drivers the 1289 1.1 riastrad * &drm_connector_funcs.dpms callback must update this. For atomic 1290 1.1 riastrad * drivers, this is handled by the core atomic code, and drivers must 1291 1.1 riastrad * only take &drm_crtc_state.active into account. 1292 1.1 riastrad */ 1293 1.1 riastrad int dpms; 1294 1.1 riastrad 1295 1.1 riastrad /** @helper_private: mid-layer private data */ 1296 1.1 riastrad const struct drm_connector_helper_funcs *helper_private; 1297 1.1 riastrad 1298 1.1 riastrad /** @cmdline_mode: mode line parsed from the kernel cmdline for this connector */ 1299 1.1 riastrad struct drm_cmdline_mode cmdline_mode; 1300 1.1 riastrad /** @force: a DRM_FORCE_<foo> state for forced mode sets */ 1301 1.1 riastrad enum drm_connector_force force; 1302 1.1 riastrad /** @override_edid: has the EDID been overwritten through debugfs for testing? */ 1303 1.1 riastrad bool override_edid; 1304 1.1 riastrad 1305 1.1 riastrad /** 1306 1.1 riastrad * @possible_encoders: Bit mask of encoders that can drive this 1307 1.1 riastrad * connector, drm_encoder_index() determines the index into the bitfield 1308 1.1 riastrad * and the bits are set with drm_connector_attach_encoder(). 1309 1.1 riastrad */ 1310 1.1 riastrad u32 possible_encoders; 1311 1.1 riastrad 1312 1.1 riastrad /** 1313 1.1 riastrad * @encoder: Currently bound encoder driving this connector, if any. 1314 1.1 riastrad * Only really meaningful for non-atomic drivers. Atomic drivers should 1315 1.1 riastrad * instead look at &drm_connector_state.best_encoder, and in case they 1316 1.1 riastrad * need the CRTC driving this output, &drm_connector_state.crtc. 1317 1.1 riastrad */ 1318 1.1 riastrad struct drm_encoder *encoder; 1319 1.1 riastrad 1320 1.5 riastrad /** @physical_address: HDMI physical address */ 1321 1.5 riastrad uint16_t physical_address; 1322 1.5 riastrad 1323 1.1 riastrad #define MAX_ELD_BYTES 128 1324 1.1 riastrad /** @eld: EDID-like data, if present */ 1325 1.1 riastrad uint8_t eld[MAX_ELD_BYTES]; 1326 1.1 riastrad /** @latency_present: AV delay info from ELD, if found */ 1327 1.1 riastrad bool latency_present[2]; 1328 1.1 riastrad /** 1329 1.1 riastrad * @video_latency: Video latency info from ELD, if found. 1330 1.1 riastrad * [0]: progressive, [1]: interlaced 1331 1.1 riastrad */ 1332 1.1 riastrad int video_latency[2]; 1333 1.1 riastrad /** 1334 1.1 riastrad * @audio_latency: audio latency info from ELD, if found 1335 1.1 riastrad * [0]: progressive, [1]: interlaced 1336 1.1 riastrad */ 1337 1.1 riastrad int audio_latency[2]; 1338 1.1 riastrad 1339 1.1 riastrad /** 1340 1.1 riastrad * @ddc: associated ddc adapter. 1341 1.1 riastrad * A connector usually has its associated ddc adapter. If a driver uses 1342 1.1 riastrad * this field, then an appropriate symbolic link is created in connector 1343 1.1 riastrad * sysfs directory to make it easy for the user to tell which i2c 1344 1.1 riastrad * adapter is for a particular display. 1345 1.1 riastrad * 1346 1.1 riastrad * The field should be set by calling drm_connector_init_with_ddc(). 1347 1.1 riastrad */ 1348 1.1 riastrad struct i2c_adapter *ddc; 1349 1.1 riastrad 1350 1.1 riastrad /** 1351 1.1 riastrad * @null_edid_counter: track sinks that give us all zeros for the EDID. 1352 1.1 riastrad * Needed to workaround some HW bugs where we get all 0s 1353 1.1 riastrad */ 1354 1.1 riastrad int null_edid_counter; 1355 1.1 riastrad 1356 1.1 riastrad /** @bad_edid_counter: track sinks that give us an EDID with invalid checksum */ 1357 1.1 riastrad unsigned bad_edid_counter; 1358 1.1 riastrad 1359 1.1 riastrad /** 1360 1.1 riastrad * @edid_corrupt: Indicates whether the last read EDID was corrupt. Used 1361 1.1 riastrad * in Displayport compliance testing - Displayport Link CTS Core 1.2 1362 1.1 riastrad * rev1.1 4.2.2.6 1363 1.1 riastrad */ 1364 1.1 riastrad bool edid_corrupt; 1365 1.1 riastrad 1366 1.1 riastrad /** @debugfs_entry: debugfs directory for this connector */ 1367 1.1 riastrad struct dentry *debugfs_entry; 1368 1.1 riastrad 1369 1.1 riastrad /** 1370 1.1 riastrad * @state: 1371 1.1 riastrad * 1372 1.1 riastrad * Current atomic state for this connector. 1373 1.1 riastrad * 1374 1.1 riastrad * This is protected by &drm_mode_config.connection_mutex. Note that 1375 1.1 riastrad * nonblocking atomic commits access the current connector state without 1376 1.1 riastrad * taking locks. Either by going through the &struct drm_atomic_state 1377 1.1 riastrad * pointers, see for_each_oldnew_connector_in_state(), 1378 1.1 riastrad * for_each_old_connector_in_state() and 1379 1.1 riastrad * for_each_new_connector_in_state(). Or through careful ordering of 1380 1.1 riastrad * atomic commit operations as implemented in the atomic helpers, see 1381 1.1 riastrad * &struct drm_crtc_commit. 1382 1.1 riastrad */ 1383 1.1 riastrad struct drm_connector_state *state; 1384 1.1 riastrad 1385 1.1 riastrad /* DisplayID bits. FIXME: Extract into a substruct? */ 1386 1.1 riastrad 1387 1.1 riastrad /** 1388 1.1 riastrad * @tile_blob_ptr: 1389 1.1 riastrad * 1390 1.1 riastrad * DRM blob property data for the tile property (used mostly by DP MST). 1391 1.1 riastrad * This is meant for screens which are driven through separate display 1392 1.1 riastrad * pipelines represented by &drm_crtc, which might not be running with 1393 1.1 riastrad * genlocked clocks. For tiled panels which are genlocked, like 1394 1.1 riastrad * dual-link LVDS or dual-link DSI, the driver should try to not expose 1395 1.1 riastrad * the tiling and virtualize both &drm_crtc and &drm_plane if needed. 1396 1.1 riastrad * 1397 1.1 riastrad * This should only be updated by calling 1398 1.1 riastrad * drm_connector_set_tile_property(). 1399 1.1 riastrad */ 1400 1.1 riastrad struct drm_property_blob *tile_blob_ptr; 1401 1.1 riastrad 1402 1.1 riastrad /** @has_tile: is this connector connected to a tiled monitor */ 1403 1.1 riastrad bool has_tile; 1404 1.1 riastrad /** @tile_group: tile group for the connected monitor */ 1405 1.1 riastrad struct drm_tile_group *tile_group; 1406 1.1 riastrad /** @tile_is_single_monitor: whether the tile is one monitor housing */ 1407 1.1 riastrad bool tile_is_single_monitor; 1408 1.1 riastrad 1409 1.1 riastrad /** @num_h_tile: number of horizontal tiles in the tile group */ 1410 1.1 riastrad /** @num_v_tile: number of vertical tiles in the tile group */ 1411 1.1 riastrad uint8_t num_h_tile, num_v_tile; 1412 1.1 riastrad /** @tile_h_loc: horizontal location of this tile */ 1413 1.1 riastrad /** @tile_v_loc: vertical location of this tile */ 1414 1.1 riastrad uint8_t tile_h_loc, tile_v_loc; 1415 1.1 riastrad /** @tile_h_size: horizontal size of this tile. */ 1416 1.1 riastrad /** @tile_v_size: vertical size of this tile. */ 1417 1.1 riastrad uint16_t tile_h_size, tile_v_size; 1418 1.1 riastrad 1419 1.1 riastrad /** 1420 1.1 riastrad * @free_node: 1421 1.1 riastrad * 1422 1.1 riastrad * List used only by &drm_connector_list_iter to be able to clean up a 1423 1.1 riastrad * connector from any context, in conjunction with 1424 1.1 riastrad * &drm_mode_config.connector_free_work. 1425 1.1 riastrad */ 1426 1.1 riastrad struct llist_node free_node; 1427 1.1 riastrad 1428 1.1 riastrad /** @hdr_sink_metadata: HDR Metadata Information read from sink */ 1429 1.1 riastrad struct hdr_sink_metadata hdr_sink_metadata; 1430 1.1 riastrad }; 1431 1.1 riastrad 1432 1.1 riastrad #define obj_to_connector(x) container_of(x, struct drm_connector, base) 1433 1.1 riastrad 1434 1.1 riastrad int drm_connector_init(struct drm_device *dev, 1435 1.1 riastrad struct drm_connector *connector, 1436 1.1 riastrad const struct drm_connector_funcs *funcs, 1437 1.1 riastrad int connector_type); 1438 1.1 riastrad int drm_connector_init_with_ddc(struct drm_device *dev, 1439 1.1 riastrad struct drm_connector *connector, 1440 1.1 riastrad const struct drm_connector_funcs *funcs, 1441 1.1 riastrad int connector_type, 1442 1.1 riastrad struct i2c_adapter *ddc); 1443 1.1 riastrad void drm_connector_attach_edid_property(struct drm_connector *connector); 1444 1.1 riastrad int drm_connector_register(struct drm_connector *connector); 1445 1.1 riastrad void drm_connector_unregister(struct drm_connector *connector); 1446 1.1 riastrad int drm_connector_attach_encoder(struct drm_connector *connector, 1447 1.1 riastrad struct drm_encoder *encoder); 1448 1.1 riastrad 1449 1.1 riastrad void drm_connector_cleanup(struct drm_connector *connector); 1450 1.1 riastrad 1451 1.1 riastrad static inline unsigned int drm_connector_index(const struct drm_connector *connector) 1452 1.1 riastrad { 1453 1.1 riastrad return connector->index; 1454 1.1 riastrad } 1455 1.1 riastrad 1456 1.1 riastrad static inline u32 drm_connector_mask(const struct drm_connector *connector) 1457 1.1 riastrad { 1458 1.1 riastrad return 1 << connector->index; 1459 1.1 riastrad } 1460 1.1 riastrad 1461 1.1 riastrad /** 1462 1.1 riastrad * drm_connector_lookup - lookup connector object 1463 1.1 riastrad * @dev: DRM device 1464 1.1 riastrad * @file_priv: drm file to check for lease against. 1465 1.1 riastrad * @id: connector object id 1466 1.1 riastrad * 1467 1.1 riastrad * This function looks up the connector object specified by id 1468 1.1 riastrad * add takes a reference to it. 1469 1.1 riastrad */ 1470 1.1 riastrad static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev, 1471 1.1 riastrad struct drm_file *file_priv, 1472 1.1 riastrad uint32_t id) 1473 1.1 riastrad { 1474 1.1 riastrad struct drm_mode_object *mo; 1475 1.1 riastrad mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CONNECTOR); 1476 1.1 riastrad return mo ? obj_to_connector(mo) : NULL; 1477 1.1 riastrad } 1478 1.1 riastrad 1479 1.1 riastrad /** 1480 1.1 riastrad * drm_connector_get - acquire a connector reference 1481 1.1 riastrad * @connector: DRM connector 1482 1.1 riastrad * 1483 1.1 riastrad * This function increments the connector's refcount. 1484 1.1 riastrad */ 1485 1.1 riastrad static inline void drm_connector_get(struct drm_connector *connector) 1486 1.1 riastrad { 1487 1.1 riastrad drm_mode_object_get(&connector->base); 1488 1.1 riastrad } 1489 1.1 riastrad 1490 1.1 riastrad /** 1491 1.1 riastrad * drm_connector_put - release a connector reference 1492 1.1 riastrad * @connector: DRM connector 1493 1.1 riastrad * 1494 1.1 riastrad * This function decrements the connector's reference count and frees the 1495 1.1 riastrad * object if the reference count drops to zero. 1496 1.1 riastrad */ 1497 1.1 riastrad static inline void drm_connector_put(struct drm_connector *connector) 1498 1.1 riastrad { 1499 1.1 riastrad drm_mode_object_put(&connector->base); 1500 1.1 riastrad } 1501 1.1 riastrad 1502 1.1 riastrad /** 1503 1.1 riastrad * drm_connector_is_unregistered - has the connector been unregistered from 1504 1.1 riastrad * userspace? 1505 1.1 riastrad * @connector: DRM connector 1506 1.1 riastrad * 1507 1.1 riastrad * Checks whether or not @connector has been unregistered from userspace. 1508 1.1 riastrad * 1509 1.1 riastrad * Returns: 1510 1.1 riastrad * True if the connector was unregistered, false if the connector is 1511 1.1 riastrad * registered or has not yet been registered with userspace. 1512 1.1 riastrad */ 1513 1.1 riastrad static inline bool 1514 1.1 riastrad drm_connector_is_unregistered(struct drm_connector *connector) 1515 1.1 riastrad { 1516 1.1 riastrad return READ_ONCE(connector->registration_state) == 1517 1.1 riastrad DRM_CONNECTOR_UNREGISTERED; 1518 1.1 riastrad } 1519 1.1 riastrad 1520 1.1 riastrad const char *drm_get_connector_status_name(enum drm_connector_status status); 1521 1.1 riastrad const char *drm_get_subpixel_order_name(enum subpixel_order order); 1522 1.1 riastrad const char *drm_get_dpms_name(int val); 1523 1.1 riastrad const char *drm_get_dvi_i_subconnector_name(int val); 1524 1.1 riastrad const char *drm_get_dvi_i_select_name(int val); 1525 1.1 riastrad const char *drm_get_tv_subconnector_name(int val); 1526 1.1 riastrad const char *drm_get_tv_select_name(int val); 1527 1.1 riastrad const char *drm_get_content_protection_name(int val); 1528 1.1 riastrad const char *drm_get_hdcp_content_type_name(int val); 1529 1.1 riastrad 1530 1.1 riastrad int drm_mode_create_dvi_i_properties(struct drm_device *dev); 1531 1.1 riastrad int drm_mode_create_tv_margin_properties(struct drm_device *dev); 1532 1.1 riastrad int drm_mode_create_tv_properties(struct drm_device *dev, 1533 1.1 riastrad unsigned int num_modes, 1534 1.1 riastrad const char * const modes[]); 1535 1.1 riastrad void drm_connector_attach_tv_margin_properties(struct drm_connector *conn); 1536 1.1 riastrad int drm_mode_create_scaling_mode_property(struct drm_device *dev); 1537 1.1 riastrad int drm_connector_attach_content_type_property(struct drm_connector *dev); 1538 1.1 riastrad int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, 1539 1.1 riastrad u32 scaling_mode_mask); 1540 1.1 riastrad int drm_connector_attach_vrr_capable_property( 1541 1.1 riastrad struct drm_connector *connector); 1542 1.1 riastrad int drm_mode_create_aspect_ratio_property(struct drm_device *dev); 1543 1.1 riastrad int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector); 1544 1.1 riastrad int drm_mode_create_dp_colorspace_property(struct drm_connector *connector); 1545 1.1 riastrad int drm_mode_create_content_type_property(struct drm_device *dev); 1546 1.1 riastrad void drm_hdmi_avi_infoframe_content_type(struct hdmi_avi_infoframe *frame, 1547 1.1 riastrad const struct drm_connector_state *conn_state); 1548 1.1 riastrad 1549 1.1 riastrad int drm_mode_create_suggested_offset_properties(struct drm_device *dev); 1550 1.1 riastrad 1551 1.1 riastrad int drm_connector_set_path_property(struct drm_connector *connector, 1552 1.1 riastrad const char *path); 1553 1.1 riastrad int drm_connector_set_tile_property(struct drm_connector *connector); 1554 1.1 riastrad int drm_connector_update_edid_property(struct drm_connector *connector, 1555 1.1 riastrad const struct edid *edid); 1556 1.1 riastrad void drm_connector_set_link_status_property(struct drm_connector *connector, 1557 1.1 riastrad uint64_t link_status); 1558 1.1 riastrad void drm_connector_set_vrr_capable_property( 1559 1.1 riastrad struct drm_connector *connector, bool capable); 1560 1.1 riastrad int drm_connector_init_panel_orientation_property( 1561 1.1 riastrad struct drm_connector *connector, int width, int height); 1562 1.1 riastrad int drm_connector_attach_max_bpc_property(struct drm_connector *connector, 1563 1.1 riastrad int min, int max); 1564 1.1 riastrad 1565 1.1 riastrad /** 1566 1.1 riastrad * struct drm_tile_group - Tile group metadata 1567 1.1 riastrad * @refcount: reference count 1568 1.1 riastrad * @dev: DRM device 1569 1.1 riastrad * @id: tile group id exposed to userspace 1570 1.1 riastrad * @group_data: Sink-private data identifying this group 1571 1.1 riastrad * 1572 1.1 riastrad * @group_data corresponds to displayid vend/prod/serial for external screens 1573 1.1 riastrad * with an EDID. 1574 1.1 riastrad */ 1575 1.1 riastrad struct drm_tile_group { 1576 1.1 riastrad struct kref refcount; 1577 1.1 riastrad struct drm_device *dev; 1578 1.1 riastrad int id; 1579 1.1 riastrad u8 group_data[8]; 1580 1.1 riastrad }; 1581 1.1 riastrad 1582 1.1 riastrad struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev, 1583 1.3 riastrad const char topology[8]); 1584 1.1 riastrad struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev, 1585 1.3 riastrad const char topology[8]); 1586 1.1 riastrad void drm_mode_put_tile_group(struct drm_device *dev, 1587 1.1 riastrad struct drm_tile_group *tg); 1588 1.1 riastrad 1589 1.1 riastrad /** 1590 1.1 riastrad * struct drm_connector_list_iter - connector_list iterator 1591 1.1 riastrad * 1592 1.1 riastrad * This iterator tracks state needed to be able to walk the connector_list 1593 1.1 riastrad * within struct drm_mode_config. Only use together with 1594 1.1 riastrad * drm_connector_list_iter_begin(), drm_connector_list_iter_end() and 1595 1.1 riastrad * drm_connector_list_iter_next() respectively the convenience macro 1596 1.1 riastrad * drm_for_each_connector_iter(). 1597 1.1 riastrad */ 1598 1.1 riastrad struct drm_connector_list_iter { 1599 1.1 riastrad /* private: */ 1600 1.1 riastrad struct drm_device *dev; 1601 1.1 riastrad struct drm_connector *conn; 1602 1.1 riastrad }; 1603 1.1 riastrad 1604 1.1 riastrad void drm_connector_list_iter_begin(struct drm_device *dev, 1605 1.1 riastrad struct drm_connector_list_iter *iter); 1606 1.1 riastrad struct drm_connector * 1607 1.1 riastrad drm_connector_list_iter_next(struct drm_connector_list_iter *iter); 1608 1.1 riastrad void drm_connector_list_iter_end(struct drm_connector_list_iter *iter); 1609 1.1 riastrad 1610 1.1 riastrad bool drm_connector_has_possible_encoder(struct drm_connector *connector, 1611 1.1 riastrad struct drm_encoder *encoder); 1612 1.1 riastrad 1613 1.1 riastrad /** 1614 1.1 riastrad * drm_for_each_connector_iter - connector_list iterator macro 1615 1.1 riastrad * @connector: &struct drm_connector pointer used as cursor 1616 1.1 riastrad * @iter: &struct drm_connector_list_iter 1617 1.1 riastrad * 1618 1.1 riastrad * Note that @connector is only valid within the list body, if you want to use 1619 1.1 riastrad * @connector after calling drm_connector_list_iter_end() then you need to grab 1620 1.1 riastrad * your own reference first using drm_connector_get(). 1621 1.1 riastrad */ 1622 1.1 riastrad #define drm_for_each_connector_iter(connector, iter) \ 1623 1.1 riastrad while ((connector = drm_connector_list_iter_next(iter))) 1624 1.1 riastrad 1625 1.1 riastrad /** 1626 1.1 riastrad * drm_connector_for_each_possible_encoder - iterate connector's possible encoders 1627 1.1 riastrad * @connector: &struct drm_connector pointer 1628 1.1 riastrad * @encoder: &struct drm_encoder pointer used as cursor 1629 1.1 riastrad */ 1630 1.1 riastrad #define drm_connector_for_each_possible_encoder(connector, encoder) \ 1631 1.1 riastrad drm_for_each_encoder_mask(encoder, (connector)->dev, \ 1632 1.1 riastrad (connector)->possible_encoders) 1633 1.1 riastrad 1634 1.1 riastrad #endif 1635