drm/i915: Move SPLL disabling into hsw_crt_post_disable
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 25 Jun 2014 19:01:52 +0000 (22:01 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 10 Jul 2014 20:05:35 +0000 (22:05 +0200)
Similar to how the ->crtc_mode_set hook should touch the hardware to
enable anything the ->crtc_off hook should disable anything in the
hardware. Otherwise runtime pm for dpms will not work.

Currently the only things left int the haswell_crtc_off hook is
disabling the ddi plls. We can't move the WRPLL enabling out yet
because the current ddi pll sharing code used by the haswell code
doesn't separately track active users and overall users. This must be
fixed by porting it to the generic shared display pll framework, which
is powerful enough.

But the SPLL source is only used by the crt encoder and so can be
moved already. We only need to make sure that the ddi port E is
already off, which hsw_fdi_disable does by calling
intel_ddi_post_disable.

With this the code reorg to shuffle hsw fdi/lpt specific code into a
new hsw-specific crt encoder type is now finally complete.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[imre: rebased on patchset version w/o pch/crt/fdi refactoring]
Signed-off-by: Imre Deak <imre.deak@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_crt.c
drivers/gpu/drm/i915/intel_ddi.c

index d312cf89c00a82032d63a4936408a4fffe8a4bdd..30bfdc735feea53f7f09887bac01e0ba60d9e31d 100644 (file)
@@ -206,6 +206,20 @@ static void intel_disable_crt(struct intel_encoder *encoder)
        intel_crt_set_dpms(encoder, DRM_MODE_DPMS_OFF);
 }
 
+
+static void hsw_crt_post_disable(struct intel_encoder *encoder)
+{
+       struct drm_device *dev = encoder->base.dev;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       uint32_t val;
+
+       DRM_DEBUG_KMS("Disabling SPLL\n");
+       val = I915_READ(SPLL_CTL);
+       WARN_ON(!(val & SPLL_PLL_ENABLE));
+       I915_WRITE(SPLL_CTL, val & ~SPLL_PLL_ENABLE);
+       POSTING_READ(SPLL_CTL);
+}
+
 static void intel_enable_crt(struct intel_encoder *encoder)
 {
        struct intel_crt *crt = intel_encoder_to_crt(encoder);
@@ -873,6 +887,7 @@ void intel_crt_init(struct drm_device *dev)
                crt->base.get_config = hsw_crt_get_config;
                crt->base.get_hw_state = intel_ddi_get_hw_state;
                crt->base.pre_enable = hsw_crt_pre_enable;
+               crt->base.post_disable = hsw_crt_post_disable;
        } else {
                crt->base.get_config = intel_crt_get_config;
                crt->base.get_hw_state = intel_crt_get_hw_state;
index 991ad0b9859cbcda547dddd8f085584fdde120fc..fa1effca82aa724387335c0167a9abd6fb95b1de 100644 (file)
@@ -394,13 +394,6 @@ void intel_ddi_put_crtc_pll(struct drm_crtc *crtc)
        uint32_t val;
 
        switch (intel_crtc->ddi_pll_sel) {
-       case PORT_CLK_SEL_SPLL:
-               DRM_DEBUG_KMS("Disabling SPLL\n");
-               val = I915_READ(SPLL_CTL);
-               WARN_ON(!(val & SPLL_PLL_ENABLE));
-               I915_WRITE(SPLL_CTL, val & ~SPLL_PLL_ENABLE);
-               POSTING_READ(SPLL_CTL);
-               break;
        case PORT_CLK_SEL_WRPLL1:
                plls->wrpll1_refcount--;
                if (plls->wrpll1_refcount == 0) {