drm/i915/fdi: move more FDI stuff to FDI link train hooks

Accept slight duplication in the fdi link train hooks in exchange for
simplification in ilk_pch_enable(). This lets us make
ivb_update_fdi_bc_bifurcation() static again, now in intel_fdi.c.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/7984e670c6bb092d213d90f838d526d594d4a690.1629906431.git.jani.nikula@intel.com
This commit is contained in:
Jani Nikula 2021-08-25 18:47:50 +03:00
parent f18362cd28
commit 12b2c3016d
3 changed files with 24 additions and 10 deletions

View File

@ -2059,14 +2059,6 @@ static void ilk_pch_enable(const struct intel_atomic_state *state,
assert_pch_transcoder_disabled(dev_priv, pipe); assert_pch_transcoder_disabled(dev_priv, pipe);
if (IS_IVYBRIDGE(dev_priv))
ivb_update_fdi_bc_bifurcation(crtc_state);
/* Write the TU size bits before fdi link training, so that error
* detection works. */
intel_de_write(dev_priv, FDI_RX_TUSIZE1(pipe),
intel_de_read(dev_priv, PIPE_DATA_M1(pipe)) & TU_SIZE_MASK);
/* For PCH output, training FDI link */ /* For PCH output, training FDI link */
dev_priv->display.fdi_link_train(crtc, crtc_state); dev_priv->display.fdi_link_train(crtc, crtc_state);

View File

@ -195,7 +195,7 @@ static void cpt_set_fdi_bc_bifurcation(struct drm_i915_private *dev_priv, bool e
intel_de_posting_read(dev_priv, SOUTH_CHICKEN1); intel_de_posting_read(dev_priv, SOUTH_CHICKEN1);
} }
void ivb_update_fdi_bc_bifurcation(const struct intel_crtc_state *crtc_state) static void ivb_update_fdi_bc_bifurcation(const struct intel_crtc_state *crtc_state)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
@ -270,6 +270,13 @@ static void ilk_fdi_link_train(struct intel_crtc *crtc,
i915_reg_t reg; i915_reg_t reg;
u32 temp, tries; u32 temp, tries;
/*
* Write the TU size bits before fdi link training, so that error
* detection works.
*/
intel_de_write(dev_priv, FDI_RX_TUSIZE1(pipe),
intel_de_read(dev_priv, PIPE_DATA_M1(pipe)) & TU_SIZE_MASK);
/* FDI needs bits from pipe first */ /* FDI needs bits from pipe first */
assert_pipe_enabled(dev_priv, crtc_state->cpu_transcoder); assert_pipe_enabled(dev_priv, crtc_state->cpu_transcoder);
@ -373,6 +380,13 @@ static void gen6_fdi_link_train(struct intel_crtc *crtc,
i915_reg_t reg; i915_reg_t reg;
u32 temp, i, retry; u32 temp, i, retry;
/*
* Write the TU size bits before fdi link training, so that error
* detection works.
*/
intel_de_write(dev_priv, FDI_RX_TUSIZE1(pipe),
intel_de_read(dev_priv, PIPE_DATA_M1(pipe)) & TU_SIZE_MASK);
/* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
for train result */ for train result */
reg = FDI_RX_IMR(pipe); reg = FDI_RX_IMR(pipe);
@ -510,6 +524,15 @@ static void ivb_manual_fdi_link_train(struct intel_crtc *crtc,
i915_reg_t reg; i915_reg_t reg;
u32 temp, i, j; u32 temp, i, j;
ivb_update_fdi_bc_bifurcation(crtc_state);
/*
* Write the TU size bits before fdi link training, so that error
* detection works.
*/
intel_de_write(dev_priv, FDI_RX_TUSIZE1(pipe),
intel_de_read(dev_priv, PIPE_DATA_M1(pipe)) & TU_SIZE_MASK);
/* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
for train result */ for train result */
reg = FDI_RX_IMR(pipe); reg = FDI_RX_IMR(pipe);

View File

@ -16,7 +16,6 @@ int intel_fdi_link_freq(struct drm_i915_private *i915,
const struct intel_crtc_state *pipe_config); const struct intel_crtc_state *pipe_config);
int ilk_fdi_compute_config(struct intel_crtc *intel_crtc, int ilk_fdi_compute_config(struct intel_crtc *intel_crtc,
struct intel_crtc_state *pipe_config); struct intel_crtc_state *pipe_config);
void ivb_update_fdi_bc_bifurcation(const struct intel_crtc_state *crtc_state);
void intel_fdi_normal_train(struct intel_crtc *crtc); void intel_fdi_normal_train(struct intel_crtc *crtc);
void ilk_fdi_disable(struct intel_crtc *crtc); void ilk_fdi_disable(struct intel_crtc *crtc);
void ilk_fdi_pll_disable(struct intel_crtc *intel_crtc); void ilk_fdi_pll_disable(struct intel_crtc *intel_crtc);