drm/i915: Extract intel_crtc_pch_transcoder()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 14 Oct 2016 17:02:53 +0000 (20:02 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 17 Oct 2016 11:51:15 +0000 (14:51 +0300)
Extract the code to determine which PCH transcoder we're using to a
small helper.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1476464574-32230-2-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h

index bdc898ef5b64266f097dcee4e32433f57d318e24..9395878abc568ceffb8e0d9860ef40feac90e232 100644 (file)
@@ -1926,6 +1926,18 @@ void lpt_disable_pch_transcoder(struct drm_i915_private *dev_priv)
        I915_WRITE(TRANS_CHICKEN2(PIPE_A), val);
 }
 
+enum transcoder intel_crtc_pch_transcoder(struct intel_crtc *crtc)
+{
+       struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
+
+       WARN_ON(!crtc->config->has_pch_encoder);
+
+       if (HAS_PCH_LPT(dev_priv))
+               return TRANSCODER_A;
+       else
+               return (enum transcoder) crtc->pipe;
+}
+
 /**
  * intel_enable_pipe - enable a pipe, asserting requirements
  * @crtc: crtc responsible for the pipe
@@ -1939,7 +1951,6 @@ static void intel_enable_pipe(struct intel_crtc *crtc)
        struct drm_i915_private *dev_priv = to_i915(dev);
        enum pipe pipe = crtc->pipe;
        enum transcoder cpu_transcoder = crtc->config->cpu_transcoder;
-       enum pipe pch_transcoder;
        i915_reg_t reg;
        u32 val;
 
@@ -1949,11 +1960,6 @@ static void intel_enable_pipe(struct intel_crtc *crtc)
        assert_cursor_disabled(dev_priv, pipe);
        assert_sprites_disabled(dev_priv, pipe);
 
-       if (HAS_PCH_LPT(dev_priv))
-               pch_transcoder = TRANSCODER_A;
-       else
-               pch_transcoder = pipe;
-
        /*
         * A pipe without a PLL won't actually be able to drive bits from
         * a plane.  On ILK+ the pipe PLLs are integrated, so we don't
@@ -1967,7 +1973,8 @@ static void intel_enable_pipe(struct intel_crtc *crtc)
        } else {
                if (crtc->config->has_pch_encoder) {
                        /* if driving the PCH, we need FDI enabled */
-                       assert_fdi_rx_pll_enabled(dev_priv, pch_transcoder);
+                       assert_fdi_rx_pll_enabled(dev_priv,
+                                                 (enum pipe) intel_crtc_pch_transcoder(crtc));
                        assert_fdi_tx_pll_enabled(dev_priv,
                                                  (enum pipe) cpu_transcoder);
                }
index 84301d3b8b7f48fb7a5c103325fc1358d8930e81..4388807f8fc85c23c5e37e2caa70d040cc37abdd 100644 (file)
@@ -1191,6 +1191,7 @@ void i915_audio_component_init(struct drm_i915_private *dev_priv);
 void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);
 
 /* intel_display.c */
+enum transcoder intel_crtc_pch_transcoder(struct intel_crtc *crtc);
 void skl_set_preferred_cdclk_vco(struct drm_i915_private *dev_priv, int vco);
 void intel_update_rawclk(struct drm_i915_private *dev_priv);
 int vlv_get_cck_clock(struct drm_i915_private *dev_priv,