drm/i915/skl: Set the eDP link rate on DPLL0
authorDamien Lespiau <damien.lespiau@intel.com>
Fri, 14 Nov 2014 17:24:33 +0000 (17:24 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 17 Nov 2014 18:19:44 +0000 (19:19 +0100)
On SKL DPLL0 is used to derive CDCLK but can also be used to drive an
eDP port (as long as we don't want SSC). DPLL0 is special enough to not
be handled by the shared DPLL framework (drives CDCLK, not supposed to
enable the HDMI mode), So we need to compute the configuration
separately from the other DPLLs.

Note that we don't need to reprogram DPLL0 (which would mean bringing
down CDCLK) to support the various eDP 1.3 link rates as they all share
the same VCO (8100).

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_ddi.c
drivers/gpu/drm/i915/intel_dp.c

index 3e4c63c..83eeecb 100644 (file)
@@ -1484,6 +1484,25 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
                uint32_t dpll = crtc->config.ddi_pll_sel;
                uint32_t val;
 
+               /*
+                * DPLL0 is used for eDP and is the only "private" DPLL (as
+                * opposed to shared) on SKL
+                */
+               if (type == INTEL_OUTPUT_EDP) {
+                       WARN_ON(dpll != SKL_DPLL0);
+
+                       val = I915_READ(DPLL_CTRL1);
+
+                       val &= ~(DPLL_CTRL1_HDMI_MODE(dpll) |
+                                DPLL_CTRL1_SSC(dpll) |
+                                DPLL_CRTL1_LINK_RATE_MASK(dpll));
+                       val |= crtc->config.dpll_hw_state.ctrl1 << (dpll * 6);
+
+                       I915_WRITE(DPLL_CTRL1, val);
+                       POSTING_READ(DPLL_CTRL1);
+               }
+
+               /* DDI -> PLL mapping  */
                val = I915_READ(DPLL_CTRL2);
 
                val &= ~(DPLL_CTRL2_DDI_CLK_OFF(port) |
@@ -1492,6 +1511,7 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
                        DPLL_CTRL2_DDI_SEL_OVERRIDE(port));
 
                I915_WRITE(DPLL_CTRL2, val);
+
        } else {
                WARN_ON(crtc->config.ddi_pll_sel == PORT_CLK_SEL_NONE);
                I915_WRITE(PORT_CLK_SEL(port), crtc->config.ddi_pll_sel);
Simple merge