diff mbox

[04/19] drm/i915: extract __hsw_do_{en, dis}able_package_c8

Message ID 1387461309-2756-5-git-send-email-przanoni@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Zanoni Dec. 19, 2013, 1:54 p.m. UTC
From: Paulo Zanoni <paulo.r.zanoni@intel.com>

When we merge PC8 and runtime PM, these new functions are going to be
called by the runtime suspend/resume functions, and their callers are
going to be removed.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 64 +++++++++++++++++++++---------------
 1 file changed, 38 insertions(+), 26 deletions(-)

Comments

Imre Deak Feb. 27, 2014, 2:49 p.m. UTC | #1
On Thu, 2013-12-19 at 11:54 -0200, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> 
> When we merge PC8 and runtime PM, these new functions are going to be
> called by the runtime suspend/resume functions, and their callers are
> going to be removed.
> 
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

Reviewed-by: Imre Deak <imre.deak@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_display.c | 64 +++++++++++++++++++++---------------
>  1 file changed, 38 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index c661423..db6523e 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -6638,19 +6638,11 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv)
>  	gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL);
>  }
>  
> -void hsw_enable_pc8_work(struct work_struct *__work)
> +static void __hsw_do_enable_pc8(struct drm_i915_private *dev_priv)
>  {
> -	struct drm_i915_private *dev_priv =
> -		container_of(to_delayed_work(__work), struct drm_i915_private,
> -			     pc8.enable_work);
>  	struct drm_device *dev = dev_priv->dev;
>  	uint32_t val;
>  
> -	WARN_ON(!HAS_PC8(dev));
> -
> -	if (dev_priv->pc8.enabled)
> -		return;
> -
>  	DRM_DEBUG_KMS("Enabling package C8+\n");
>  
>  	dev_priv->pc8.enabled = true;
> @@ -6664,7 +6656,21 @@ void hsw_enable_pc8_work(struct work_struct *__work)
>  	lpt_disable_clkout_dp(dev);
>  	hsw_pc8_disable_interrupts(dev);
>  	hsw_disable_lcpll(dev_priv, true, true);
> +}
> +
> +void hsw_enable_pc8_work(struct work_struct *__work)
> +{
> +	struct drm_i915_private *dev_priv =
> +		container_of(to_delayed_work(__work), struct drm_i915_private,
> +			     pc8.enable_work);
> +	struct drm_device *dev = dev_priv->dev;
> +
> +	WARN_ON(!HAS_PC8(dev));
>  
> +	if (dev_priv->pc8.enabled)
> +		return;
> +
> +	__hsw_do_enable_pc8(dev_priv);
>  	intel_runtime_pm_put(dev_priv);
>  }
>  
> @@ -6682,29 +6688,13 @@ static void __hsw_enable_package_c8(struct drm_i915_private *dev_priv)
>  			      msecs_to_jiffies(i915_pc8_timeout));
>  }
>  
> -static void __hsw_disable_package_c8(struct drm_i915_private *dev_priv)
> +static void __hsw_do_disable_package_c8(struct drm_i915_private *dev_priv)
>  {
>  	struct drm_device *dev = dev_priv->dev;
>  	uint32_t val;
>  
> -	WARN_ON(!mutex_is_locked(&dev_priv->pc8.lock));
> -	WARN(dev_priv->pc8.disable_count < 0,
> -	     "pc8.disable_count: %d\n", dev_priv->pc8.disable_count);
> -
> -	dev_priv->pc8.disable_count++;
> -	if (dev_priv->pc8.disable_count != 1)
> -		return;
> -
> -	WARN_ON(!HAS_PC8(dev));
> -
> -	cancel_delayed_work_sync(&dev_priv->pc8.enable_work);
> -	if (!dev_priv->pc8.enabled)
> -		return;
> -
>  	DRM_DEBUG_KMS("Disabling package C8+\n");
>  
> -	intel_runtime_pm_get(dev_priv);
> -
>  	hsw_restore_lcpll(dev_priv);
>  	hsw_pc8_restore_interrupts(dev);
>  	lpt_init_pch_refclk(dev);
> @@ -6723,6 +6713,28 @@ static void __hsw_disable_package_c8(struct drm_i915_private *dev_priv)
>  	dev_priv->pc8.enabled = false;
>  }
>  
> +static void __hsw_disable_package_c8(struct drm_i915_private *dev_priv)
> +{
> +	struct drm_device *dev = dev_priv->dev;
> +
> +	WARN_ON(!mutex_is_locked(&dev_priv->pc8.lock));
> +	WARN(dev_priv->pc8.disable_count < 0,
> +	     "pc8.disable_count: %d\n", dev_priv->pc8.disable_count);
> +
> +	dev_priv->pc8.disable_count++;
> +	if (dev_priv->pc8.disable_count != 1)
> +		return;
> +
> +	WARN_ON(!HAS_PC8(dev));
> +
> +	cancel_delayed_work_sync(&dev_priv->pc8.enable_work);
> +	if (!dev_priv->pc8.enabled)
> +		return;
> +
> +	intel_runtime_pm_get(dev_priv);
> +	__hsw_do_disable_package_c8(dev_priv);
> +}
> +
>  void hsw_enable_package_c8(struct drm_i915_private *dev_priv)
>  {
>  	if (!HAS_PC8(dev_priv->dev))
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c661423..db6523e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6638,19 +6638,11 @@  static void hsw_restore_lcpll(struct drm_i915_private *dev_priv)
 	gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL);
 }
 
-void hsw_enable_pc8_work(struct work_struct *__work)
+static void __hsw_do_enable_pc8(struct drm_i915_private *dev_priv)
 {
-	struct drm_i915_private *dev_priv =
-		container_of(to_delayed_work(__work), struct drm_i915_private,
-			     pc8.enable_work);
 	struct drm_device *dev = dev_priv->dev;
 	uint32_t val;
 
-	WARN_ON(!HAS_PC8(dev));
-
-	if (dev_priv->pc8.enabled)
-		return;
-
 	DRM_DEBUG_KMS("Enabling package C8+\n");
 
 	dev_priv->pc8.enabled = true;
@@ -6664,7 +6656,21 @@  void hsw_enable_pc8_work(struct work_struct *__work)
 	lpt_disable_clkout_dp(dev);
 	hsw_pc8_disable_interrupts(dev);
 	hsw_disable_lcpll(dev_priv, true, true);
+}
+
+void hsw_enable_pc8_work(struct work_struct *__work)
+{
+	struct drm_i915_private *dev_priv =
+		container_of(to_delayed_work(__work), struct drm_i915_private,
+			     pc8.enable_work);
+	struct drm_device *dev = dev_priv->dev;
+
+	WARN_ON(!HAS_PC8(dev));
 
+	if (dev_priv->pc8.enabled)
+		return;
+
+	__hsw_do_enable_pc8(dev_priv);
 	intel_runtime_pm_put(dev_priv);
 }
 
@@ -6682,29 +6688,13 @@  static void __hsw_enable_package_c8(struct drm_i915_private *dev_priv)
 			      msecs_to_jiffies(i915_pc8_timeout));
 }
 
-static void __hsw_disable_package_c8(struct drm_i915_private *dev_priv)
+static void __hsw_do_disable_package_c8(struct drm_i915_private *dev_priv)
 {
 	struct drm_device *dev = dev_priv->dev;
 	uint32_t val;
 
-	WARN_ON(!mutex_is_locked(&dev_priv->pc8.lock));
-	WARN(dev_priv->pc8.disable_count < 0,
-	     "pc8.disable_count: %d\n", dev_priv->pc8.disable_count);
-
-	dev_priv->pc8.disable_count++;
-	if (dev_priv->pc8.disable_count != 1)
-		return;
-
-	WARN_ON(!HAS_PC8(dev));
-
-	cancel_delayed_work_sync(&dev_priv->pc8.enable_work);
-	if (!dev_priv->pc8.enabled)
-		return;
-
 	DRM_DEBUG_KMS("Disabling package C8+\n");
 
-	intel_runtime_pm_get(dev_priv);
-
 	hsw_restore_lcpll(dev_priv);
 	hsw_pc8_restore_interrupts(dev);
 	lpt_init_pch_refclk(dev);
@@ -6723,6 +6713,28 @@  static void __hsw_disable_package_c8(struct drm_i915_private *dev_priv)
 	dev_priv->pc8.enabled = false;
 }
 
+static void __hsw_disable_package_c8(struct drm_i915_private *dev_priv)
+{
+	struct drm_device *dev = dev_priv->dev;
+
+	WARN_ON(!mutex_is_locked(&dev_priv->pc8.lock));
+	WARN(dev_priv->pc8.disable_count < 0,
+	     "pc8.disable_count: %d\n", dev_priv->pc8.disable_count);
+
+	dev_priv->pc8.disable_count++;
+	if (dev_priv->pc8.disable_count != 1)
+		return;
+
+	WARN_ON(!HAS_PC8(dev));
+
+	cancel_delayed_work_sync(&dev_priv->pc8.enable_work);
+	if (!dev_priv->pc8.enabled)
+		return;
+
+	intel_runtime_pm_get(dev_priv);
+	__hsw_do_disable_package_c8(dev_priv);
+}
+
 void hsw_enable_package_c8(struct drm_i915_private *dev_priv)
 {
 	if (!HAS_PC8(dev_priv->dev))