Lines Matching +full:auto +full:- +full:retry
1 // SPDX-License-Identifier: MIT
29 struct intel_display *display = &dev_priv->display; in assert_fdi_tx()
37 * so pipe->transcoder cast is fine here. in assert_fdi_tx()
63 struct intel_display *display = &dev_priv->display; in assert_fdi_rx()
85 struct intel_display *display = &i915->display; in assert_fdi_tx_pll_enabled()
104 struct intel_display *display = &i915->display; in assert_fdi_rx_pll()
126 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); in intel_fdi_link_train()
128 dev_priv->display.funcs.fdi->fdi_link_train(crtc, crtc_state); in intel_fdi_link_train()
132 * intel_fdi_add_affected_crtcs - add CRTCs on FDI affected by other modeset CRTCs
145 struct drm_i915_private *i915 = to_i915(state->base.dev); in intel_fdi_add_affected_crtcs()
162 if (!old_crtc_state->fdi_lanes) in intel_fdi_add_affected_crtcs()
166 new_crtc_state = intel_atomic_get_crtc_state(&state->base, crtc); in intel_fdi_add_affected_crtcs()
171 if (!old_crtc_state->fdi_lanes) in intel_fdi_add_affected_crtcs()
182 if (crtc_state->hw.enable && crtc_state->has_pch_encoder) in pipe_required_fdi_lanes()
183 return crtc_state->fdi_lanes; in pipe_required_fdi_lanes()
194 struct drm_atomic_state *state = pipe_config->uapi.state; in ilk_check_fdi_lanes()
200 drm_dbg_kms(&dev_priv->drm, in ilk_check_fdi_lanes()
202 pipe_name(pipe), pipe_config->fdi_lanes); in ilk_check_fdi_lanes()
203 if (pipe_config->fdi_lanes > 4) { in ilk_check_fdi_lanes()
204 drm_dbg_kms(&dev_priv->drm, in ilk_check_fdi_lanes()
206 pipe_name(pipe), pipe_config->fdi_lanes); in ilk_check_fdi_lanes()
207 return -EINVAL; in ilk_check_fdi_lanes()
211 if (pipe_config->fdi_lanes > 2) { in ilk_check_fdi_lanes()
212 drm_dbg_kms(&dev_priv->drm, in ilk_check_fdi_lanes()
214 pipe_config->fdi_lanes); in ilk_check_fdi_lanes()
215 return -EINVAL; in ilk_check_fdi_lanes()
229 if (pipe_config->fdi_lanes <= 2) in ilk_check_fdi_lanes()
239 drm_dbg_kms(&dev_priv->drm, in ilk_check_fdi_lanes()
241 pipe_name(pipe), pipe_config->fdi_lanes); in ilk_check_fdi_lanes()
242 return -EINVAL; in ilk_check_fdi_lanes()
246 if (pipe_config->fdi_lanes > 2) { in ilk_check_fdi_lanes()
247 drm_dbg_kms(&dev_priv->drm, in ilk_check_fdi_lanes()
249 pipe_name(pipe), pipe_config->fdi_lanes); in ilk_check_fdi_lanes()
250 return -EINVAL; in ilk_check_fdi_lanes()
260 drm_dbg_kms(&dev_priv->drm, in ilk_check_fdi_lanes()
265 return -EINVAL; in ilk_check_fdi_lanes()
280 i915->display.fdi.pll_freq = (fdi_pll_clk + 2) * 10000; in intel_fdi_pll_freq_update()
282 i915->display.fdi.pll_freq = 270000; in intel_fdi_pll_freq_update()
287 drm_dbg(&i915->drm, "FDI PLL freq=%d\n", i915->display.fdi.pll_freq); in intel_fdi_pll_freq_update()
294 return pipe_config->port_clock; /* SPLL */ in intel_fdi_link_freq()
296 return i915->display.fdi.pll_freq; in intel_fdi_link_freq()
300 * intel_fdi_compute_pipe_bpp - compute pipe bpp limited by max link bpp
305 * link bpp will always match the pipe bpp. This is the case for all non-DP
314 int pipe_bpp = min(crtc_state->pipe_bpp, in intel_fdi_compute_pipe_bpp()
315 fxp_q4_to_int(crtc_state->max_link_bpp_x16)); in intel_fdi_compute_pipe_bpp()
322 crtc_state->pipe_bpp = pipe_bpp; in intel_fdi_compute_pipe_bpp()
330 struct drm_device *dev = crtc->base.dev; in ilk_fdi_compute_config()
332 const struct drm_display_mode *adjusted_mode = &pipe_config->hw.adjusted_mode; in ilk_fdi_compute_config()
344 fdi_dotclock = adjusted_mode->crtc_clock; in ilk_fdi_compute_config()
347 pipe_config->pipe_bpp); in ilk_fdi_compute_config()
349 pipe_config->fdi_lanes = lane; in ilk_fdi_compute_config()
351 intel_link_compute_m_n(fxp_q4_from_int(pipe_config->pipe_bpp), in ilk_fdi_compute_config()
355 &pipe_config->fdi_m_n); in ilk_fdi_compute_config()
365 struct drm_i915_private *i915 = to_i915(crtc->base.dev); in intel_fdi_atomic_check_bw()
369 ret = ilk_check_fdi_lanes(&i915->drm, crtc->pipe, pipe_config, in intel_fdi_atomic_check_bw()
371 if (ret != -EINVAL) in intel_fdi_atomic_check_bw()
378 return ret ? : -EAGAIN; in intel_fdi_atomic_check_bw()
382 * intel_fdi_atomic_check_link - check all modeset FDI link configuration
392 * - 0 if the confugration is valid
393 * - %-EAGAIN, if the configuration is invalid and @limits got updated
396 * - Other negative error, if the configuration is invalid without a
409 if (!crtc_state->has_pch_encoder || in intel_fdi_atomic_check_link()
411 !crtc_state->hw.enable) in intel_fdi_atomic_check_link()
430 drm_WARN_ON(&dev_priv->drm, in cpt_set_fdi_bc_bifurcation()
433 drm_WARN_ON(&dev_priv->drm, in cpt_set_fdi_bc_bifurcation()
441 drm_dbg_kms(&dev_priv->drm, "%sabling fdi C rx\n", in cpt_set_fdi_bc_bifurcation()
449 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in ivb_update_fdi_bc_bifurcation()
450 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); in ivb_update_fdi_bc_bifurcation()
452 switch (crtc->pipe) { in ivb_update_fdi_bc_bifurcation()
456 if (crtc_state->fdi_lanes > 2) in ivb_update_fdi_bc_bifurcation()
467 MISSING_CASE(crtc->pipe); in ivb_update_fdi_bc_bifurcation()
473 struct drm_device *dev = crtc->base.dev; in intel_fdi_normal_train()
475 enum pipe pipe = crtc->pipe; in intel_fdi_normal_train()
515 struct drm_device *dev = crtc->base.dev; in ilk_fdi_link_train()
517 enum pipe pipe = crtc->pipe; in ilk_fdi_link_train()
529 assert_transcoder_enabled(dev_priv, crtc_state->cpu_transcoder); in ilk_fdi_link_train()
545 temp |= FDI_DP_PORT_WIDTH(crtc_state->fdi_lanes); in ilk_fdi_link_train()
568 drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR 0x%x\n", temp); in ilk_fdi_link_train()
571 drm_dbg_kms(&dev_priv->drm, "FDI train 1 done.\n"); in ilk_fdi_link_train()
577 drm_err(&dev_priv->drm, "FDI train 1 fail!\n"); in ilk_fdi_link_train()
590 drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR 0x%x\n", temp); in ilk_fdi_link_train()
595 drm_dbg_kms(&dev_priv->drm, "FDI train 2 done.\n"); in ilk_fdi_link_train()
600 drm_err(&dev_priv->drm, "FDI train 2 fail!\n"); in ilk_fdi_link_train()
602 drm_dbg_kms(&dev_priv->drm, "FDI train done\n"); in ilk_fdi_link_train()
617 struct drm_device *dev = crtc->base.dev; in gen6_fdi_link_train()
619 enum pipe pipe = crtc->pipe; in gen6_fdi_link_train()
621 u32 temp, i, retry; in gen6_fdi_link_train() local
645 temp |= FDI_DP_PORT_WIDTH(crtc_state->fdi_lanes); in gen6_fdi_link_train()
649 /* SNB-B */ in gen6_fdi_link_train()
676 for (retry = 0; retry < 5; retry++) { in gen6_fdi_link_train()
679 drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR 0x%x\n", temp); in gen6_fdi_link_train()
683 drm_dbg_kms(&dev_priv->drm, in gen6_fdi_link_train()
689 if (retry < 5) in gen6_fdi_link_train()
693 drm_err(&dev_priv->drm, "FDI train 1 fail!\n"); in gen6_fdi_link_train()
702 /* SNB-B */ in gen6_fdi_link_train()
727 for (retry = 0; retry < 5; retry++) { in gen6_fdi_link_train()
730 drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR 0x%x\n", temp); in gen6_fdi_link_train()
734 drm_dbg_kms(&dev_priv->drm, in gen6_fdi_link_train()
740 if (retry < 5) in gen6_fdi_link_train()
744 drm_err(&dev_priv->drm, "FDI train 2 fail!\n"); in gen6_fdi_link_train()
746 drm_dbg_kms(&dev_priv->drm, "FDI train done.\n"); in gen6_fdi_link_train()
753 struct drm_device *dev = crtc->base.dev; in ivb_manual_fdi_link_train()
755 enum pipe pipe = crtc->pipe; in ivb_manual_fdi_link_train()
779 drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR before link train 0x%x\n", in ivb_manual_fdi_link_train()
784 /* disable first in case we need to retry */ in ivb_manual_fdi_link_train()
802 temp |= FDI_DP_PORT_WIDTH(crtc_state->fdi_lanes); in ivb_manual_fdi_link_train()
824 drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR 0x%x\n", temp); in ivb_manual_fdi_link_train()
830 drm_dbg_kms(&dev_priv->drm, in ivb_manual_fdi_link_train()
838 drm_dbg_kms(&dev_priv->drm, in ivb_manual_fdi_link_train()
856 drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR 0x%x\n", temp); in ivb_manual_fdi_link_train()
862 drm_dbg_kms(&dev_priv->drm, in ivb_manual_fdi_link_train()
870 drm_dbg_kms(&dev_priv->drm, in ivb_manual_fdi_link_train()
875 drm_dbg_kms(&dev_priv->drm, "FDI train done.\n"); in ivb_manual_fdi_link_train()
879 * connection to the PCH-located connectors. For this, it is necessary to train
889 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in hsw_fdi_link_train()
890 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); in hsw_fdi_link_train()
894 encoder->get_buf_trans(encoder, crtc_state, &n_entries); in hsw_fdi_link_train()
900 * - TP1 to TP2 time with the default value in hsw_fdi_link_train()
901 * - FDI delay to 90h in hsw_fdi_link_train()
912 rx_ctl_val = dev_priv->display.fdi.rx_config | FDI_RX_ENHANCE_FRAME_ENABLE | in hsw_fdi_link_train()
914 FDI_DP_PORT_WIDTH(crtc_state->fdi_lanes); in hsw_fdi_link_train()
924 drm_WARN_ON(&dev_priv->drm, crtc_state->shared_dpll->info->id != DPLL_ID_SPLL); in hsw_fdi_link_train()
930 /* Configure DP_TP_CTL with auto-training */ in hsw_fdi_link_train()
943 ((crtc_state->fdi_lanes - 1) << 1) | in hsw_fdi_link_train()
952 /* Enable PCH FDI Receiver with auto-training */ in hsw_fdi_link_train()
965 /* Wait for FDI auto training time */ in hsw_fdi_link_train()
970 drm_dbg_kms(&dev_priv->drm, in hsw_fdi_link_train()
979 if (i == n_entries * 2 - 1) { in hsw_fdi_link_train()
980 drm_err(&dev_priv->drm, "FDI link training failed!\n"); in hsw_fdi_link_train()
991 /* Disable DP_TP_CTL and FDI_RX_CTL and retry */ in hsw_fdi_link_train()
1014 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); in hsw_fdi_disable()
1035 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in ilk_fdi_pll_enable()
1036 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); in ilk_fdi_pll_enable()
1037 enum pipe pipe = crtc->pipe; in ilk_fdi_pll_enable()
1045 temp |= FDI_DP_PORT_WIDTH(crtc_state->fdi_lanes); in ilk_fdi_pll_enable()
1070 struct drm_device *dev = crtc->base.dev; in ilk_fdi_pll_disable()
1072 enum pipe pipe = crtc->pipe; in ilk_fdi_pll_disable()
1090 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); in ilk_fdi_disable()
1091 enum pipe pipe = crtc->pipe; in ilk_fdi_disable()
1151 dev_priv->display.funcs.fdi = &ilk_funcs; in intel_fdi_init_hook()
1153 dev_priv->display.funcs.fdi = &gen6_funcs; in intel_fdi_init_hook()
1155 /* FIXME: detect B0+ stepping and use auto training */ in intel_fdi_init_hook()
1156 dev_priv->display.funcs.fdi = &ivb_funcs; in intel_fdi_init_hook()