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