Lines Matching +full:op +full:- +full:panel
51 * Hence they are reference-counted using drm_connector_get() and
67 * For connectors which are not fixed (like built-in panels) the driver needs to
76 * Note drm_connector_[un]register() first take connector->lock and then
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
147 * drm_connector_get_cmdline_mode - reads the user's cmdline mode
150 * The kernel supports per-connector configuration of its consoles through
158 struct drm_cmdline_mode *mode = &connector->cmdline_mode;
161 option = video_get_options(connector->name);
170 if (mode->force) {
171 DRM_INFO("forcing %s connector %s\n", connector->name,
172 drm_get_connector_force_name(mode->force));
173 connector->force = mode->force;
176 if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) {
178 connector->name, mode->panel_orientation);
180 mode->panel_orientation);
184 connector->name, mode->name,
185 mode->xres, mode->yres,
186 mode->refresh_specified ? mode->refresh : 60,
187 mode->rb ? " reduced blanking" : "",
188 mode->margins ? " with margins" : "",
189 mode->interlace ? " interlaced" : "");
196 struct drm_device *dev = connector->dev;
198 drm_mode_object_unregister(dev, &connector->base);
199 connector->funcs->destroy(connector);
207 struct drm_mode_config *config = &dev->mode_config;
211 spin_lock_irqsave(&config->connector_list_lock, flags);
212 freed = llist_del_all(&config->connector_free_list);
213 spin_unlock_irqrestore(&config->connector_list_lock, flags);
216 drm_mode_object_unregister(dev, &connector->base);
217 connector->funcs->destroy(connector);
227 struct drm_mode_config *config = &dev->mode_config;
233 (!funcs->atomic_destroy_state ||
234 !funcs->atomic_duplicate_state));
236 ret = __drm_mode_object_add(dev, &connector->base,
242 connector->base.properties = &connector->properties;
243 connector->dev = dev;
244 connector->funcs = funcs;
247 ret = ida_alloc_max(&config->connector_ida, 31, GFP_KERNEL);
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 =
265 kasprintf(GFP_KERNEL, "%s-%d",
267 connector->connector_type_id);
268 if (!connector->name) {
269 ret = -ENOMEM;
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->eld_mutex);
281 mutex_init(&connector->edid_override_mutex);
282 connector->edid_blob_ptr = NULL;
283 connector->epoch_counter = 0;
284 connector->tile_blob_ptr = NULL;
285 connector->status = connector_status_unknown;
286 connector->display_info.panel_orientation =
294 spin_lock_irq(&config->connector_list_lock);
295 list_add_tail(&connector->head, &config->connector_list);
296 config->num_connector++;
297 spin_unlock_irq(&config->connector_list_lock);
303 drm_object_attach_property(&connector->base,
304 config->dpms_property, 0);
306 drm_object_attach_property(&connector->base,
307 config->link_status_property,
310 drm_object_attach_property(&connector->base,
311 config->non_desktop_property,
313 drm_object_attach_property(&connector->base,
314 config->tile_property,
318 drm_object_attach_property(&connector->base, config->prop_crtc_id, 0);
321 connector->debugfs_entry = NULL;
324 ida_free(connector_ida, connector->connector_type_id);
327 ida_free(&config->connector_ida, connector->index);
330 drm_mode_object_unregister(dev, &connector->base);
336 * drm_connector_init - Init a preallocated connector
361 if (drm_WARN_ON(dev, !(funcs && funcs->destroy)))
362 return -EINVAL;
369 * drm_connector_init_with_ddc - Init a preallocated connector
398 if (drm_WARN_ON(dev, !(funcs && funcs->destroy)))
399 return -EINVAL;
414 * drmm_connector_init - Init a preallocated connector
425 * drm_connector_cleanup() in a DRM-managed action.
440 if (drm_WARN_ON(dev, funcs && funcs->destroy))
441 return -EINVAL;
457 * drm_connector_attach_edid_property - attach edid property.
466 struct drm_mode_config *config = &connector->dev->mode_config;
468 drm_object_attach_property(&connector->base,
469 config->edid_property,
475 * drm_connector_attach_encoder - attach a connector to an encoder
492 * direct assignment of connector->encoder = encoder. This connection
500 if (WARN_ON(connector->encoder))
501 return -EINVAL;
503 connector->possible_encoders |= drm_encoder_mask(encoder);
510 * drm_connector_has_possible_encoder - check if the connector and encoder are
521 return connector->possible_encoders & drm_encoder_mask(encoder);
528 list_del(&mode->head);
529 drm_mode_destroy(connector->dev, mode);
533 * drm_connector_cleanup - cleans up an initialised connector
540 struct drm_device *dev = connector->dev;
546 if (WARN_ON(connector->registration_state ==
550 if (connector->privacy_screen) {
551 drm_privacy_screen_put(connector->privacy_screen);
552 connector->privacy_screen = NULL;
555 if (connector->tile_group) {
556 drm_mode_put_tile_group(dev, connector->tile_group);
557 connector->tile_group = NULL;
560 list_for_each_entry_safe(mode, t, &connector->probed_modes, head)
563 list_for_each_entry_safe(mode, t, &connector->modes, head)
566 ida_free(&drm_connector_enum_list[connector->connector_type].ida,
567 connector->connector_type_id);
569 ida_free(&dev->mode_config.connector_ida, connector->index);
571 kfree(connector->display_info.bus_formats);
572 kfree(connector->display_info.vics);
573 drm_mode_object_unregister(dev, &connector->base);
574 kfree(connector->name);
575 connector->name = NULL;
576 fwnode_handle_put(connector->fwnode);
577 connector->fwnode = NULL;
578 spin_lock_irq(&dev->mode_config.connector_list_lock);
579 list_del(&connector->head);
580 dev->mode_config.num_connector--;
581 spin_unlock_irq(&dev->mode_config.connector_list_lock);
583 WARN_ON(connector->state && !connector->funcs->atomic_destroy_state);
584 if (connector->state && connector->funcs->atomic_destroy_state)
585 connector->funcs->atomic_destroy_state(connector,
586 connector->state);
588 mutex_destroy(&connector->mutex);
592 if (dev->registered)
598 * drm_connector_register - register a connector
616 if (!connector->dev->registered)
619 mutex_lock(&connector->mutex);
620 if (connector->registration_state != DRM_CONNECTOR_INITIALIZING)
629 if (connector->funcs->late_register) {
630 ret = connector->funcs->late_register(connector);
635 drm_mode_object_register(connector->dev, &connector->base);
637 connector->registration_state = DRM_CONNECTOR_REGISTERED;
642 if (connector->privacy_screen)
643 drm_privacy_screen_register_notifier(connector->privacy_screen,
644 &connector->privacy_screen_notifier);
647 list_add_tail(&connector->global_connector_list_entry, &connector_list);
655 mutex_unlock(&connector->mutex);
661 * drm_connector_unregister - unregister a connector
670 mutex_lock(&connector->mutex);
671 if (connector->registration_state != DRM_CONNECTOR_REGISTERED) {
672 mutex_unlock(&connector->mutex);
677 list_del_init(&connector->global_connector_list_entry);
680 if (connector->privacy_screen)
682 connector->privacy_screen,
683 &connector->privacy_screen_notifier);
685 if (connector->funcs->early_unregister)
686 connector->funcs->early_unregister(connector);
691 connector->registration_state = DRM_CONNECTOR_UNREGISTERED;
692 mutex_unlock(&connector->mutex);
727 * drm_get_connector_status_name - return a string for connector status
747 * drm_get_connector_force_name - return a string for connector force
775 * drm_connector_list_iter_begin - initialize a connector_list iterator
787 iter->dev = dev;
788 iter->conn = NULL;
794 * Extra-safe connector put function that works in any context. Should only be
801 struct drm_mode_config *config = &conn->dev->mode_config;
803 lockdep_assert_held(&config->connector_list_lock);
805 if (!refcount_dec_and_test(&conn->base.refcount.refcount))
808 llist_add(&conn->free_node, &config->connector_free_list);
809 schedule_work(&config->connector_free_work);
813 * drm_connector_list_iter_next - return next connector
822 struct drm_connector *old_conn = iter->conn;
823 struct drm_mode_config *config = &iter->dev->mode_config;
827 spin_lock_irqsave(&config->connector_list_lock, flags);
828 lhead = old_conn ? &old_conn->head : &config->connector_list;
831 if (lhead->next == &config->connector_list) {
832 iter->conn = NULL;
836 lhead = lhead->next;
837 iter->conn = list_entry(lhead, struct drm_connector, head);
840 } while (!kref_get_unless_zero(&iter->conn->base.refcount));
844 spin_unlock_irqrestore(&config->connector_list_lock, flags);
846 return iter->conn;
851 * drm_connector_list_iter_end - tear down a connector_list iterator
861 struct drm_mode_config *config = &iter->dev->mode_config;
864 iter->dev = NULL;
865 if (iter->conn) {
866 spin_lock_irqsave(&config->connector_list_lock, flags);
867 __drm_connector_put_safe(iter->conn);
868 spin_unlock_irqrestore(&config->connector_list_lock, flags);
884 * drm_get_subpixel_order_name - return a string for a given subpixel enum
912 * drm_display_info_set_bus_formats - set the supported bus formats
918 * See MEDIA_BUS_FMT_* definitions in include/uapi/linux/media-bus-format.h for
931 return -EINVAL;
937 return -ENOMEM;
940 kfree(info->bus_formats);
941 info->bus_formats = fmts;
942 info->num_bus_formats = num_formats;
978 { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */
979 { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */
980 { DRM_MODE_SUBCONNECTOR_DVIA, "DVI-A" }, /* DVI-I */
985 { DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I, TV-out and DP */
986 { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */
987 { DRM_MODE_SUBCONNECTOR_DVIA, "DVI-A" }, /* DVI-I */
994 { DRM_MODE_TV_MODE_NTSC_443, "NTSC-443" },
995 { DRM_MODE_TV_MODE_NTSC_J, "NTSC-J" },
997 { DRM_MODE_TV_MODE_PAL_M, "PAL-M" },
998 { DRM_MODE_TV_MODE_PAL_N, "PAL-N" },
1004 * drm_get_tv_mode_from_name - Translates a TV mode name into its enum value
1019 if (strlen(item->name) == len && !strncmp(item->name, name, len))
1020 return item->type;
1023 return -EINVAL;
1028 { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */
1029 { DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */
1030 { DRM_MODE_SUBCONNECTOR_SVIDEO, "SVIDEO" }, /* TV-out */
1031 { DRM_MODE_SUBCONNECTOR_Component, "Component" }, /* TV-out */
1032 { DRM_MODE_SUBCONNECTOR_SCART, "SCART" }, /* TV-out */
1037 { DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I, TV-out and DP */
1038 { DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */
1039 { DRM_MODE_SUBCONNECTOR_SVIDEO, "SVIDEO" }, /* TV-out */
1040 { DRM_MODE_SUBCONNECTOR_Component, "Component" }, /* TV-out */
1041 { DRM_MODE_SUBCONNECTOR_SCART, "SCART" }, /* TV-out */
1047 { DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I, TV-out and DP */
1049 { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DP */
1066 /* Standard Definition Colorimetry based on IEC 61966-2-4 */
1068 /* High Definition Colorimetry based on IEC 61966-2-4 */
1070 /* Colorimetry based on IEC 61966-2-1/Amendment 1 */
1072 /* Colorimetry based on IEC 61966-2-5 [33] */
1074 /* Colorimetry based on IEC 61966-2-5 */
1076 /* Colorimetry based on ITU-R BT.2020 */
1078 /* Colorimetry based on ITU-R BT.2020 */
1080 /* Colorimetry based on ITU-R BT.2020 */
1083 [DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65] = "DCI-P3_RGB_D65",
1084 [DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER] = "DCI-P3_RGB_Theater",
1086 /* Colorimetry based on scRGB (IEC 61966-2-2) */
1092 * drm_get_colorspace_name - return a string for color encoding
1122 * Format Table 2-120
1152 * User-space should not parse the EDID to obtain information exposed via
1154 * fixups to the EDID). For instance, user-space should not try to parse
1180 * The second issue is that the DPMS state is only well-defined when the
1199 * compose together into one logical screen. This is used by both high-res
1201 * DP MST sinks), or high-res integrated panels (like dual-link DSI) which
1202 * are not gen-locked. Note that for tiled panels which are genlocked, like
1203 * dual-link LVDS or dual-link DSI, the driver should try to not expose the
1207 * link-status:
1208 * Connector link-status property to indicate the status of link. The
1209 * default value of link-status is "GOOD". If something fails during or
1214 * When user-space receives the hotplug uevent and detects a "BAD"
1215 * link-status, the sink doesn't receive pixels anymore (e.g. the screen
1217 * changed. User-space is expected to pick a new mode if the current one
1218 * has disappeared and perform a new modeset with link-status set to
1219 * "GOOD" to re-enable the connector.
1222 * link-status, the other are unaffected (ie. the sinks still continue to
1225 * When user-space performs an atomic commit on a connector with a "BAD"
1226 * link-status without resetting the property to "GOOD", the sink may
1227 * still not receive pixels. When user-space performs an atomic commit
1228 * which resets the link-status property to "GOOD" without the
1231 * User-space can only change link-status to "GOOD", changing it to "BAD"
1232 * is a no-op.
1234 * For backwards compatibility with non-atomic userspace the kernel
1235 * tries to automatically set the link-status back to "GOOD" in the
1264 * -EINVAL.
1268 * - DESIRED state should be preserved until userspace de-asserts it by
1271 * - If the state is DESIRED, kernel should attempt to re-authenticate the
1274 * - Kernel sends uevent with the connector id and property id through
1278 * - DESIRED -> ENABLED (authentication success)
1279 * - ENABLED -> DESIRED (termination of authentication)
1280 * - Please note no uevents for userspace triggered property state changes,
1283 * - DESIRED/ENABLED -> UNDESIRED
1284 * - UNDESIRED -> DESIRED
1285 * - Userspace is responsible for polling the property or listen to uevents
1300 * - "HDCP Type0": DRM_MODE_HDCP_CONTENT_TYPE0 = 0
1301 * - "HDCP Type1": DRM_MODE_HDCP_CONTENT_TYPE1 = 1
1336 * then kernel will disable the HDCP and re-enable with new type in the
1347 * SDP packet (Non-audio INFOFRAME SDP v1.3) for DP. This is then
1365 * - Some layers are HDR and others are SDR
1366 * - HDR layers luminance is not same as sink
1396 * panel orientation:
1397 * On some devices the LCD panel is mounted in the casing in such a way
1398 * that the up/top side of the panel does not match with the top side of
1401 * INPUT_PROP_DIRECT) will still map 1:1 to the actual LCD panel
1409 * This property defines how a non-native mode is upscaled to the native
1410 * mode of an LCD panel:
1413 * No upscaling happens, scaling is left to the panel. Not all
1416 * The output is upscaled to the full resolution of the panel,
1420 * resolution the panel.
1429 * have a built-in scaler).
1432 * This property is used by DVI-I, TVout and DisplayPort to indicate different
1435 * For DVI-I and TVout there is also a matching property "select subconnector"
1439 * privacy-screen sw-state, privacy-screen hw-state:
1445 * "privacy-screen hw-state" is read-only and reflects the actual state
1446 * of the privacy-screen, possible values: "Enabled", "Disabled,
1447 * "Enabled-locked", "Disabled-locked". The locked states indicate
1449 * might be devices where the firmware-setup options, or a hardware
1450 * slider-switch, offer always on / off modes.
1452 * "privacy-screen sw-state" can be set to change the privacy-screen state
1453 * when not locked. In this case the driver must update the hw-state
1455 * sw-state property. Setting the sw-state property when the hw-state is
1457 * state to the set state when the hw-state becomes unlocked. E.g. if
1458 * "privacy-screen hw-state" is "Enabled-locked" and the sw-state
1460 * changing the slider-switch position, then the driver must set the
1463 * In some cases the privacy-screen's actual state might change outside of
1467 * In this case the driver must update both the hw-state and the sw-state
1469 * sw-state. Any pending sw-state requests are thus discarded.
1473 * of the sw-state. Caching the sw-state value and including it in later
1476 * privacy-screen sw-state in an atomic commit unless it wants to change
1502 return -ENOMEM;
1503 dev->mode_config.edid_property = prop;
1509 return -ENOMEM;
1510 dev->mode_config.dpms_property = prop;
1517 return -ENOMEM;
1518 dev->mode_config.path_property = prop;
1525 return -ENOMEM;
1526 dev->mode_config.tile_property = prop;
1528 prop = drm_property_create_enum(dev, 0, "link-status",
1532 return -ENOMEM;
1533 dev->mode_config.link_status_property = prop;
1535 prop = drm_property_create_bool(dev, DRM_MODE_PROP_IMMUTABLE, "non-desktop");
1537 return -ENOMEM;
1538 dev->mode_config.non_desktop_property = prop;
1543 return -ENOMEM;
1544 dev->mode_config.hdr_output_metadata_property = prop;
1550 * drm_mode_create_dvi_i_properties - create DVI-I specific connector properties
1553 * Called by a driver the first time a DVI-I connector is made.
1562 if (dev->mode_config.dvi_i_select_subconnector_property)
1570 dev->mode_config.dvi_i_select_subconnector_property = dvi_i_selector;
1576 dev->mode_config.dvi_i_subconnector_property = dvi_i_subconnector;
1583 * drm_connector_attach_dp_subconnector_property - create subconnector property for DP
1590 struct drm_mode_config *mode_config = &connector->dev->mode_config;
1592 if (!mode_config->dp_subconnector_property)
1593 mode_config->dp_subconnector_property =
1594 drm_property_create_enum(connector->dev,
1600 drm_object_attach_property(&connector->base,
1601 mode_config->dp_subconnector_property,
1627 * The meaning of each content type is defined in CTA-861-G table 15.
1636 * - brightness
1637 * - contrast
1638 * - flicker reduction
1639 * - hue
1640 * - mode
1641 * - overscan
1642 * - saturation
1643 * - select subconnector
1653 * TV Mode is CCIR System M (aka 525-lines) together with
1656 * NTSC-443:
1658 * TV Mode is CCIR System M (aka 525-lines) together with
1662 * NTSC-J:
1664 * TV Mode is CCIR System M (aka 525-lines) together with
1670 * TV Mode is CCIR System B (aka 625-lines) together with
1673 * PAL-M:
1675 * TV Mode is CCIR System M (aka 525-lines) together with
1678 * PAL-N:
1687 * TV Mode is CCIR System B (aka 625-lines) together with
1695 * drm_connector_attach_content_type_property - attach content-type property
1704 if (!drm_mode_create_content_type_property(connector->dev))
1705 drm_object_attach_property(&connector->base,
1706 connector->dev->mode_config.content_type_property,
1713 * drm_connector_attach_tv_margin_properties - attach TV connector margin
1722 struct drm_device *dev = connector->dev;
1724 drm_object_attach_property(&connector->base,
1725 dev->mode_config.tv_left_margin_property,
1727 drm_object_attach_property(&connector->base,
1728 dev->mode_config.tv_right_margin_property,
1730 drm_object_attach_property(&connector->base,
1731 dev->mode_config.tv_top_margin_property,
1733 drm_object_attach_property(&connector->base,
1734 dev->mode_config.tv_bottom_margin_property,
1740 * drm_mode_create_tv_margin_properties - create TV connector margin properties
1753 if (dev->mode_config.tv_left_margin_property)
1756 dev->mode_config.tv_left_margin_property =
1758 if (!dev->mode_config.tv_left_margin_property)
1759 return -ENOMEM;
1761 dev->mode_config.tv_right_margin_property =
1763 if (!dev->mode_config.tv_right_margin_property)
1764 return -ENOMEM;
1766 dev->mode_config.tv_top_margin_property =
1768 if (!dev->mode_config.tv_top_margin_property)
1769 return -ENOMEM;
1771 dev->mode_config.tv_bottom_margin_property =
1773 if (!dev->mode_config.tv_bottom_margin_property)
1774 return -ENOMEM;
1781 * drm_mode_create_tv_properties_legacy - create TV specific connector properties
1806 if (dev->mode_config.tv_select_subconnector_property)
1819 dev->mode_config.tv_select_subconnector_property = tv_selector;
1828 dev->mode_config.tv_subconnector_property = tv_subconnector;
1837 dev->mode_config.legacy_tv_mode_property =
1840 if (!dev->mode_config.legacy_tv_mode_property)
1844 drm_property_add_enum(dev->mode_config.legacy_tv_mode_property,
1848 dev->mode_config.tv_brightness_property =
1850 if (!dev->mode_config.tv_brightness_property)
1853 dev->mode_config.tv_contrast_property =
1855 if (!dev->mode_config.tv_contrast_property)
1858 dev->mode_config.tv_flicker_reduction_property =
1860 if (!dev->mode_config.tv_flicker_reduction_property)
1863 dev->mode_config.tv_overscan_property =
1865 if (!dev->mode_config.tv_overscan_property)
1868 dev->mode_config.tv_saturation_property =
1870 if (!dev->mode_config.tv_saturation_property)
1873 dev->mode_config.tv_hue_property =
1875 if (!dev->mode_config.tv_hue_property)
1880 return -ENOMEM;
1885 * drm_mode_create_tv_properties - create TV specific connector properties
1902 if (dev->mode_config.tv_mode_property)
1917 return -ENOMEM;
1919 dev->mode_config.tv_mode_property = tv_mode;
1926 * drm_mode_create_scaling_mode_property - create scaling mode property
1942 if (dev->mode_config.scaling_mode_property)
1950 dev->mode_config.scaling_mode_property = scaling_mode;
1981 * Panel brightness will also vary with vertical front porch duration. Some
2004 * vertical front porch duration will be extended until page-flip or
2019 * drm_connector_attach_vrr_capable_property - creates the
2032 struct drm_device *dev = connector->dev;
2035 if (!connector->vrr_capable_property) {
2039 return -ENOMEM;
2041 connector->vrr_capable_property = prop;
2042 drm_object_attach_property(&connector->base, prop, 0);
2050 * drm_connector_attach_scaling_mode_property - attach atomic scaling mode property
2056 * and can be used from &drm_connector_helper_funcs->atomic_check for validation.
2066 struct drm_device *dev = connector->dev;
2070 (1U << ARRAY_SIZE(drm_scaling_mode_enum_list)) - 1;
2074 return -EINVAL;
2081 return -ENOMEM;
2100 drm_object_attach_property(&connector->base,
2103 connector->scaling_mode_property = scaling_mode_property;
2110 * drm_mode_create_aspect_ratio_property - create aspect ratio property
2121 if (dev->mode_config.aspect_ratio_property)
2124 dev->mode_config.aspect_ratio_property =
2129 if (dev->mode_config.aspect_ratio_property == NULL)
2130 return -ENOMEM;
2152 * - Set up CRTC DEGAMMA/CTM/GAMMA to convert to some sink
2154 * - Set this new property to let the sink know what it
2156 * - This property is just to inform sink what colorspace
2167 struct drm_device *dev = connector->dev;
2172 if (connector->colorspace_property)
2177 connector->base.id, connector->name);
2178 return -EINVAL;
2181 if ((supported_colorspaces & -BIT(DRM_MODE_COLORIMETRY_COUNT)) != 0) {
2183 connector->base.id, connector->name);
2184 return -EINVAL;
2197 connector->colorspace_property =
2202 if (!connector->colorspace_property)
2203 return -ENOMEM;
2209 * drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property
2234 * drm_mode_create_dp_colorspace_property - create dp colorspace property
2259 * drm_mode_create_content_type_property - create content type property
2270 if (dev->mode_config.content_type_property)
2273 dev->mode_config.content_type_property =
2278 if (dev->mode_config.content_type_property == NULL)
2279 return -ENOMEM;
2286 * drm_mode_create_suggested_offset_properties - create suggests offset properties
2296 if (dev->mode_config.suggested_x_property && dev->mode_config.suggested_y_property)
2299 dev->mode_config.suggested_x_property =
2302 dev->mode_config.suggested_y_property =
2305 if (dev->mode_config.suggested_x_property == NULL ||
2306 dev->mode_config.suggested_y_property == NULL)
2307 return -ENOMEM;
2313 * drm_connector_set_path_property - set tile property on connector
2328 struct drm_device *dev = connector->dev;
2332 &connector->path_blob_ptr,
2335 &connector->base,
2336 dev->mode_config.path_property);
2342 * drm_connector_set_tile_property - set tile property on connector
2356 struct drm_device *dev = connector->dev;
2360 if (!connector->has_tile) {
2362 &connector->tile_blob_ptr,
2365 &connector->base,
2366 dev->mode_config.tile_property);
2371 connector->tile_group->id, connector->tile_is_single_monitor,
2372 connector->num_h_tile, connector->num_v_tile,
2373 connector->tile_h_loc, connector->tile_v_loc,
2374 connector->tile_h_size, connector->tile_v_size);
2377 &connector->tile_blob_ptr,
2380 &connector->base,
2381 dev->mode_config.tile_property);
2387 * drm_connector_set_link_status_property - Set link status property of a connector
2394 * hotplug uevent for userspace to re-check the valid modes through
2399 * re-training a link) without userspace's intervention.
2408 struct drm_device *dev = connector->dev;
2410 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
2411 connector->state->link_status = link_status;
2412 drm_modeset_unlock(&dev->mode_config.connection_mutex);
2417 * drm_connector_attach_max_bpc_property - attach "max bpc" property
2430 struct drm_device *dev = connector->dev;
2433 prop = connector->max_bpc_property;
2437 return -ENOMEM;
2439 connector->max_bpc_property = prop;
2442 drm_object_attach_property(&connector->base, prop, max);
2443 connector->state->max_requested_bpc = max;
2444 connector->state->max_bpc = max;
2451 * drm_connector_attach_hdr_output_metadata_property - attach "HDR_OUTPUT_METADA" property
2462 struct drm_device *dev = connector->dev;
2463 struct drm_property *prop = dev->mode_config.hdr_output_metadata_property;
2465 drm_object_attach_property(&connector->base, prop, 0);
2472 * drm_connector_attach_colorspace_property - attach "Colorspace" property
2483 struct drm_property *prop = connector->colorspace_property;
2485 drm_object_attach_property(&connector->base, prop, DRM_MODE_COLORIMETRY_DEFAULT);
2492 * drm_connector_atomic_hdr_metadata_equal - checks if the hdr metadata changed
2496 * This is used by HDR-enabled drivers to test whether the HDR metadata
2506 struct drm_property_blob *old_blob = old_state->hdr_output_metadata;
2507 struct drm_property_blob *new_blob = new_state->hdr_output_metadata;
2512 if (old_blob->length != new_blob->length)
2515 return !memcmp(old_blob->data, new_blob->data, old_blob->length);
2520 * drm_connector_set_vrr_capable_property - sets the variable refresh rate
2531 if (!connector->vrr_capable_property)
2534 drm_object_property_set_value(&connector->base,
2535 connector->vrr_capable_property,
2541 * drm_connector_set_panel_orientation - sets the connector's panel_orientation
2542 * @connector: connector for which to set the panel-orientation property.
2546 * a "panel orientation" property to the connector.
2549 * already been set is a no-op (e.g. the orientation has been overridden with
2553 * DRM_MODE_PANEL_ORIENTATION_UNKNOWN, in which case it is a no-op.
2555 * The function shouldn't be called in panel after drm is registered (i.e.
2565 struct drm_device *dev = connector->dev;
2566 struct drm_display_info *info = &connector->display_info;
2570 if (info->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
2577 info->panel_orientation = panel_orientation;
2579 prop = dev->mode_config.panel_orientation_property;
2582 "panel orientation",
2586 return -ENOMEM;
2588 dev->mode_config.panel_orientation_property = prop;
2591 drm_object_attach_property(&connector->base, prop,
2592 info->panel_orientation);
2598 * drm_connector_set_panel_orientation_with_quirk - set the
2600 * @connector: connector for which to init the panel-orientation property.
2602 * @width: width in pixels of the panel, used for panel quirk detection
2603 * @height: height in pixels of the panel, used for panel quirk detection
2628 * drm_connector_set_orientation_from_panel -
2629 * set the connector's panel_orientation from panel's callback.
2630 * @connector: connector for which to init the panel-orientation property.
2631 * @panel: panel that can provide orientation information.
2634 * Orientation is obtained from panel's .get_orientation() callback.
2641 struct drm_panel *panel)
2645 if (panel && panel->funcs && panel->funcs->get_orientation)
2646 orientation = panel->funcs->get_orientation(panel);
2657 { PRIVACY_SCREEN_DISABLED_LOCKED, "Disabled-locked" },
2658 { PRIVACY_SCREEN_ENABLED_LOCKED, "Enabled-locked" },
2662 * drm_connector_create_privacy_screen_properties - create the drm connecter's
2663 * privacy-screen properties.
2664 * @connector: connector for which to create the privacy-screen properties
2666 * This function creates the "privacy-screen sw-state" and "privacy-screen
2667 * hw-state" properties for the connector. They are not attached.
2672 if (connector->privacy_screen_sw_state_property)
2675 /* Note sw-state only supports the first 2 values of the enum */
2676 connector->privacy_screen_sw_state_property =
2677 drm_property_create_enum(connector->dev, DRM_MODE_PROP_ENUM,
2678 "privacy-screen sw-state",
2681 connector->privacy_screen_hw_state_property =
2682 drm_property_create_enum(connector->dev,
2684 "privacy-screen hw-state",
2691 * drm_connector_attach_privacy_screen_properties - attach the drm connecter's
2692 * privacy-screen properties.
2693 * @connector: connector on which to attach the privacy-screen properties
2695 * This function attaches the "privacy-screen sw-state" and "privacy-screen
2696 * hw-state" properties to the connector. The initial state of both is set
2702 if (!connector->privacy_screen_sw_state_property)
2705 drm_object_attach_property(&connector->base,
2706 connector->privacy_screen_sw_state_property,
2709 drm_object_attach_property(&connector->base,
2710 connector->privacy_screen_hw_state_property,
2720 drm_privacy_screen_get_state(connector->privacy_screen,
2724 connector->state->privacy_screen_sw_state = sw_state;
2725 drm_object_property_set_value(&connector->base,
2726 connector->privacy_screen_hw_state_property, hw_state);
2734 struct drm_device *dev = connector->dev;
2736 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
2738 drm_modeset_unlock(&dev->mode_config.connection_mutex);
2741 connector->privacy_screen_sw_state_property);
2743 connector->privacy_screen_hw_state_property);
2749 * drm_connector_attach_privacy_screen_provider - attach a privacy-screen to
2751 * @connector: connector to attach the privacy-screen to
2754 * Create and attach the standard privacy-screen properties and register
2755 * a generic notifier for generating sysfs-connector-status-events
2756 * on external changes to the privacy-screen status.
2763 connector->privacy_screen = priv;
2764 connector->privacy_screen_notifier.notifier_call =
2774 * drm_connector_update_privacy_screen - update connector's privacy-screen sw-state
2775 * @connector_state: connector-state to update the privacy-screen for
2778 * privacy-screen.
2780 * If the connector has no privacy-screen, then this is a no-op.
2784 struct drm_connector *connector = connector_state->connector;
2787 if (!connector->privacy_screen)
2790 ret = drm_privacy_screen_set_sw_state(connector->privacy_screen,
2791 connector_state->privacy_screen_sw_state);
2793 drm_err(connector->dev, "Error updating privacy-screen sw_state\n");
2806 int ret = -EINVAL;
2810 if (property == connector->dev->mode_config.dpms_property) {
2811 ret = (*connector->funcs->dpms)(connector, (int)value);
2812 } else if (connector->funcs->set_property)
2813 ret = connector->funcs->set_property(connector, property, value);
2816 drm_object_property_set_value(&connector->base, property, value);
2825 .value = conn_set_prop->value,
2826 .prop_id = conn_set_prop->prop_id,
2827 .obj_id = conn_set_prop->connector_id,
2840 if (connector->state)
2841 return connector->state->best_encoder;
2842 return connector->encoder;
2851 * If user-space hasn't configured the driver to expose the stereo 3D
2854 if (!file_priv->stereo_allowed && drm_mode_is_stereo(mode))
2857 * If user-space hasn't configured the driver to expose the modes
2858 * with aspect-ratio, don't expose them. However if such a mode
2859 * is unique, let it be exposed, but reset the aspect-ratio flags
2860 * while preparing the list of user-modes.
2862 if (!file_priv->aspect_ratio_allowed) {
2866 if (mode_itr->expose_to_userspace &&
2896 return -EOPNOTSUPP;
2900 connector = drm_connector_lookup(dev, file_priv, out_resp->connector_id);
2902 return -ENOENT;
2904 encoders_count = hweight32(connector->possible_encoders);
2906 if ((out_resp->count_encoders >= encoders_count) && encoders_count) {
2908 encoder_ptr = (uint32_t __user *)(unsigned long)(out_resp->encoders_ptr);
2911 if (put_user(encoder->base.id, encoder_ptr + copied)) {
2912 ret = -EFAULT;
2918 out_resp->count_encoders = encoders_count;
2920 out_resp->connector_id = connector->base.id;
2921 out_resp->connector_type = connector->connector_type;
2922 out_resp->connector_type_id = connector->connector_type_id;
2926 mutex_lock(&dev->mode_config.mutex);
2927 if (out_resp->count_modes == 0) {
2929 connector->funcs->fill_modes(connector,
2930 dev->mode_config.max_width,
2931 dev->mode_config.max_height);
2933 drm_dbg_kms(dev, "User-space requested a forced probe on [CONNECTOR:%d:%s] but is not the DRM master, demoting to read-only probe\n",
2934 connector->base.id, connector->name);
2937 out_resp->mm_width = connector->display_info.width_mm;
2938 out_resp->mm_height = connector->display_info.height_mm;
2939 out_resp->subpixel = connector->display_info.subpixel_order;
2940 out_resp->connection = connector->status;
2942 /* delayed so we get modes regardless of pre-fill_modes state */
2943 list_for_each_entry(mode, &connector->modes, head) {
2944 WARN_ON(mode->expose_to_userspace);
2946 if (drm_mode_expose_to_userspace(mode, &connector->modes,
2948 mode->expose_to_userspace = true;
2957 if ((out_resp->count_modes >= mode_count) && mode_count) {
2959 mode_ptr = (struct drm_mode_modeinfo __user *)(unsigned long)out_resp->modes_ptr;
2960 list_for_each_entry(mode, &connector->modes, head) {
2961 if (!mode->expose_to_userspace)
2965 mode->expose_to_userspace = false;
2969 * Reset aspect ratio flags of user-mode, if modes with
2970 * aspect-ratio are not supported.
2972 if (!file_priv->aspect_ratio_allowed)
2976 ret = -EFAULT;
2982 list_for_each_entry_continue(mode, &connector->modes, head)
2983 mode->expose_to_userspace = false;
2985 mutex_unlock(&dev->mode_config.mutex);
2993 list_for_each_entry(mode, &connector->modes, head)
2994 mode->expose_to_userspace = false;
2997 out_resp->count_modes = mode_count;
2998 mutex_unlock(&dev->mode_config.mutex);
3000 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
3003 out_resp->encoder_id = encoder->base.id;
3005 out_resp->encoder_id = 0;
3010 ret = drm_mode_object_get_properties(&connector->base, file_priv->atomic,
3011 (uint32_t __user *)(unsigned long)(out_resp->props_ptr),
3012 (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr),
3013 &out_resp->count_props);
3014 drm_modeset_unlock(&dev->mode_config.connection_mutex);
3023 * drm_connector_find_by_fwnode - Find a connector based on the associated fwnode
3035 struct drm_connector *connector, *found = ERR_PTR(-ENODEV);
3038 return ERR_PTR(-ENODEV);
3043 if (connector->fwnode == fwnode ||
3044 (connector->fwnode && connector->fwnode->secondary == fwnode)) {
3057 * drm_connector_oob_hotplug_event - Report out-of-band hotplug event to connector
3061 * driver / device. An example of this is some USB Type-C setups where the hardware
3062 * muxes the DisplayPort data and aux-lines but does not pass the altmode HPD
3065 * This function can be used to report these out-of-band events after obtaining
3076 if (connector->funcs->oob_hotplug_event)
3077 connector->funcs->oob_hotplug_event(connector);
3088 * identifier. Tiled monitors using DisplayID v1.3 have a unique 8-byte handle,
3093 * the tile group information is exposed through a non-standard way.
3099 struct drm_device *dev = tg->dev;
3101 mutex_lock(&dev->mode_config.idr_mutex);
3102 idr_remove(&dev->mode_config.tile_idr, tg->id);
3103 mutex_unlock(&dev->mode_config.idr_mutex);
3108 * drm_mode_put_tile_group - drop a reference to a tile group.
3117 kref_put(&tg->refcount, drm_tile_group_free);
3122 * drm_mode_get_tile_group - get a reference to an existing tile group
3124 * @topology: 8-bytes unique per monitor.
3137 mutex_lock(&dev->mode_config.idr_mutex);
3138 idr_for_each_entry(&dev->mode_config.tile_idr, tg, id) {
3139 if (!memcmp(tg->group_data, topology, 8)) {
3140 if (!kref_get_unless_zero(&tg->refcount))
3142 mutex_unlock(&dev->mode_config.idr_mutex);
3146 mutex_unlock(&dev->mode_config.idr_mutex);
3152 * drm_mode_create_tile_group - create a tile group from a displayid description
3154 * @topology: 8-bytes unique per monitor.
3172 kref_init(&tg->refcount);
3173 memcpy(tg->group_data, topology, 8);
3174 tg->dev = dev;
3176 mutex_lock(&dev->mode_config.idr_mutex);
3177 ret = idr_alloc(&dev->mode_config.tile_idr, tg, 1, 0, GFP_KERNEL);
3179 tg->id = ret;
3185 mutex_unlock(&dev->mode_config.idr_mutex);