Lines Matching refs:connector

56  * track of a per-connector hpd interrupt.
90 struct drm_connector *connector,
94 struct drm_device *dev = connector->dev;
98 /* Step 1: Validate against connector */
99 ret = drm_connector_mode_valid(connector, mode, ctx, status);
104 drm_connector_for_each_possible_encoder(connector, encoder) {
119 &connector->display_info,
144 static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector)
149 cmdline_mode = &connector->cmdline_mode;
154 list_for_each_entry(mode, &connector->probed_modes, head) {
170 mode = drm_mode_create_from_cmdline_mode(connector->dev,
175 drm_mode_probed_add(connector, mode);
203 drm_connector_mode_valid(struct drm_connector *connector,
209 connector->helper_private;
215 ret = connector_funcs->mode_valid_ctx(connector, mode, ctx,
218 *status = connector_funcs->mode_valid(connector, mode);
227 struct drm_connector *connector;
231 drm_for_each_connector_iter(connector, &conn_iter) {
233 connector->helper_private;
236 funcs->disable_hpd(connector);
244 struct drm_connector *connector;
248 drm_for_each_connector_iter(connector, &conn_iter) {
250 connector->helper_private;
253 funcs->enable_hpd(connector);
255 if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT |
322 * connector has been enabled.
324 * Drivers must call this helper after enabling polling for a connector by
327 * flags for a connector will stop the output polling work automatically if
341 drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force)
343 const struct drm_connector_helper_funcs *funcs = connector->helper_private;
350 ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex, &ctx);
353 ret = funcs->detect_ctx(connector, &ctx, force);
354 else if (connector->funcs->detect)
355 ret = connector->funcs->detect(connector, force);
368 if (ret != connector->status)
369 connector->epoch_counter += 1;
378 * drm_helper_probe_detect - probe connector status
379 * @connector: connector to probe
383 * This function calls the detect callbacks of the connector.
388 drm_helper_probe_detect(struct drm_connector *connector,
392 const struct drm_connector_helper_funcs *funcs = connector->helper_private;
393 struct drm_device *dev = connector->dev;
397 return drm_helper_probe_detect_ctx(connector, force);
404 ret = funcs->detect_ctx(connector, ctx, force);
405 else if (connector->funcs->detect)
406 ret = connector->funcs->detect(connector, force);
410 if (ret != connector->status)
411 connector->epoch_counter += 1;
417 static int drm_helper_probe_get_modes(struct drm_connector *connector)
420 connector->helper_private;
423 count = connector_funcs->get_modes(connector);
427 drm_err(connector->dev, ".get_modes() returned %pe\n",
436 if (count == 0 && connector->status == connector_status_connected)
437 count = drm_edid_override_connector_update(connector);
442 static int __drm_helper_update_and_validate(struct drm_connector *connector,
446 struct drm_device *dev = connector->dev;
451 drm_connector_list_update(connector);
453 if (connector->interlace_allowed)
455 if (connector->doublescan_allowed)
457 if (connector->stereo_allowed)
460 list_for_each_entry(mode, &connector->modes, head) {
476 ret = drm_mode_validate_pipeline(mode, connector, ctx,
491 mode->status = drm_mode_validate_ycbcr420(mode, connector);
499 * @connector: connector to probe
503 * Based on the helper callbacks implemented by @connector in struct
505 * be added to the connector's probed_modes list, then culled (based on validity
514 * 1. All modes currently on the connector's modes list are marked as stale
516 * 2. New modes are added to the connector's probed_modes list with
521 * - if the connector status is connector_status_connected, standard
539 * - drm_mode_validate_flag() checks the modes against basic connector
549 * 5. Any mode whose status is not OK is pruned from the connector's modes list,
554 * The number of modes found on @connector.
556 int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
559 struct drm_device *dev = connector->dev;
569 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
570 connector->name);
581 list_for_each_entry(mode, &connector->modes, head)
584 old_status = connector->status;
586 if (connector->force) {
587 if (connector->force == DRM_FORCE_ON ||
588 connector->force == DRM_FORCE_ON_DIGITAL)
589 connector->status = connector_status_connected;
591 connector->status = connector_status_disconnected;
592 if (connector->funcs->force)
593 connector->funcs->force(connector);
595 ret = drm_helper_probe_detect(connector, &ctx, true);
600 } else if (WARN(ret < 0, "Invalid return value %i for connector detection\n", ret))
603 connector->status = ret;
612 if (old_status != connector->status) {
614 connector->base.id,
615 connector->name,
617 drm_get_connector_status_name(connector->status));
639 if (connector->status == connector_status_disconnected) {
641 connector->base.id, connector->name);
642 drm_connector_update_edid_property(connector, NULL);
643 drm_mode_prune_invalid(dev, &connector->modes, false);
647 count = drm_helper_probe_get_modes(connector);
649 if (count == 0 && (connector->status == connector_status_connected ||
650 connector->status == connector_status_unknown)) {
651 count = drm_add_modes_noedid(connector, 1024, 768);
658 if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort)
659 drm_set_preferred_mode(connector, 640, 480);
661 count += drm_helper_probe_add_cmdline_mode(connector);
663 ret = __drm_helper_update_and_validate(connector, maxX, maxY, &ctx);
670 drm_mode_prune_invalid(dev, &connector->modes, true);
679 if (list_empty(&connector->modes) &&
680 connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) {
681 count = drm_add_modes_noedid(connector, 640, 480);
682 ret = __drm_helper_update_and_validate(connector, maxX, maxY, &ctx);
687 drm_mode_prune_invalid(dev, &connector->modes, true);
694 if (list_empty(&connector->modes))
697 drm_mode_sort(&connector->modes);
699 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id,
700 connector->name);
701 list_for_each_entry(mode, &connector->modes, head) {
712 * @dev: drm_device whose connector state changed
726 * If only a single connector has changed, consider calling
741 * drm_kms_helper_connector_hotplug_event - fire off a KMS connector hotplug event
742 * @connector: drm_connector which has changed
745 * fine-grained uevent for a single connector.
747 void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector)
749 struct drm_device *dev = connector->dev;
752 drm_sysfs_connector_hotplug_event(connector);
764 struct drm_connector *connector;
791 drm_for_each_connector_iter(connector, &conn_iter) {
793 if (connector->force)
798 if (!connector->polled || connector->polled == DRM_CONNECTOR_POLL_HPD)
801 old_status = connector->status;
805 !(connector->polled & DRM_CONNECTOR_POLL_DISCONNECT))
810 old_epoch_counter = connector->epoch_counter;
811 connector->status = drm_helper_probe_detect(connector, NULL, false);
812 if (old_epoch_counter != connector->epoch_counter) {
828 if (connector->status == connector_status_unknown) {
829 connector->status = old_status;
834 new = drm_get_connector_status_name(connector->status);
838 connector->base.id,
839 connector->name,
842 connector->base.id, connector->name,
843 old_epoch_counter, connector->epoch_counter);
870 * connector ->detect hook.
927 * Note that a connector can be both polled and probed from the hotplug handler,
954 static bool check_connector_changed(struct drm_connector *connector)
956 struct drm_device *dev = connector->dev;
961 drm_WARN_ON(dev, !(connector->polled & DRM_CONNECTOR_POLL_HPD));
965 old_status = connector->status;
966 old_epoch_counter = connector->epoch_counter;
967 connector->status = drm_helper_probe_detect(connector, NULL, false);
969 if (old_epoch_counter == connector->epoch_counter) {
971 connector->base.id,
972 connector->name,
973 connector->epoch_counter);
979 connector->base.id,
980 connector->name,
982 drm_get_connector_status_name(connector->status));
985 connector->base.id,
986 connector->name,
988 connector->epoch_counter);
995 * @connector: drm_connector
997 * Drivers can use this helper function to run a detect cycle on a connector
1001 * interrupts for a single connector. Drivers that want to send a
1003 * per connector need to use drm_helper_hpd_irq_event().
1008 * Note that a connector can be both polled and probed from the hotplug
1012 * A boolean indicating whether the connector status changed or not
1014 bool drm_connector_helper_hpd_irq_event(struct drm_connector *connector)
1016 struct drm_device *dev = connector->dev;
1020 changed = check_connector_changed(connector);
1024 drm_kms_helper_connector_hotplug_event(connector);
1026 connector->base.id,
1027 connector->name);
1044 * interrupts for each connector.
1046 * Drivers which support hotplug interrupts for each connector individually and
1049 * code and directly call drm_kms_helper_hotplug_event() in case the connector
1055 * Note that a connector can be both polled and probed from the hotplug handler,
1059 * A boolean indicating whether the connector status changed or not
1063 struct drm_connector *connector, *first_changed_connector = NULL;
1072 drm_for_each_connector_iter(connector, &conn_iter) {
1074 if (!(connector->polled & DRM_CONNECTOR_POLL_HPD))
1077 if (check_connector_changed(connector)) {
1079 drm_connector_get(connector);
1080 first_changed_connector = connector;
1126 * drm_connector_helper_get_modes_fixed - Duplicates a display mode for a connector
1127 * @connector: the connector
1130 * This function duplicates a display modes for a connector. Drivers for hardware
1131 * that only supports a single fixed mode can use this function in their connector's
1137 int drm_connector_helper_get_modes_fixed(struct drm_connector *connector,
1140 struct drm_device *dev = connector->dev;
1154 drm_mode_probed_add(connector, mode);
1157 connector->display_info.width_mm = mode->width_mm;
1159 connector->display_info.height_mm = mode->height_mm;
1166 * drm_connector_helper_get_modes - Read EDID and update connector.
1167 * @connector: The connector
1169 * Read the EDID using drm_edid_read() (which requires that connector->ddc is
1170 * set), and update the connector using the EDID.
1172 * This can be used as the "default" connector helper .get_modes() hook if the
1174 * custom .get_modes() hooks should do regarding EDID read and connector update.
1178 int drm_connector_helper_get_modes(struct drm_connector *connector)
1183 drm_edid = drm_edid_read(connector);
1186 * Unconditionally update the connector. If the EDID was read
1187 * successfully, fill in the connector information derived from the
1188 * EDID. Otherwise, if the EDID is NULL, clear the connector
1191 drm_edid_connector_update(connector, drm_edid);
1193 count = drm_edid_connector_add_modes(connector);
1202 * drm_connector_helper_tv_get_modes - Fills the modes availables to a TV connector
1203 * @connector: The connector
1205 * Fills the available modes for a TV connector based on the supported
1208 * This can be used as the default TV connector helper .get_modes() hook
1212 * The number of modes added to the connector.
1214 int drm_connector_helper_tv_get_modes(struct drm_connector *connector)
1216 struct drm_device *dev = connector->dev;
1219 struct drm_cmdline_mode *cmdline = &connector->cmdline_mode;
1240 if (drm_object_property_get_default_value(&connector->base,
1276 drm_mode_probed_add(connector, mode);