diff mbox series

drm/i915/pps: debug log the remaining power cycle delay to wait

Message ID 20241204160048.2774419-1-jani.nikula@intel.com (mailing list archive)
State New
Headers show
Series drm/i915/pps: debug log the remaining power cycle delay to wait | expand

Commit Message

Jani Nikula Dec. 4, 2024, 4 p.m. UTC
While pps_init_delays() debug logs the power cycle delay, also debug log
the actual remaining time to wait in wait_panel_power_cycle().

Note that this still isn't the full picture; the power sequencer may
still wait after this one.

Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13007
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

---

Cc: Paul Menzel <pmenzel@molgen.mpg.de>
---
 drivers/gpu/drm/i915/display/intel_pps.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

Comments

Paul Menzel Dec. 5, 2024, 2:39 p.m. UTC | #1
Dear Jani,


Thank you very much for the patch.

Am 04.12.24 um 17:00 schrieb Jani Nikula:
> While pps_init_delays() debug logs the power cycle delay, also debug log
> the actual remaining time to wait in wait_panel_power_cycle().
> 
> Note that this still isn't the full picture; the power sequencer may
> still wait after this one.
> 
> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13007
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> 
> ---
> 
> Cc: Paul Menzel <pmenzel@molgen.mpg.de>
> ---
>   drivers/gpu/drm/i915/display/intel_pps.c | 19 ++++++++++---------
>   1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c
> index 7784b3b760db..bfda52850150 100644
> --- a/drivers/gpu/drm/i915/display/intel_pps.c
> +++ b/drivers/gpu/drm/i915/display/intel_pps.c
> @@ -668,23 +668,24 @@ static void wait_panel_power_cycle(struct intel_dp *intel_dp)
>   	struct intel_display *display = to_intel_display(intel_dp);
>   	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>   	ktime_t panel_power_on_time;
> -	s64 panel_power_off_duration;
> -
> -	drm_dbg_kms(display->drm,
> -		    "[ENCODER:%d:%s] %s wait for panel power cycle\n",
> -		    dig_port->base.base.base.id, dig_port->base.base.name,
> -		    pps_name(intel_dp));
> +	s64 panel_power_off_duration, remaining;
>   
>   	/* take the difference of current time and panel power off time
>   	 * and then make panel wait for power_cycle if needed. */
>   	panel_power_on_time = ktime_get_boottime();
>   	panel_power_off_duration = ktime_ms_delta(panel_power_on_time, intel_dp->pps.panel_power_off_time);
>   
> +	remaining = max(0, intel_dp->pps.panel_power_cycle_delay - panel_power_off_duration);
> +
> +	drm_dbg_kms(display->drm,
> +		    "[ENCODER:%d:%s] %s wait for panel power cycle (%lld ms remaining)\n",
> +		    dig_port->base.base.base.id, dig_port->base.base.name,
> +		    pps_name(intel_dp), remaining);
> +
>   	/* When we disable the VDD override bit last we have to do the manual
>   	 * wait. */
> -	if (panel_power_off_duration < (s64)intel_dp->pps.panel_power_cycle_delay)
> -		wait_remaining_ms_from_jiffies(jiffies,
> -				       intel_dp->pps.panel_power_cycle_delay - panel_power_off_duration);
> +	if (remaining)
> +		wait_remaining_ms_from_jiffies(jiffies, remaining);
>   
>   	wait_panel_status(intel_dp, IDLE_CYCLE_MASK, IDLE_CYCLE_VALUE);
>   }

Tested-by: Paul Menzel <pmenzel@molgen.mpg.de> # Dell XPS 13 
9360/0596KF, BIOS 2.21.0 06/02/2022

     [   51.596033] PM: suspend entry (deep)
     [   51.622184] Filesystems sync: 0.026 seconds
     [   51.634863] Freezing user space processes
     [   51.636697] Freezing user space processes completed (elapsed 
0.001 seconds)
     [   51.636708] OOM killer disabled.
     [   51.636711] Freezing remaining freezable tasks
     [   51.638017] Freezing remaining freezable tasks completed 
(elapsed 0.001 seconds)
     [   51.638132] printk: Suspending console(s) (use 
no_console_suspend to debug)
     [   51.673815] i915 0000:00:02.0: [drm:intel_power_well_enable 
[i915]] enabling always-on
     […]
     [   53.751682] i915 0000:00:02.0: [drm:intel_pps_on_unlocked 
[i915]] [ENCODER:98:DDI A/PHY A] PPS 0 turn panel power on
     [   53.751872] i915 0000:00:02.0: [drm:wait_panel_power_cycle 
[i915]] [ENCODER:98:DDI A/PHY A] PPS 0 wait for panel power cycle (0 ms 
remaining)
     [   53.752096] i915 0000:00:02.0: [drm:wait_panel_status [i915]] 
[ENCODER:98:DDI A/PHY A] PPS 0 mask: 0xb800000f value: 0x00000000 
PP_STATUS: 0x00000000 PP_CONTROL: 0x00000000
     [   53.752268] i915 0000:00:02.0: [drm:intel_pps_on_unlocked 
[i915]] Wait complete
     [   53.752440] i915 0000:00:02.0: [drm:intel_pps_on_unlocked 
[i915]] [ENCODER:98:DDI A/PHY A] PPS 0 wait for panel power on
     [   53.752638] i915 0000:00:02.0: [drm:wait_panel_status [i915]] 
[ENCODER:98:DDI A/PHY A] PPS 0 mask: 0xb000000f value: 0x80000008 
PP_STATUS: 0x9000000a PP_CONTROL: 0x00000003
     [   53.801920] i915 0000:00:02.0: [drm:spt_irq_handler [i915]] 
hotplug event received, stat 0x01000000, dig 0x12001010, pins 
0x00000010, long 0x00000010
     [   53.802088] i915 0000:00:02.0: [drm:intel_hpd_irq_handler 
[i915]] digital hpd on [ENCODER:98:DDI A/PHY A] - long
     [   53.802226] i915 0000:00:02.0: [drm:intel_hpd_irq_handler 
[i915]] Received HPD interrupt on PIN 4 - cnt: 10
     [   53.802399] i915 0000:00:02.0: [drm:intel_dp_hpd_pulse [i915]] 
ignoring long hpd on eDP [ENCODER:98:DDI A/PHY A]
     [   53.831776] i915 0000:00:02.0: [drm:i915_hdcp_component_bind 
[i915]] I915 HDCP comp bind
     [   53.832940] mei_hdcp 
0000:00:16.0-b638ab7e-94e2-4ea2-a552-d1c54b627f04: bound 0000:00:02.0 
(ops i915_hdcp_ops [i915])
     [   53.835771] Bluetooth: hci0: using NVM file: 
qca/nvm_usb_00000302.bin
     [   53.864037] Bluetooth: hci0: HCI Enhanced Setup Synchronous 
Connection command is advertised, but not supported.
     [   53.952873] i915 0000:00:02.0: [drm:intel_pps_on_unlocked 
[i915]] Wait complete


Kind regards,

Paul
Chaitanya Kumar Borah Dec. 9, 2024, 1:02 p.m. UTC | #2
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Jani
> Nikula
> Sent: Wednesday, December 4, 2024 9:31 PM
> To: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
> Cc: Nikula, Jani <jani.nikula@intel.com>; Paul Menzel
> <pmenzel@molgen.mpg.de>
> Subject: [PATCH] drm/i915/pps: debug log the remaining power cycle delay to
> wait
> 
> While pps_init_delays() debug logs the power cycle delay, also debug log the
> actual remaining time to wait in wait_panel_power_cycle().
> 
> Note that this still isn't the full picture; the power sequencer may still wait after
> this one.
> 
> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13007
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

LGTM
Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>



> 
> ---
> 
> Cc: Paul Menzel <pmenzel@molgen.mpg.de>
> ---
>  drivers/gpu/drm/i915/display/intel_pps.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_pps.c
> b/drivers/gpu/drm/i915/display/intel_pps.c
> index 7784b3b760db..bfda52850150 100644
> --- a/drivers/gpu/drm/i915/display/intel_pps.c
> +++ b/drivers/gpu/drm/i915/display/intel_pps.c
> @@ -668,23 +668,24 @@ static void wait_panel_power_cycle(struct intel_dp
> *intel_dp)
>  	struct intel_display *display = to_intel_display(intel_dp);
>  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>  	ktime_t panel_power_on_time;
> -	s64 panel_power_off_duration;
> -
> -	drm_dbg_kms(display->drm,
> -		    "[ENCODER:%d:%s] %s wait for panel power cycle\n",
> -		    dig_port->base.base.base.id, dig_port->base.base.name,
> -		    pps_name(intel_dp));
> +	s64 panel_power_off_duration, remaining;
> 
>  	/* take the difference of current time and panel power off time
>  	 * and then make panel wait for power_cycle if needed. */
>  	panel_power_on_time = ktime_get_boottime();
>  	panel_power_off_duration = ktime_ms_delta(panel_power_on_time,
> intel_dp->pps.panel_power_off_time);
> 
> +	remaining = max(0, intel_dp->pps.panel_power_cycle_delay -
> +panel_power_off_duration);
> +
> +	drm_dbg_kms(display->drm,
> +		    "[ENCODER:%d:%s] %s wait for panel power cycle (%lld ms
> remaining)\n",
> +		    dig_port->base.base.base.id, dig_port->base.base.name,
> +		    pps_name(intel_dp), remaining);
> +
>  	/* When we disable the VDD override bit last we have to do the
> manual
>  	 * wait. */
> -	if (panel_power_off_duration < (s64)intel_dp-
> >pps.panel_power_cycle_delay)
> -		wait_remaining_ms_from_jiffies(jiffies,
> -				       intel_dp->pps.panel_power_cycle_delay -
> panel_power_off_duration);
> +	if (remaining)
> +		wait_remaining_ms_from_jiffies(jiffies, remaining);
> 
>  	wait_panel_status(intel_dp, IDLE_CYCLE_MASK, IDLE_CYCLE_VALUE);
> }
> --
> 2.39.5
Jani Nikula Dec. 10, 2024, 9:27 a.m. UTC | #3
On Mon, 09 Dec 2024, "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com> wrote:
>> -----Original Message-----
>> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Jani
>> Nikula
>> Sent: Wednesday, December 4, 2024 9:31 PM
>> To: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
>> Cc: Nikula, Jani <jani.nikula@intel.com>; Paul Menzel
>> <pmenzel@molgen.mpg.de>
>> Subject: [PATCH] drm/i915/pps: debug log the remaining power cycle delay to
>> wait
>>
>> While pps_init_delays() debug logs the power cycle delay, also debug log the
>> actual remaining time to wait in wait_panel_power_cycle().
>>
>> Note that this still isn't the full picture; the power sequencer may still wait after
>> this one.
>>
>> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13007
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> LGTM
> Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>

Thanks, pushed to din.

BR,
Jani.

>
>
>
>>
>> ---
>>
>> Cc: Paul Menzel <pmenzel@molgen.mpg.de>
>> ---
>>  drivers/gpu/drm/i915/display/intel_pps.c | 19 ++++++++++---------
>>  1 file changed, 10 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_pps.c
>> b/drivers/gpu/drm/i915/display/intel_pps.c
>> index 7784b3b760db..bfda52850150 100644
>> --- a/drivers/gpu/drm/i915/display/intel_pps.c
>> +++ b/drivers/gpu/drm/i915/display/intel_pps.c
>> @@ -668,23 +668,24 @@ static void wait_panel_power_cycle(struct intel_dp
>> *intel_dp)
>>       struct intel_display *display = to_intel_display(intel_dp);
>>       struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>>       ktime_t panel_power_on_time;
>> -     s64 panel_power_off_duration;
>> -
>> -     drm_dbg_kms(display->drm,
>> -                 "[ENCODER:%d:%s] %s wait for panel power cycle\n",
>> -                 dig_port->base.base.base.id, dig_port->base.base.name,
>> -                 pps_name(intel_dp));
>> +     s64 panel_power_off_duration, remaining;
>>
>>       /* take the difference of current time and panel power off time
>>        * and then make panel wait for power_cycle if needed. */
>>       panel_power_on_time = ktime_get_boottime();
>>       panel_power_off_duration = ktime_ms_delta(panel_power_on_time,
>> intel_dp->pps.panel_power_off_time);
>>
>> +     remaining = max(0, intel_dp->pps.panel_power_cycle_delay -
>> +panel_power_off_duration);
>> +
>> +     drm_dbg_kms(display->drm,
>> +                 "[ENCODER:%d:%s] %s wait for panel power cycle (%lld ms
>> remaining)\n",
>> +                 dig_port->base.base.base.id, dig_port->base.base.name,
>> +                 pps_name(intel_dp), remaining);
>> +
>>       /* When we disable the VDD override bit last we have to do the
>> manual
>>        * wait. */
>> -     if (panel_power_off_duration < (s64)intel_dp-
>> >pps.panel_power_cycle_delay)
>> -             wait_remaining_ms_from_jiffies(jiffies,
>> -                                    intel_dp->pps.panel_power_cycle_delay -
>> panel_power_off_duration);
>> +     if (remaining)
>> +             wait_remaining_ms_from_jiffies(jiffies, remaining);
>>
>>       wait_panel_status(intel_dp, IDLE_CYCLE_MASK, IDLE_CYCLE_VALUE);
>> }
>> --
>> 2.39.5
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c
index 7784b3b760db..bfda52850150 100644
--- a/drivers/gpu/drm/i915/display/intel_pps.c
+++ b/drivers/gpu/drm/i915/display/intel_pps.c
@@ -668,23 +668,24 @@  static void wait_panel_power_cycle(struct intel_dp *intel_dp)
 	struct intel_display *display = to_intel_display(intel_dp);
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	ktime_t panel_power_on_time;
-	s64 panel_power_off_duration;
-
-	drm_dbg_kms(display->drm,
-		    "[ENCODER:%d:%s] %s wait for panel power cycle\n",
-		    dig_port->base.base.base.id, dig_port->base.base.name,
-		    pps_name(intel_dp));
+	s64 panel_power_off_duration, remaining;
 
 	/* take the difference of current time and panel power off time
 	 * and then make panel wait for power_cycle if needed. */
 	panel_power_on_time = ktime_get_boottime();
 	panel_power_off_duration = ktime_ms_delta(panel_power_on_time, intel_dp->pps.panel_power_off_time);
 
+	remaining = max(0, intel_dp->pps.panel_power_cycle_delay - panel_power_off_duration);
+
+	drm_dbg_kms(display->drm,
+		    "[ENCODER:%d:%s] %s wait for panel power cycle (%lld ms remaining)\n",
+		    dig_port->base.base.base.id, dig_port->base.base.name,
+		    pps_name(intel_dp), remaining);
+
 	/* When we disable the VDD override bit last we have to do the manual
 	 * wait. */
-	if (panel_power_off_duration < (s64)intel_dp->pps.panel_power_cycle_delay)
-		wait_remaining_ms_from_jiffies(jiffies,
-				       intel_dp->pps.panel_power_cycle_delay - panel_power_off_duration);
+	if (remaining)
+		wait_remaining_ms_from_jiffies(jiffies, remaining);
 
 	wait_panel_status(intel_dp, IDLE_CYCLE_MASK, IDLE_CYCLE_VALUE);
 }