diff mbox

[57/58] drm/i915: disable all crtcs at suspend time

Message ID 1345403595-9678-58-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State Accepted
Headers show

Commit Message

Daniel Vetter Aug. 19, 2012, 7:13 p.m. UTC
We need this to avoid confusing the hw state readout code with the cpt
pch plls at resume time: We'd read the new pipe state (which is
disabled), but still believe that we have a life pll connected to that
pipe (from before the suspend). Hence properly disable pipes to clear
out all the residual state.

This has the neat side-effect that we don't enable ports prematurely
by restoring bogus state from the saved register values.

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Conflicts:
	drivers/gpu/drm/i915/intel_drv.h
---
 drivers/gpu/drm/i915/i915_drv.c      |  3 +++
 drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 3 files changed, 14 insertions(+)

Comments

Jesse Barnes Sept. 5, 2012, 6:29 p.m. UTC | #1
On Sun, 19 Aug 2012 21:13:14 +0200
Daniel Vetter <daniel.vetter@ffwll.ch> wrote:

> We need this to avoid confusing the hw state readout code with the cpt
> pch plls at resume time: We'd read the new pipe state (which is
> disabled), but still believe that we have a life pll connected to that
> pipe (from before the suspend). Hence properly disable pipes to clear
> out all the residual state.
> 
> This has the neat side-effect that we don't enable ports prematurely
> by restoring bogus state from the saved register values.
> 
> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> Conflicts:
> 	drivers/gpu/drm/i915/intel_drv.h
> ---
>  drivers/gpu/drm/i915/i915_drv.c      |  3 +++
>  drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++
>  drivers/gpu/drm/i915/intel_drv.h     |  1 +
>  3 files changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 4abac6d..fe7512a 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -470,6 +470,9 @@ static int i915_drm_freeze(struct drm_device *dev)
>  				"GEM idle failed, resume might fail\n");
>  			return error;
>  		}
> +
> +		intel_modeset_disable(dev);
> +
>  		drm_irq_uninstall(dev);
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 10e3f9c..95a9f04 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3545,6 +3545,16 @@ static void intel_crtc_disable(struct drm_crtc *crtc)
>  	}
>  }
>  
> +void intel_modeset_disable(struct drm_device *dev)
> +{
> +	struct drm_crtc *crtc;
> +
> +	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
> +		if (crtc->enabled)
> +			intel_crtc_disable(crtc);
> +	}
> +}
> +
>  void intel_encoder_noop(struct drm_encoder *encoder)
>  {
>  }
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 1282bf0..71c1517 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -450,6 +450,7 @@ struct intel_set_config {
>  
>  extern bool intel_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode,
>  			   int x, int y, struct drm_framebuffer *old_fb);
> +extern void intel_modeset_disable(struct drm_device *dev);
>  extern void intel_crtc_load_lut(struct drm_crtc *crtc);
>  extern void intel_crtc_update_dpms(struct drm_crtc *crtc);
>  extern void intel_encoder_noop(struct drm_encoder *encoder);

Looks safe enough.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 4abac6d..fe7512a 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -470,6 +470,9 @@  static int i915_drm_freeze(struct drm_device *dev)
 				"GEM idle failed, resume might fail\n");
 			return error;
 		}
+
+		intel_modeset_disable(dev);
+
 		drm_irq_uninstall(dev);
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 10e3f9c..95a9f04 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3545,6 +3545,16 @@  static void intel_crtc_disable(struct drm_crtc *crtc)
 	}
 }
 
+void intel_modeset_disable(struct drm_device *dev)
+{
+	struct drm_crtc *crtc;
+
+	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+		if (crtc->enabled)
+			intel_crtc_disable(crtc);
+	}
+}
+
 void intel_encoder_noop(struct drm_encoder *encoder)
 {
 }
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 1282bf0..71c1517 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -450,6 +450,7 @@  struct intel_set_config {
 
 extern bool intel_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode,
 			   int x, int y, struct drm_framebuffer *old_fb);
+extern void intel_modeset_disable(struct drm_device *dev);
 extern void intel_crtc_load_lut(struct drm_crtc *crtc);
 extern void intel_crtc_update_dpms(struct drm_crtc *crtc);
 extern void intel_encoder_noop(struct drm_encoder *encoder);