diff mbox

[09/19] drm/i915: get a runtime PM reference when the panel VDD is on

Message ID 1385048853-1579-10-git-send-email-przanoni@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Zanoni Nov. 21, 2013, 3:47 p.m. UTC
From: Paulo Zanoni <paulo.r.zanoni@intel.com>

And put it when it's off. Otherwise, when you run pm_pc8 from
intel-gpu-tools, and the delayed function that disables VDD runs,
we'll get some messages saying we're touching registers while the HW
is suspended.

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

Comments

Rodrigo Vivi Nov. 29, 2013, 1:50 p.m. UTC | #1
On Thu, Nov 21, 2013 at 01:47:23PM -0200, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> 
> And put it when it's off. Otherwise, when you run pm_pc8 from
> intel-gpu-tools, and the delayed function that disables VDD runs,
> we'll get some messages saying we're touching registers while the HW
> is suspended.
> 
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 28fc070..9e9e3d6 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1092,6 +1092,8 @@ void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp)
>  	if (ironlake_edp_have_panel_vdd(intel_dp))
>  		return;
>  
> +	intel_runtime_pm_get(dev_priv);
> +
>  	DRM_DEBUG_KMS("Turning eDP VDD on\n");
>  
>  	if (!ironlake_edp_have_panel_power(intel_dp))
> @@ -1141,6 +1143,8 @@ static void ironlake_panel_vdd_off_sync(struct intel_dp *intel_dp)
>  		DRM_DEBUG_KMS("PP_STATUS: 0x%08x PP_CONTROL: 0x%08x\n",
>  		I915_READ(pp_stat_reg), I915_READ(pp_ctrl_reg));
>  		msleep(intel_dp->panel_power_down_delay);
> +
> +		intel_runtime_pm_put(dev_priv);
>  	}
>  }
>  
> @@ -1248,6 +1252,9 @@ void ironlake_edp_panel_off(struct intel_dp *intel_dp)
>  	intel_dp->want_panel_vdd = false;
>  
>  	ironlake_wait_panel_off(intel_dp);
> +
> +	/* We got a reference when we enabled the VDD. */
> +	intel_runtime_pm_put(dev_priv);

I was going to say it was missing a get until I read the comment above.
But if it gets on VDD on, why not just let it put back on VDD off instead?

>  }
>  
>  void ironlake_edp_backlight_on(struct intel_dp *intel_dp)
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Paulo Zanoni Nov. 29, 2013, 1:59 p.m. UTC | #2
2013/11/29 Rodrigo Vivi <rodrigo.vivi@gmail.com>:
> On Thu, Nov 21, 2013 at 01:47:23PM -0200, Paulo Zanoni wrote:
>> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
>>
>> And put it when it's off. Otherwise, when you run pm_pc8 from
>> intel-gpu-tools, and the delayed function that disables VDD runs,
>> we'll get some messages saying we're touching registers while the HW
>> is suspended.
>>
>> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_dp.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index 28fc070..9e9e3d6 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -1092,6 +1092,8 @@ void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp)
>>       if (ironlake_edp_have_panel_vdd(intel_dp))
>>               return;
>>
>> +     intel_runtime_pm_get(dev_priv);
>> +
>>       DRM_DEBUG_KMS("Turning eDP VDD on\n");
>>
>>       if (!ironlake_edp_have_panel_power(intel_dp))
>> @@ -1141,6 +1143,8 @@ static void ironlake_panel_vdd_off_sync(struct intel_dp *intel_dp)
>>               DRM_DEBUG_KMS("PP_STATUS: 0x%08x PP_CONTROL: 0x%08x\n",
>>               I915_READ(pp_stat_reg), I915_READ(pp_ctrl_reg));
>>               msleep(intel_dp->panel_power_down_delay);
>> +
>> +             intel_runtime_pm_put(dev_priv);
>>       }
>>  }
>>
>> @@ -1248,6 +1252,9 @@ void ironlake_edp_panel_off(struct intel_dp *intel_dp)
>>       intel_dp->want_panel_vdd = false;
>>
>>       ironlake_wait_panel_off(intel_dp);
>> +
>> +     /* We got a reference when we enabled the VDD. */
>> +     intel_runtime_pm_put(dev_priv);
>
> I was going to say it was missing a get until I read the comment above.
> But if it gets on VDD on, why not just let it put back on VDD off instead?

That's the goal of my series. See patches 15 and 16.

>
>>  }
>>
>>  void ironlake_edp_backlight_on(struct intel_dp *intel_dp)
>> --
>> 1.8.3.1
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi Nov. 29, 2013, 2:37 p.m. UTC | #3
On Fri, Nov 29, 2013 at 11:59 AM, Paulo Zanoni <przanoni@gmail.com> wrote:
> 2013/11/29 Rodrigo Vivi <rodrigo.vivi@gmail.com>:
>> On Thu, Nov 21, 2013 at 01:47:23PM -0200, Paulo Zanoni wrote:
>>> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
>>>
>>> And put it when it's off. Otherwise, when you run pm_pc8 from
>>> intel-gpu-tools, and the delayed function that disables VDD runs,
>>> we'll get some messages saying we're touching registers while the HW
>>> is suspended.
>>>
>>> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
>>> ---
>>>  drivers/gpu/drm/i915/intel_dp.c | 7 +++++++
>>>  1 file changed, 7 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>>> index 28fc070..9e9e3d6 100644
>>> --- a/drivers/gpu/drm/i915/intel_dp.c
>>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>>> @@ -1092,6 +1092,8 @@ void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp)
>>>       if (ironlake_edp_have_panel_vdd(intel_dp))
>>>               return;
>>>
>>> +     intel_runtime_pm_get(dev_priv);
>>> +
>>>       DRM_DEBUG_KMS("Turning eDP VDD on\n");
>>>
>>>       if (!ironlake_edp_have_panel_power(intel_dp))
>>> @@ -1141,6 +1143,8 @@ static void ironlake_panel_vdd_off_sync(struct intel_dp *intel_dp)
>>>               DRM_DEBUG_KMS("PP_STATUS: 0x%08x PP_CONTROL: 0x%08x\n",
>>>               I915_READ(pp_stat_reg), I915_READ(pp_ctrl_reg));
>>>               msleep(intel_dp->panel_power_down_delay);
>>> +
>>> +             intel_runtime_pm_put(dev_priv);
>>>       }
>>>  }
>>>
>>> @@ -1248,6 +1252,9 @@ void ironlake_edp_panel_off(struct intel_dp *intel_dp)
>>>       intel_dp->want_panel_vdd = false;
>>>
>>>       ironlake_wait_panel_off(intel_dp);
>>> +
>>> +     /* We got a reference when we enabled the VDD. */
>>> +     intel_runtime_pm_put(dev_priv);
>>
>> I was going to say it was missing a get until I read the comment above.
>> But if it gets on VDD on, why not just let it put back on VDD off instead?
>
> That's the goal of my series. See patches 15 and 16.

I saw both and got your point, but even after them get and put doesn't
look in a symmetric place for me.

wouldn't make sense on this patch remove both of _put here and add one
in vdd_off?
Even after your vdd fixes it would be symmetric.

>
>>
>>>  }
>>>
>>>  void ironlake_edp_backlight_on(struct intel_dp *intel_dp)
>>> --
>>> 1.8.3.1
>>>
>>> _______________________________________________
>>> Intel-gfx mailing list
>>> Intel-gfx@lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
>
>
> --
> Paulo Zanoni
Paulo Zanoni Dec. 6, 2013, 10:23 p.m. UTC | #4
2013/11/29 Rodrigo Vivi <rodrigo.vivi@gmail.com>:
> On Fri, Nov 29, 2013 at 11:59 AM, Paulo Zanoni <przanoni@gmail.com> wrote:
>> 2013/11/29 Rodrigo Vivi <rodrigo.vivi@gmail.com>:
>>> On Thu, Nov 21, 2013 at 01:47:23PM -0200, Paulo Zanoni wrote:
>>>> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
>>>>
>>>> And put it when it's off. Otherwise, when you run pm_pc8 from
>>>> intel-gpu-tools, and the delayed function that disables VDD runs,
>>>> we'll get some messages saying we're touching registers while the HW
>>>> is suspended.
>>>>
>>>> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
>>>> ---
>>>>  drivers/gpu/drm/i915/intel_dp.c | 7 +++++++
>>>>  1 file changed, 7 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>>>> index 28fc070..9e9e3d6 100644
>>>> --- a/drivers/gpu/drm/i915/intel_dp.c
>>>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>>>> @@ -1092,6 +1092,8 @@ void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp)
>>>>       if (ironlake_edp_have_panel_vdd(intel_dp))
>>>>               return;
>>>>
>>>> +     intel_runtime_pm_get(dev_priv);
>>>> +
>>>>       DRM_DEBUG_KMS("Turning eDP VDD on\n");
>>>>
>>>>       if (!ironlake_edp_have_panel_power(intel_dp))
>>>> @@ -1141,6 +1143,8 @@ static void ironlake_panel_vdd_off_sync(struct intel_dp *intel_dp)
>>>>               DRM_DEBUG_KMS("PP_STATUS: 0x%08x PP_CONTROL: 0x%08x\n",
>>>>               I915_READ(pp_stat_reg), I915_READ(pp_ctrl_reg));
>>>>               msleep(intel_dp->panel_power_down_delay);
>>>> +
>>>> +             intel_runtime_pm_put(dev_priv);
>>>>       }
>>>>  }
>>>>
>>>> @@ -1248,6 +1252,9 @@ void ironlake_edp_panel_off(struct intel_dp *intel_dp)
>>>>       intel_dp->want_panel_vdd = false;
>>>>
>>>>       ironlake_wait_panel_off(intel_dp);
>>>> +
>>>> +     /* We got a reference when we enabled the VDD. */
>>>> +     intel_runtime_pm_put(dev_priv);
>>>
>>> I was going to say it was missing a get until I read the comment above.
>>> But if it gets on VDD on, why not just let it put back on VDD off instead?
>>
>> That's the goal of my series. See patches 15 and 16.
>
> I saw both and got your point, but even after them get and put doesn't
> look in a symmetric place for me.
>

We have 1 place where we "get" and 2 places where we "put", because we
have 1 place where we enable EDP_FORCE_VDD and two places where we
disable EDP_FORCE_VDD. If you only count the get/put ratio it doesn't
look symmetric, but if you compare it against the EDP_FORCE_VDD bit,
it will look symmetric :)


> wouldn't make sense on this patch remove both of _put here and add one
> in vdd_off?

You mean ironlake_edp_panel_vdd_off? That function doesn't touch EDP_FORCE_VDD.

> Even after your vdd fixes it would be symmetric.

Well, at this point maybe the VDD fixes will be merged first, so I
will have to update this patch on top of that, and maybe it will make
more sense to the reviewers :)

>
>>
>>>
>>>>  }
>>>>
>>>>  void ironlake_edp_backlight_on(struct intel_dp *intel_dp)
>>>> --
>>>> 1.8.3.1
>>>>
>>>> _______________________________________________
>>>> Intel-gfx mailing list
>>>> Intel-gfx@lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>>
>>
>>
>> --
>> Paulo Zanoni
>
>
>
> --
> 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 28fc070..9e9e3d6 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1092,6 +1092,8 @@  void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp)
 	if (ironlake_edp_have_panel_vdd(intel_dp))
 		return;
 
+	intel_runtime_pm_get(dev_priv);
+
 	DRM_DEBUG_KMS("Turning eDP VDD on\n");
 
 	if (!ironlake_edp_have_panel_power(intel_dp))
@@ -1141,6 +1143,8 @@  static void ironlake_panel_vdd_off_sync(struct intel_dp *intel_dp)
 		DRM_DEBUG_KMS("PP_STATUS: 0x%08x PP_CONTROL: 0x%08x\n",
 		I915_READ(pp_stat_reg), I915_READ(pp_ctrl_reg));
 		msleep(intel_dp->panel_power_down_delay);
+
+		intel_runtime_pm_put(dev_priv);
 	}
 }
 
@@ -1248,6 +1252,9 @@  void ironlake_edp_panel_off(struct intel_dp *intel_dp)
 	intel_dp->want_panel_vdd = false;
 
 	ironlake_wait_panel_off(intel_dp);
+
+	/* We got a reference when we enabled the VDD. */
+	intel_runtime_pm_put(dev_priv);
 }
 
 void ironlake_edp_backlight_on(struct intel_dp *intel_dp)