[Intel-gfx] [PATCH 05/14] drm/i915: Call runtime_pm_disable directly

Imre Deak imre.deak at intel.com
Tue Sep 30 14:46:20 CEST 2014


On Tue, 2014-09-30 at 10:56 +0200, Daniel Vetter wrote:
> Allows us to mark it static and so forgoe the kerneldoc for it.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_dma.c         |  4 +---
>  drivers/gpu/drm/i915/intel_drv.h        |  1 -
>  drivers/gpu/drm/i915/intel_runtime_pm.c | 34 +++++++++++++++++----------------
>  3 files changed, 19 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 9aeec0df5658..7075bd2adee8 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1846,12 +1846,10 @@ int i915_driver_unload(struct drm_device *dev)
>  		return ret;
>  	}
>  
> -	intel_runtime_pm_disable(dev_priv);
> +	intel_power_domains_fini(dev_priv);
>  
>  	intel_gpu_ips_teardown();
>  
> -	intel_power_domains_fini(dev_priv);
> -
>  	i915_teardown_sysfs(dev);
>  
>  	WARN_ON(unregister_oom_notifier(&dev_priv->mm.oom_notifier));
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index ce1b5e99eb56..bf321993a88e 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1077,7 +1077,6 @@ int intel_power_domains_init(struct drm_i915_private *);
>  void intel_power_domains_fini(struct drm_i915_private *);
>  void intel_power_domains_init_hw(struct drm_i915_private *dev_priv);
>  void intel_runtime_pm_enable(struct drm_i915_private *dev_priv);
> -void intel_runtime_pm_disable(struct drm_i915_private *dev_priv);
>  
>  bool intel_display_power_is_enabled(struct drm_i915_private *dev_priv,
>  				    enum intel_display_power_domain domain);
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index db3716d93dcf..c49fee218e1b 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -995,8 +995,26 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv)
>  	return 0;
>  }
>  
> +static void intel_runtime_pm_disable(struct drm_i915_private *dev_priv)
> +{
> +	struct drm_device *dev = dev_priv->dev;
> +	struct device *device = &dev->pdev->dev;
> +
> +	if (!HAS_RUNTIME_PM(dev))
> +		return;
> +
> +	if (!intel_enable_rc6(dev))
> +		return;
> +
> +	/* Make sure we're not suspended first. */
> +	pm_runtime_get_sync(device);
> +	pm_runtime_disable(device);
> +}
> +
>  void intel_power_domains_fini(struct drm_i915_private *dev_priv)
>  {
> +	intel_runtime_pm_disable(dev_priv);
> +

This is also called on the driver load error path, where we didn't yet
call intel_runtime_pm_enable(). It works and I'm ok with it, but I
thought it's worth mentioning.

>  	/* The i915.ko module is still not prepared to be loaded when
>  	 * the power well is not enabled, so just enable it in case
>  	 * we're going to unload/reload. */
> @@ -1142,22 +1160,6 @@ void intel_runtime_pm_enable(struct drm_i915_private *dev_priv)
>  	pm_runtime_put_autosuspend(device);
>  }
>  
> -void intel_runtime_pm_disable(struct drm_i915_private *dev_priv)
> -{
> -	struct drm_device *dev = dev_priv->dev;
> -	struct device *device = &dev->pdev->dev;
> -
> -	if (!HAS_RUNTIME_PM(dev))
> -		return;
> -
> -	if (!intel_enable_rc6(dev))
> -		return;
> -
> -	/* Make sure we're not suspended first. */
> -	pm_runtime_get_sync(device);
> -	pm_runtime_disable(device);
> -}
> -
>  /* Display audio driver power well request */
>  int i915_request_power_well(void)
>  {





More information about the Intel-gfx mailing list