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()
228 struct drm_connector *connector; in drm_kms_helper_disable_hpd() local
232 drm_for_each_connector_iter(connector, &conn_iter) { in drm_kms_helper_disable_hpd()
234 connector->helper_private; in drm_kms_helper_disable_hpd()
237 funcs->disable_hpd(connector); in drm_kms_helper_disable_hpd()
245 struct drm_connector *connector; in drm_kms_helper_enable_hpd() local
249 drm_for_each_connector_iter(connector, &conn_iter) { in drm_kms_helper_enable_hpd()
251 connector->helper_private; in drm_kms_helper_enable_hpd()
254 funcs->enable_hpd(connector); in drm_kms_helper_enable_hpd()
256 if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | in drm_kms_helper_enable_hpd()
323 * connector has been enabled.
325 * Drivers must call this helper after enabling polling for a connector by
328 * flags for a connector will stop the output polling work automatically if
342 drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force) in drm_helper_probe_detect_ctx() argument
344 const struct drm_connector_helper_funcs *funcs = connector->helper_private; in drm_helper_probe_detect_ctx()
351 ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex, &ctx); in drm_helper_probe_detect_ctx()
354 ret = funcs->detect_ctx(connector, &ctx, force); in drm_helper_probe_detect_ctx()
355 else if (connector->funcs->detect) in drm_helper_probe_detect_ctx()
356 ret = connector->funcs->detect(connector, force); in drm_helper_probe_detect_ctx()
369 if (ret != connector->status) in drm_helper_probe_detect_ctx()
370 connector->epoch_counter += 1; in drm_helper_probe_detect_ctx()
379 * drm_helper_probe_detect - probe connector status
380 * @connector: connector to probe
384 * This function calls the detect callbacks of the connector.
389 drm_helper_probe_detect(struct drm_connector *connector, in drm_helper_probe_detect() argument
393 const struct drm_connector_helper_funcs *funcs = connector->helper_private; in drm_helper_probe_detect()
394 struct drm_device *dev = connector->dev; in drm_helper_probe_detect()
398 return drm_helper_probe_detect_ctx(connector, force); in drm_helper_probe_detect()
405 ret = funcs->detect_ctx(connector, ctx, force); in drm_helper_probe_detect()
406 else if (connector->funcs->detect) in drm_helper_probe_detect()
407 ret = connector->funcs->detect(connector, force); in drm_helper_probe_detect()
411 if (ret != connector->status) in drm_helper_probe_detect()
412 connector->epoch_counter += 1; in drm_helper_probe_detect()
418 static int drm_helper_probe_get_modes(struct drm_connector *connector) in drm_helper_probe_get_modes() argument
421 connector->helper_private; in drm_helper_probe_get_modes()
424 count = connector_funcs->get_modes(connector); in drm_helper_probe_get_modes()
428 drm_err(connector->dev, ".get_modes() returned %pe\n", in drm_helper_probe_get_modes()
437 if (count == 0 && connector->status == connector_status_connected) in drm_helper_probe_get_modes()
438 count = drm_edid_override_connector_update(connector); in drm_helper_probe_get_modes()
443 static int __drm_helper_update_and_validate(struct drm_connector *connector, in __drm_helper_update_and_validate() argument
447 struct drm_device *dev = connector->dev; in __drm_helper_update_and_validate()
452 drm_connector_list_update(connector); in __drm_helper_update_and_validate()
454 if (connector->interlace_allowed) in __drm_helper_update_and_validate()
456 if (connector->doublescan_allowed) in __drm_helper_update_and_validate()
458 if (connector->stereo_allowed) in __drm_helper_update_and_validate()
461 list_for_each_entry(mode, &connector->modes, head) { in __drm_helper_update_and_validate()
477 mode->status = drm_mode_validate_ycbcr420(mode, connector); in __drm_helper_update_and_validate()
481 ret = drm_mode_validate_pipeline(mode, connector, ctx, in __drm_helper_update_and_validate()
500 * @connector: connector to probe
504 * Based on the helper callbacks implemented by @connector in struct
506 * be added to the connector's probed_modes list, then culled (based on validity
515 * 1. All modes currently on the connector's modes list are marked as stale
517 * 2. New modes are added to the connector's probed_modes list with
522 * - if the connector status is connector_status_connected, standard
540 * - drm_mode_validate_flag() checks the modes against basic connector
550 * 5. Any mode whose status is not OK is pruned from the connector's modes list,
555 * The number of modes found on @connector.
557 int drm_helper_probe_single_connector_modes(struct drm_connector *connector, in drm_helper_probe_single_connector_modes() argument
560 struct drm_device *dev = connector->dev; in drm_helper_probe_single_connector_modes()
570 drm_dbg_kms(dev, "[CONNECTOR:%d:%s]\n", connector->base.id, in drm_helper_probe_single_connector_modes()
571 connector->name); in drm_helper_probe_single_connector_modes()
582 list_for_each_entry(mode, &connector->modes, head) in drm_helper_probe_single_connector_modes()
585 old_status = connector->status; in drm_helper_probe_single_connector_modes()
587 if (connector->force) { in drm_helper_probe_single_connector_modes()
588 if (connector->force == DRM_FORCE_ON || in drm_helper_probe_single_connector_modes()
589 connector->force == DRM_FORCE_ON_DIGITAL) in drm_helper_probe_single_connector_modes()
590 connector->status = connector_status_connected; in drm_helper_probe_single_connector_modes()
592 connector->status = connector_status_disconnected; in drm_helper_probe_single_connector_modes()
593 if (connector->funcs->force) in drm_helper_probe_single_connector_modes()
594 connector->funcs->force(connector); in drm_helper_probe_single_connector_modes()
596 ret = drm_helper_probe_detect(connector, &ctx, true); in drm_helper_probe_single_connector_modes()
601 } else if (WARN(ret < 0, "Invalid return value %i for connector detection\n", ret)) in drm_helper_probe_single_connector_modes()
604 connector->status = ret; in drm_helper_probe_single_connector_modes()
613 if (old_status != connector->status) { in drm_helper_probe_single_connector_modes()
614 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] status updated from %s to %s\n", in drm_helper_probe_single_connector_modes()
615 connector->base.id, connector->name, in drm_helper_probe_single_connector_modes()
617 drm_get_connector_status_name(connector->status)); in drm_helper_probe_single_connector_modes()
639 if (connector->status == connector_status_disconnected) { in drm_helper_probe_single_connector_modes()
640 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] disconnected\n", in drm_helper_probe_single_connector_modes()
641 connector->base.id, connector->name); in drm_helper_probe_single_connector_modes()
642 drm_connector_update_edid_property(connector, NULL); in drm_helper_probe_single_connector_modes()
643 drm_mode_prune_invalid(dev, &connector->modes, false); in drm_helper_probe_single_connector_modes()
647 count = drm_helper_probe_get_modes(connector); in drm_helper_probe_single_connector_modes()
649 if (count == 0 && (connector->status == connector_status_connected || in drm_helper_probe_single_connector_modes()
650 connector->status == connector_status_unknown)) { in drm_helper_probe_single_connector_modes()
651 count = drm_add_modes_noedid(connector, 1024, 768); in drm_helper_probe_single_connector_modes()
658 if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) in drm_helper_probe_single_connector_modes()
659 drm_set_preferred_mode(connector, 640, 480); in drm_helper_probe_single_connector_modes()
661 count += drm_helper_probe_add_cmdline_mode(connector); in drm_helper_probe_single_connector_modes()
663 ret = __drm_helper_update_and_validate(connector, maxX, maxY, &ctx); in drm_helper_probe_single_connector_modes()
670 drm_mode_prune_invalid(dev, &connector->modes, true); in drm_helper_probe_single_connector_modes()
679 if (list_empty(&connector->modes) && in drm_helper_probe_single_connector_modes()
680 connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) { in drm_helper_probe_single_connector_modes()
681 count = drm_add_modes_noedid(connector, 640, 480); in drm_helper_probe_single_connector_modes()
682 ret = __drm_helper_update_and_validate(connector, maxX, maxY, &ctx); in drm_helper_probe_single_connector_modes()
687 drm_mode_prune_invalid(dev, &connector->modes, true); in drm_helper_probe_single_connector_modes()
694 if (list_empty(&connector->modes)) in drm_helper_probe_single_connector_modes()
697 drm_mode_sort(&connector->modes); in drm_helper_probe_single_connector_modes()
699 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] probed modes:\n", in drm_helper_probe_single_connector_modes()
700 connector->base.id, connector->name); in drm_helper_probe_single_connector_modes()
702 list_for_each_entry(mode, &connector->modes, head) { in drm_helper_probe_single_connector_modes()
714 * @dev: drm_device whose connector state changed
728 * If only a single connector has changed, consider calling
739 * drm_kms_helper_connector_hotplug_event - fire off a KMS connector hotplug event
740 * @connector: drm_connector which has changed
743 * fine-grained uevent for a single connector.
745 void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector) in drm_kms_helper_connector_hotplug_event() argument
747 struct drm_device *dev = connector->dev; in drm_kms_helper_connector_hotplug_event()
749 drm_sysfs_connector_hotplug_event(connector); in drm_kms_helper_connector_hotplug_event()
758 struct drm_connector *connector; in output_poll_execute() local
785 drm_for_each_connector_iter(connector, &conn_iter) { in output_poll_execute()
787 if (connector->force) in output_poll_execute()
792 if (!connector->polled || connector->polled == DRM_CONNECTOR_POLL_HPD) in output_poll_execute()
795 old_status = connector->status; in output_poll_execute()
799 !(connector->polled & DRM_CONNECTOR_POLL_DISCONNECT)) in output_poll_execute()
804 old_epoch_counter = connector->epoch_counter; in output_poll_execute()
805 connector->status = drm_helper_probe_detect(connector, NULL, false); in output_poll_execute()
806 if (old_epoch_counter != connector->epoch_counter) { in output_poll_execute()
822 if (connector->status == connector_status_unknown) { in output_poll_execute()
823 connector->status = old_status; in output_poll_execute()
828 new = drm_get_connector_status_name(connector->status); in output_poll_execute()
830 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] status updated from %s to %s\n", in output_poll_execute()
831 connector->base.id, connector->name, in output_poll_execute()
833 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n", in output_poll_execute()
834 connector->base.id, connector->name, in output_poll_execute()
835 old_epoch_counter, connector->epoch_counter); in output_poll_execute()
862 * connector ->detect hook.
919 * Note that a connector can be both polled and probed from the hotplug handler,
972 static bool check_connector_changed(struct drm_connector *connector) in check_connector_changed() argument
974 struct drm_device *dev = connector->dev; in check_connector_changed()
979 drm_WARN_ON(dev, !(connector->polled & DRM_CONNECTOR_POLL_HPD)); in check_connector_changed()
983 old_status = connector->status; in check_connector_changed()
984 old_epoch_counter = connector->epoch_counter; in check_connector_changed()
985 connector->status = drm_helper_probe_detect(connector, NULL, false); in check_connector_changed()
987 if (old_epoch_counter == connector->epoch_counter) { in check_connector_changed()
988 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Same epoch counter %llu\n", in check_connector_changed()
989 connector->base.id, in check_connector_changed()
990 connector->name, in check_connector_changed()
991 connector->epoch_counter); in check_connector_changed()
996 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] status updated from %s to %s\n", in check_connector_changed()
997 connector->base.id, in check_connector_changed()
998 connector->name, in check_connector_changed()
1000 drm_get_connector_status_name(connector->status)); in check_connector_changed()
1002 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Changed epoch counter %llu => %llu\n", in check_connector_changed()
1003 connector->base.id, in check_connector_changed()
1004 connector->name, in check_connector_changed()
1006 connector->epoch_counter); in check_connector_changed()
1013 * @connector: drm_connector
1015 * Drivers can use this helper function to run a detect cycle on a connector
1019 * interrupts for a single connector. Drivers that want to send a
1021 * per connector need to use drm_helper_hpd_irq_event().
1026 * Note that a connector can be both polled and probed from the hotplug
1030 * A boolean indicating whether the connector status changed or not
1032 bool drm_connector_helper_hpd_irq_event(struct drm_connector *connector) in drm_connector_helper_hpd_irq_event() argument
1034 struct drm_device *dev = connector->dev; in drm_connector_helper_hpd_irq_event()
1038 changed = check_connector_changed(connector); in drm_connector_helper_hpd_irq_event()
1042 drm_kms_helper_connector_hotplug_event(connector); in drm_connector_helper_hpd_irq_event()
1043 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Sent hotplug event\n", in drm_connector_helper_hpd_irq_event()
1044 connector->base.id, in drm_connector_helper_hpd_irq_event()
1045 connector->name); in drm_connector_helper_hpd_irq_event()
1062 * interrupts for each connector.
1064 * Drivers which support hotplug interrupts for each connector individually and
1067 * code and directly call drm_kms_helper_hotplug_event() in case the connector
1073 * Note that a connector can be both polled and probed from the hotplug handler,
1077 * A boolean indicating whether the connector status changed or not
1081 struct drm_connector *connector, *first_changed_connector = NULL; in drm_helper_hpd_irq_event() local
1090 drm_for_each_connector_iter(connector, &conn_iter) { in drm_helper_hpd_irq_event()
1092 if (!(connector->polled & DRM_CONNECTOR_POLL_HPD)) in drm_helper_hpd_irq_event()
1095 if (check_connector_changed(connector)) { in drm_helper_hpd_irq_event()
1097 drm_connector_get(connector); in drm_helper_hpd_irq_event()
1098 first_changed_connector = connector; in drm_helper_hpd_irq_event()
1144 * drm_connector_helper_get_modes_fixed - Duplicates a display mode for a connector
1145 * @connector: the connector
1148 * This function duplicates a display modes for a connector. Drivers for hardware
1149 * that only supports a single fixed mode can use this function in their connector's
1155 int drm_connector_helper_get_modes_fixed(struct drm_connector *connector, in drm_connector_helper_get_modes_fixed() argument
1158 struct drm_device *dev = connector->dev; in drm_connector_helper_get_modes_fixed()
1172 drm_mode_probed_add(connector, mode); in drm_connector_helper_get_modes_fixed()
1175 connector->display_info.width_mm = mode->width_mm; in drm_connector_helper_get_modes_fixed()
1177 connector->display_info.height_mm = mode->height_mm; in drm_connector_helper_get_modes_fixed()
1184 * drm_connector_helper_get_modes - Read EDID and update connector.
1185 * @connector: The connector
1187 * Read the EDID using drm_edid_read() (which requires that connector->ddc is
1188 * set), and update the connector using the EDID.
1190 * This can be used as the "default" connector helper .get_modes() hook if the
1192 * custom .get_modes() hooks should do regarding EDID read and connector update.
1196 int drm_connector_helper_get_modes(struct drm_connector *connector) in drm_connector_helper_get_modes() argument
1201 drm_edid = drm_edid_read(connector); in drm_connector_helper_get_modes()
1204 * Unconditionally update the connector. If the EDID was read in drm_connector_helper_get_modes()
1205 * successfully, fill in the connector information derived from the in drm_connector_helper_get_modes()
1206 * EDID. Otherwise, if the EDID is NULL, clear the connector in drm_connector_helper_get_modes()
1209 drm_edid_connector_update(connector, drm_edid); in drm_connector_helper_get_modes()
1211 count = drm_edid_connector_add_modes(connector); in drm_connector_helper_get_modes()
1220 * drm_connector_helper_tv_get_modes - Fills the modes availables to a TV connector
1221 * @connector: The connector
1223 * Fills the available modes for a TV connector based on the supported
1226 * This can be used as the default TV connector helper .get_modes() hook
1230 * The number of modes added to the connector.
1232 int drm_connector_helper_tv_get_modes(struct drm_connector *connector) in drm_connector_helper_tv_get_modes() argument
1234 struct drm_device *dev = connector->dev; in drm_connector_helper_tv_get_modes()
1237 struct drm_cmdline_mode *cmdline = &connector->cmdline_mode; in drm_connector_helper_tv_get_modes()
1259 if (drm_object_property_get_default_value(&connector->base, in drm_connector_helper_tv_get_modes()
1295 drm_mode_probed_add(connector, mode); in drm_connector_helper_tv_get_modes()
1303 * drm_connector_helper_detect_from_ddc - Read EDID and detect connector status.
1304 * @connector: The connector
1308 * Detects the connector status by reading the EDID using drm_probe_ddc(),
1309 * which requires connector->ddc to be set. Returns connector_status_connected
1313 * The connector status as defined by enum drm_connector_status.
1315 int drm_connector_helper_detect_from_ddc(struct drm_connector *connector, in drm_connector_helper_detect_from_ddc() argument
1319 struct i2c_adapter *ddc = connector->ddc; in drm_connector_helper_detect_from_ddc()