Lines Matching full:connector

57  * track of a per-connector hpd interrupt.
91 struct drm_connector *connector, in drm_mode_validate_pipeline() argument
95 struct drm_device *dev = connector->dev; in drm_mode_validate_pipeline()
99 /* Step 1: Validate against connector */ in drm_mode_validate_pipeline()
100 ret = drm_connector_mode_valid(connector, mode, ctx, status); in drm_mode_validate_pipeline()
105 drm_connector_for_each_possible_encoder(connector, encoder) { in drm_mode_validate_pipeline()
120 &connector->display_info, in drm_mode_validate_pipeline()
145 static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector) in drm_helper_probe_add_cmdline_mode() argument
150 cmdline_mode = &connector->cmdline_mode; in drm_helper_probe_add_cmdline_mode()
155 list_for_each_entry(mode, &connector->probed_modes, head) { in drm_helper_probe_add_cmdline_mode()
171 mode = drm_mode_create_from_cmdline_mode(connector->dev, in drm_helper_probe_add_cmdline_mode()
176 drm_mode_probed_add(connector, mode); in drm_helper_probe_add_cmdline_mode()
204 drm_connector_mode_valid(struct drm_connector *connector, in drm_connector_mode_valid() argument
210 connector->helper_private; in drm_connector_mode_valid()
216 ret = connector_funcs->mode_valid_ctx(connector, mode, ctx, in drm_connector_mode_valid()
219 *status = connector_funcs->mode_valid(connector, mode); in drm_connector_mode_valid()
245 struct drm_connector *connector; in drm_kms_helper_poll_enable() local
253 drm_for_each_connector_iter(connector, &conn_iter) { in drm_kms_helper_poll_enable()
254 if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | in drm_kms_helper_poll_enable()
281 drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force) in drm_helper_probe_detect_ctx() argument
283 const struct drm_connector_helper_funcs *funcs = connector->helper_private; in drm_helper_probe_detect_ctx()
290 ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex, &ctx); in drm_helper_probe_detect_ctx()
293 ret = funcs->detect_ctx(connector, &ctx, force); in drm_helper_probe_detect_ctx()
294 else if (connector->funcs->detect) in drm_helper_probe_detect_ctx()
295 ret = connector->funcs->detect(connector, force); in drm_helper_probe_detect_ctx()
308 if (ret != connector->status) in drm_helper_probe_detect_ctx()
309 connector->epoch_counter += 1; in drm_helper_probe_detect_ctx()
318 * drm_helper_probe_detect - probe connector status
319 * @connector: connector to probe
323 * This function calls the detect callbacks of the connector.
328 drm_helper_probe_detect(struct drm_connector *connector, in drm_helper_probe_detect() argument
332 const struct drm_connector_helper_funcs *funcs = connector->helper_private; in drm_helper_probe_detect()
333 struct drm_device *dev = connector->dev; in drm_helper_probe_detect()
337 return drm_helper_probe_detect_ctx(connector, force); in drm_helper_probe_detect()
344 ret = funcs->detect_ctx(connector, ctx, force); in drm_helper_probe_detect()
345 else if (connector->funcs->detect) in drm_helper_probe_detect()
346 ret = connector->funcs->detect(connector, force); in drm_helper_probe_detect()
350 if (ret != connector->status) in drm_helper_probe_detect()
351 connector->epoch_counter += 1; in drm_helper_probe_detect()
357 static int drm_helper_probe_get_modes(struct drm_connector *connector) in drm_helper_probe_get_modes() argument
360 connector->helper_private; in drm_helper_probe_get_modes()
363 count = connector_funcs->get_modes(connector); in drm_helper_probe_get_modes()
369 if (count == 0 && connector->status == connector_status_connected) in drm_helper_probe_get_modes()
370 count = drm_add_override_edid_modes(connector); in drm_helper_probe_get_modes()
375 static int __drm_helper_update_and_validate(struct drm_connector *connector, in __drm_helper_update_and_validate() argument
379 struct drm_device *dev = connector->dev; in __drm_helper_update_and_validate()
384 drm_connector_list_update(connector); in __drm_helper_update_and_validate()
386 if (connector->interlace_allowed) in __drm_helper_update_and_validate()
388 if (connector->doublescan_allowed) in __drm_helper_update_and_validate()
390 if (connector->stereo_allowed) in __drm_helper_update_and_validate()
393 list_for_each_entry(mode, &connector->modes, head) { in __drm_helper_update_and_validate()
409 ret = drm_mode_validate_pipeline(mode, connector, ctx, in __drm_helper_update_and_validate()
424 mode->status = drm_mode_validate_ycbcr420(mode, connector); in __drm_helper_update_and_validate()
432 * @connector: connector to probe
436 * Based on the helper callbacks implemented by @connector in struct
438 * be added to the connector's probed_modes list, then culled (based on validity
447 * 1. All modes currently on the connector's modes list are marked as stale
449 * 2. New modes are added to the connector's probed_modes list with
454 * - if the connector status is connector_status_connected, standard
472 * - drm_mode_validate_flag() checks the modes against basic connector
482 * 5. Any mode whose status is not OK is pruned from the connector's modes list,
487 * The number of modes found on @connector.
489 int drm_helper_probe_single_connector_modes(struct drm_connector *connector, in drm_helper_probe_single_connector_modes() argument
492 struct drm_device *dev = connector->dev; in drm_helper_probe_single_connector_modes()
502 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, in drm_helper_probe_single_connector_modes()
503 connector->name); in drm_helper_probe_single_connector_modes()
514 list_for_each_entry(mode, &connector->modes, head) in drm_helper_probe_single_connector_modes()
517 old_status = connector->status; in drm_helper_probe_single_connector_modes()
519 if (connector->force) { in drm_helper_probe_single_connector_modes()
520 if (connector->force == DRM_FORCE_ON || in drm_helper_probe_single_connector_modes()
521 connector->force == DRM_FORCE_ON_DIGITAL) in drm_helper_probe_single_connector_modes()
522 connector->status = connector_status_connected; in drm_helper_probe_single_connector_modes()
524 connector->status = connector_status_disconnected; in drm_helper_probe_single_connector_modes()
525 if (connector->funcs->force) in drm_helper_probe_single_connector_modes()
526 connector->funcs->force(connector); in drm_helper_probe_single_connector_modes()
528 ret = drm_helper_probe_detect(connector, &ctx, true); in drm_helper_probe_single_connector_modes()
533 } else if (WARN(ret < 0, "Invalid return value %i for connector detection\n", ret)) in drm_helper_probe_single_connector_modes()
536 connector->status = ret; in drm_helper_probe_single_connector_modes()
545 if (old_status != connector->status) { in drm_helper_probe_single_connector_modes()
546 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n", in drm_helper_probe_single_connector_modes()
547 connector->base.id, in drm_helper_probe_single_connector_modes()
548 connector->name, in drm_helper_probe_single_connector_modes()
550 drm_get_connector_status_name(connector->status)); in drm_helper_probe_single_connector_modes()
570 if (connector->status == connector_status_disconnected) { in drm_helper_probe_single_connector_modes()
571 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n", in drm_helper_probe_single_connector_modes()
572 connector->base.id, connector->name); in drm_helper_probe_single_connector_modes()
573 drm_connector_update_edid_property(connector, NULL); in drm_helper_probe_single_connector_modes()
574 drm_mode_prune_invalid(dev, &connector->modes, false); in drm_helper_probe_single_connector_modes()
578 count = drm_helper_probe_get_modes(connector); in drm_helper_probe_single_connector_modes()
580 if (count == 0 && (connector->status == connector_status_connected || in drm_helper_probe_single_connector_modes()
581 connector->status == connector_status_unknown)) { in drm_helper_probe_single_connector_modes()
582 count = drm_add_modes_noedid(connector, 1024, 768); in drm_helper_probe_single_connector_modes()
589 if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) in drm_helper_probe_single_connector_modes()
590 drm_set_preferred_mode(connector, 640, 480); in drm_helper_probe_single_connector_modes()
592 count += drm_helper_probe_add_cmdline_mode(connector); in drm_helper_probe_single_connector_modes()
594 ret = __drm_helper_update_and_validate(connector, maxX, maxY, &ctx); in drm_helper_probe_single_connector_modes()
601 drm_mode_prune_invalid(dev, &connector->modes, true); in drm_helper_probe_single_connector_modes()
610 if (list_empty(&connector->modes) && in drm_helper_probe_single_connector_modes()
611 connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) { in drm_helper_probe_single_connector_modes()
612 count = drm_add_modes_noedid(connector, 640, 480); in drm_helper_probe_single_connector_modes()
613 ret = __drm_helper_update_and_validate(connector, maxX, maxY, &ctx); in drm_helper_probe_single_connector_modes()
618 drm_mode_prune_invalid(dev, &connector->modes, true); in drm_helper_probe_single_connector_modes()
625 if (list_empty(&connector->modes)) in drm_helper_probe_single_connector_modes()
628 drm_mode_sort(&connector->modes); in drm_helper_probe_single_connector_modes()
630 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id, in drm_helper_probe_single_connector_modes()
631 connector->name); in drm_helper_probe_single_connector_modes()
632 list_for_each_entry(mode, &connector->modes, head) { in drm_helper_probe_single_connector_modes()
643 * @dev: drm_device whose connector state changed
657 * If only a single connector has changed, consider calling
672 * drm_kms_helper_connector_hotplug_event - fire off a KMS connector hotplug event
673 * @connector: drm_connector which has changed
676 * fine-grained uevent for a single connector.
678 void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector) in drm_kms_helper_connector_hotplug_event() argument
680 struct drm_device *dev = connector->dev; in drm_kms_helper_connector_hotplug_event()
683 drm_sysfs_connector_hotplug_event(connector); in drm_kms_helper_connector_hotplug_event()
695 struct drm_connector *connector; in output_poll_execute() local
717 drm_for_each_connector_iter(connector, &conn_iter) { in output_poll_execute()
719 if (connector->force) in output_poll_execute()
724 if (!connector->polled || connector->polled == DRM_CONNECTOR_POLL_HPD) in output_poll_execute()
727 old_status = connector->status; in output_poll_execute()
731 !(connector->polled & DRM_CONNECTOR_POLL_DISCONNECT)) in output_poll_execute()
736 old_epoch_counter = connector->epoch_counter; in output_poll_execute()
737 connector->status = drm_helper_probe_detect(connector, NULL, false); in output_poll_execute()
738 if (old_epoch_counter != connector->epoch_counter) { in output_poll_execute()
754 if (connector->status == connector_status_unknown) { in output_poll_execute()
755 connector->status = old_status; in output_poll_execute()
760 new = drm_get_connector_status_name(connector->status); in output_poll_execute()
762 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] " in output_poll_execute()
764 connector->base.id, in output_poll_execute()
765 connector->name, in output_poll_execute()
767 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n", in output_poll_execute()
768 connector->base.id, connector->name, in output_poll_execute()
769 old_epoch_counter, connector->epoch_counter); in output_poll_execute()
796 * connector ->detect hook.
844 * Note that a connector can be both polled and probed from the hotplug handler,
870 static bool check_connector_changed(struct drm_connector *connector) in check_connector_changed() argument
872 struct drm_device *dev = connector->dev; in check_connector_changed()
877 drm_WARN_ON(dev, !(connector->polled & DRM_CONNECTOR_POLL_HPD)); in check_connector_changed()
881 old_status = connector->status; in check_connector_changed()
882 old_epoch_counter = connector->epoch_counter; in check_connector_changed()
883 connector->status = drm_helper_probe_detect(connector, NULL, false); in check_connector_changed()
885 if (old_epoch_counter == connector->epoch_counter) { in check_connector_changed()
886 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Same epoch counter %llu\n", in check_connector_changed()
887 connector->base.id, in check_connector_changed()
888 connector->name, in check_connector_changed()
889 connector->epoch_counter); in check_connector_changed()
894 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] status updated from %s to %s\n", in check_connector_changed()
895 connector->base.id, in check_connector_changed()
896 connector->name, in check_connector_changed()
898 drm_get_connector_status_name(connector->status)); in check_connector_changed()
900 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Changed epoch counter %llu => %llu\n", in check_connector_changed()
901 connector->base.id, in check_connector_changed()
902 connector->name, in check_connector_changed()
904 connector->epoch_counter); in check_connector_changed()
911 * @connector: drm_connector
913 * Drivers can use this helper function to run a detect cycle on a connector
917 * interrupts for a single connector. Drivers that want to send a
919 * per connector need to use drm_helper_hpd_irq_event().
924 * Note that a connector can be both polled and probed from the hotplug
928 * A boolean indicating whether the connector status changed or not
930 bool drm_connector_helper_hpd_irq_event(struct drm_connector *connector) in drm_connector_helper_hpd_irq_event() argument
932 struct drm_device *dev = connector->dev; in drm_connector_helper_hpd_irq_event()
936 changed = check_connector_changed(connector); in drm_connector_helper_hpd_irq_event()
940 drm_kms_helper_connector_hotplug_event(connector); in drm_connector_helper_hpd_irq_event()
941 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Sent hotplug event\n", in drm_connector_helper_hpd_irq_event()
942 connector->base.id, in drm_connector_helper_hpd_irq_event()
943 connector->name); in drm_connector_helper_hpd_irq_event()
960 * interrupts for each connector.
962 * Drivers which support hotplug interrupts for each connector individually and
965 * code and directly call drm_kms_helper_hotplug_event() in case the connector
971 * Note that a connector can be both polled and probed from the hotplug handler,
975 * A boolean indicating whether the connector status changed or not
979 struct drm_connector *connector, *first_changed_connector = NULL; in drm_helper_hpd_irq_event() local
988 drm_for_each_connector_iter(connector, &conn_iter) { in drm_helper_hpd_irq_event()
990 if (!(connector->polled & DRM_CONNECTOR_POLL_HPD)) in drm_helper_hpd_irq_event()
993 if (check_connector_changed(connector)) { in drm_helper_hpd_irq_event()
995 drm_connector_get(connector); in drm_helper_hpd_irq_event()
996 first_changed_connector = connector; in drm_helper_hpd_irq_event()
1042 * drm_connector_helper_get_modes_from_ddc - Updates the connector's EDID
1043 * property from the connector's
1045 * @connector: The connector
1050 * Uses a connector's DDC channel to retrieve EDID data and update the
1051 * connector's EDID property and display modes. Drivers can use this
1055 int drm_connector_helper_get_modes_from_ddc(struct drm_connector *connector) in drm_connector_helper_get_modes_from_ddc() argument
1060 if (!connector->ddc) in drm_connector_helper_get_modes_from_ddc()
1063 edid = drm_get_edid(connector, connector->ddc); in drm_connector_helper_get_modes_from_ddc()
1066 drm_connector_update_edid_property(connector, edid); in drm_connector_helper_get_modes_from_ddc()
1069 count = drm_add_edid_modes(connector, edid); in drm_connector_helper_get_modes_from_ddc()
1078 * drm_connector_helper_get_modes_fixed - Duplicates a display mode for a connector
1079 * @connector: the connector
1082 * This function duplicates a display modes for a connector. Drivers for hardware
1083 * that only supports a single fixed mode can use this function in their connector's
1089 int drm_connector_helper_get_modes_fixed(struct drm_connector *connector, in drm_connector_helper_get_modes_fixed() argument
1092 struct drm_device *dev = connector->dev; in drm_connector_helper_get_modes_fixed()
1106 drm_mode_probed_add(connector, mode); in drm_connector_helper_get_modes_fixed()
1109 connector->display_info.width_mm = mode->width_mm; in drm_connector_helper_get_modes_fixed()
1111 connector->display_info.height_mm = mode->height_mm; in drm_connector_helper_get_modes_fixed()
1118 * drm_connector_helper_get_modes - Read EDID and update connector.
1119 * @connector: The connector
1121 * Read the EDID using drm_edid_read() (which requires that connector->ddc is
1122 * set), and update the connector using the EDID.
1124 * This can be used as the "default" connector helper .get_modes() hook if the
1126 * custom .get_modes() hooks should do regarding EDID read and connector update.
1130 int drm_connector_helper_get_modes(struct drm_connector *connector) in drm_connector_helper_get_modes() argument
1135 drm_edid = drm_edid_read(connector); in drm_connector_helper_get_modes()
1138 * Unconditionally update the connector. If the EDID was read in drm_connector_helper_get_modes()
1139 * successfully, fill in the connector information derived from the in drm_connector_helper_get_modes()
1140 * EDID. Otherwise, if the EDID is NULL, clear the connector in drm_connector_helper_get_modes()
1143 count = drm_edid_connector_update(connector, drm_edid); in drm_connector_helper_get_modes()