]>
Commit | Line | Data |
---|---|---|
52217195 DV |
1 | /* |
2 | * Copyright (c) 2016 Intel Corporation | |
3 | * | |
4 | * Permission to use, copy, modify, distribute, and sell this software and its | |
5 | * documentation for any purpose is hereby granted without fee, provided that | |
6 | * the above copyright notice appear in all copies and that both that copyright | |
7 | * notice and this permission notice appear in supporting documentation, and | |
8 | * that the name of the copyright holders not be used in advertising or | |
9 | * publicity pertaining to distribution of the software without specific, | |
10 | * written prior permission. The copyright holders make no representations | |
11 | * about the suitability of this software for any purpose. It is provided "as | |
12 | * is" without express or implied warranty. | |
13 | * | |
14 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | |
15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO | |
16 | * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR | |
17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | |
18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |
19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |
20 | * OF THIS SOFTWARE. | |
21 | */ | |
22 | ||
23 | #ifndef __DRM_CONNECTOR_H__ | |
24 | #define __DRM_CONNECTOR_H__ | |
25 | ||
26 | #include <linux/list.h> | |
27 | #include <linux/ctype.h> | |
28 | #include <drm/drm_modeset.h> | |
29 | ||
30 | struct drm_connector_helper_funcs; | |
31 | struct drm_device; | |
32 | struct drm_crtc; | |
33 | struct drm_encoder; | |
34 | struct drm_property; | |
35 | struct drm_property_blob; | |
36 | struct edid; | |
37 | ||
38 | enum drm_connector_force { | |
39 | DRM_FORCE_UNSPECIFIED, | |
40 | DRM_FORCE_OFF, | |
41 | DRM_FORCE_ON, /* force on analog part normally */ | |
42 | DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ | |
43 | }; | |
44 | ||
45 | enum drm_connector_status { | |
46 | connector_status_connected = 1, | |
47 | connector_status_disconnected = 2, | |
48 | connector_status_unknown = 3, | |
49 | }; | |
50 | ||
51 | enum subpixel_order { | |
52 | SubPixelUnknown = 0, | |
53 | SubPixelHorizontalRGB, | |
54 | SubPixelHorizontalBGR, | |
55 | SubPixelVerticalRGB, | |
56 | SubPixelVerticalBGR, | |
57 | SubPixelNone, | |
58 | }; | |
59 | ||
60 | /* | |
61 | * Describes a given display (e.g. CRT or flat panel) and its limitations. | |
62 | */ | |
63 | struct drm_display_info { | |
64 | char name[DRM_DISPLAY_INFO_LEN]; | |
65 | ||
66 | /* Physical size */ | |
67 | unsigned int width_mm; | |
68 | unsigned int height_mm; | |
69 | ||
70 | /* Clock limits FIXME: storage format */ | |
71 | unsigned int min_vfreq, max_vfreq; | |
72 | unsigned int min_hfreq, max_hfreq; | |
73 | unsigned int pixel_clock; | |
74 | unsigned int bpc; | |
75 | ||
76 | enum subpixel_order subpixel_order; | |
77 | ||
78 | #define DRM_COLOR_FORMAT_RGB444 (1<<0) | |
79 | #define DRM_COLOR_FORMAT_YCRCB444 (1<<1) | |
80 | #define DRM_COLOR_FORMAT_YCRCB422 (1<<2) | |
81 | ||
82 | u32 color_formats; | |
83 | ||
84 | const u32 *bus_formats; | |
85 | unsigned int num_bus_formats; | |
86 | ||
87 | #define DRM_BUS_FLAG_DE_LOW (1<<0) | |
88 | #define DRM_BUS_FLAG_DE_HIGH (1<<1) | |
89 | /* drive data on pos. edge */ | |
90 | #define DRM_BUS_FLAG_PIXDATA_POSEDGE (1<<2) | |
91 | /* drive data on neg. edge */ | |
92 | #define DRM_BUS_FLAG_PIXDATA_NEGEDGE (1<<3) | |
93 | ||
94 | u32 bus_flags; | |
95 | ||
96 | /* Mask of supported hdmi deep color modes */ | |
97 | u8 edid_hdmi_dc_modes; | |
98 | ||
99 | u8 cea_rev; | |
100 | }; | |
101 | ||
102 | /** | |
103 | * struct drm_connector_state - mutable connector state | |
104 | * @connector: backpointer to the connector | |
105 | * @crtc: CRTC to connect connector to, NULL if disabled | |
106 | * @best_encoder: can be used by helpers and drivers to select the encoder | |
107 | * @state: backpointer to global drm_atomic_state | |
108 | */ | |
109 | struct drm_connector_state { | |
110 | struct drm_connector *connector; | |
111 | ||
112 | struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_connector() */ | |
113 | ||
114 | struct drm_encoder *best_encoder; | |
115 | ||
116 | struct drm_atomic_state *state; | |
117 | }; | |
118 | ||
119 | /** | |
120 | * struct drm_connector_funcs - control connectors on a given device | |
121 | * | |
122 | * Each CRTC may have one or more connectors attached to it. The functions | |
123 | * below allow the core DRM code to control connectors, enumerate available modes, | |
124 | * etc. | |
125 | */ | |
126 | struct drm_connector_funcs { | |
127 | /** | |
128 | * @dpms: | |
129 | * | |
130 | * Legacy entry point to set the per-connector DPMS state. Legacy DPMS | |
131 | * is exposed as a standard property on the connector, but diverted to | |
132 | * this callback in the drm core. Note that atomic drivers don't | |
133 | * implement the 4 level DPMS support on the connector any more, but | |
134 | * instead only have an on/off "ACTIVE" property on the CRTC object. | |
135 | * | |
136 | * Drivers implementing atomic modeset should use | |
137 | * drm_atomic_helper_connector_dpms() to implement this hook. | |
138 | * | |
139 | * RETURNS: | |
140 | * | |
141 | * 0 on success or a negative error code on failure. | |
142 | */ | |
143 | int (*dpms)(struct drm_connector *connector, int mode); | |
144 | ||
145 | /** | |
146 | * @reset: | |
147 | * | |
148 | * Reset connector hardware and software state to off. This function isn't | |
149 | * called by the core directly, only through drm_mode_config_reset(). | |
150 | * It's not a helper hook only for historical reasons. | |
151 | * | |
152 | * Atomic drivers can use drm_atomic_helper_connector_reset() to reset | |
153 | * atomic state using this hook. | |
154 | */ | |
155 | void (*reset)(struct drm_connector *connector); | |
156 | ||
157 | /** | |
158 | * @detect: | |
159 | * | |
160 | * Check to see if anything is attached to the connector. The parameter | |
161 | * force is set to false whilst polling, true when checking the | |
162 | * connector due to a user request. force can be used by the driver to | |
163 | * avoid expensive, destructive operations during automated probing. | |
164 | * | |
165 | * FIXME: | |
166 | * | |
167 | * Note that this hook is only called by the probe helper. It's not in | |
168 | * the helper library vtable purely for historical reasons. The only DRM | |
169 | * core entry point to probe connector state is @fill_modes. | |
170 | * | |
171 | * RETURNS: | |
172 | * | |
173 | * drm_connector_status indicating the connector's status. | |
174 | */ | |
175 | enum drm_connector_status (*detect)(struct drm_connector *connector, | |
176 | bool force); | |
177 | ||
178 | /** | |
179 | * @force: | |
180 | * | |
181 | * This function is called to update internal encoder state when the | |
182 | * connector is forced to a certain state by userspace, either through | |
183 | * the sysfs interfaces or on the kernel cmdline. In that case the | |
184 | * @detect callback isn't called. | |
185 | * | |
186 | * FIXME: | |
187 | * | |
188 | * Note that this hook is only called by the probe helper. It's not in | |
189 | * the helper library vtable purely for historical reasons. The only DRM | |
190 | * core entry point to probe connector state is @fill_modes. | |
191 | */ | |
192 | void (*force)(struct drm_connector *connector); | |
193 | ||
194 | /** | |
195 | * @fill_modes: | |
196 | * | |
197 | * Entry point for output detection and basic mode validation. The | |
198 | * driver should reprobe the output if needed (e.g. when hotplug | |
199 | * handling is unreliable), add all detected modes to connector->modes | |
200 | * and filter out any the device can't support in any configuration. It | |
201 | * also needs to filter out any modes wider or higher than the | |
202 | * parameters max_width and max_height indicate. | |
203 | * | |
204 | * The drivers must also prune any modes no longer valid from | |
205 | * connector->modes. Furthermore it must update connector->status and | |
206 | * connector->edid. If no EDID has been received for this output | |
207 | * connector->edid must be NULL. | |
208 | * | |
209 | * Drivers using the probe helpers should use | |
210 | * drm_helper_probe_single_connector_modes() or | |
211 | * drm_helper_probe_single_connector_modes_nomerge() to implement this | |
212 | * function. | |
213 | * | |
214 | * RETURNS: | |
215 | * | |
216 | * The number of modes detected and filled into connector->modes. | |
217 | */ | |
218 | int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); | |
219 | ||
220 | /** | |
221 | * @set_property: | |
222 | * | |
223 | * This is the legacy entry point to update a property attached to the | |
224 | * connector. | |
225 | * | |
226 | * Drivers implementing atomic modeset should use | |
227 | * drm_atomic_helper_connector_set_property() to implement this hook. | |
228 | * | |
229 | * This callback is optional if the driver does not support any legacy | |
230 | * driver-private properties. | |
231 | * | |
232 | * RETURNS: | |
233 | * | |
234 | * 0 on success or a negative error code on failure. | |
235 | */ | |
236 | int (*set_property)(struct drm_connector *connector, struct drm_property *property, | |
237 | uint64_t val); | |
238 | ||
239 | /** | |
240 | * @late_register: | |
241 | * | |
242 | * This optional hook can be used to register additional userspace | |
243 | * interfaces attached to the connector, light backlight control, i2c, | |
244 | * DP aux or similar interfaces. It is called late in the driver load | |
245 | * sequence from drm_connector_register() when registering all the | |
246 | * core drm connector interfaces. Everything added from this callback | |
247 | * should be unregistered in the early_unregister callback. | |
248 | * | |
249 | * Returns: | |
250 | * | |
251 | * 0 on success, or a negative error code on failure. | |
252 | */ | |
253 | int (*late_register)(struct drm_connector *connector); | |
254 | ||
255 | /** | |
256 | * @early_unregister: | |
257 | * | |
258 | * This optional hook should be used to unregister the additional | |
259 | * userspace interfaces attached to the connector from | |
260 | * late_unregister(). It is called from drm_connector_unregister(), | |
261 | * early in the driver unload sequence to disable userspace access | |
262 | * before data structures are torndown. | |
263 | */ | |
264 | void (*early_unregister)(struct drm_connector *connector); | |
265 | ||
266 | /** | |
267 | * @destroy: | |
268 | * | |
269 | * Clean up connector resources. This is called at driver unload time | |
270 | * through drm_mode_config_cleanup(). It can also be called at runtime | |
271 | * when a connector is being hot-unplugged for drivers that support | |
272 | * connector hotplugging (e.g. DisplayPort MST). | |
273 | */ | |
274 | void (*destroy)(struct drm_connector *connector); | |
275 | ||
276 | /** | |
277 | * @atomic_duplicate_state: | |
278 | * | |
279 | * Duplicate the current atomic state for this connector and return it. | |
280 | * The core and helpers gurantee that any atomic state duplicated with | |
281 | * this hook and still owned by the caller (i.e. not transferred to the | |
282 | * driver by calling ->atomic_commit() from struct | |
283 | * &drm_mode_config_funcs) will be cleaned up by calling the | |
284 | * @atomic_destroy_state hook in this structure. | |
285 | * | |
286 | * Atomic drivers which don't subclass struct &drm_connector_state should use | |
287 | * drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the | |
288 | * state structure to extend it with driver-private state should use | |
289 | * __drm_atomic_helper_connector_duplicate_state() to make sure shared state is | |
290 | * duplicated in a consistent fashion across drivers. | |
291 | * | |
292 | * It is an error to call this hook before connector->state has been | |
293 | * initialized correctly. | |
294 | * | |
295 | * NOTE: | |
296 | * | |
297 | * If the duplicate state references refcounted resources this hook must | |
298 | * acquire a reference for each of them. The driver must release these | |
299 | * references again in @atomic_destroy_state. | |
300 | * | |
301 | * RETURNS: | |
302 | * | |
303 | * Duplicated atomic state or NULL when the allocation failed. | |
304 | */ | |
305 | struct drm_connector_state *(*atomic_duplicate_state)(struct drm_connector *connector); | |
306 | ||
307 | /** | |
308 | * @atomic_destroy_state: | |
309 | * | |
310 | * Destroy a state duplicated with @atomic_duplicate_state and release | |
311 | * or unreference all resources it references | |
312 | */ | |
313 | void (*atomic_destroy_state)(struct drm_connector *connector, | |
314 | struct drm_connector_state *state); | |
315 | ||
316 | /** | |
317 | * @atomic_set_property: | |
318 | * | |
319 | * Decode a driver-private property value and store the decoded value | |
320 | * into the passed-in state structure. Since the atomic core decodes all | |
321 | * standardized properties (even for extensions beyond the core set of | |
322 | * properties which might not be implemented by all drivers) this | |
323 | * requires drivers to subclass the state structure. | |
324 | * | |
325 | * Such driver-private properties should really only be implemented for | |
326 | * truly hardware/vendor specific state. Instead it is preferred to | |
327 | * standardize atomic extension and decode the properties used to expose | |
328 | * such an extension in the core. | |
329 | * | |
330 | * Do not call this function directly, use | |
331 | * drm_atomic_connector_set_property() instead. | |
332 | * | |
333 | * This callback is optional if the driver does not support any | |
334 | * driver-private atomic properties. | |
335 | * | |
336 | * NOTE: | |
337 | * | |
338 | * This function is called in the state assembly phase of atomic | |
339 | * modesets, which can be aborted for any reason (including on | |
340 | * userspace's request to just check whether a configuration would be | |
341 | * possible). Drivers MUST NOT touch any persistent state (hardware or | |
342 | * software) or data structures except the passed in @state parameter. | |
343 | * | |
344 | * Also since userspace controls in which order properties are set this | |
345 | * function must not do any input validation (since the state update is | |
346 | * incomplete and hence likely inconsistent). Instead any such input | |
347 | * validation must be done in the various atomic_check callbacks. | |
348 | * | |
349 | * RETURNS: | |
350 | * | |
351 | * 0 if the property has been found, -EINVAL if the property isn't | |
352 | * implemented by the driver (which shouldn't ever happen, the core only | |
353 | * asks for properties attached to this connector). No other validation | |
354 | * is allowed by the driver. The core already checks that the property | |
355 | * value is within the range (integer, valid enum value, ...) the driver | |
356 | * set when registering the property. | |
357 | */ | |
358 | int (*atomic_set_property)(struct drm_connector *connector, | |
359 | struct drm_connector_state *state, | |
360 | struct drm_property *property, | |
361 | uint64_t val); | |
362 | ||
363 | /** | |
364 | * @atomic_get_property: | |
365 | * | |
366 | * Reads out the decoded driver-private property. This is used to | |
367 | * implement the GETCONNECTOR IOCTL. | |
368 | * | |
369 | * Do not call this function directly, use | |
370 | * drm_atomic_connector_get_property() instead. | |
371 | * | |
372 | * This callback is optional if the driver does not support any | |
373 | * driver-private atomic properties. | |
374 | * | |
375 | * RETURNS: | |
376 | * | |
377 | * 0 on success, -EINVAL if the property isn't implemented by the | |
378 | * driver (which shouldn't ever happen, the core only asks for | |
379 | * properties attached to this connector). | |
380 | */ | |
381 | int (*atomic_get_property)(struct drm_connector *connector, | |
382 | const struct drm_connector_state *state, | |
383 | struct drm_property *property, | |
384 | uint64_t *val); | |
385 | }; | |
386 | ||
387 | /* mode specified on the command line */ | |
388 | struct drm_cmdline_mode { | |
389 | bool specified; | |
390 | bool refresh_specified; | |
391 | bool bpp_specified; | |
392 | int xres, yres; | |
393 | int bpp; | |
394 | int refresh; | |
395 | bool rb; | |
396 | bool interlace; | |
397 | bool cvt; | |
398 | bool margins; | |
399 | enum drm_connector_force force; | |
400 | }; | |
401 | ||
402 | /** | |
403 | * struct drm_connector - central DRM connector control structure | |
404 | * @dev: parent DRM device | |
405 | * @kdev: kernel device for sysfs attributes | |
406 | * @attr: sysfs attributes | |
407 | * @head: list management | |
408 | * @base: base KMS object | |
409 | * @name: human readable name, can be overwritten by the driver | |
410 | * @connector_type: one of the DRM_MODE_CONNECTOR_<foo> types from drm_mode.h | |
411 | * @connector_type_id: index into connector type enum | |
412 | * @interlace_allowed: can this connector handle interlaced modes? | |
413 | * @doublescan_allowed: can this connector handle doublescan? | |
414 | * @stereo_allowed: can this connector handle stereo modes? | |
415 | * @registered: is this connector exposed (registered) with userspace? | |
416 | * @modes: modes available on this connector (from fill_modes() + user) | |
417 | * @status: one of the drm_connector_status enums (connected, not, or unknown) | |
418 | * @probed_modes: list of modes derived directly from the display | |
419 | * @display_info: information about attached display (e.g. from EDID) | |
420 | * @funcs: connector control functions | |
421 | * @edid_blob_ptr: DRM property containing EDID if present | |
422 | * @properties: property tracking for this connector | |
423 | * @polled: a DRM_CONNECTOR_POLL_<foo> value for core driven polling | |
424 | * @dpms: current dpms state | |
425 | * @helper_private: mid-layer private data | |
426 | * @cmdline_mode: mode line parsed from the kernel cmdline for this connector | |
427 | * @force: a DRM_FORCE_<foo> state for forced mode sets | |
428 | * @override_edid: has the EDID been overwritten through debugfs for testing? | |
429 | * @encoder_ids: valid encoders for this connector | |
430 | * @encoder: encoder driving this connector, if any | |
431 | * @eld: EDID-like data, if present | |
432 | * @dvi_dual: dual link DVI, if found | |
433 | * @max_tmds_clock: max clock rate, if found | |
434 | * @latency_present: AV delay info from ELD, if found | |
435 | * @video_latency: video latency info from ELD, if found | |
436 | * @audio_latency: audio latency info from ELD, if found | |
437 | * @null_edid_counter: track sinks that give us all zeros for the EDID | |
438 | * @bad_edid_counter: track sinks that give us an EDID with invalid checksum | |
439 | * @edid_corrupt: indicates whether the last read EDID was corrupt | |
440 | * @debugfs_entry: debugfs directory for this connector | |
441 | * @state: current atomic state for this connector | |
442 | * @has_tile: is this connector connected to a tiled monitor | |
443 | * @tile_group: tile group for the connected monitor | |
444 | * @tile_is_single_monitor: whether the tile is one monitor housing | |
445 | * @num_h_tile: number of horizontal tiles in the tile group | |
446 | * @num_v_tile: number of vertical tiles in the tile group | |
447 | * @tile_h_loc: horizontal location of this tile | |
448 | * @tile_v_loc: vertical location of this tile | |
449 | * @tile_h_size: horizontal size of this tile. | |
450 | * @tile_v_size: vertical size of this tile. | |
451 | * | |
452 | * Each connector may be connected to one or more CRTCs, or may be clonable by | |
453 | * another connector if they can share a CRTC. Each connector also has a specific | |
454 | * position in the broader display (referred to as a 'screen' though it could | |
455 | * span multiple monitors). | |
456 | */ | |
457 | struct drm_connector { | |
458 | struct drm_device *dev; | |
459 | struct device *kdev; | |
460 | struct device_attribute *attr; | |
461 | struct list_head head; | |
462 | ||
463 | struct drm_mode_object base; | |
464 | ||
465 | char *name; | |
466 | ||
467 | /** | |
468 | * @index: Compacted connector index, which matches the position inside | |
469 | * the mode_config.list for drivers not supporting hot-add/removing. Can | |
470 | * be used as an array index. It is invariant over the lifetime of the | |
471 | * connector. | |
472 | */ | |
473 | unsigned index; | |
474 | ||
475 | int connector_type; | |
476 | int connector_type_id; | |
477 | bool interlace_allowed; | |
478 | bool doublescan_allowed; | |
479 | bool stereo_allowed; | |
480 | bool registered; | |
481 | struct list_head modes; /* list of modes on this connector */ | |
482 | ||
483 | enum drm_connector_status status; | |
484 | ||
485 | /* these are modes added by probing with DDC or the BIOS */ | |
486 | struct list_head probed_modes; | |
487 | ||
488 | struct drm_display_info display_info; | |
489 | const struct drm_connector_funcs *funcs; | |
490 | ||
491 | struct drm_property_blob *edid_blob_ptr; | |
492 | struct drm_object_properties properties; | |
493 | ||
494 | /** | |
495 | * @path_blob_ptr: | |
496 | * | |
497 | * DRM blob property data for the DP MST path property. | |
498 | */ | |
499 | struct drm_property_blob *path_blob_ptr; | |
500 | ||
501 | /** | |
502 | * @tile_blob_ptr: | |
503 | * | |
504 | * DRM blob property data for the tile property (used mostly by DP MST). | |
505 | * This is meant for screens which are driven through separate display | |
506 | * pipelines represented by &drm_crtc, which might not be running with | |
507 | * genlocked clocks. For tiled panels which are genlocked, like | |
508 | * dual-link LVDS or dual-link DSI, the driver should try to not expose | |
509 | * the tiling and virtualize both &drm_crtc and &drm_plane if needed. | |
510 | */ | |
511 | struct drm_property_blob *tile_blob_ptr; | |
512 | ||
513 | /* should we poll this connector for connects and disconnects */ | |
514 | /* hot plug detectable */ | |
515 | #define DRM_CONNECTOR_POLL_HPD (1 << 0) | |
516 | /* poll for connections */ | |
517 | #define DRM_CONNECTOR_POLL_CONNECT (1 << 1) | |
518 | /* can cleanly poll for disconnections without flickering the screen */ | |
519 | /* DACs should rarely do this without a lot of testing */ | |
520 | #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2) | |
521 | ||
522 | uint8_t polled; /* DRM_CONNECTOR_POLL_* */ | |
523 | ||
524 | /* requested DPMS state */ | |
525 | int dpms; | |
526 | ||
527 | const struct drm_connector_helper_funcs *helper_private; | |
528 | ||
529 | /* forced on connector */ | |
530 | struct drm_cmdline_mode cmdline_mode; | |
531 | enum drm_connector_force force; | |
532 | bool override_edid; | |
533 | ||
534 | #define DRM_CONNECTOR_MAX_ENCODER 3 | |
535 | uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; | |
536 | struct drm_encoder *encoder; /* currently active encoder */ | |
537 | ||
538 | #define MAX_ELD_BYTES 128 | |
539 | /* EDID bits */ | |
540 | uint8_t eld[MAX_ELD_BYTES]; | |
541 | bool dvi_dual; | |
542 | int max_tmds_clock; /* in MHz */ | |
543 | bool latency_present[2]; | |
544 | int video_latency[2]; /* [0]: progressive, [1]: interlaced */ | |
545 | int audio_latency[2]; | |
546 | int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */ | |
547 | unsigned bad_edid_counter; | |
548 | ||
549 | /* Flag for raw EDID header corruption - used in Displayport | |
550 | * compliance testing - * Displayport Link CTS Core 1.2 rev1.1 4.2.2.6 | |
551 | */ | |
552 | bool edid_corrupt; | |
553 | ||
554 | struct dentry *debugfs_entry; | |
555 | ||
556 | struct drm_connector_state *state; | |
557 | ||
558 | /* DisplayID bits */ | |
559 | bool has_tile; | |
560 | struct drm_tile_group *tile_group; | |
561 | bool tile_is_single_monitor; | |
562 | ||
563 | uint8_t num_h_tile, num_v_tile; | |
564 | uint8_t tile_h_loc, tile_v_loc; | |
565 | uint16_t tile_h_size, tile_v_size; | |
566 | }; | |
567 | ||
568 | #define obj_to_connector(x) container_of(x, struct drm_connector, base) | |
569 | ||
570 | int drm_connector_init(struct drm_device *dev, | |
571 | struct drm_connector *connector, | |
572 | const struct drm_connector_funcs *funcs, | |
573 | int connector_type); | |
574 | int drm_connector_register(struct drm_connector *connector); | |
575 | void drm_connector_unregister(struct drm_connector *connector); | |
576 | int drm_mode_connector_attach_encoder(struct drm_connector *connector, | |
577 | struct drm_encoder *encoder); | |
578 | ||
579 | void drm_connector_cleanup(struct drm_connector *connector); | |
580 | static inline unsigned drm_connector_index(struct drm_connector *connector) | |
581 | { | |
582 | return connector->index; | |
583 | } | |
584 | ||
585 | /** | |
586 | * drm_connector_lookup - lookup connector object | |
587 | * @dev: DRM device | |
588 | * @id: connector object id | |
589 | * | |
590 | * This function looks up the connector object specified by id | |
591 | * add takes a reference to it. | |
592 | */ | |
593 | static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev, | |
594 | uint32_t id) | |
595 | { | |
596 | struct drm_mode_object *mo; | |
597 | mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CONNECTOR); | |
598 | return mo ? obj_to_connector(mo) : NULL; | |
599 | } | |
600 | ||
601 | /** | |
602 | * drm_connector_reference - incr the connector refcnt | |
603 | * @connector: connector | |
604 | * | |
605 | * This function increments the connector's refcount. | |
606 | */ | |
607 | static inline void drm_connector_reference(struct drm_connector *connector) | |
608 | { | |
609 | drm_mode_object_reference(&connector->base); | |
610 | } | |
611 | ||
612 | /** | |
613 | * drm_connector_unreference - unref a connector | |
614 | * @connector: connector to unref | |
615 | * | |
616 | * This function decrements the connector's refcount and frees it if it drops to zero. | |
617 | */ | |
618 | static inline void drm_connector_unreference(struct drm_connector *connector) | |
619 | { | |
620 | drm_mode_object_unreference(&connector->base); | |
621 | } | |
622 | ||
623 | const char *drm_get_connector_status_name(enum drm_connector_status status); | |
624 | const char *drm_get_subpixel_order_name(enum subpixel_order order); | |
625 | const char *drm_get_dpms_name(int val); | |
626 | const char *drm_get_dvi_i_subconnector_name(int val); | |
627 | const char *drm_get_dvi_i_select_name(int val); | |
628 | const char *drm_get_tv_subconnector_name(int val); | |
629 | const char *drm_get_tv_select_name(int val); | |
630 | ||
631 | int drm_mode_create_dvi_i_properties(struct drm_device *dev); | |
632 | int drm_mode_create_tv_properties(struct drm_device *dev, | |
633 | unsigned int num_modes, | |
634 | const char * const modes[]); | |
635 | int drm_mode_create_scaling_mode_property(struct drm_device *dev); | |
636 | int drm_mode_create_aspect_ratio_property(struct drm_device *dev); | |
637 | int drm_mode_create_suggested_offset_properties(struct drm_device *dev); | |
638 | ||
639 | int drm_mode_connector_set_path_property(struct drm_connector *connector, | |
640 | const char *path); | |
641 | int drm_mode_connector_set_tile_property(struct drm_connector *connector); | |
642 | int drm_mode_connector_update_edid_property(struct drm_connector *connector, | |
643 | const struct edid *edid); | |
644 | #endif |