RE: [PATCH] drm/amd/display: Keep eDP Vdd on when eDP stream is already

2022-01-27 Thread Liu, Zhan
[Public]

After giving it a second thought, I will apply a similar patch on internal 
branch first, then get it promoted to external branch. This patch is abandoned.

Thanks,
Zhan

> -Original Message-
> From: Liu, Zhan
> Sent: 2022/January/27, Thursday 9:51 PM
> To: amd-gfx@lists.freedesktop.org; Liu, Charlene 
> Cc: Pierre-Loup Griffais ; Cornij, Nikola
> ; Kotarac, Pavle ; Gutierrez,
> Agustin 
> Subject: [PATCH] drm/amd/display: Keep eDP Vdd on when eDP stream is already
>
> [Why]
> Even if can_apply_edp_fast_boot is set to 1 at boot, this flag will be 
> cleared to 0
> at S3 resume. However, we still need to keep Vdd on at S3 resume. Turning eDP
> Vdd off at resume will result in black screen at S3 resume.
>
> [How]
> Don't turn eDP Vdd off when there is an existing eDP stream. This can assure 
> eDP
> display come back after S3.
>
> Signed-off-by: Zhan Liu 
> ---
>  .../display/dc/dce110/dce110_hw_sequencer.c   | 23 +--
>  1 file changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
> b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
> index 72dd41e7a7d6..1aa6f2737534 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
> @@ -1796,9 +1796,28 @@ void dce110_enable_accelerated_mode(struct dc *dc,
> struct dc_state *context)
>   break;
>   }
>   }
> - // We are trying to enable eDP, don't power down VDD
> - if (can_apply_edp_fast_boot)
> +
> + /*
> +  * TO-DO: So far the code logic below only addresses single eDP
> case.
> +  * For dual eDP case, there are a few things that need to be
> +  * implemented first:
> +  *
> +  * 1. Change the fastboot logic above, so eDP link[0 or 1]'s
> +  * stream[0 or 1] will all be checked.
> +  *
> +  * 2. Change keep_edp_vdd_on to an array, and maintain
> keep_edp_vdd_on
> +  * for each eDP.
> +  *
> +  * Once above 2 things are completed, we can then change the
> logic below
> +  * correspondingly, so dual eDP case will be fully covered.
> +  */
> +
> + // We are trying to enable eDP, don't power down VDD if there is
> an existing eDP stream
> + if ((edp_stream_num = 1 && edp_streams[0]) ||
> +can_apply_edp_fast_boot) {
>   keep_edp_vdd_on = true;
> + DC_LOG_EVENT_LINK_TRAINING("At least 1 eDP stream is
> already enabled, will keep eDP Vdd on\n");
> + } else
> + DC_LOG_EVENT_LINK_TRAINING("No eDP stream enabled,
> will turn eDP Vdd
> +off\n");
>   }
>
>   // Check seamless boot support
> --
> 2.25.1


[PATCH] drm/amd/display: Keep eDP Vdd on when eDP stream is already

2022-01-27 Thread Liu, Zhan
[Public]

[Why]
Even if can_apply_edp_fast_boot is set to 1 at boot, this flag will
be cleared to 0 at S3 resume. However, we still need to keep Vdd on
at S3 resume. Turning eDP Vdd off at resume will result in black
screen at S3 resume.

[How]
Don't turn eDP Vdd off when there is an existing eDP stream. This can
assure eDP display come back after S3.

Signed-off-by: Zhan Liu 
---
 .../display/dc/dce110/dce110_hw_sequencer.c   | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 72dd41e7a7d6..1aa6f2737534 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -1796,9 +1796,28 @@ void dce110_enable_accelerated_mode(struct dc *dc, 
struct dc_state *context)
break;
}
}
-   // We are trying to enable eDP, don't power down VDD
-   if (can_apply_edp_fast_boot)
+
+   /*
+* TO-DO: So far the code logic below only addresses single eDP 
case.
+* For dual eDP case, there are a few things that need to be
+* implemented first:
+*
+* 1. Change the fastboot logic above, so eDP link[0 or 1]'s
+* stream[0 or 1] will all be checked.
+*
+* 2. Change keep_edp_vdd_on to an array, and maintain 
keep_edp_vdd_on
+* for each eDP.
+*
+* Once above 2 things are completed, we can then change the 
logic below
+* correspondingly, so dual eDP case will be fully covered.
+*/
+
+   // We are trying to enable eDP, don't power down VDD if there 
is an existing eDP stream
+   if ((edp_stream_num = 1 && edp_streams[0]) || 
can_apply_edp_fast_boot) {
keep_edp_vdd_on = true;
+   DC_LOG_EVENT_LINK_TRAINING("At least 1 eDP stream is 
already enabled, will keep eDP Vdd on\n");
+   } else
+   DC_LOG_EVENT_LINK_TRAINING("No eDP stream enabled, will 
turn eDP Vdd off\n");
}

// Check seamless boot support
--
2.25.1