Lines Matching defs:connector

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
75 * Global connector list for drm_connector_find_by_fwnode().
76 * Note drm_connector_[un]register() first take connector->lock and then
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.
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)
158 struct drm_cmdline_mode *mode = &connector->cmdline_mode;
161 option = video_get_options(connector->name);
166 connector,
171 DRM_INFO("forcing %s connector %s\n", connector->name,
173 connector->force = mode->force;
177 DRM_INFO("cmdline forces connector %s panel_orientation to %d\n",
178 connector->name, mode->panel_orientation);
179 drm_connector_set_panel_orientation(connector,
183 DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
184 connector->name, mode->name,
194 struct drm_connector *connector =
196 struct drm_device *dev = connector->dev;
198 drm_mode_object_unregister(dev, &connector->base);
199 connector->funcs->destroy(connector);
204 struct drm_connector *connector, *n;
215 llist_for_each_entry_safe(connector, n, freed, free_node) {
216 drm_mode_object_unregister(dev, &connector->base);
217 connector->funcs->destroy(connector);
222 struct drm_connector *connector,
236 ret = __drm_mode_object_add(dev, &connector->base,
242 connector->base.properties = &connector->properties;
243 connector->dev = dev;
244 connector->funcs = funcs;
246 /* connector index is used with 32bit bitmasks */
249 DRM_DEBUG_KMS("Failed to allocate %s connector index: %d\n",
254 connector->index = ret;
257 connector->connector_type = connector_type;
258 connector->connector_type_id =
260 if (connector->connector_type_id < 0) {
261 ret = connector->connector_type_id;
264 connector->name =
267 connector->connector_type_id);
268 if (!connector->name) {
274 connector->ddc = ddc;
276 INIT_LIST_HEAD(&connector->global_connector_list_entry);
277 INIT_LIST_HEAD(&connector->probed_modes);
278 INIT_LIST_HEAD(&connector->modes);
279 mutex_init(&connector->mutex);
280 mutex_init(&connector->edid_override_mutex);
281 connector->edid_blob_ptr = NULL;
282 connector->epoch_counter = 0;
283 connector->tile_blob_ptr = NULL;
284 connector->status = connector_status_unknown;
285 connector->display_info.panel_orientation =
288 drm_connector_get_cmdline_mode(connector);
290 /* We should add connectors at the end to avoid upsetting the connector
294 list_add_tail(&connector->head, &config->connector_list);
300 drm_connector_attach_edid_property(connector);
302 drm_object_attach_property(&connector->base,
305 drm_object_attach_property(&connector->base,
309 drm_object_attach_property(&connector->base,
312 drm_object_attach_property(&connector->base,
317 drm_object_attach_property(&connector->base, config->prop_crtc_id, 0);
320 connector->debugfs_entry = NULL;
323 ida_free(connector_ida, connector->connector_type_id);
326 ida_free(&config->connector_ida, connector->index);
329 drm_mode_object_unregister(dev, &connector->base);
335 * drm_connector_init - Init a preallocated connector
337 * @connector: the connector to init
338 * @funcs: callbacks for this connector
339 * @connector_type: user visible type of the connector
341 * Initialises a preallocated connector. Connectors should be
342 * subclassed as part of driver connector objects.
345 * should call drm_connector_cleanup() and free the connector structure.
346 * The connector structure should not be allocated with devm_kzalloc().
356 struct drm_connector *connector,
363 return __drm_connector_init(dev, connector, funcs, connector_type, NULL);
368 * drm_connector_init_with_ddc - Init a preallocated connector
370 * @connector: the connector to init
371 * @funcs: callbacks for this connector
372 * @connector_type: user visible type of the connector
375 * Initialises a preallocated connector. Connectors should be
376 * subclassed as part of driver connector objects.
379 * should call drm_connector_cleanup() and free the connector structure.
380 * The connector structure should not be allocated with devm_kzalloc().
382 * Ensures that the ddc field of the connector is correctly set.
392 struct drm_connector *connector,
400 return __drm_connector_init(dev, connector, funcs, connector_type, ddc);
407 struct drm_connector *connector = ptr;
409 drm_connector_cleanup(connector);
413 * drmm_connector_init - Init a preallocated connector
415 * @connector: the connector to init
416 * @funcs: callbacks for this connector
417 * @connector_type: user visible type of the connector
420 * Initialises a preallocated connector. Connectors should be
421 * subclassed as part of driver connector objects.
426 * The connector structure should be allocated with drmm_kzalloc().
432 struct drm_connector *connector,
442 ret = __drm_connector_init(dev, connector, funcs, connector_type, ddc);
447 connector);
457 * @connector: the connector
459 * Some connector types like DRM_MODE_CONNECTOR_VIRTUAL do not get a
463 void drm_connector_attach_edid_property(struct drm_connector *connector)
465 struct drm_mode_config *config = &connector->dev->mode_config;
467 drm_object_attach_property(&connector->base,
474 * drm_connector_attach_encoder - attach a connector to an encoder
475 * @connector: connector to attach
476 * @encoder: encoder to attach @connector to
478 * This function links up a connector to an encoder. Note that the routing
485 int drm_connector_attach_encoder(struct drm_connector *connector,
490 * of connector to encoder in simple connector/encoder devices using a
491 * direct assignment of connector->encoder = encoder. This connection
499 if (WARN_ON(connector->encoder))
502 connector->possible_encoders |= drm_encoder_mask(encoder);
509 * drm_connector_has_possible_encoder - check if the connector and encoder are
511 * @connector: the connector
515 * True if @encoder is one of the possible encoders for @connector.
517 bool drm_connector_has_possible_encoder(struct drm_connector *connector,
520 return connector->possible_encoders & drm_encoder_mask(encoder);
524 static void drm_mode_remove(struct drm_connector *connector,
528 drm_mode_destroy(connector->dev, mode);
532 * drm_connector_cleanup - cleans up an initialised connector
533 * @connector: connector to cleanup
535 * Cleans up the connector but doesn't free the object.
537 void drm_connector_cleanup(struct drm_connector *connector)
539 struct drm_device *dev = connector->dev;
542 /* The connector should have been removed from userspace long before
545 if (WARN_ON(connector->registration_state ==
547 drm_connector_unregister(connector);
549 if (connector->privacy_screen) {
550 drm_privacy_screen_put(connector->privacy_screen);
551 connector->privacy_screen = NULL;
554 if (connector->tile_group) {
555 drm_mode_put_tile_group(dev, connector->tile_group);
556 connector->tile_group = NULL;
559 list_for_each_entry_safe(mode, t, &connector->probed_modes, head)
560 drm_mode_remove(connector, mode);
562 list_for_each_entry_safe(mode, t, &connector->modes, head)
563 drm_mode_remove(connector, mode);
565 ida_free(&drm_connector_enum_list[connector->connector_type].ida,
566 connector->connector_type_id);
568 ida_free(&dev->mode_config.connector_ida, connector->index);
570 kfree(connector->display_info.bus_formats);
571 kfree(connector->display_info.vics);
572 drm_mode_object_unregister(dev, &connector->base);
573 kfree(connector->name);
574 connector->name = NULL;
575 fwnode_handle_put(connector->fwnode);
576 connector->fwnode = NULL;
578 list_del(&connector->head);
582 WARN_ON(connector->state && !connector->funcs->atomic_destroy_state);
583 if (connector->state && connector->funcs->atomic_destroy_state)
584 connector->funcs->atomic_destroy_state(connector,
585 connector->state);
587 mutex_destroy(&connector->mutex);
589 memset(connector, 0, sizeof(*connector));
597 * drm_connector_register - register a connector
598 * @connector: the connector to register
600 * Register userspace interfaces for a connector. Only call this for connectors
605 * When the connector is no longer available, callers must call
611 int drm_connector_register(struct drm_connector *connector)
615 if (!connector->dev->registered)
618 mutex_lock(&connector->mutex);
619 if (connector->registration_state != DRM_CONNECTOR_INITIALIZING)
622 ret = drm_sysfs_connector_add(connector);
626 drm_debugfs_connector_add(connector);
628 if (connector->funcs->late_register) {
629 ret = connector->funcs->late_register(connector);
634 drm_mode_object_register(connector->dev, &connector->base);
636 connector->registration_state = DRM_CONNECTOR_REGISTERED;
638 /* Let userspace know we have a new connector */
639 drm_sysfs_connector_hotplug_event(connector);
641 if (connector->privacy_screen)
642 drm_privacy_screen_register_notifier(connector->privacy_screen,
643 &connector->privacy_screen_notifier);
646 list_add_tail(&connector->global_connector_list_entry, &connector_list);
651 drm_debugfs_connector_remove(connector);
652 drm_sysfs_connector_remove(connector);
654 mutex_unlock(&connector->mutex);
660 * drm_connector_unregister - unregister a connector
661 * @connector: the connector to unregister
663 * Unregister userspace interfaces for a connector. Only call this for
667 void drm_connector_unregister(struct drm_connector *connector)
669 mutex_lock(&connector->mutex);
670 if (connector->registration_state != DRM_CONNECTOR_REGISTERED) {
671 mutex_unlock(&connector->mutex);
676 list_del_init(&connector->global_connector_list_entry);
679 if (connector->privacy_screen)
681 connector->privacy_screen,
682 &connector->privacy_screen_notifier);
684 if (connector->funcs->early_unregister)
685 connector->funcs->early_unregister(connector);
687 drm_sysfs_connector_remove(connector);
688 drm_debugfs_connector_remove(connector);
690 connector->registration_state = DRM_CONNECTOR_UNREGISTERED;
691 mutex_unlock(&connector->mutex);
697 struct drm_connector *connector;
701 drm_for_each_connector_iter(connector, &conn_iter)
702 drm_connector_unregister(connector);
708 struct drm_connector *connector;
713 drm_for_each_connector_iter(connector, &conn_iter) {
714 ret = drm_connector_register(connector);
726 * drm_get_connector_status_name - return a string for connector status
727 * @status: connector status to compute name of
732 * Returns: connector status string
746 * drm_get_connector_force_name - return a string for connector force
747 * @force: connector force to get name of
793 * Extra-safe connector put function that works in any context. Should only be
795 * actually release the connector when dropping our final reference.
812 * drm_connector_list_iter_next - return next connector
815 * Returns: the next connector for @iter, or NULL when the list walk has
838 /* loop until it's not a zombie connector */
947 /* Optional connector properties. */
1139 * DOC: standard connector properties
1156 * Legacy property for setting the power state of the connector. For atomic
1159 * connector is linked to. Drivers should never set this property directly,
1176 * connector is connected to a CRTC. In atomic the DRM core enforces that
1183 * Summarizing: Only set "DPMS" when the connector is known to be enabled,
1193 * Connector tile group property to indicate how a set of DRM connector
1214 * "GOOD" to re-enable the connector.
1220 * When user-space performs an atomic commit on a connector with a "BAD"
1269 * - Kernel sends uevent with the connector id and property id through
1382 * property to the connector during initialization.
1387 * Mode object ID of the &drm_crtc this connector should be connected to.
1428 * connector subtypes. Enum values more or less match with those from main
1429 * connector types.
1475 * Add margins to the connector's viewport. This is typically used to
1545 * drm_mode_create_dvi_i_properties - create DVI-I specific connector properties
1548 * Called by a driver the first time a DVI-I connector is made.
1579 * @connector: drm_connector to attach property
1581 * Called by a driver when DP connector is created.
1583 void drm_connector_attach_dp_subconnector_property(struct drm_connector *connector)
1585 struct drm_mode_config *mode_config = &connector->dev->mode_config;
1589 drm_property_create_enum(connector->dev,
1595 drm_object_attach_property(&connector->base,
1602 * DOC: HDMI connector properties
1644 * Indicates the TV Mode used on an analog TV connector. The value
1691 * @connector: connector to attach content type property on.
1693 * Called by a driver the first time a HDMI connector is made.
1697 int drm_connector_attach_content_type_property(struct drm_connector *connector)
1699 if (!drm_mode_create_content_type_property(connector->dev))
1700 drm_object_attach_property(&connector->base,
1701 connector->dev->mode_config.content_type_property,
1708 * drm_connector_attach_tv_margin_properties - attach TV connector margin
1710 * @connector: DRM connector
1712 * Called by a driver when it needs to attach TV margin props to a connector.
1715 void drm_connector_attach_tv_margin_properties(struct drm_connector *connector)
1717 struct drm_device *dev = connector->dev;
1719 drm_object_attach_property(&connector->base,
1722 drm_object_attach_property(&connector->base,
1725 drm_object_attach_property(&connector->base,
1728 drm_object_attach_property(&connector->base,
1735 * drm_mode_create_tv_margin_properties - create TV connector margin properties
1738 * Called by a driver's HDMI connector initialization routine, this function
1740 * function for an SDTV connector, it's already called from
1776 * drm_mode_create_tv_properties_legacy - create TV specific connector properties
1782 * the TV specific connector properties for a given device. Caller is
1786 * NOTE: This functions registers the deprecated "mode" connector
1805 * Basic connector properties
1880 * drm_mode_create_tv_properties - create TV specific connector properties
1885 * the TV specific connector properties for a given device.
2007 * from the minimum supported variable refresh rate for the connector.
2016 * @connector: connector to create the vrr_capable property on.
2019 * variable refresh rate capability for a connector.
2025 struct drm_connector *connector)
2027 struct drm_device *dev = connector->dev;
2030 if (!connector->vrr_capable_property) {
2036 connector->vrr_capable_property = prop;
2037 drm_object_attach_property(&connector->base, prop, 0);
2046 * @connector: connector to attach scaling mode property on.
2058 int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
2061 struct drm_device *dev = connector->dev;
2095 drm_object_attach_property(&connector->base,
2098 connector->scaling_mode_property = scaling_mode_property;
2132 * DOC: standard connector properties
2155 * drm_mode_create_hdmi_colorspace_property() is used for HDMI connector and
2156 * drm_mode_create_dp_colorspace_property() is used for DP connector.
2159 static int drm_mode_create_colorspace_property(struct drm_connector *connector,
2162 struct drm_device *dev = connector->dev;
2167 if (connector->colorspace_property)
2172 connector->base.id, connector->name);
2178 connector->base.id, connector->name);
2192 connector->colorspace_property =
2197 if (!connector->colorspace_property)
2205 * @connector: connector to create the Colorspace property on.
2214 int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector,
2224 return drm_mode_create_colorspace_property(connector, colorspaces);
2230 * @connector: connector to create the Colorspace property on.
2239 int drm_mode_create_dp_colorspace_property(struct drm_connector *connector,
2249 return drm_mode_create_colorspace_property(connector, colorspaces);
2308 * drm_connector_set_path_property - set tile property on connector
2309 * @connector: connector to set property on.
2313 * connector path. This is mainly used for DisplayPort MST where
2320 int drm_connector_set_path_property(struct drm_connector *connector,
2323 struct drm_device *dev = connector->dev;
2327 &connector->path_blob_ptr,
2330 &connector->base,
2337 * drm_connector_set_tile_property - set tile property on connector
2338 * @connector: connector to set property on.
2340 * This looks up the tile information for a connector, and creates a
2349 int drm_connector_set_tile_property(struct drm_connector *connector)
2351 struct drm_device *dev = connector->dev;
2355 if (!connector->has_tile) {
2357 &connector->tile_blob_ptr,
2360 &connector->base,
2366 connector->tile_group->id, connector->tile_is_single_monitor,
2367 connector->num_h_tile, connector->num_v_tile,
2368 connector->tile_h_loc, connector->tile_v_loc,
2369 connector->tile_h_size, connector->tile_v_size);
2372 &connector->tile_blob_ptr,
2375 &connector->base,
2382 * drm_connector_set_link_status_property - Set link status property of a connector
2383 * @connector: drm connector
2400 void drm_connector_set_link_status_property(struct drm_connector *connector,
2403 struct drm_device *dev = connector->dev;
2406 connector->state->link_status = link_status;
2413 * @connector: connector to attach max bpc property on.
2414 * @min: The minimum bit depth supported by the connector.
2415 * @max: The maximum bit depth supported by the connector.
2417 * This is used to add support for limiting the bit depth on a connector.
2422 int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
2425 struct drm_device *dev = connector->dev;
2428 prop = connector->max_bpc_property;
2434 connector->max_bpc_property = prop;
2437 drm_object_attach_property(&connector->base, prop, max);
2438 connector->state->max_requested_bpc = max;
2439 connector->state->max_bpc = max;
2447 * @connector: connector to attach the property on.
2455 int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector)
2457 struct drm_device *dev = connector->dev;
2460 drm_object_attach_property(&connector->base, prop, 0);
2468 * @connector: connector to attach the property on.
2476 int drm_connector_attach_colorspace_property(struct drm_connector *connector)
2478 struct drm_property *prop = connector->colorspace_property;
2480 drm_object_attach_property(&connector->base, prop, DRM_MODE_COLORIMETRY_DEFAULT);
2488 * @old_state: old connector state to compare
2489 * @new_state: new connector state to compare
2492 * have changed between two different connector state (and thus probably
2516 * capable property for a connector
2517 * @connector: drm connector
2518 * @capable: True if the connector is variable refresh rate capable
2521 * variable refresh rate over a connector.
2524 struct drm_connector *connector, bool capable)
2526 if (!connector->vrr_capable_property)
2529 drm_object_property_set_value(&connector->base,
2530 connector->vrr_capable_property,
2536 * drm_connector_set_panel_orientation - sets the connector's panel_orientation
2537 * @connector: connector for which to set the panel-orientation property.
2540 * This function sets the connector's panel_orientation and attaches
2541 * a "panel orientation" property to the connector.
2543 * Calling this function on a connector where the panel_orientation has
2557 struct drm_connector *connector,
2560 struct drm_device *dev = connector->dev;
2561 struct drm_display_info *info = &connector->display_info;
2586 drm_object_attach_property(&connector->base, prop,
2594 * connector's panel_orientation after checking for quirks
2595 * @connector: connector for which to init the panel-orientation property.
2607 struct drm_connector *connector,
2617 return drm_connector_set_panel_orientation(connector,
2624 * set the connector's panel_orientation from panel's callback.
2625 * @connector: connector for which to init the panel-orientation property.
2635 struct drm_connector *connector,
2645 return drm_connector_set_panel_orientation(connector, orientation);
2659 * @connector: connector for which to create the privacy-screen properties
2662 * hw-state" properties for the connector. They are not attached.
2665 drm_connector_create_privacy_screen_properties(struct drm_connector *connector)
2667 if (connector->privacy_screen_sw_state_property)
2671 connector->privacy_screen_sw_state_property =
2672 drm_property_create_enum(connector->dev, DRM_MODE_PROP_ENUM,
2676 connector->privacy_screen_hw_state_property =
2677 drm_property_create_enum(connector->dev,
2688 * @connector: connector on which to attach the privacy-screen properties
2691 * hw-state" properties to the connector. The initial state of both is set
2695 drm_connector_attach_privacy_screen_properties(struct drm_connector *connector)
2697 if (!connector->privacy_screen_sw_state_property)
2700 drm_object_attach_property(&connector->base,
2701 connector->privacy_screen_sw_state_property,
2704 drm_object_attach_property(&connector->base,
2705 connector->privacy_screen_hw_state_property,
2711 struct drm_connector *connector, bool set_sw_state)
2715 drm_privacy_screen_get_state(connector->privacy_screen,
2719 connector->state->privacy_screen_sw_state = sw_state;
2720 drm_object_property_set_value(&connector->base,
2721 connector->privacy_screen_hw_state_property, hw_state);
2727 struct drm_connector *connector =
2729 struct drm_device *dev = connector->dev;
2732 drm_connector_update_privacy_screen_properties(connector, true);
2735 drm_sysfs_connector_property_event(connector,
2736 connector->privacy_screen_sw_state_property);
2737 drm_sysfs_connector_property_event(connector,
2738 connector->privacy_screen_hw_state_property);
2745 * the connector
2746 * @connector: connector to attach the privacy-screen to
2750 * a generic notifier for generating sysfs-connector-status-events
2753 * call drm_privacy_screen_put() on it when the connector is destroyed.
2756 struct drm_connector *connector, struct drm_privacy_screen *priv)
2758 connector->privacy_screen = priv;
2759 connector->privacy_screen_notifier.notifier_call =
2762 drm_connector_create_privacy_screen_properties(connector);
2763 drm_connector_update_privacy_screen_properties(connector, true);
2764 drm_connector_attach_privacy_screen_properties(connector);
2769 * drm_connector_update_privacy_screen - update connector's privacy-screen sw-state
2770 * @connector_state: connector-state to update the privacy-screen for
2772 * This function calls drm_privacy_screen_set_sw_state() on the connector's
2775 * If the connector has no privacy-screen, then this is a no-op.
2779 struct drm_connector *connector = connector_state->connector;
2782 if (!connector->privacy_screen)
2785 ret = drm_privacy_screen_set_sw_state(connector->privacy_screen,
2788 drm_err(connector->dev, "Error updating privacy-screen sw_state\n");
2793 drm_connector_update_privacy_screen_properties(connector, false);
2802 struct drm_connector *connector = obj_to_connector(obj);
2805 if (property == connector->dev->mode_config.dpms_property) {
2806 ret = (*connector->funcs->dpms)(connector, (int)value);
2807 } else if (connector->funcs->set_property)
2808 ret = connector->funcs->set_property(connector, property, value);
2811 drm_object_property_set_value(&connector->base, property, value);
2830 static struct drm_encoder *drm_connector_get_encoder(struct drm_connector *connector)
2835 if (connector->state)
2836 return connector->state->best_encoder;
2837 return connector->encoder;
2878 struct drm_connector *connector;
2895 connector = drm_connector_lookup(dev, file_priv, out_resp->connector_id);
2896 if (!connector)
2899 encoders_count = hweight32(connector->possible_encoders);
2905 drm_connector_for_each_possible_encoder(connector, encoder) {
2915 out_resp->connector_id = connector->base.id;
2916 out_resp->connector_type = connector->connector_type;
2917 out_resp->connector_type_id = connector->connector_type_id;
2924 connector->funcs->fill_modes(connector,
2929 connector->base.id, connector->name);
2932 out_resp->mm_width = connector->display_info.width_mm;
2933 out_resp->mm_height = connector->display_info.height_mm;
2934 out_resp->subpixel = connector->display_info.subpixel_order;
2935 out_resp->connection = connector->status;
2938 list_for_each_entry(mode, &connector->modes, head) {
2941 if (drm_mode_expose_to_userspace(mode, &connector->modes,
2955 list_for_each_entry(mode, &connector->modes, head) {
2977 list_for_each_entry_continue(mode, &connector->modes, head)
2988 list_for_each_entry(mode, &connector->modes, head)
2996 encoder = drm_connector_get_encoder(connector);
3005 ret = drm_mode_object_get_properties(&connector->base, file_priv->atomic,
3012 drm_connector_put(connector);
3018 * drm_connector_find_by_fwnode - Find a connector based on the associated fwnode
3022 * a connector is found a reference to the connector is returned. The caller must
3024 * connector.
3026 * Returns: A reference to the found connector or an ERR_PTR().
3030 struct drm_connector *connector, *found = ERR_PTR(-ENODEV);
3037 list_for_each_entry(connector, &connector_list, global_connector_list_entry) {
3038 if (connector->fwnode == fwnode ||
3039 (connector->fwnode && connector->fwnode->secondary == fwnode)) {
3040 drm_connector_get(connector);
3041 found = connector;
3052 * drm_connector_oob_hotplug_event - Report out-of-band hotplug event to connector
3065 struct drm_connector *connector;
3067 connector = drm_connector_find_by_fwnode(connector_fwnode);
3068 if (IS_ERR(connector))
3071 if (connector->funcs->oob_hotplug_event)
3072 connector->funcs->oob_hotplug_event(connector);
3074 drm_connector_put(connector);