Lines Matching defs:connector

57  * track of a per-connector hpd interrupt.
91 struct drm_connector *connector,
95 struct drm_device *dev = connector->dev;
99 /* Step 1: Validate against connector */
100 ret = drm_connector_mode_valid(connector, mode, ctx, status);
105 drm_connector_for_each_possible_encoder(connector, encoder) {
120 &connector->display_info,
145 static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector)
150 cmdline_mode = &connector->cmdline_mode;
155 list_for_each_entry(mode, &connector->probed_modes, head) {
171 mode = drm_mode_create_from_cmdline_mode(connector->dev,
176 drm_mode_probed_add(connector, mode);
204 drm_connector_mode_valid(struct drm_connector *connector,
210 connector->helper_private;
216 ret = connector_funcs->mode_valid_ctx(connector, mode, ctx,
219 *status = connector_funcs->mode_valid(connector, mode);
228 struct drm_connector *connector;
232 drm_for_each_connector_iter(connector, &conn_iter) {
234 connector->helper_private;
237 funcs->disable_hpd(connector);
245 struct drm_connector *connector;
249 drm_for_each_connector_iter(connector, &conn_iter) {
251 connector->helper_private;
254 funcs->enable_hpd(connector);
256 if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT |
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)
344 const struct drm_connector_helper_funcs *funcs = connector->helper_private;
351 ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex, &ctx);
354 ret = funcs->detect_ctx(connector, &ctx, force);
355 else if (connector->funcs->detect)
356 ret = connector->funcs->detect(connector, force);
369 if (ret != connector->status)
370 connector->epoch_counter += 1;
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,
393 const struct drm_connector_helper_funcs *funcs = connector->helper_private;
394 struct drm_device *dev = connector->dev;
398 return drm_helper_probe_detect_ctx(connector, force);
405 ret = funcs->detect_ctx(connector, ctx, force);
406 else if (connector->funcs->detect)
407 ret = connector->funcs->detect(connector, force);
411 if (ret != connector->status)
412 connector->epoch_counter += 1;
418 static int drm_helper_probe_get_modes(struct drm_connector *connector)
421 connector->helper_private;
424 count = connector_funcs->get_modes(connector);
428 drm_err(connector->dev, ".get_modes() returned %pe\n",
437 if (count == 0 && connector->status == connector_status_connected)
438 count = drm_edid_override_connector_update(connector);
443 static int __drm_helper_update_and_validate(struct drm_connector *connector,
447 struct drm_device *dev = connector->dev;
452 drm_connector_list_update(connector);
454 if (connector->interlace_allowed)
456 if (connector->doublescan_allowed)
458 if (connector->stereo_allowed)
461 list_for_each_entry(mode, &connector->modes, head) {
477 ret = drm_mode_validate_pipeline(mode, connector, ctx,
492 mode->status = drm_mode_validate_ycbcr420(mode, connector);
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,
560 struct drm_device *dev = connector->dev;
570 drm_dbg_kms(dev, "[CONNECTOR:%d:%s]\n", connector->base.id,
571 connector->name);
582 list_for_each_entry(mode, &connector->modes, head)
585 old_status = connector->status;
587 if (connector->force) {
588 if (connector->force == DRM_FORCE_ON ||
589 connector->force == DRM_FORCE_ON_DIGITAL)
590 connector->status = connector_status_connected;
592 connector->status = connector_status_disconnected;
593 if (connector->funcs->force)
594 connector->funcs->force(connector);
596 ret = drm_helper_probe_detect(connector, &ctx, true);
601 } else if (WARN(ret < 0, "Invalid return value %i for connector detection\n", ret))
604 connector->status = ret;
613 if (old_status != connector->status) {
615 connector->base.id, 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);
700 connector->base.id, connector->name);
702 list_for_each_entry(mode, &connector->modes, head) {
714 * @dev: drm_device whose connector state changed
728 * If only a single connector has changed, consider calling
743 * drm_kms_helper_connector_hotplug_event - fire off a KMS connector hotplug event
744 * @connector: drm_connector which has changed
747 * fine-grained uevent for a single connector.
749 void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector)
751 struct drm_device *dev = connector->dev;
754 drm_sysfs_connector_hotplug_event(connector);
766 struct drm_connector *connector;
793 drm_for_each_connector_iter(connector, &conn_iter) {
795 if (connector->force)
800 if (!connector->polled || connector->polled == DRM_CONNECTOR_POLL_HPD)
803 old_status = connector->status;
807 !(connector->polled & DRM_CONNECTOR_POLL_DISCONNECT))
812 old_epoch_counter = connector->epoch_counter;
813 connector->status = drm_helper_probe_detect(connector, NULL, false);
814 if (old_epoch_counter != connector->epoch_counter) {
830 if (connector->status == connector_status_unknown) {
831 connector->status = old_status;
836 new = drm_get_connector_status_name(connector->status);
839 connector->base.id, 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,
980 static bool check_connector_changed(struct drm_connector *connector)
982 struct drm_device *dev = connector->dev;
987 drm_WARN_ON(dev, !(connector->polled & DRM_CONNECTOR_POLL_HPD));
991 old_status = connector->status;
992 old_epoch_counter = connector->epoch_counter;
993 connector->status = drm_helper_probe_detect(connector, NULL, false);
995 if (old_epoch_counter == connector->epoch_counter) {
997 connector->base.id,
998 connector->name,
999 connector->epoch_counter);
1005 connector->base.id,
1006 connector->name,
1008 drm_get_connector_status_name(connector->status));
1011 connector->base.id,
1012 connector->name,
1014 connector->epoch_counter);
1021 * @connector: drm_connector
1023 * Drivers can use this helper function to run a detect cycle on a connector
1027 * interrupts for a single connector. Drivers that want to send a
1029 * per connector need to use drm_helper_hpd_irq_event().
1034 * Note that a connector can be both polled and probed from the hotplug
1038 * A boolean indicating whether the connector status changed or not
1040 bool drm_connector_helper_hpd_irq_event(struct drm_connector *connector)
1042 struct drm_device *dev = connector->dev;
1046 changed = check_connector_changed(connector);
1050 drm_kms_helper_connector_hotplug_event(connector);
1052 connector->base.id,
1053 connector->name);
1070 * interrupts for each connector.
1072 * Drivers which support hotplug interrupts for each connector individually and
1075 * code and directly call drm_kms_helper_hotplug_event() in case the connector
1081 * Note that a connector can be both polled and probed from the hotplug handler,
1085 * A boolean indicating whether the connector status changed or not
1089 struct drm_connector *connector, *first_changed_connector = NULL;
1098 drm_for_each_connector_iter(connector, &conn_iter) {
1100 if (!(connector->polled & DRM_CONNECTOR_POLL_HPD))
1103 if (check_connector_changed(connector)) {
1105 drm_connector_get(connector);
1106 first_changed_connector = connector;
1152 * drm_connector_helper_get_modes_fixed - Duplicates a display mode for a connector
1153 * @connector: the connector
1156 * This function duplicates a display modes for a connector. Drivers for hardware
1157 * that only supports a single fixed mode can use this function in their connector's
1163 int drm_connector_helper_get_modes_fixed(struct drm_connector *connector,
1166 struct drm_device *dev = connector->dev;
1180 drm_mode_probed_add(connector, mode);
1183 connector->display_info.width_mm = mode->width_mm;
1185 connector->display_info.height_mm = mode->height_mm;
1192 * drm_connector_helper_get_modes - Read EDID and update connector.
1193 * @connector: The connector
1195 * Read the EDID using drm_edid_read() (which requires that connector->ddc is
1196 * set), and update the connector using the EDID.
1198 * This can be used as the "default" connector helper .get_modes() hook if the
1200 * custom .get_modes() hooks should do regarding EDID read and connector update.
1204 int drm_connector_helper_get_modes(struct drm_connector *connector)
1209 drm_edid = drm_edid_read(connector);
1212 * Unconditionally update the connector. If the EDID was read
1213 * successfully, fill in the connector information derived from the
1214 * EDID. Otherwise, if the EDID is NULL, clear the connector
1217 drm_edid_connector_update(connector, drm_edid);
1219 count = drm_edid_connector_add_modes(connector);
1228 * drm_connector_helper_tv_get_modes - Fills the modes availables to a TV connector
1229 * @connector: The connector
1231 * Fills the available modes for a TV connector based on the supported
1234 * This can be used as the default TV connector helper .get_modes() hook
1238 * The number of modes added to the connector.
1240 int drm_connector_helper_tv_get_modes(struct drm_connector *connector)
1242 struct drm_device *dev = connector->dev;
1245 struct drm_cmdline_mode *cmdline = &connector->cmdline_mode;
1266 if (drm_object_property_get_default_value(&connector->base,
1302 drm_mode_probed_add(connector, mode);
1310 * drm_connector_helper_detect_from_ddc - Read EDID and detect connector status.
1311 * @connector: The connector
1315 * Detects the connector status by reading the EDID using drm_probe_ddc(),
1316 * which requires connector->ddc to be set. Returns connector_status_connected
1320 * The connector status as defined by enum drm_connector_status.
1322 int drm_connector_helper_detect_from_ddc(struct drm_connector *connector,
1326 struct i2c_adapter *ddc = connector->ddc;