Lines Matching +full:vga +full:- +full:connector
2 * Copyright © 2006-2007 Intel Corporation
55 /* DPMS state is stored in the connector, which we need in the
57 struct intel_connector *connector; member
67 static struct intel_crt *intel_attached_crt(struct intel_connector *connector) in intel_attached_crt() argument
69 return intel_encoder_to_crt(intel_attached_encoder(connector)); in intel_attached_crt()
91 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); in intel_crt_get_hw_state()
97 encoder->power_domain); in intel_crt_get_hw_state()
101 ret = intel_crt_port_enabled(dev_priv, crt->adpa_reg, pipe); in intel_crt_get_hw_state()
103 intel_display_power_put(dev_priv, encoder->power_domain, wakeref); in intel_crt_get_hw_state()
110 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); in intel_crt_get_flags()
114 tmp = intel_de_read(dev_priv, crt->adpa_reg); in intel_crt_get_flags()
132 pipe_config->output_types |= BIT(INTEL_OUTPUT_ANALOG); in intel_crt_get_config()
134 pipe_config->hw.adjusted_mode.flags |= intel_crt_get_flags(encoder); in intel_crt_get_config()
136 pipe_config->hw.adjusted_mode.crtc_clock = pipe_config->port_clock; in intel_crt_get_config()
142 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); in hsw_crt_get_config()
146 pipe_config->hw.adjusted_mode.flags &= ~(DRM_MODE_FLAG_PHSYNC | in hsw_crt_get_config()
150 pipe_config->hw.adjusted_mode.flags |= intel_crt_get_flags(encoder); in hsw_crt_get_config()
152 pipe_config->hw.adjusted_mode.crtc_clock = lpt_get_iclkip(dev_priv); in hsw_crt_get_config()
161 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); in intel_crt_set_dpms()
163 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in intel_crt_set_dpms()
164 const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; in intel_crt_set_dpms()
172 if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) in intel_crt_set_dpms()
174 if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) in intel_crt_set_dpms()
181 adpa |= ADPA_PIPE_SEL_CPT(crtc->pipe); in intel_crt_set_dpms()
183 adpa |= ADPA_PIPE_SEL(crtc->pipe); in intel_crt_set_dpms()
186 intel_de_write(dev_priv, BCLRPAT(crtc->pipe), 0); in intel_crt_set_dpms()
203 intel_de_write(dev_priv, crt->adpa_reg, adpa); in intel_crt_set_dpms()
234 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); in hsw_disable_crt()
236 drm_WARN_ON(&dev_priv->drm, !old_crtc_state->has_pch_encoder); in hsw_disable_crt()
246 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); in hsw_post_disable_crt()
265 drm_WARN_ON(&dev_priv->drm, !old_crtc_state->has_pch_encoder); in hsw_post_disable_crt()
275 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); in hsw_pre_pll_enable_crt()
277 drm_WARN_ON(&dev_priv->drm, !crtc_state->has_pch_encoder); in hsw_pre_pll_enable_crt()
287 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); in hsw_pre_enable_crt()
288 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in hsw_pre_enable_crt()
289 enum pipe pipe = crtc->pipe; in hsw_pre_enable_crt()
291 drm_WARN_ON(&dev_priv->drm, !crtc_state->has_pch_encoder); in hsw_pre_enable_crt()
305 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); in hsw_enable_crt()
306 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in hsw_enable_crt()
307 enum pipe pipe = crtc->pipe; in hsw_enable_crt()
309 drm_WARN_ON(&dev_priv->drm, !crtc_state->has_pch_encoder); in hsw_enable_crt()
336 intel_crt_mode_valid(struct drm_connector *connector, in intel_crt_mode_valid() argument
339 struct drm_device *dev = connector->dev; in intel_crt_mode_valid()
341 int max_dotclk = dev_priv->max_dotclk_freq; in intel_crt_mode_valid()
344 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) in intel_crt_mode_valid()
347 if (mode->clock < 25000) in intel_crt_mode_valid()
362 if (mode->clock > max_clock) in intel_crt_mode_valid()
365 if (mode->clock > max_dotclk) in intel_crt_mode_valid()
370 ilk_get_lanes_required(mode->clock, 270000, 24) > 2) in intel_crt_mode_valid()
374 if (mode->hdisplay > 4096) in intel_crt_mode_valid()
385 &pipe_config->hw.adjusted_mode; in intel_crt_compute_config()
387 if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) in intel_crt_compute_config()
388 return -EINVAL; in intel_crt_compute_config()
390 pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB; in intel_crt_compute_config()
400 &pipe_config->hw.adjusted_mode; in pch_crt_compute_config()
402 if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) in pch_crt_compute_config()
403 return -EINVAL; in pch_crt_compute_config()
405 pipe_config->has_pch_encoder = true; in pch_crt_compute_config()
406 pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB; in pch_crt_compute_config()
415 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); in hsw_crt_compute_config()
417 &pipe_config->hw.adjusted_mode; in hsw_crt_compute_config()
419 if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) in hsw_crt_compute_config()
420 return -EINVAL; in hsw_crt_compute_config()
423 if (adjusted_mode->crtc_hdisplay > 4096 || in hsw_crt_compute_config()
424 adjusted_mode->crtc_hblank_start > 4096) in hsw_crt_compute_config()
425 return -EINVAL; in hsw_crt_compute_config()
427 pipe_config->has_pch_encoder = true; in hsw_crt_compute_config()
428 pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB; in hsw_crt_compute_config()
432 if (pipe_config->bw_constrained && pipe_config->pipe_bpp < 24) { in hsw_crt_compute_config()
433 drm_dbg_kms(&dev_priv->drm, in hsw_crt_compute_config()
435 return -EINVAL; in hsw_crt_compute_config()
438 pipe_config->pipe_bpp = 24; in hsw_crt_compute_config()
442 pipe_config->port_clock = 135000 * 2; in hsw_crt_compute_config()
447 static bool ilk_crt_detect_hotplug(struct drm_connector *connector) in ilk_crt_detect_hotplug() argument
449 struct drm_device *dev = connector->dev; in ilk_crt_detect_hotplug()
450 struct intel_crt *crt = intel_attached_crt(to_intel_connector(connector)); in ilk_crt_detect_hotplug()
456 if (crt->force_hotplug_required) { in ilk_crt_detect_hotplug()
460 crt->force_hotplug_required = false; in ilk_crt_detect_hotplug()
462 save_adpa = adpa = intel_de_read(dev_priv, crt->adpa_reg); in ilk_crt_detect_hotplug()
463 drm_dbg_kms(&dev_priv->drm, in ilk_crt_detect_hotplug()
470 intel_de_write(dev_priv, crt->adpa_reg, adpa); in ilk_crt_detect_hotplug()
473 crt->adpa_reg, in ilk_crt_detect_hotplug()
476 drm_dbg_kms(&dev_priv->drm, in ilk_crt_detect_hotplug()
480 intel_de_write(dev_priv, crt->adpa_reg, save_adpa); in ilk_crt_detect_hotplug()
481 intel_de_posting_read(dev_priv, crt->adpa_reg); in ilk_crt_detect_hotplug()
486 adpa = intel_de_read(dev_priv, crt->adpa_reg); in ilk_crt_detect_hotplug()
491 drm_dbg_kms(&dev_priv->drm, "ironlake hotplug adpa=0x%x, result %d\n", in ilk_crt_detect_hotplug()
497 static bool valleyview_crt_detect_hotplug(struct drm_connector *connector) in valleyview_crt_detect_hotplug() argument
499 struct drm_device *dev = connector->dev; in valleyview_crt_detect_hotplug()
500 struct intel_crt *crt = intel_attached_crt(to_intel_connector(connector)); in valleyview_crt_detect_hotplug()
510 * - We enable power wells and reset the ADPA in valleyview_crt_detect_hotplug()
511 * - output_poll_exec does force probe on VGA, triggering a hpd in valleyview_crt_detect_hotplug()
512 * - HPD handler waits for poll to unlock dev->mode_config.mutex in valleyview_crt_detect_hotplug()
513 * - output_poll_exec shuts off the ADPA, unlocks in valleyview_crt_detect_hotplug()
514 * dev->mode_config.mutex in valleyview_crt_detect_hotplug()
515 * - HPD handler runs, resets ADPA and brings us back to the start in valleyview_crt_detect_hotplug()
519 reenable_hpd = intel_hpd_disable(dev_priv, crt->base.hpd_pin); in valleyview_crt_detect_hotplug()
521 save_adpa = adpa = intel_de_read(dev_priv, crt->adpa_reg); in valleyview_crt_detect_hotplug()
522 drm_dbg_kms(&dev_priv->drm, in valleyview_crt_detect_hotplug()
527 intel_de_write(dev_priv, crt->adpa_reg, adpa); in valleyview_crt_detect_hotplug()
529 if (intel_de_wait_for_clear(dev_priv, crt->adpa_reg, in valleyview_crt_detect_hotplug()
531 drm_dbg_kms(&dev_priv->drm, in valleyview_crt_detect_hotplug()
533 intel_de_write(dev_priv, crt->adpa_reg, save_adpa); in valleyview_crt_detect_hotplug()
537 adpa = intel_de_read(dev_priv, crt->adpa_reg); in valleyview_crt_detect_hotplug()
543 drm_dbg_kms(&dev_priv->drm, in valleyview_crt_detect_hotplug()
547 intel_hpd_enable(dev_priv, crt->base.hpd_pin); in valleyview_crt_detect_hotplug()
552 static bool intel_crt_detect_hotplug(struct drm_connector *connector) in intel_crt_detect_hotplug() argument
554 struct drm_device *dev = connector->dev; in intel_crt_detect_hotplug()
561 return ilk_crt_detect_hotplug(connector); in intel_crt_detect_hotplug()
564 return valleyview_crt_detect_hotplug(connector); in intel_crt_detect_hotplug()
584 drm_dbg_kms(&dev_priv->drm, in intel_crt_detect_hotplug()
600 static struct edid *intel_crt_get_edid(struct drm_connector *connector, in intel_crt_get_edid() argument
605 edid = drm_get_edid(connector, i2c); in intel_crt_get_edid()
608 drm_dbg_kms(connector->dev, in intel_crt_get_edid()
609 "CRT GMBUS EDID read failed, retry using GPIO bit-banging\n"); in intel_crt_get_edid()
611 edid = drm_get_edid(connector, i2c); in intel_crt_get_edid()
619 static int intel_crt_ddc_get_modes(struct drm_connector *connector, in intel_crt_ddc_get_modes() argument
625 edid = intel_crt_get_edid(connector, adapter); in intel_crt_ddc_get_modes()
629 ret = intel_connector_update_modes(connector, edid); in intel_crt_ddc_get_modes()
635 static bool intel_crt_detect_ddc(struct drm_connector *connector) in intel_crt_detect_ddc() argument
637 struct intel_crt *crt = intel_attached_crt(to_intel_connector(connector)); in intel_crt_detect_ddc()
638 struct drm_i915_private *dev_priv = to_i915(crt->base.base.dev); in intel_crt_detect_ddc()
643 BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG); in intel_crt_detect_ddc()
645 i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->vbt.crt_ddc_pin); in intel_crt_detect_ddc()
646 edid = intel_crt_get_edid(connector, i2c); in intel_crt_detect_ddc()
649 bool is_digital = edid->input & DRM_EDID_INPUT_DIGITAL; in intel_crt_detect_ddc()
652 * This may be a DVI-I connector with a shared DDC in intel_crt_detect_ddc()
657 drm_dbg_kms(&dev_priv->drm, in intel_crt_detect_ddc()
661 drm_dbg_kms(&dev_priv->drm, in intel_crt_detect_ddc()
665 drm_dbg_kms(&dev_priv->drm, in intel_crt_detect_ddc()
677 struct drm_device *dev = crt->base.base.dev; in intel_crt_load_detect()
679 struct intel_uncore *uncore = &dev_priv->uncore; in intel_crt_load_detect()
691 drm_dbg_kms(&dev_priv->drm, "starting load-detect on CRT\n"); in intel_crt_load_detect()
743 (vblank_start - 1) | in intel_crt_load_detect()
744 ((vblank_end - 1) << 16)); in intel_crt_load_detect()
748 if (vblank_start - vactive >= vtotal - vblank_end) in intel_crt_load_detect()
768 /* Read the ST00 VGA status register */ in intel_crt_load_detect()
796 DRM_DEBUG_DRIVER("Skipping CRT detection for %s\n", id->ident); in intel_spurious_crt_detect_dmi_callback()
811 .ident = "Intel DZ77BH-55K",
814 DMI_MATCH(DMI_BOARD_NAME, "DZ77BH-55K"),
821 intel_crt_detect(struct drm_connector *connector, in intel_crt_detect() argument
825 struct drm_i915_private *dev_priv = to_i915(connector->dev); in intel_crt_detect()
826 struct intel_crt *crt = intel_attached_crt(to_intel_connector(connector)); in intel_crt_detect()
827 struct intel_encoder *intel_encoder = &crt->base; in intel_crt_detect()
832 drm_dbg_kms(&dev_priv->drm, "[CONNECTOR:%d:%s] force=%d\n", in intel_crt_detect()
833 connector->base.id, connector->name, in intel_crt_detect()
839 if (dev_priv->params.load_detect_test) { in intel_crt_detect()
841 intel_encoder->power_domain); in intel_crt_detect()
845 /* Skip machines without VGA that falsely report hotplug events */ in intel_crt_detect()
850 intel_encoder->power_domain); in intel_crt_detect()
857 if (intel_crt_detect_hotplug(connector)) { in intel_crt_detect()
858 drm_dbg_kms(&dev_priv->drm, in intel_crt_detect()
863 drm_dbg_kms(&dev_priv->drm, in intel_crt_detect()
867 if (intel_crt_detect_ddc(connector)) { in intel_crt_detect()
883 status = connector->status; in intel_crt_detect()
887 /* for pre-945g platforms use load detect */ in intel_crt_detect()
888 ret = intel_get_load_detect_pipe(connector, &tmp, ctx); in intel_crt_detect()
890 if (intel_crt_detect_ddc(connector)) in intel_crt_detect()
894 to_intel_crtc(connector->state->crtc)->pipe); in intel_crt_detect()
895 else if (dev_priv->params.load_detect_test) in intel_crt_detect()
899 intel_release_load_detect_pipe(connector, &tmp, ctx); in intel_crt_detect()
907 intel_display_power_put(dev_priv, intel_encoder->power_domain, wakeref); in intel_crt_detect()
918 static int intel_crt_get_modes(struct drm_connector *connector) in intel_crt_get_modes() argument
920 struct drm_device *dev = connector->dev; in intel_crt_get_modes()
922 struct intel_crt *crt = intel_attached_crt(to_intel_connector(connector)); in intel_crt_get_modes()
923 struct intel_encoder *intel_encoder = &crt->base; in intel_crt_get_modes()
929 intel_encoder->power_domain); in intel_crt_get_modes()
931 i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->vbt.crt_ddc_pin); in intel_crt_get_modes()
932 ret = intel_crt_ddc_get_modes(connector, i2c); in intel_crt_get_modes()
936 /* Try to probe digital port for output in DVI-I -> VGA mode. */ in intel_crt_get_modes()
938 ret = intel_crt_ddc_get_modes(connector, i2c); in intel_crt_get_modes()
941 intel_display_power_put(dev_priv, intel_encoder->power_domain, wakeref); in intel_crt_get_modes()
948 struct drm_i915_private *dev_priv = to_i915(encoder->dev); in intel_crt_reset()
954 adpa = intel_de_read(dev_priv, crt->adpa_reg); in intel_crt_reset()
957 intel_de_write(dev_priv, crt->adpa_reg, adpa); in intel_crt_reset()
958 intel_de_posting_read(dev_priv, crt->adpa_reg); in intel_crt_reset()
960 drm_dbg_kms(&dev_priv->drm, "crt adpa set to 0x%x\n", adpa); in intel_crt_reset()
961 crt->force_hotplug_required = true; in intel_crt_reset()
992 struct drm_connector *connector; in intel_crt_init() local
1032 connector = &intel_connector->base; in intel_crt_init()
1033 crt->connector = intel_connector; in intel_crt_init()
1034 drm_connector_init(&dev_priv->drm, &intel_connector->base, in intel_crt_init()
1037 drm_encoder_init(&dev_priv->drm, &crt->base.base, &intel_crt_enc_funcs, in intel_crt_init()
1040 intel_connector_attach_encoder(intel_connector, &crt->base); in intel_crt_init()
1042 crt->base.type = INTEL_OUTPUT_ANALOG; in intel_crt_init()
1043 crt->base.cloneable = (1 << INTEL_OUTPUT_DVO) | (1 << INTEL_OUTPUT_HDMI); in intel_crt_init()
1045 crt->base.pipe_mask = BIT(PIPE_A); in intel_crt_init()
1047 crt->base.pipe_mask = ~0; in intel_crt_init()
1050 connector->interlace_allowed = 0; in intel_crt_init()
1052 connector->interlace_allowed = 1; in intel_crt_init()
1053 connector->doublescan_allowed = 0; in intel_crt_init()
1055 crt->adpa_reg = adpa_reg; in intel_crt_init()
1057 crt->base.power_domain = POWER_DOMAIN_PORT_CRT; in intel_crt_init()
1061 crt->base.hpd_pin = HPD_CRT; in intel_crt_init()
1062 crt->base.hotplug = intel_encoder_hotplug; in intel_crt_init()
1063 intel_connector->polled = DRM_CONNECTOR_POLL_HPD; in intel_crt_init()
1065 intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT; in intel_crt_init()
1069 crt->base.port = PORT_E; in intel_crt_init()
1070 crt->base.get_config = hsw_crt_get_config; in intel_crt_init()
1071 crt->base.get_hw_state = intel_ddi_get_hw_state; in intel_crt_init()
1072 crt->base.compute_config = hsw_crt_compute_config; in intel_crt_init()
1073 crt->base.pre_pll_enable = hsw_pre_pll_enable_crt; in intel_crt_init()
1074 crt->base.pre_enable = hsw_pre_enable_crt; in intel_crt_init()
1075 crt->base.enable = hsw_enable_crt; in intel_crt_init()
1076 crt->base.disable = hsw_disable_crt; in intel_crt_init()
1077 crt->base.post_disable = hsw_post_disable_crt; in intel_crt_init()
1080 crt->base.compute_config = pch_crt_compute_config; in intel_crt_init()
1081 crt->base.disable = pch_disable_crt; in intel_crt_init()
1082 crt->base.post_disable = pch_post_disable_crt; in intel_crt_init()
1084 crt->base.compute_config = intel_crt_compute_config; in intel_crt_init()
1085 crt->base.disable = intel_disable_crt; in intel_crt_init()
1087 crt->base.port = PORT_NONE; in intel_crt_init()
1088 crt->base.get_config = intel_crt_get_config; in intel_crt_init()
1089 crt->base.get_hw_state = intel_crt_get_hw_state; in intel_crt_init()
1090 crt->base.enable = intel_enable_crt; in intel_crt_init()
1092 intel_connector->get_hw_state = intel_connector_get_hw_state; in intel_crt_init()
1094 drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); in intel_crt_init()
1105 dev_priv->fdi_rx_config = intel_de_read(dev_priv, in intel_crt_init()
1109 intel_crt_reset(&crt->base.base); in intel_crt_init()