diff mbox

[2/6] drm/i915/dp: split edp_panel_vdd_on() for reuse

Message ID a8b9b3bd905628b91dfbaa4b0ae3261109f0d9f0.1394808141.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula March 14, 2014, 2:51 p.m. UTC
Introduce _edp_panel_vdd_on() that returns true if the call enabled vdd,
and a matching disable is needed. Keep edp_panel_vdd_on() as a helper
for when it is expected the vdd is off.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

Comments

Rodrigo Vivi March 17, 2014, 2:09 p.m. UTC | #1
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>

On Fri, Mar 14, 2014 at 11:51 AM, Jani Nikula <jani.nikula@intel.com> wrote:
> Introduce _edp_panel_vdd_on() that returns true if the call enabled vdd,
> and a matching disable is needed. Keep edp_panel_vdd_on() as a helper
> for when it is expected the vdd is off.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c |   22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index bb66f9301cd9..94e7577da484 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -91,6 +91,7 @@ static struct intel_dp *intel_attached_dp(struct drm_connector *connector)
>  }
>
>  static void intel_dp_link_down(struct intel_dp *intel_dp);
> +static bool _edp_panel_vdd_on(struct intel_dp *intel_dp);
>  static void edp_panel_vdd_on(struct intel_dp *intel_dp);
>  static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync);
>
> @@ -1162,23 +1163,21 @@ static  u32 ironlake_get_pp_control(struct intel_dp *intel_dp)
>         return control;
>  }
>
> -static void edp_panel_vdd_on(struct intel_dp *intel_dp)
> +static bool _edp_panel_vdd_on(struct intel_dp *intel_dp)
>  {
>         struct drm_device *dev = intel_dp_to_dev(intel_dp);
>         struct drm_i915_private *dev_priv = dev->dev_private;
>         u32 pp;
>         u32 pp_stat_reg, pp_ctrl_reg;
> +       bool need_to_disable = !intel_dp->want_panel_vdd;
>
>         if (!is_edp(intel_dp))
> -               return;
> -
> -       WARN(intel_dp->want_panel_vdd,
> -            "eDP VDD already requested on\n");
> +               return false;
>
>         intel_dp->want_panel_vdd = true;
>
>         if (edp_have_panel_vdd(intel_dp))
> -               return;
> +               return need_to_disable;
>
>         intel_runtime_pm_get(dev_priv);
>
> @@ -1204,6 +1203,17 @@ static void edp_panel_vdd_on(struct intel_dp *intel_dp)
>                 DRM_DEBUG_KMS("eDP was not running\n");
>                 msleep(intel_dp->panel_power_up_delay);
>         }
> +
> +       return need_to_disable;
> +}
> +
> +static void edp_panel_vdd_on(struct intel_dp *intel_dp)
> +{
> +       if (is_edp(intel_dp)) {
> +               bool vdd = _edp_panel_vdd_on(intel_dp);
> +
> +               WARN(!vdd, "eDP VDD already requested on\n");
> +       }
>  }
>
>  static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)
> --
> 1.7.9.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi March 17, 2014, 2:47 p.m. UTC | #2
forgot to say that this patch needs a rebase on -nightly

On Mon, Mar 17, 2014 at 11:09 AM, Rodrigo Vivi <rodrigo.vivi@gmail.com> wrote:
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
>
> On Fri, Mar 14, 2014 at 11:51 AM, Jani Nikula <jani.nikula@intel.com> wrote:
>> Introduce _edp_panel_vdd_on() that returns true if the call enabled vdd,
>> and a matching disable is needed. Keep edp_panel_vdd_on() as a helper
>> for when it is expected the vdd is off.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_dp.c |   22 ++++++++++++++++------
>>  1 file changed, 16 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index bb66f9301cd9..94e7577da484 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -91,6 +91,7 @@ static struct intel_dp *intel_attached_dp(struct drm_connector *connector)
>>  }
>>
>>  static void intel_dp_link_down(struct intel_dp *intel_dp);
>> +static bool _edp_panel_vdd_on(struct intel_dp *intel_dp);
>>  static void edp_panel_vdd_on(struct intel_dp *intel_dp);
>>  static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync);
>>
>> @@ -1162,23 +1163,21 @@ static  u32 ironlake_get_pp_control(struct intel_dp *intel_dp)
>>         return control;
>>  }
>>
>> -static void edp_panel_vdd_on(struct intel_dp *intel_dp)
>> +static bool _edp_panel_vdd_on(struct intel_dp *intel_dp)
>>  {
>>         struct drm_device *dev = intel_dp_to_dev(intel_dp);
>>         struct drm_i915_private *dev_priv = dev->dev_private;
>>         u32 pp;
>>         u32 pp_stat_reg, pp_ctrl_reg;
>> +       bool need_to_disable = !intel_dp->want_panel_vdd;
>>
>>         if (!is_edp(intel_dp))
>> -               return;
>> -
>> -       WARN(intel_dp->want_panel_vdd,
>> -            "eDP VDD already requested on\n");
>> +               return false;
>>
>>         intel_dp->want_panel_vdd = true;
>>
>>         if (edp_have_panel_vdd(intel_dp))
>> -               return;
>> +               return need_to_disable;
>>
>>         intel_runtime_pm_get(dev_priv);
>>
>> @@ -1204,6 +1203,17 @@ static void edp_panel_vdd_on(struct intel_dp *intel_dp)
>>                 DRM_DEBUG_KMS("eDP was not running\n");
>>                 msleep(intel_dp->panel_power_up_delay);
>>         }
>> +
>> +       return need_to_disable;
>> +}
>> +
>> +static void edp_panel_vdd_on(struct intel_dp *intel_dp)
>> +{
>> +       if (is_edp(intel_dp)) {
>> +               bool vdd = _edp_panel_vdd_on(intel_dp);
>> +
>> +               WARN(!vdd, "eDP VDD already requested on\n");
>> +       }
>>  }
>>
>>  static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)
>> --
>> 1.7.9.5
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
>
>
> --
> Rodrigo Vivi
> Blog: http://blog.vivi.eng.br
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index bb66f9301cd9..94e7577da484 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -91,6 +91,7 @@  static struct intel_dp *intel_attached_dp(struct drm_connector *connector)
 }
 
 static void intel_dp_link_down(struct intel_dp *intel_dp);
+static bool _edp_panel_vdd_on(struct intel_dp *intel_dp);
 static void edp_panel_vdd_on(struct intel_dp *intel_dp);
 static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync);
 
@@ -1162,23 +1163,21 @@  static  u32 ironlake_get_pp_control(struct intel_dp *intel_dp)
 	return control;
 }
 
-static void edp_panel_vdd_on(struct intel_dp *intel_dp)
+static bool _edp_panel_vdd_on(struct intel_dp *intel_dp)
 {
 	struct drm_device *dev = intel_dp_to_dev(intel_dp);
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 pp;
 	u32 pp_stat_reg, pp_ctrl_reg;
+	bool need_to_disable = !intel_dp->want_panel_vdd;
 
 	if (!is_edp(intel_dp))
-		return;
-
-	WARN(intel_dp->want_panel_vdd,
-	     "eDP VDD already requested on\n");
+		return false;
 
 	intel_dp->want_panel_vdd = true;
 
 	if (edp_have_panel_vdd(intel_dp))
-		return;
+		return need_to_disable;
 
 	intel_runtime_pm_get(dev_priv);
 
@@ -1204,6 +1203,17 @@  static void edp_panel_vdd_on(struct intel_dp *intel_dp)
 		DRM_DEBUG_KMS("eDP was not running\n");
 		msleep(intel_dp->panel_power_up_delay);
 	}
+
+	return need_to_disable;
+}
+
+static void edp_panel_vdd_on(struct intel_dp *intel_dp)
+{
+	if (is_edp(intel_dp)) {
+		bool vdd = _edp_panel_vdd_on(intel_dp);
+
+		WARN(!vdd, "eDP VDD already requested on\n");
+	}
 }
 
 static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)