Lines Matching +full:dvi +full:- +full:connector

51  * Hence they are reference-counted using drm_connector_get() and
56 * objects and initialized by setting the following fields. The connector is
58 * &struct drm_connector_funcs and a connector type, and then exposed to
62 * connectors to encoders 1:1, the connector should be attached at
67 * For connectors which are not fixed (like built-in panels) the driver needs to
75 * Global connector list for drm_connector_find_by_fwnode().
76 * Note drm_connector_[un]register() first take connector->lock and then
89 * Connector and encoder types.
94 { DRM_MODE_CONNECTOR_DVII, "DVI-I" },
95 { DRM_MODE_CONNECTOR_DVID, "DVI-D" },
96 { DRM_MODE_CONNECTOR_DVIA, "DVI-A" },
103 { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" },
104 { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" },
132 * drm_get_connector_type_name - return a string for connector type
133 * @type: The connector type (DRM_MODE_CONNECTOR_*)
135 * Returns: the name of the connector type, or NULL if the type is not valid.
147 * drm_connector_get_cmdline_mode - reads the user's cmdline mode
148 * @connector: connector to query
150 * The kernel supports per-connector configuration of its consoles through
153 * particular connector. This is typically only used during the early fbdev
156 static void drm_connector_get_cmdline_mode(struct drm_connector *connector) in drm_connector_get_cmdline_mode() argument
158 struct drm_cmdline_mode *mode = &connector->cmdline_mode; in drm_connector_get_cmdline_mode()
161 option = video_get_options(connector->name); in drm_connector_get_cmdline_mode()
166 connector, in drm_connector_get_cmdline_mode()
170 if (mode->force) { in drm_connector_get_cmdline_mode()
171 DRM_INFO("forcing %s connector %s\n", connector->name, in drm_connector_get_cmdline_mode()
172 drm_get_connector_force_name(mode->force)); in drm_connector_get_cmdline_mode()
173 connector->force = mode->force; in drm_connector_get_cmdline_mode()
176 if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) { in drm_connector_get_cmdline_mode()
177 DRM_INFO("cmdline forces connector %s panel_orientation to %d\n", in drm_connector_get_cmdline_mode()
178 connector->name, mode->panel_orientation); in drm_connector_get_cmdline_mode()
179 drm_connector_set_panel_orientation(connector, in drm_connector_get_cmdline_mode()
180 mode->panel_orientation); in drm_connector_get_cmdline_mode()
183 DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n", in drm_connector_get_cmdline_mode()
184 connector->name, mode->name, in drm_connector_get_cmdline_mode()
185 mode->xres, mode->yres, in drm_connector_get_cmdline_mode()
186 mode->refresh_specified ? mode->refresh : 60, in drm_connector_get_cmdline_mode()
187 mode->rb ? " reduced blanking" : "", in drm_connector_get_cmdline_mode()
188 mode->margins ? " with margins" : "", in drm_connector_get_cmdline_mode()
189 mode->interlace ? " interlaced" : ""); in drm_connector_get_cmdline_mode()
194 struct drm_connector *connector = in drm_connector_free() local
196 struct drm_device *dev = connector->dev; in drm_connector_free()
198 drm_mode_object_unregister(dev, &connector->base); in drm_connector_free()
199 connector->funcs->destroy(connector); in drm_connector_free()
204 struct drm_connector *connector, *n; in drm_connector_free_work_fn() local
207 struct drm_mode_config *config = &dev->mode_config; in drm_connector_free_work_fn()
211 spin_lock_irqsave(&config->connector_list_lock, flags); in drm_connector_free_work_fn()
212 freed = llist_del_all(&config->connector_free_list); in drm_connector_free_work_fn()
213 spin_unlock_irqrestore(&config->connector_list_lock, flags); in drm_connector_free_work_fn()
215 llist_for_each_entry_safe(connector, n, freed, free_node) { in drm_connector_free_work_fn()
216 drm_mode_object_unregister(dev, &connector->base); in drm_connector_free_work_fn()
217 connector->funcs->destroy(connector); in drm_connector_free_work_fn()
222 struct drm_connector *connector, in __drm_connector_init() argument
227 struct drm_mode_config *config = &dev->mode_config; in __drm_connector_init()
233 (!funcs->atomic_destroy_state || in __drm_connector_init()
234 !funcs->atomic_duplicate_state)); in __drm_connector_init()
236 ret = __drm_mode_object_add(dev, &connector->base, in __drm_connector_init()
242 connector->base.properties = &connector->properties; in __drm_connector_init()
243 connector->dev = dev; in __drm_connector_init()
244 connector->funcs = funcs; in __drm_connector_init()
246 /* connector index is used with 32bit bitmasks */ in __drm_connector_init()
247 ret = ida_alloc_max(&config->connector_ida, 31, GFP_KERNEL); in __drm_connector_init()
249 DRM_DEBUG_KMS("Failed to allocate %s connector index: %d\n", in __drm_connector_init()
254 connector->index = ret; in __drm_connector_init()
257 connector->connector_type = connector_type; in __drm_connector_init()
258 connector->connector_type_id = in __drm_connector_init()
260 if (connector->connector_type_id < 0) { in __drm_connector_init()
261 ret = connector->connector_type_id; in __drm_connector_init()
264 connector->name = in __drm_connector_init()
265 kasprintf(GFP_KERNEL, "%s-%d", in __drm_connector_init()
267 connector->connector_type_id); in __drm_connector_init()
268 if (!connector->name) { in __drm_connector_init()
269 ret = -ENOMEM; in __drm_connector_init()
274 connector->ddc = ddc; in __drm_connector_init()
276 INIT_LIST_HEAD(&connector->global_connector_list_entry); in __drm_connector_init()
277 INIT_LIST_HEAD(&connector->probed_modes); in __drm_connector_init()
278 INIT_LIST_HEAD(&connector->modes); in __drm_connector_init()
279 mutex_init(&connector->mutex); in __drm_connector_init()
280 mutex_init(&connector->edid_override_mutex); in __drm_connector_init()
281 mutex_init(&connector->hdmi.infoframes.lock); in __drm_connector_init()
282 connector->edid_blob_ptr = NULL; in __drm_connector_init()
283 connector->epoch_counter = 0; in __drm_connector_init()
284 connector->tile_blob_ptr = NULL; in __drm_connector_init()
285 connector->status = connector_status_unknown; in __drm_connector_init()
286 connector->display_info.panel_orientation = in __drm_connector_init()
289 drm_connector_get_cmdline_mode(connector); in __drm_connector_init()
291 /* We should add connectors at the end to avoid upsetting the connector in __drm_connector_init()
294 spin_lock_irq(&config->connector_list_lock); in __drm_connector_init()
295 list_add_tail(&connector->head, &config->connector_list); in __drm_connector_init()
296 config->num_connector++; in __drm_connector_init()
297 spin_unlock_irq(&config->connector_list_lock); in __drm_connector_init()
301 drm_connector_attach_edid_property(connector); in __drm_connector_init()
303 drm_object_attach_property(&connector->base, in __drm_connector_init()
304 config->dpms_property, 0); in __drm_connector_init()
306 drm_object_attach_property(&connector->base, in __drm_connector_init()
307 config->link_status_property, in __drm_connector_init()
310 drm_object_attach_property(&connector->base, in __drm_connector_init()
311 config->non_desktop_property, in __drm_connector_init()
313 drm_object_attach_property(&connector->base, in __drm_connector_init()
314 config->tile_property, in __drm_connector_init()
318 drm_object_attach_property(&connector->base, config->prop_crtc_id, 0); in __drm_connector_init()
321 connector->debugfs_entry = NULL; in __drm_connector_init()
324 ida_free(connector_ida, connector->connector_type_id); in __drm_connector_init()
327 ida_free(&config->connector_ida, connector->index); in __drm_connector_init()
330 drm_mode_object_unregister(dev, &connector->base); in __drm_connector_init()
336 * drm_connector_init - Init a preallocated connector
338 * @connector: the connector to init
339 * @funcs: callbacks for this connector
340 * @connector_type: user visible type of the connector
342 * Initialises a preallocated connector. Connectors should be
343 * subclassed as part of driver connector objects.
346 * should call drm_connector_cleanup() and free the connector structure.
347 * The connector structure should not be allocated with devm_kzalloc().
357 struct drm_connector *connector, in drm_connector_init() argument
361 if (drm_WARN_ON(dev, !(funcs && funcs->destroy))) in drm_connector_init()
362 return -EINVAL; in drm_connector_init()
364 return __drm_connector_init(dev, connector, funcs, connector_type, NULL); in drm_connector_init()
369 * drm_connector_init_with_ddc - Init a preallocated connector
371 * @connector: the connector to init
372 * @funcs: callbacks for this connector
373 * @connector_type: user visible type of the connector
376 * Initialises a preallocated connector. Connectors should be
377 * subclassed as part of driver connector objects.
380 * should call drm_connector_cleanup() and free the connector structure.
381 * The connector structure should not be allocated with devm_kzalloc().
383 * Ensures that the ddc field of the connector is correctly set.
393 struct drm_connector *connector, in drm_connector_init_with_ddc() argument
398 if (drm_WARN_ON(dev, !(funcs && funcs->destroy))) in drm_connector_init_with_ddc()
399 return -EINVAL; in drm_connector_init_with_ddc()
401 return __drm_connector_init(dev, connector, funcs, connector_type, ddc); in drm_connector_init_with_ddc()
408 struct drm_connector *connector = ptr; in drm_connector_cleanup_action() local
410 drm_connector_cleanup(connector); in drm_connector_cleanup_action()
414 * drmm_connector_init - Init a preallocated connector
416 * @connector: the connector to init
417 * @funcs: callbacks for this connector
418 * @connector_type: user visible type of the connector
421 * Initialises a preallocated connector. Connectors should be
422 * subclassed as part of driver connector objects.
425 * drm_connector_cleanup() in a DRM-managed action.
427 * The connector structure should be allocated with drmm_kzalloc().
435 struct drm_connector *connector, in drmm_connector_init() argument
442 if (drm_WARN_ON(dev, funcs && funcs->destroy)) in drmm_connector_init()
443 return -EINVAL; in drmm_connector_init()
445 ret = __drm_connector_init(dev, connector, funcs, connector_type, ddc); in drmm_connector_init()
450 connector); in drmm_connector_init()
459 * drmm_connector_hdmi_init - Init a preallocated HDMI connector
461 * @connector: A pointer to the HDMI connector to init
464 * @funcs: callbacks for this connector
465 * @hdmi_funcs: HDMI-related callbacks for this connector
466 * @connector_type: user visible type of the connector
469 * @max_bpc: Maximum bits per char the HDMI connector supports
471 * Initialises a preallocated HDMI connector. Connectors can be
472 * subclassed as part of driver connector objects.
475 * drm_connector_cleanup() in a DRM-managed action.
477 * The connector structure should be allocated with drmm_kzalloc().
485 struct drm_connector *connector, in drmm_connector_hdmi_init() argument
497 return -EINVAL; in drmm_connector_hdmi_init()
501 return -EINVAL; in drmm_connector_hdmi_init()
505 return -EINVAL; in drmm_connector_hdmi_init()
508 return -EINVAL; in drmm_connector_hdmi_init()
511 return -EINVAL; in drmm_connector_hdmi_init()
513 ret = drmm_connector_init(dev, connector, funcs, connector_type, ddc); in drmm_connector_hdmi_init()
517 connector->hdmi.supported_formats = supported_formats; in drmm_connector_hdmi_init()
518 strtomem_pad(connector->hdmi.vendor, vendor, 0); in drmm_connector_hdmi_init()
519 strtomem_pad(connector->hdmi.product, product, 0); in drmm_connector_hdmi_init()
523 * connector to have a state. in drmm_connector_hdmi_init()
525 if (connector->funcs->reset) in drmm_connector_hdmi_init()
526 connector->funcs->reset(connector); in drmm_connector_hdmi_init()
528 drm_connector_attach_max_bpc_property(connector, 8, max_bpc); in drmm_connector_hdmi_init()
529 connector->max_bpc = max_bpc; in drmm_connector_hdmi_init()
532 drm_connector_attach_hdr_output_metadata_property(connector); in drmm_connector_hdmi_init()
534 connector->hdmi.funcs = hdmi_funcs; in drmm_connector_hdmi_init()
541 * drm_connector_attach_edid_property - attach edid property.
542 * @connector: the connector
544 * Some connector types like DRM_MODE_CONNECTOR_VIRTUAL do not get a
548 void drm_connector_attach_edid_property(struct drm_connector *connector) in drm_connector_attach_edid_property() argument
550 struct drm_mode_config *config = &connector->dev->mode_config; in drm_connector_attach_edid_property()
552 drm_object_attach_property(&connector->base, in drm_connector_attach_edid_property()
553 config->edid_property, in drm_connector_attach_edid_property()
559 * drm_connector_attach_encoder - attach a connector to an encoder
560 * @connector: connector to attach
561 * @encoder: encoder to attach @connector to
563 * This function links up a connector to an encoder. Note that the routing
570 int drm_connector_attach_encoder(struct drm_connector *connector, in drm_connector_attach_encoder() argument
575 * of connector to encoder in simple connector/encoder devices using a in drm_connector_attach_encoder()
576 * direct assignment of connector->encoder = encoder. This connection in drm_connector_attach_encoder()
584 if (WARN_ON(connector->encoder)) in drm_connector_attach_encoder()
585 return -EINVAL; in drm_connector_attach_encoder()
587 connector->possible_encoders |= drm_encoder_mask(encoder); in drm_connector_attach_encoder()
594 * drm_connector_has_possible_encoder - check if the connector and encoder are
596 * @connector: the connector
600 * True if @encoder is one of the possible encoders for @connector.
602 bool drm_connector_has_possible_encoder(struct drm_connector *connector, in drm_connector_has_possible_encoder() argument
605 return connector->possible_encoders & drm_encoder_mask(encoder); in drm_connector_has_possible_encoder()
609 static void drm_mode_remove(struct drm_connector *connector, in drm_mode_remove() argument
612 list_del(&mode->head); in drm_mode_remove()
613 drm_mode_destroy(connector->dev, mode); in drm_mode_remove()
617 * drm_connector_cleanup - cleans up an initialised connector
618 * @connector: connector to cleanup
620 * Cleans up the connector but doesn't free the object.
622 void drm_connector_cleanup(struct drm_connector *connector) in drm_connector_cleanup() argument
624 struct drm_device *dev = connector->dev; in drm_connector_cleanup()
627 /* The connector should have been removed from userspace long before in drm_connector_cleanup()
630 if (WARN_ON(connector->registration_state == in drm_connector_cleanup()
632 drm_connector_unregister(connector); in drm_connector_cleanup()
634 if (connector->privacy_screen) { in drm_connector_cleanup()
635 drm_privacy_screen_put(connector->privacy_screen); in drm_connector_cleanup()
636 connector->privacy_screen = NULL; in drm_connector_cleanup()
639 if (connector->tile_group) { in drm_connector_cleanup()
640 drm_mode_put_tile_group(dev, connector->tile_group); in drm_connector_cleanup()
641 connector->tile_group = NULL; in drm_connector_cleanup()
644 list_for_each_entry_safe(mode, t, &connector->probed_modes, head) in drm_connector_cleanup()
645 drm_mode_remove(connector, mode); in drm_connector_cleanup()
647 list_for_each_entry_safe(mode, t, &connector->modes, head) in drm_connector_cleanup()
648 drm_mode_remove(connector, mode); in drm_connector_cleanup()
650 ida_free(&drm_connector_enum_list[connector->connector_type].ida, in drm_connector_cleanup()
651 connector->connector_type_id); in drm_connector_cleanup()
653 ida_free(&dev->mode_config.connector_ida, connector->index); in drm_connector_cleanup()
655 kfree(connector->display_info.bus_formats); in drm_connector_cleanup()
656 kfree(connector->display_info.vics); in drm_connector_cleanup()
657 drm_mode_object_unregister(dev, &connector->base); in drm_connector_cleanup()
658 kfree(connector->name); in drm_connector_cleanup()
659 connector->name = NULL; in drm_connector_cleanup()
660 fwnode_handle_put(connector->fwnode); in drm_connector_cleanup()
661 connector->fwnode = NULL; in drm_connector_cleanup()
662 spin_lock_irq(&dev->mode_config.connector_list_lock); in drm_connector_cleanup()
663 list_del(&connector->head); in drm_connector_cleanup()
664 dev->mode_config.num_connector--; in drm_connector_cleanup()
665 spin_unlock_irq(&dev->mode_config.connector_list_lock); in drm_connector_cleanup()
667 WARN_ON(connector->state && !connector->funcs->atomic_destroy_state); in drm_connector_cleanup()
668 if (connector->state && connector->funcs->atomic_destroy_state) in drm_connector_cleanup()
669 connector->funcs->atomic_destroy_state(connector, in drm_connector_cleanup()
670 connector->state); in drm_connector_cleanup()
672 mutex_destroy(&connector->hdmi.infoframes.lock); in drm_connector_cleanup()
673 mutex_destroy(&connector->mutex); in drm_connector_cleanup()
675 memset(connector, 0, sizeof(*connector)); in drm_connector_cleanup()
677 if (dev->registered) in drm_connector_cleanup()
683 * drm_connector_register - register a connector
684 * @connector: the connector to register
686 * Register userspace interfaces for a connector. Only call this for connectors
691 * When the connector is no longer available, callers must call
697 int drm_connector_register(struct drm_connector *connector) in drm_connector_register() argument
701 if (!connector->dev->registered) in drm_connector_register()
704 mutex_lock(&connector->mutex); in drm_connector_register()
705 if (connector->registration_state != DRM_CONNECTOR_INITIALIZING) in drm_connector_register()
708 ret = drm_sysfs_connector_add(connector); in drm_connector_register()
712 drm_debugfs_connector_add(connector); in drm_connector_register()
714 if (connector->funcs->late_register) { in drm_connector_register()
715 ret = connector->funcs->late_register(connector); in drm_connector_register()
720 ret = drm_sysfs_connector_add_late(connector); in drm_connector_register()
724 drm_mode_object_register(connector->dev, &connector->base); in drm_connector_register()
726 connector->registration_state = DRM_CONNECTOR_REGISTERED; in drm_connector_register()
728 /* Let userspace know we have a new connector */ in drm_connector_register()
729 drm_sysfs_connector_hotplug_event(connector); in drm_connector_register()
731 if (connector->privacy_screen) in drm_connector_register()
732 drm_privacy_screen_register_notifier(connector->privacy_screen, in drm_connector_register()
733 &connector->privacy_screen_notifier); in drm_connector_register()
736 list_add_tail(&connector->global_connector_list_entry, &connector_list); in drm_connector_register()
741 if (connector->funcs->early_unregister) in drm_connector_register()
742 connector->funcs->early_unregister(connector); in drm_connector_register()
744 drm_debugfs_connector_remove(connector); in drm_connector_register()
745 drm_sysfs_connector_remove(connector); in drm_connector_register()
747 mutex_unlock(&connector->mutex); in drm_connector_register()
753 * drm_connector_unregister - unregister a connector
754 * @connector: the connector to unregister
756 * Unregister userspace interfaces for a connector. Only call this for
760 void drm_connector_unregister(struct drm_connector *connector) in drm_connector_unregister() argument
762 mutex_lock(&connector->mutex); in drm_connector_unregister()
763 if (connector->registration_state != DRM_CONNECTOR_REGISTERED) { in drm_connector_unregister()
764 mutex_unlock(&connector->mutex); in drm_connector_unregister()
769 list_del_init(&connector->global_connector_list_entry); in drm_connector_unregister()
772 if (connector->privacy_screen) in drm_connector_unregister()
774 connector->privacy_screen, in drm_connector_unregister()
775 &connector->privacy_screen_notifier); in drm_connector_unregister()
777 drm_sysfs_connector_remove_early(connector); in drm_connector_unregister()
779 if (connector->funcs->early_unregister) in drm_connector_unregister()
780 connector->funcs->early_unregister(connector); in drm_connector_unregister()
782 drm_debugfs_connector_remove(connector); in drm_connector_unregister()
783 drm_sysfs_connector_remove(connector); in drm_connector_unregister()
785 connector->registration_state = DRM_CONNECTOR_UNREGISTERED; in drm_connector_unregister()
786 mutex_unlock(&connector->mutex); in drm_connector_unregister()
792 struct drm_connector *connector; in drm_connector_unregister_all() local
796 drm_for_each_connector_iter(connector, &conn_iter) in drm_connector_unregister_all()
797 drm_connector_unregister(connector); in drm_connector_unregister_all()
803 struct drm_connector *connector; in drm_connector_register_all() local
808 drm_for_each_connector_iter(connector, &conn_iter) { in drm_connector_register_all()
809 ret = drm_connector_register(connector); in drm_connector_register_all()
821 * drm_get_connector_status_name - return a string for connector status
822 * @status: connector status to compute name of
827 * Returns: connector status string
841 * drm_get_connector_force_name - return a string for connector force
842 * @force: connector force to get name of
869 * drm_connector_list_iter_begin - initialize a connector_list iterator
881 iter->dev = dev; in drm_connector_list_iter_begin()
882 iter->conn = NULL; in drm_connector_list_iter_begin()
888 * Extra-safe connector put function that works in any context. Should only be
890 * actually release the connector when dropping our final reference.
895 struct drm_mode_config *config = &conn->dev->mode_config; in __drm_connector_put_safe()
897 lockdep_assert_held(&config->connector_list_lock); in __drm_connector_put_safe()
899 if (!refcount_dec_and_test(&conn->base.refcount.refcount)) in __drm_connector_put_safe()
902 llist_add(&conn->free_node, &config->connector_free_list); in __drm_connector_put_safe()
903 schedule_work(&config->connector_free_work); in __drm_connector_put_safe()
907 * drm_connector_list_iter_next - return next connector
910 * Returns: the next connector for @iter, or NULL when the list walk has
916 struct drm_connector *old_conn = iter->conn; in drm_connector_list_iter_next()
917 struct drm_mode_config *config = &iter->dev->mode_config; in drm_connector_list_iter_next()
921 spin_lock_irqsave(&config->connector_list_lock, flags); in drm_connector_list_iter_next()
922 lhead = old_conn ? &old_conn->head : &config->connector_list; in drm_connector_list_iter_next()
925 if (lhead->next == &config->connector_list) { in drm_connector_list_iter_next()
926 iter->conn = NULL; in drm_connector_list_iter_next()
930 lhead = lhead->next; in drm_connector_list_iter_next()
931 iter->conn = list_entry(lhead, struct drm_connector, head); in drm_connector_list_iter_next()
933 /* loop until it's not a zombie connector */ in drm_connector_list_iter_next()
934 } while (!kref_get_unless_zero(&iter->conn->base.refcount)); in drm_connector_list_iter_next()
938 spin_unlock_irqrestore(&config->connector_list_lock, flags); in drm_connector_list_iter_next()
940 return iter->conn; in drm_connector_list_iter_next()
945 * drm_connector_list_iter_end - tear down a connector_list iterator
955 struct drm_mode_config *config = &iter->dev->mode_config; in drm_connector_list_iter_end()
958 iter->dev = NULL; in drm_connector_list_iter_end()
959 if (iter->conn) { in drm_connector_list_iter_end()
960 spin_lock_irqsave(&config->connector_list_lock, flags); in drm_connector_list_iter_end()
961 __drm_connector_put_safe(iter->conn); in drm_connector_list_iter_end()
962 spin_unlock_irqrestore(&config->connector_list_lock, flags); in drm_connector_list_iter_end()
978 * drm_get_subpixel_order_name - return a string for a given subpixel enum
1006 * drm_display_info_set_bus_formats - set the supported bus formats
1012 * See MEDIA_BUS_FMT_* definitions in include/uapi/linux/media-bus-format.h for
1025 return -EINVAL; in drm_display_info_set_bus_formats()
1031 return -ENOMEM; in drm_display_info_set_bus_formats()
1034 kfree(info->bus_formats); in drm_display_info_set_bus_formats()
1035 info->bus_formats = fmts; in drm_display_info_set_bus_formats()
1036 info->num_bus_formats = num_formats; in drm_display_info_set_bus_formats()
1042 /* Optional connector properties. */
1072 { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */
1073 { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */
1074 { DRM_MODE_SUBCONNECTOR_DVIA, "DVI-A" }, /* DVI-I */
1079 { DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I, TV-out and DP */
1080 { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */
1081 { DRM_MODE_SUBCONNECTOR_DVIA, "DVI-A" }, /* DVI-I */
1088 { DRM_MODE_TV_MODE_NTSC_443, "NTSC-443" },
1089 { DRM_MODE_TV_MODE_NTSC_J, "NTSC-J" },
1091 { DRM_MODE_TV_MODE_PAL_M, "PAL-M" },
1092 { DRM_MODE_TV_MODE_PAL_N, "PAL-N" },
1099 * drm_get_tv_mode_from_name - Translates a TV mode name into its enum value in DRM_ENUM_NAME_FN()
1114 if (strlen(item->name) == len && !strncmp(item->name, name, len)) in DRM_ENUM_NAME_FN()
1115 return item->type; in DRM_ENUM_NAME_FN()
1118 return -EINVAL; in DRM_ENUM_NAME_FN()
1123 { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */
1124 { DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */
1125 { DRM_MODE_SUBCONNECTOR_SVIDEO, "SVIDEO" }, /* TV-out */
1126 { DRM_MODE_SUBCONNECTOR_Component, "Component" }, /* TV-out */
1127 { DRM_MODE_SUBCONNECTOR_SCART, "SCART" }, /* TV-out */
1132 { DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I, TV-out and DP */
1133 { DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */
1134 { DRM_MODE_SUBCONNECTOR_SVIDEO, "SVIDEO" }, /* TV-out */
1135 { DRM_MODE_SUBCONNECTOR_Component, "Component" }, /* TV-out */
1136 { DRM_MODE_SUBCONNECTOR_SCART, "SCART" }, /* TV-out */
1142 { DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I, TV-out and DP */
1144 { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DP */
1161 /* Standard Definition Colorimetry based on IEC 61966-2-4 */
1163 /* High Definition Colorimetry based on IEC 61966-2-4 */
1165 /* Colorimetry based on IEC 61966-2-1/Amendment 1 */
1167 /* Colorimetry based on IEC 61966-2-5 [33] */
1169 /* Colorimetry based on IEC 61966-2-5 */
1171 /* Colorimetry based on ITU-R BT.2020 */
1173 /* Colorimetry based on ITU-R BT.2020 */
1175 /* Colorimetry based on ITU-R BT.2020 */
1178 [DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65] = "DCI-P3_RGB_D65",
1179 [DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER] = "DCI-P3_RGB_Theater",
1181 /* Colorimetry based on scRGB (IEC 61966-2-2) */
1187 * drm_get_colorspace_name - return a string for color encoding
1217 * Format Table 2-120
1241 …* drm_hdmi_connector_get_broadcast_rgb_name - Return a string for HDMI connector RGB broadcast sel…
1265 * drm_hdmi_connector_get_output_format_name() - Return a string for HDMI connector output format
1282 * DOC: standard connector properties
1294 * User-space should not parse the EDID to obtain information exposed via
1296 * fixups to the EDID). For instance, user-space should not try to parse
1299 * Legacy property for setting the power state of the connector. For atomic
1302 * connector is linked to. Drivers should never set this property directly,
1318 * The second issue is that the DPMS state is only well-defined when the
1319 * connector is connected to a CRTC. In atomic the DRM core enforces that
1326 * Summarizing: Only set "DPMS" when the connector is known to be enabled,
1330 * Connector path property to identify how this sink is physically
1337 * ``mst:<parent>-<ports>`` where ``<parent>`` is the KMS object ID of the
1338 * parent connector and ``<ports>`` is a hyphen-separated list of DP MST
1342 * Connector tile group property to indicate how a set of DRM connector
1343 * compose together into one logical screen. This is used by both high-res
1345 * DP MST sinks), or high-res integrated panels (like dual-link DSI) which
1346 * are not gen-locked. Note that for tiled panels which are genlocked, like
1347 * dual-link LVDS or dual-link DSI, the driver should try to not expose the
1351 * link-status:
1352 * Connector link-status property to indicate the status of link. The
1353 * default value of link-status is "GOOD". If something fails during or
1358 * When user-space receives the hotplug uevent and detects a "BAD"
1359 * link-status, the sink doesn't receive pixels anymore (e.g. the screen
1361 * changed. User-space is expected to pick a new mode if the current one
1362 * has disappeared and perform a new modeset with link-status set to
1363 * "GOOD" to re-enable the connector.
1366 * link-status, the other are unaffected (ie. the sinks still continue to
1369 * When user-space performs an atomic commit on a connector with a "BAD"
1370 * link-status without resetting the property to "GOOD", the sink may
1371 * still not receive pixels. When user-space performs an atomic commit
1372 * which resets the link-status property to "GOOD" without the
1375 * User-space can only change link-status to "GOOD", changing it to "BAD"
1376 * is a no-op.
1378 * For backwards compatibility with non-atomic userspace the kernel
1379 * tries to automatically set the link-status back to "GOOD" in the
1408 * -EINVAL.
1412 * - DESIRED state should be preserved until userspace de-asserts it by
1415 * - If the state is DESIRED, kernel should attempt to re-authenticate the
1418 * - Kernel sends uevent with the connector id and property id through
1422 * - DESIRED -> ENABLED (authentication success)
1423 * - ENABLED -> DESIRED (termination of authentication)
1424 * - Please note no uevents for userspace triggered property state changes,
1427 * - DESIRED/ENABLED -> UNDESIRED
1428 * - UNDESIRED -> DESIRED
1429 * - Userspace is responsible for polling the property or listen to uevents
1444 * - "HDCP Type0": DRM_MODE_HDCP_CONTENT_TYPE0 = 0
1445 * - "HDCP Type1": DRM_MODE_HDCP_CONTENT_TYPE1 = 1
1480 * then kernel will disable the HDCP and re-enable with new type in the
1486 * Connector property to enable userspace to send HDR Metadata to
1491 * SDP packet (Non-audio INFOFRAME SDP v1.3) for DP. This is then
1509 * - Some layers are HDR and others are SDR
1510 * - HDR layers luminance is not same as sink
1531 * property to the connector during initialization.
1536 * Mode object ID of the &drm_crtc this connector should be connected to.
1553 * This property defines how a non-native mode is upscaled to the native
1573 * have a built-in scaler).
1576 * This property is used by DVI-I, TVout and DisplayPort to indicate different
1577 * connector subtypes. Enum values more or less match with those from main
1578 * connector types.
1579 * For DVI-I and TVout there is also a matching property "select subconnector"
1583 * privacy-screen sw-state, privacy-screen hw-state:
1589 * "privacy-screen hw-state" is read-only and reflects the actual state
1590 * of the privacy-screen, possible values: "Enabled", "Disabled,
1591 * "Enabled-locked", "Disabled-locked". The locked states indicate
1593 * might be devices where the firmware-setup options, or a hardware
1594 * slider-switch, offer always on / off modes.
1596 * "privacy-screen sw-state" can be set to change the privacy-screen state
1597 * when not locked. In this case the driver must update the hw-state
1599 * sw-state property. Setting the sw-state property when the hw-state is
1601 * state to the set state when the hw-state becomes unlocked. E.g. if
1602 * "privacy-screen hw-state" is "Enabled-locked" and the sw-state
1604 * changing the slider-switch position, then the driver must set the
1607 * In some cases the privacy-screen's actual state might change outside of
1611 * In this case the driver must update both the hw-state and the sw-state
1613 * sw-state. Any pending sw-state requests are thus discarded.
1617 * of the sw-state. Caching the sw-state value and including it in later
1620 * privacy-screen sw-state in an atomic commit unless it wants to change
1624 * Add margins to the connector's viewport. This is typically used to
1646 return -ENOMEM; in drm_connector_create_standard_properties()
1647 dev->mode_config.edid_property = prop; in drm_connector_create_standard_properties()
1653 return -ENOMEM; in drm_connector_create_standard_properties()
1654 dev->mode_config.dpms_property = prop; in drm_connector_create_standard_properties()
1661 return -ENOMEM; in drm_connector_create_standard_properties()
1662 dev->mode_config.path_property = prop; in drm_connector_create_standard_properties()
1669 return -ENOMEM; in drm_connector_create_standard_properties()
1670 dev->mode_config.tile_property = prop; in drm_connector_create_standard_properties()
1672 prop = drm_property_create_enum(dev, 0, "link-status", in drm_connector_create_standard_properties()
1676 return -ENOMEM; in drm_connector_create_standard_properties()
1677 dev->mode_config.link_status_property = prop; in drm_connector_create_standard_properties()
1679 prop = drm_property_create_bool(dev, DRM_MODE_PROP_IMMUTABLE, "non-desktop"); in drm_connector_create_standard_properties()
1681 return -ENOMEM; in drm_connector_create_standard_properties()
1682 dev->mode_config.non_desktop_property = prop; in drm_connector_create_standard_properties()
1687 return -ENOMEM; in drm_connector_create_standard_properties()
1688 dev->mode_config.hdr_output_metadata_property = prop; in drm_connector_create_standard_properties()
1694 * drm_mode_create_dvi_i_properties - create DVI-I specific connector properties
1697 * Called by a driver the first time a DVI-I connector is made.
1706 if (dev->mode_config.dvi_i_select_subconnector_property) in drm_mode_create_dvi_i_properties()
1714 dev->mode_config.dvi_i_select_subconnector_property = dvi_i_selector; in drm_mode_create_dvi_i_properties()
1720 dev->mode_config.dvi_i_subconnector_property = dvi_i_subconnector; in drm_mode_create_dvi_i_properties()
1727 * drm_connector_attach_dp_subconnector_property - create subconnector property for DP
1728 * @connector: drm_connector to attach property
1730 * Called by a driver when DP connector is created.
1732 void drm_connector_attach_dp_subconnector_property(struct drm_connector *connector) in drm_connector_attach_dp_subconnector_property() argument
1734 struct drm_mode_config *mode_config = &connector->dev->mode_config; in drm_connector_attach_dp_subconnector_property()
1736 if (!mode_config->dp_subconnector_property) in drm_connector_attach_dp_subconnector_property()
1737 mode_config->dp_subconnector_property = in drm_connector_attach_dp_subconnector_property()
1738 drm_property_create_enum(connector->dev, in drm_connector_attach_dp_subconnector_property()
1744 drm_object_attach_property(&connector->base, in drm_connector_attach_dp_subconnector_property()
1745 mode_config->dp_subconnector_property, in drm_connector_attach_dp_subconnector_property()
1751 * DOC: HDMI connector properties
1761 * The CRTC attached to the connector must be configured by user-space to
1762 * always produce full-range pixels.
1768 * mode according to the HDMI specifications (HDMI 1.4b - Section
1769 * 6.6 - Video Quantization Ranges).
1776 * this works for any number of bits-per-component.
1803 * The meaning of each content type is defined in CTA-861-G table 15.
1812 * - brightness
1813 * - contrast
1814 * - flicker reduction
1815 * - hue
1816 * - mode
1817 * - overscan
1818 * - saturation
1819 * - select subconnector
1822 * DOC: Analog TV Connector Properties
1825 * Indicates the TV Mode used on an analog TV connector. The value
1829 * TV Mode is CCIR System M (aka 525-lines) together with
1832 * NTSC-443:
1834 * TV Mode is CCIR System M (aka 525-lines) together with
1838 * NTSC-J:
1840 * TV Mode is CCIR System M (aka 525-lines) together with
1846 * TV Mode is CCIR System B (aka 625-lines) together with
1849 * PAL-M:
1851 * TV Mode is CCIR System M (aka 525-lines) together with
1854 * PAL-N:
1863 * TV Mode is CCIR System B (aka 625-lines) together with
1869 * equalizing pulses for a 525-line or 625-line mode,
1877 * drm_connector_attach_content_type_property - attach content-type property
1878 * @connector: connector to attach content type property on.
1880 * Called by a driver the first time a HDMI connector is made.
1884 int drm_connector_attach_content_type_property(struct drm_connector *connector) in drm_connector_attach_content_type_property() argument
1886 if (!drm_mode_create_content_type_property(connector->dev)) in drm_connector_attach_content_type_property()
1887 drm_object_attach_property(&connector->base, in drm_connector_attach_content_type_property()
1888 connector->dev->mode_config.content_type_property, in drm_connector_attach_content_type_property()
1895 * drm_connector_attach_tv_margin_properties - attach TV connector margin
1897 * @connector: DRM connector
1899 * Called by a driver when it needs to attach TV margin props to a connector.
1902 void drm_connector_attach_tv_margin_properties(struct drm_connector *connector) in drm_connector_attach_tv_margin_properties() argument
1904 struct drm_device *dev = connector->dev; in drm_connector_attach_tv_margin_properties()
1906 drm_object_attach_property(&connector->base, in drm_connector_attach_tv_margin_properties()
1907 dev->mode_config.tv_left_margin_property, in drm_connector_attach_tv_margin_properties()
1909 drm_object_attach_property(&connector->base, in drm_connector_attach_tv_margin_properties()
1910 dev->mode_config.tv_right_margin_property, in drm_connector_attach_tv_margin_properties()
1912 drm_object_attach_property(&connector->base, in drm_connector_attach_tv_margin_properties()
1913 dev->mode_config.tv_top_margin_property, in drm_connector_attach_tv_margin_properties()
1915 drm_object_attach_property(&connector->base, in drm_connector_attach_tv_margin_properties()
1916 dev->mode_config.tv_bottom_margin_property, in drm_connector_attach_tv_margin_properties()
1922 * drm_mode_create_tv_margin_properties - create TV connector margin properties
1925 * Called by a driver's HDMI connector initialization routine, this function
1927 * function for an SDTV connector, it's already called from
1935 if (dev->mode_config.tv_left_margin_property) in drm_mode_create_tv_margin_properties()
1938 dev->mode_config.tv_left_margin_property = in drm_mode_create_tv_margin_properties()
1940 if (!dev->mode_config.tv_left_margin_property) in drm_mode_create_tv_margin_properties()
1941 return -ENOMEM; in drm_mode_create_tv_margin_properties()
1943 dev->mode_config.tv_right_margin_property = in drm_mode_create_tv_margin_properties()
1945 if (!dev->mode_config.tv_right_margin_property) in drm_mode_create_tv_margin_properties()
1946 return -ENOMEM; in drm_mode_create_tv_margin_properties()
1948 dev->mode_config.tv_top_margin_property = in drm_mode_create_tv_margin_properties()
1950 if (!dev->mode_config.tv_top_margin_property) in drm_mode_create_tv_margin_properties()
1951 return -ENOMEM; in drm_mode_create_tv_margin_properties()
1953 dev->mode_config.tv_bottom_margin_property = in drm_mode_create_tv_margin_properties()
1955 if (!dev->mode_config.tv_bottom_margin_property) in drm_mode_create_tv_margin_properties()
1956 return -ENOMEM; in drm_mode_create_tv_margin_properties()
1963 * drm_mode_create_tv_properties_legacy - create TV specific connector properties
1969 * the TV specific connector properties for a given device. Caller is
1973 * NOTE: This functions registers the deprecated "mode" connector
1988 if (dev->mode_config.tv_select_subconnector_property) in drm_mode_create_tv_properties_legacy()
1992 * Basic connector properties in drm_mode_create_tv_properties_legacy()
2001 dev->mode_config.tv_select_subconnector_property = tv_selector; in drm_mode_create_tv_properties_legacy()
2010 dev->mode_config.tv_subconnector_property = tv_subconnector; in drm_mode_create_tv_properties_legacy()
2019 dev->mode_config.legacy_tv_mode_property = in drm_mode_create_tv_properties_legacy()
2022 if (!dev->mode_config.legacy_tv_mode_property) in drm_mode_create_tv_properties_legacy()
2026 drm_property_add_enum(dev->mode_config.legacy_tv_mode_property, in drm_mode_create_tv_properties_legacy()
2030 dev->mode_config.tv_brightness_property = in drm_mode_create_tv_properties_legacy()
2032 if (!dev->mode_config.tv_brightness_property) in drm_mode_create_tv_properties_legacy()
2035 dev->mode_config.tv_contrast_property = in drm_mode_create_tv_properties_legacy()
2037 if (!dev->mode_config.tv_contrast_property) in drm_mode_create_tv_properties_legacy()
2040 dev->mode_config.tv_flicker_reduction_property = in drm_mode_create_tv_properties_legacy()
2042 if (!dev->mode_config.tv_flicker_reduction_property) in drm_mode_create_tv_properties_legacy()
2045 dev->mode_config.tv_overscan_property = in drm_mode_create_tv_properties_legacy()
2047 if (!dev->mode_config.tv_overscan_property) in drm_mode_create_tv_properties_legacy()
2050 dev->mode_config.tv_saturation_property = in drm_mode_create_tv_properties_legacy()
2052 if (!dev->mode_config.tv_saturation_property) in drm_mode_create_tv_properties_legacy()
2055 dev->mode_config.tv_hue_property = in drm_mode_create_tv_properties_legacy()
2057 if (!dev->mode_config.tv_hue_property) in drm_mode_create_tv_properties_legacy()
2062 return -ENOMEM; in drm_mode_create_tv_properties_legacy()
2067 * drm_mode_create_tv_properties - create TV specific connector properties
2072 * the TV specific connector properties for a given device.
2084 if (dev->mode_config.tv_mode_property) in drm_mode_create_tv_properties()
2099 return -ENOMEM; in drm_mode_create_tv_properties()
2101 dev->mode_config.tv_mode_property = tv_mode; in drm_mode_create_tv_properties()
2108 * drm_mode_create_scaling_mode_property - create scaling mode property
2124 if (dev->mode_config.scaling_mode_property) in drm_mode_create_scaling_mode_property()
2132 dev->mode_config.scaling_mode_property = scaling_mode; in drm_mode_create_scaling_mode_property()
2186 * vertical front porch duration will be extended until page-flip or
2194 * from the minimum supported variable refresh rate for the connector.
2201 * drm_connector_attach_vrr_capable_property - creates the
2203 * @connector: connector to create the vrr_capable property on.
2206 * variable refresh rate capability for a connector.
2212 struct drm_connector *connector) in drm_connector_attach_vrr_capable_property() argument
2214 struct drm_device *dev = connector->dev; in drm_connector_attach_vrr_capable_property()
2217 if (!connector->vrr_capable_property) { in drm_connector_attach_vrr_capable_property()
2221 return -ENOMEM; in drm_connector_attach_vrr_capable_property()
2223 connector->vrr_capable_property = prop; in drm_connector_attach_vrr_capable_property()
2224 drm_object_attach_property(&connector->base, prop, 0); in drm_connector_attach_vrr_capable_property()
2232 * drm_connector_attach_scaling_mode_property - attach atomic scaling mode property
2233 * @connector: connector to attach scaling mode property on.
2238 * and can be used from &drm_connector_helper_funcs->atomic_check for validation.
2245 int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, in drm_connector_attach_scaling_mode_property() argument
2248 struct drm_device *dev = connector->dev; in drm_connector_attach_scaling_mode_property()
2252 (1U << ARRAY_SIZE(drm_scaling_mode_enum_list)) - 1; in drm_connector_attach_scaling_mode_property()
2256 return -EINVAL; in drm_connector_attach_scaling_mode_property()
2263 return -ENOMEM; in drm_connector_attach_scaling_mode_property()
2282 drm_object_attach_property(&connector->base, in drm_connector_attach_scaling_mode_property()
2285 connector->scaling_mode_property = scaling_mode_property; in drm_connector_attach_scaling_mode_property()
2292 * drm_mode_create_aspect_ratio_property - create aspect ratio property
2303 if (dev->mode_config.aspect_ratio_property) in drm_mode_create_aspect_ratio_property()
2306 dev->mode_config.aspect_ratio_property = in drm_mode_create_aspect_ratio_property()
2311 if (dev->mode_config.aspect_ratio_property == NULL) in drm_mode_create_aspect_ratio_property()
2312 return -ENOMEM; in drm_mode_create_aspect_ratio_property()
2319 * DOC: standard connector properties
2344 * The behavior is driver-specific.
2350 * RGB content with Rec. ITU-R BT.2020 colorimetry, Rec.
2351 * ITU-R BT.2020 (Table 4, RGB) transfer characteristics and full
2354 * transfer characteristics to PQ (Rec. ITU-R BT.2100 Table 4) or
2355 * HLG (Rec. ITU-R BT.2100 Table 5) in which case, user space
2359 * ITU-R BT.2020 R'G'B' and Rec. ITU-R BT.2020 Y'C'BC'R
2362 * sink to expect Rec. ITU-R BT.2020 R'G'B' colorimetry and convert
2365 * sink to expect Rec. ITU-R BT.2020 Y'C'BC'R colorimetry, convert
2366 * to YCbCr using the Rec. ITU-R BT.2020 non-constant luminance
2380 * DCI-P3_RGB_D65:
2381 * DCI-P3_RGB_Theater:
2389 * drm_mode_create_hdmi_colorspace_property() is used for HDMI connector and
2390 * drm_mode_create_dp_colorspace_property() is used for DP connector.
2393 static int drm_mode_create_colorspace_property(struct drm_connector *connector, in drm_mode_create_colorspace_property() argument
2396 struct drm_device *dev = connector->dev; in drm_mode_create_colorspace_property()
2401 if (connector->colorspace_property) in drm_mode_create_colorspace_property()
2405 drm_err(dev, "No supported colorspaces provded on [CONNECTOR:%d:%s]\n", in drm_mode_create_colorspace_property()
2406 connector->base.id, connector->name); in drm_mode_create_colorspace_property()
2407 return -EINVAL; in drm_mode_create_colorspace_property()
2410 if ((supported_colorspaces & -BIT(DRM_MODE_COLORIMETRY_COUNT)) != 0) { in drm_mode_create_colorspace_property()
2411 drm_err(dev, "Unknown colorspace provded on [CONNECTOR:%d:%s]\n", in drm_mode_create_colorspace_property()
2412 connector->base.id, connector->name); in drm_mode_create_colorspace_property()
2413 return -EINVAL; in drm_mode_create_colorspace_property()
2426 connector->colorspace_property = in drm_mode_create_colorspace_property()
2431 if (!connector->colorspace_property) in drm_mode_create_colorspace_property()
2432 return -ENOMEM; in drm_mode_create_colorspace_property()
2438 * drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property
2439 * @connector: connector to create the Colorspace property on.
2448 int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector, in drm_mode_create_hdmi_colorspace_property() argument
2458 return drm_mode_create_colorspace_property(connector, colorspaces); in drm_mode_create_hdmi_colorspace_property()
2463 * drm_mode_create_dp_colorspace_property - create dp colorspace property
2464 * @connector: connector to create the Colorspace property on.
2473 int drm_mode_create_dp_colorspace_property(struct drm_connector *connector, in drm_mode_create_dp_colorspace_property() argument
2483 return drm_mode_create_colorspace_property(connector, colorspaces); in drm_mode_create_dp_colorspace_property()
2488 * drm_mode_create_content_type_property - create content type property
2499 if (dev->mode_config.content_type_property) in drm_mode_create_content_type_property()
2502 dev->mode_config.content_type_property = in drm_mode_create_content_type_property()
2507 if (dev->mode_config.content_type_property == NULL) in drm_mode_create_content_type_property()
2508 return -ENOMEM; in drm_mode_create_content_type_property()
2515 * drm_mode_create_suggested_offset_properties - create suggests offset properties
2525 if (dev->mode_config.suggested_x_property && dev->mode_config.suggested_y_property) in drm_mode_create_suggested_offset_properties()
2528 dev->mode_config.suggested_x_property = in drm_mode_create_suggested_offset_properties()
2531 dev->mode_config.suggested_y_property = in drm_mode_create_suggested_offset_properties()
2534 if (dev->mode_config.suggested_x_property == NULL || in drm_mode_create_suggested_offset_properties()
2535 dev->mode_config.suggested_y_property == NULL) in drm_mode_create_suggested_offset_properties()
2536 return -ENOMEM; in drm_mode_create_suggested_offset_properties()
2542 * drm_connector_set_path_property - set tile property on connector
2543 * @connector: connector to set property on.
2547 * connector path. This is mainly used for DisplayPort MST where
2554 int drm_connector_set_path_property(struct drm_connector *connector, in drm_connector_set_path_property() argument
2557 struct drm_device *dev = connector->dev; in drm_connector_set_path_property()
2561 &connector->path_blob_ptr, in drm_connector_set_path_property()
2564 &connector->base, in drm_connector_set_path_property()
2565 dev->mode_config.path_property); in drm_connector_set_path_property()
2571 * drm_connector_set_tile_property - set tile property on connector
2572 * @connector: connector to set property on.
2574 * This looks up the tile information for a connector, and creates a
2583 int drm_connector_set_tile_property(struct drm_connector *connector) in drm_connector_set_tile_property() argument
2585 struct drm_device *dev = connector->dev; in drm_connector_set_tile_property()
2589 if (!connector->has_tile) { in drm_connector_set_tile_property()
2591 &connector->tile_blob_ptr, in drm_connector_set_tile_property()
2594 &connector->base, in drm_connector_set_tile_property()
2595 dev->mode_config.tile_property); in drm_connector_set_tile_property()
2600 connector->tile_group->id, connector->tile_is_single_monitor, in drm_connector_set_tile_property()
2601 connector->num_h_tile, connector->num_v_tile, in drm_connector_set_tile_property()
2602 connector->tile_h_loc, connector->tile_v_loc, in drm_connector_set_tile_property()
2603 connector->tile_h_size, connector->tile_v_size); in drm_connector_set_tile_property()
2606 &connector->tile_blob_ptr, in drm_connector_set_tile_property()
2609 &connector->base, in drm_connector_set_tile_property()
2610 dev->mode_config.tile_property); in drm_connector_set_tile_property()
2616 * drm_connector_set_link_status_property - Set link status property of a connector
2617 * @connector: drm connector
2623 * hotplug uevent for userspace to re-check the valid modes through
2628 * re-training a link) without userspace's intervention.
2634 void drm_connector_set_link_status_property(struct drm_connector *connector, in drm_connector_set_link_status_property() argument
2637 struct drm_device *dev = connector->dev; in drm_connector_set_link_status_property()
2639 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); in drm_connector_set_link_status_property()
2640 connector->state->link_status = link_status; in drm_connector_set_link_status_property()
2641 drm_modeset_unlock(&dev->mode_config.connection_mutex); in drm_connector_set_link_status_property()
2646 * drm_connector_attach_max_bpc_property - attach "max bpc" property
2647 * @connector: connector to attach max bpc property on.
2648 * @min: The minimum bit depth supported by the connector.
2649 * @max: The maximum bit depth supported by the connector.
2651 * This is used to add support for limiting the bit depth on a connector.
2656 int drm_connector_attach_max_bpc_property(struct drm_connector *connector, in drm_connector_attach_max_bpc_property() argument
2659 struct drm_device *dev = connector->dev; in drm_connector_attach_max_bpc_property()
2662 prop = connector->max_bpc_property; in drm_connector_attach_max_bpc_property()
2666 return -ENOMEM; in drm_connector_attach_max_bpc_property()
2668 connector->max_bpc_property = prop; in drm_connector_attach_max_bpc_property()
2671 drm_object_attach_property(&connector->base, prop, max); in drm_connector_attach_max_bpc_property()
2672 connector->state->max_requested_bpc = max; in drm_connector_attach_max_bpc_property()
2673 connector->state->max_bpc = max; in drm_connector_attach_max_bpc_property()
2680 * drm_connector_attach_hdr_output_metadata_property - attach "HDR_OUTPUT_METADA" property
2681 * @connector: connector to attach the property on.
2689 int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector) in drm_connector_attach_hdr_output_metadata_property() argument
2691 struct drm_device *dev = connector->dev; in drm_connector_attach_hdr_output_metadata_property()
2692 struct drm_property *prop = dev->mode_config.hdr_output_metadata_property; in drm_connector_attach_hdr_output_metadata_property()
2694 drm_object_attach_property(&connector->base, prop, 0); in drm_connector_attach_hdr_output_metadata_property()
2701 * drm_connector_attach_broadcast_rgb_property - attach "Broadcast RGB" property
2702 * @connector: connector to attach the property on.
2704 * This is used to add support for forcing the RGB range on a connector
2709 int drm_connector_attach_broadcast_rgb_property(struct drm_connector *connector) in drm_connector_attach_broadcast_rgb_property() argument
2711 struct drm_device *dev = connector->dev; in drm_connector_attach_broadcast_rgb_property()
2714 prop = connector->broadcast_rgb_property; in drm_connector_attach_broadcast_rgb_property()
2721 return -EINVAL; in drm_connector_attach_broadcast_rgb_property()
2723 connector->broadcast_rgb_property = prop; in drm_connector_attach_broadcast_rgb_property()
2726 drm_object_attach_property(&connector->base, prop, in drm_connector_attach_broadcast_rgb_property()
2734 * drm_connector_attach_colorspace_property - attach "Colorspace" property
2735 * @connector: connector to attach the property on.
2743 int drm_connector_attach_colorspace_property(struct drm_connector *connector) in drm_connector_attach_colorspace_property() argument
2745 struct drm_property *prop = connector->colorspace_property; in drm_connector_attach_colorspace_property()
2747 drm_object_attach_property(&connector->base, prop, DRM_MODE_COLORIMETRY_DEFAULT); in drm_connector_attach_colorspace_property()
2754 * drm_connector_atomic_hdr_metadata_equal - checks if the hdr metadata changed
2755 * @old_state: old connector state to compare
2756 * @new_state: new connector state to compare
2758 * This is used by HDR-enabled drivers to test whether the HDR metadata
2759 * have changed between two different connector state (and thus probably
2768 struct drm_property_blob *old_blob = old_state->hdr_output_metadata; in drm_connector_atomic_hdr_metadata_equal()
2769 struct drm_property_blob *new_blob = new_state->hdr_output_metadata; in drm_connector_atomic_hdr_metadata_equal()
2774 if (old_blob->length != new_blob->length) in drm_connector_atomic_hdr_metadata_equal()
2777 return !memcmp(old_blob->data, new_blob->data, old_blob->length); in drm_connector_atomic_hdr_metadata_equal()
2782 * drm_connector_set_vrr_capable_property - sets the variable refresh rate
2783 * capable property for a connector
2784 * @connector: drm connector
2785 * @capable: True if the connector is variable refresh rate capable
2788 * variable refresh rate over a connector.
2791 struct drm_connector *connector, bool capable) in drm_connector_set_vrr_capable_property() argument
2793 if (!connector->vrr_capable_property) in drm_connector_set_vrr_capable_property()
2796 drm_object_property_set_value(&connector->base, in drm_connector_set_vrr_capable_property()
2797 connector->vrr_capable_property, in drm_connector_set_vrr_capable_property()
2803 * drm_connector_set_panel_orientation - sets the connector's panel_orientation
2804 * @connector: connector for which to set the panel-orientation property.
2807 * This function sets the connector's panel_orientation and attaches
2808 * a "panel orientation" property to the connector.
2810 * Calling this function on a connector where the panel_orientation has
2811 * already been set is a no-op (e.g. the orientation has been overridden with
2815 * DRM_MODE_PANEL_ORIENTATION_UNKNOWN, in which case it is a no-op.
2824 struct drm_connector *connector, in drm_connector_set_panel_orientation() argument
2827 struct drm_device *dev = connector->dev; in drm_connector_set_panel_orientation()
2828 struct drm_display_info *info = &connector->display_info; in drm_connector_set_panel_orientation()
2832 if (info->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) in drm_connector_set_panel_orientation()
2839 info->panel_orientation = panel_orientation; in drm_connector_set_panel_orientation()
2841 prop = dev->mode_config.panel_orientation_property; in drm_connector_set_panel_orientation()
2848 return -ENOMEM; in drm_connector_set_panel_orientation()
2850 dev->mode_config.panel_orientation_property = prop; in drm_connector_set_panel_orientation()
2853 drm_object_attach_property(&connector->base, prop, in drm_connector_set_panel_orientation()
2854 info->panel_orientation); in drm_connector_set_panel_orientation()
2860 * drm_connector_set_panel_orientation_with_quirk - set the
2861 * connector's panel_orientation after checking for quirks
2862 * @connector: connector for which to init the panel-orientation property.
2874 struct drm_connector *connector, in drm_connector_set_panel_orientation_with_quirk() argument
2884 return drm_connector_set_panel_orientation(connector, in drm_connector_set_panel_orientation_with_quirk()
2890 * drm_connector_set_orientation_from_panel -
2891 * set the connector's panel_orientation from panel's callback.
2892 * @connector: connector for which to init the panel-orientation property.
2902 struct drm_connector *connector, in drm_connector_set_orientation_from_panel() argument
2907 if (panel && panel->funcs && panel->funcs->get_orientation) in drm_connector_set_orientation_from_panel()
2908 orientation = panel->funcs->get_orientation(panel); in drm_connector_set_orientation_from_panel()
2912 return drm_connector_set_panel_orientation(connector, orientation); in drm_connector_set_orientation_from_panel()
2919 { PRIVACY_SCREEN_DISABLED_LOCKED, "Disabled-locked" },
2920 { PRIVACY_SCREEN_ENABLED_LOCKED, "Enabled-locked" },
2924 * drm_connector_create_privacy_screen_properties - create the drm connecter's
2925 * privacy-screen properties.
2926 * @connector: connector for which to create the privacy-screen properties
2928 * This function creates the "privacy-screen sw-state" and "privacy-screen
2929 * hw-state" properties for the connector. They are not attached.
2932 drm_connector_create_privacy_screen_properties(struct drm_connector *connector) in drm_connector_create_privacy_screen_properties() argument
2934 if (connector->privacy_screen_sw_state_property) in drm_connector_create_privacy_screen_properties()
2937 /* Note sw-state only supports the first 2 values of the enum */ in drm_connector_create_privacy_screen_properties()
2938 connector->privacy_screen_sw_state_property = in drm_connector_create_privacy_screen_properties()
2939 drm_property_create_enum(connector->dev, DRM_MODE_PROP_ENUM, in drm_connector_create_privacy_screen_properties()
2940 "privacy-screen sw-state", in drm_connector_create_privacy_screen_properties()
2943 connector->privacy_screen_hw_state_property = in drm_connector_create_privacy_screen_properties()
2944 drm_property_create_enum(connector->dev, in drm_connector_create_privacy_screen_properties()
2946 "privacy-screen hw-state", in drm_connector_create_privacy_screen_properties()
2953 * drm_connector_attach_privacy_screen_properties - attach the drm connecter's
2954 * privacy-screen properties.
2955 * @connector: connector on which to attach the privacy-screen properties
2957 * This function attaches the "privacy-screen sw-state" and "privacy-screen
2958 * hw-state" properties to the connector. The initial state of both is set
2962 drm_connector_attach_privacy_screen_properties(struct drm_connector *connector) in drm_connector_attach_privacy_screen_properties() argument
2964 if (!connector->privacy_screen_sw_state_property) in drm_connector_attach_privacy_screen_properties()
2967 drm_object_attach_property(&connector->base, in drm_connector_attach_privacy_screen_properties()
2968 connector->privacy_screen_sw_state_property, in drm_connector_attach_privacy_screen_properties()
2971 drm_object_attach_property(&connector->base, in drm_connector_attach_privacy_screen_properties()
2972 connector->privacy_screen_hw_state_property, in drm_connector_attach_privacy_screen_properties()
2978 struct drm_connector *connector, bool set_sw_state) in drm_connector_update_privacy_screen_properties() argument
2982 drm_privacy_screen_get_state(connector->privacy_screen, in drm_connector_update_privacy_screen_properties()
2986 connector->state->privacy_screen_sw_state = sw_state; in drm_connector_update_privacy_screen_properties()
2987 drm_object_property_set_value(&connector->base, in drm_connector_update_privacy_screen_properties()
2988 connector->privacy_screen_hw_state_property, hw_state); in drm_connector_update_privacy_screen_properties()
2994 struct drm_connector *connector = in drm_connector_privacy_screen_notifier() local
2996 struct drm_device *dev = connector->dev; in drm_connector_privacy_screen_notifier()
2998 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); in drm_connector_privacy_screen_notifier()
2999 drm_connector_update_privacy_screen_properties(connector, true); in drm_connector_privacy_screen_notifier()
3000 drm_modeset_unlock(&dev->mode_config.connection_mutex); in drm_connector_privacy_screen_notifier()
3002 drm_sysfs_connector_property_event(connector, in drm_connector_privacy_screen_notifier()
3003 connector->privacy_screen_sw_state_property); in drm_connector_privacy_screen_notifier()
3004 drm_sysfs_connector_property_event(connector, in drm_connector_privacy_screen_notifier()
3005 connector->privacy_screen_hw_state_property); in drm_connector_privacy_screen_notifier()
3011 * drm_connector_attach_privacy_screen_provider - attach a privacy-screen to
3012 * the connector
3013 * @connector: connector to attach the privacy-screen to
3016 * Create and attach the standard privacy-screen properties and register
3017 * a generic notifier for generating sysfs-connector-status-events
3018 * on external changes to the privacy-screen status.
3020 * call drm_privacy_screen_put() on it when the connector is destroyed.
3023 struct drm_connector *connector, struct drm_privacy_screen *priv) in drm_connector_attach_privacy_screen_provider() argument
3025 connector->privacy_screen = priv; in drm_connector_attach_privacy_screen_provider()
3026 connector->privacy_screen_notifier.notifier_call = in drm_connector_attach_privacy_screen_provider()
3029 drm_connector_create_privacy_screen_properties(connector); in drm_connector_attach_privacy_screen_provider()
3030 drm_connector_update_privacy_screen_properties(connector, true); in drm_connector_attach_privacy_screen_provider()
3031 drm_connector_attach_privacy_screen_properties(connector); in drm_connector_attach_privacy_screen_provider()
3036 * drm_connector_update_privacy_screen - update connector's privacy-screen sw-state
3037 * @connector_state: connector-state to update the privacy-screen for
3039 * This function calls drm_privacy_screen_set_sw_state() on the connector's
3040 * privacy-screen.
3042 * If the connector has no privacy-screen, then this is a no-op.
3046 struct drm_connector *connector = connector_state->connector; in drm_connector_update_privacy_screen() local
3049 if (!connector->privacy_screen) in drm_connector_update_privacy_screen()
3052 ret = drm_privacy_screen_set_sw_state(connector->privacy_screen, in drm_connector_update_privacy_screen()
3053 connector_state->privacy_screen_sw_state); in drm_connector_update_privacy_screen()
3055 drm_err(connector->dev, "Error updating privacy-screen sw_state\n"); in drm_connector_update_privacy_screen()
3060 drm_connector_update_privacy_screen_properties(connector, false); in drm_connector_update_privacy_screen()
3068 int ret = -EINVAL; in drm_connector_set_obj_prop()
3069 struct drm_connector *connector = obj_to_connector(obj); in drm_connector_set_obj_prop() local
3072 if (property == connector->dev->mode_config.dpms_property) { in drm_connector_set_obj_prop()
3073 ret = (*connector->funcs->dpms)(connector, (int)value); in drm_connector_set_obj_prop()
3074 } else if (connector->funcs->set_property) in drm_connector_set_obj_prop()
3075 ret = connector->funcs->set_property(connector, property, value); in drm_connector_set_obj_prop()
3078 drm_object_property_set_value(&connector->base, property, value); in drm_connector_set_obj_prop()
3087 .value = conn_set_prop->value, in drm_connector_property_set_ioctl()
3088 .prop_id = conn_set_prop->prop_id, in drm_connector_property_set_ioctl()
3089 .obj_id = conn_set_prop->connector_id, in drm_connector_property_set_ioctl()
3097 static struct drm_encoder *drm_connector_get_encoder(struct drm_connector *connector) in drm_connector_get_encoder() argument
3102 if (connector->state) in drm_connector_get_encoder()
3103 return connector->state->best_encoder; in drm_connector_get_encoder()
3104 return connector->encoder; in drm_connector_get_encoder()
3113 * If user-space hasn't configured the driver to expose the stereo 3D in drm_mode_expose_to_userspace()
3116 if (!file_priv->stereo_allowed && drm_mode_is_stereo(mode)) in drm_mode_expose_to_userspace()
3119 * If user-space hasn't configured the driver to expose the modes in drm_mode_expose_to_userspace()
3120 * with aspect-ratio, don't expose them. However if such a mode in drm_mode_expose_to_userspace()
3121 * is unique, let it be exposed, but reset the aspect-ratio flags in drm_mode_expose_to_userspace()
3122 * while preparing the list of user-modes. in drm_mode_expose_to_userspace()
3124 if (!file_priv->aspect_ratio_allowed) { in drm_mode_expose_to_userspace()
3128 if (mode_itr->expose_to_userspace && in drm_mode_expose_to_userspace()
3145 struct drm_connector *connector; in drm_mode_getconnector() local
3158 return -EOPNOTSUPP; in drm_mode_getconnector()
3162 connector = drm_connector_lookup(dev, file_priv, out_resp->connector_id); in drm_mode_getconnector()
3163 if (!connector) in drm_mode_getconnector()
3164 return -ENOENT; in drm_mode_getconnector()
3166 encoders_count = hweight32(connector->possible_encoders); in drm_mode_getconnector()
3168 if ((out_resp->count_encoders >= encoders_count) && encoders_count) { in drm_mode_getconnector()
3170 encoder_ptr = (uint32_t __user *)(unsigned long)(out_resp->encoders_ptr); in drm_mode_getconnector()
3172 drm_connector_for_each_possible_encoder(connector, encoder) { in drm_mode_getconnector()
3173 if (put_user(encoder->base.id, encoder_ptr + copied)) { in drm_mode_getconnector()
3174 ret = -EFAULT; in drm_mode_getconnector()
3180 out_resp->count_encoders = encoders_count; in drm_mode_getconnector()
3182 out_resp->connector_id = connector->base.id; in drm_mode_getconnector()
3183 out_resp->connector_type = connector->connector_type; in drm_mode_getconnector()
3184 out_resp->connector_type_id = connector->connector_type_id; in drm_mode_getconnector()
3188 mutex_lock(&dev->mode_config.mutex); in drm_mode_getconnector()
3189 if (out_resp->count_modes == 0) { in drm_mode_getconnector()
3191 connector->funcs->fill_modes(connector, in drm_mode_getconnector()
3192 dev->mode_config.max_width, in drm_mode_getconnector()
3193 dev->mode_config.max_height); in drm_mode_getconnector()
3195 …drm_dbg_kms(dev, "User-space requested a forced probe on [CONNECTOR:%d:%s] but is not the DRM mast… in drm_mode_getconnector()
3196 connector->base.id, connector->name); in drm_mode_getconnector()
3199 out_resp->mm_width = connector->display_info.width_mm; in drm_mode_getconnector()
3200 out_resp->mm_height = connector->display_info.height_mm; in drm_mode_getconnector()
3201 out_resp->subpixel = connector->display_info.subpixel_order; in drm_mode_getconnector()
3202 out_resp->connection = connector->status; in drm_mode_getconnector()
3204 /* delayed so we get modes regardless of pre-fill_modes state */ in drm_mode_getconnector()
3205 list_for_each_entry(mode, &connector->modes, head) { in drm_mode_getconnector()
3206 WARN_ON(mode->expose_to_userspace); in drm_mode_getconnector()
3208 if (drm_mode_expose_to_userspace(mode, &connector->modes, in drm_mode_getconnector()
3210 mode->expose_to_userspace = true; in drm_mode_getconnector()
3219 if ((out_resp->count_modes >= mode_count) && mode_count) { in drm_mode_getconnector()
3221 mode_ptr = (struct drm_mode_modeinfo __user *)(unsigned long)out_resp->modes_ptr; in drm_mode_getconnector()
3222 list_for_each_entry(mode, &connector->modes, head) { in drm_mode_getconnector()
3223 if (!mode->expose_to_userspace) in drm_mode_getconnector()
3227 mode->expose_to_userspace = false; in drm_mode_getconnector()
3231 * Reset aspect ratio flags of user-mode, if modes with in drm_mode_getconnector()
3232 * aspect-ratio are not supported. in drm_mode_getconnector()
3234 if (!file_priv->aspect_ratio_allowed) in drm_mode_getconnector()
3238 ret = -EFAULT; in drm_mode_getconnector()
3244 list_for_each_entry_continue(mode, &connector->modes, head) in drm_mode_getconnector()
3245 mode->expose_to_userspace = false; in drm_mode_getconnector()
3247 mutex_unlock(&dev->mode_config.mutex); in drm_mode_getconnector()
3255 list_for_each_entry(mode, &connector->modes, head) in drm_mode_getconnector()
3256 mode->expose_to_userspace = false; in drm_mode_getconnector()
3259 out_resp->count_modes = mode_count; in drm_mode_getconnector()
3260 mutex_unlock(&dev->mode_config.mutex); in drm_mode_getconnector()
3262 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); in drm_mode_getconnector()
3263 encoder = drm_connector_get_encoder(connector); in drm_mode_getconnector()
3265 out_resp->encoder_id = encoder->base.id; in drm_mode_getconnector()
3267 out_resp->encoder_id = 0; in drm_mode_getconnector()
3272 ret = drm_mode_object_get_properties(&connector->base, file_priv->atomic, in drm_mode_getconnector()
3273 (uint32_t __user *)(unsigned long)(out_resp->props_ptr), in drm_mode_getconnector()
3274 (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr), in drm_mode_getconnector()
3275 &out_resp->count_props); in drm_mode_getconnector()
3276 drm_modeset_unlock(&dev->mode_config.connection_mutex); in drm_mode_getconnector()
3279 drm_connector_put(connector); in drm_mode_getconnector()
3285 * drm_connector_find_by_fwnode - Find a connector based on the associated fwnode
3289 * a connector is found a reference to the connector is returned. The caller must
3291 * connector.
3293 * Returns: A reference to the found connector or an ERR_PTR().
3297 struct drm_connector *connector, *found = ERR_PTR(-ENODEV); in drm_connector_find_by_fwnode() local
3300 return ERR_PTR(-ENODEV); in drm_connector_find_by_fwnode()
3304 list_for_each_entry(connector, &connector_list, global_connector_list_entry) { in drm_connector_find_by_fwnode()
3305 if (connector->fwnode == fwnode || in drm_connector_find_by_fwnode()
3306 (connector->fwnode && connector->fwnode->secondary == fwnode)) { in drm_connector_find_by_fwnode()
3307 drm_connector_get(connector); in drm_connector_find_by_fwnode()
3308 found = connector; in drm_connector_find_by_fwnode()
3319 * drm_connector_oob_hotplug_event - Report out-of-band hotplug event to connector
3324 * driver / device. An example of this is some USB Type-C setups where the hardware
3325 * muxes the DisplayPort data and aux-lines but does not pass the altmode HPD
3328 * This function can be used to report these out-of-band events after obtaining
3334 struct drm_connector *connector; in drm_connector_oob_hotplug_event() local
3336 connector = drm_connector_find_by_fwnode(connector_fwnode); in drm_connector_oob_hotplug_event()
3337 if (IS_ERR(connector)) in drm_connector_oob_hotplug_event()
3340 if (connector->funcs->oob_hotplug_event) in drm_connector_oob_hotplug_event()
3341 connector->funcs->oob_hotplug_event(connector, status); in drm_connector_oob_hotplug_event()
3343 drm_connector_put(connector); in drm_connector_oob_hotplug_event()
3352 * identifier. Tiled monitors using DisplayID v1.3 have a unique 8-byte handle,
3357 * the tile group information is exposed through a non-standard way.
3363 struct drm_device *dev = tg->dev; in drm_tile_group_free()
3365 mutex_lock(&dev->mode_config.idr_mutex); in drm_tile_group_free()
3366 idr_remove(&dev->mode_config.tile_idr, tg->id); in drm_tile_group_free()
3367 mutex_unlock(&dev->mode_config.idr_mutex); in drm_tile_group_free()
3372 * drm_mode_put_tile_group - drop a reference to a tile group.
3381 kref_put(&tg->refcount, drm_tile_group_free); in drm_mode_put_tile_group()
3386 * drm_mode_get_tile_group - get a reference to an existing tile group
3388 * @topology: 8-bytes unique per monitor.
3401 mutex_lock(&dev->mode_config.idr_mutex); in drm_mode_get_tile_group()
3402 idr_for_each_entry(&dev->mode_config.tile_idr, tg, id) { in drm_mode_get_tile_group()
3403 if (!memcmp(tg->group_data, topology, 8)) { in drm_mode_get_tile_group()
3404 if (!kref_get_unless_zero(&tg->refcount)) in drm_mode_get_tile_group()
3406 mutex_unlock(&dev->mode_config.idr_mutex); in drm_mode_get_tile_group()
3410 mutex_unlock(&dev->mode_config.idr_mutex); in drm_mode_get_tile_group()
3416 * drm_mode_create_tile_group - create a tile group from a displayid description
3418 * @topology: 8-bytes unique per monitor.
3436 kref_init(&tg->refcount); in drm_mode_create_tile_group()
3437 memcpy(tg->group_data, topology, 8); in drm_mode_create_tile_group()
3438 tg->dev = dev; in drm_mode_create_tile_group()
3440 mutex_lock(&dev->mode_config.idr_mutex); in drm_mode_create_tile_group()
3441 ret = idr_alloc(&dev->mode_config.tile_idr, tg, 1, 0, GFP_KERNEL); in drm_mode_create_tile_group()
3443 tg->id = ret; in drm_mode_create_tile_group()
3449 mutex_unlock(&dev->mode_config.idr_mutex); in drm_mode_create_tile_group()