Skip to contentSkip to conversation

Fix some DC regressions on DCE 6-8

PATCH In review Timur Kristóf 4 participants 15 messages Jul 22, 2025 – Jul 29, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Fix some DC regressions on DCE 6-8

This series fixes some regressions in DC, mainly on DCE6-8.

There is a fix for a recent regression caused by refactoring the DSC cap calculation that affects DCE8-10, as well as some fixes related to clock sources in DCE 6.

Timur Kristóf (3):
drm/amd/display: Fix refactored DSC cap calculation drm/amd/display: Don't overwrite dce60_clk_mgr drm/amd/display: Fix DCE 6.0 and 6.4 PLL programming.

 .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c  |  1 -
 .../display/dc/clk_mgr/dce100/dce_clk_mgr.c   |  5 +++
 drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c   | 17 +++++-----
 .../dc/resource/dce60/dce60_resource.c        | 34 +++++++++++--------
 4 files changed, 34 insertions(+), 23 deletions(-)
Signature · 1 line
2.50.1
#1 lore raw

PATCH 1/3 drm/amd/display: Fix refactored DSC cap calculation

After refactoring the DSC capability calculation, the get_min_slice_count_for_odm could crash on some GPUs due to a division by zero when max_total_throughput_mps was zero. As a result, DC was broken when connecting a GPU that doesn't support DSC to a monitor that supports DSC.
Tested on Oland (DCE 6) and Fiji (DCE 10).

This commit fixes it by returning zero instead.

Fixes 4909b8b3846c ("drm/amd/display: Refactor DSC cap calculations")
---
 drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +9 -8
index a454d16e6586..4169ece9c535 100644
@@ -642,14 +642,15 @@ static unsigned int get_min_slice_count_for_odm(
 	unsigned int max_dispclk_khz;
 
 	/* get max pixel rate and combine caps */
-	max_dispclk_khz = dsc_enc_caps->max_total_throughput_mps * 1000;
-	if (dsc && dsc->ctx->dc) {
-		if (dsc->ctx->dc->clk_mgr &&
-			dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz) {
-			/* dispclk is available */
-			max_dispclk_khz = dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz(dsc->ctx->dc->clk_mgr, CLK_TYPE_DISPCLK);
-		}
-	}
+	if (dsc && dsc->ctx->dc && dsc->ctx->dc->clk_mgr &&
+		dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz)
+		max_dispclk_khz =
+			dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz(
+				dsc->ctx->dc->clk_mgr, CLK_TYPE_DISPCLK);
+	else if (dsc_enc_caps->max_total_throughput_mps)
+		max_dispclk_khz = dsc_enc_caps->max_total_throughput_mps * 1000;
+	else
+		return 0;
 
 	/* consider minimum odm slices required due to
 	 * 1) display pipe throughput (dispclk)
Signature · 1 line
2.50.1
reviewer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] drm/amd/display: Fix refactored DSC cap calculation

Quoted 46 lines · Timur Kristóf

After refactoring the DSC capability calculation, the get_min_slice_count_for_odm could crash on some GPUs due to a division by zero when max_total_throughput_mps was zero. As a result, DC was broken when connecting a GPU that doesn't support DSC to a monitor that supports DSC.
Tested on Oland (DCE 6) and Fiji (DCE 10).

This commit fixes it by returning zero instead.

Fixes 4909b8b3846c ("drm/amd/display: Refactor DSC cap calculations")
---
 drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +9 -8
index a454d16e6586..4169ece9c535 100644
@@ -642,14 +642,15 @@ static unsigned int get_min_slice_count_for_odm(
 	unsigned int max_dispclk_khz;
 
 	/* get max pixel rate and combine caps */
-	max_dispclk_khz = dsc_enc_caps->max_total_throughput_mps * 1000;
-	if (dsc && dsc->ctx->dc) {
-		if (dsc->ctx->dc->clk_mgr &&
-			dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz) {
-			/* dispclk is available */
-			max_dispclk_khz = dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz(dsc->ctx->dc->clk_mgr, CLK_TYPE_DISPCLK);
-		}
-	}
+	if (dsc && dsc->ctx->dc && dsc->ctx->dc->clk_mgr &&
+		dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz)
+		max_dispclk_khz =
+			dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz(
+				dsc->ctx->dc->clk_mgr, CLK_TYPE_DISPCLK);
+	else if (dsc_enc_caps->max_total_throughput_mps)
+		max_dispclk_khz = dsc_enc_caps->max_total_throughput_mps * 1000;
+	else
+		return 0;
 
 	/* consider minimum odm slices required due to
 	 * 1) display pipe throughput (dispclk)
Signature · 1 line
2.50.1

This patch lgtm.

I added other display folks to this patch.

I'm not sure if the original modification (4909b8b3846c) is already in the stable kernel; if so, it could be a good idea to send this fix to the stable kernel as well.

Thanks

Signature · 1 line
Rodrigo Siqueira
#3 lore raw

Re: [PATCH 1/3] drm/amd/display: Fix refactored DSC cap calculation

This patch may be related and conflict to https://www.mail-archive.com/[email protected]/msg125873.html

amd-staging-drm-next should include the above patch but it is not updated for 2 weeks, so let's wait for ASDN to be updated.

Quoted 60 lines · Rodrigo Siqueira
Quoted 46 lines · Timur Kristóf

After refactoring the DSC capability calculation, the get_min_slice_count_for_odm could crash on some GPUs due to a division by zero when max_total_throughput_mps was zero. As a result, DC was broken when connecting a GPU that doesn't support DSC to a monitor that supports DSC.
Tested on Oland (DCE 6) and Fiji (DCE 10).

This commit fixes it by returning zero instead.

Fixes 4909b8b3846c ("drm/amd/display: Refactor DSC cap calculations")
---
  drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 17 +++++++++--------
  1 file changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +9 -8
index a454d16e6586..4169ece9c535 100644
@@ -642,14 +642,15 @@ static unsigned int get_min_slice_count_for_odm(
  	unsigned int max_dispclk_khz;
 
  	/* get max pixel rate and combine caps */
-	max_dispclk_khz = dsc_enc_caps->max_total_throughput_mps * 1000;
-	if (dsc && dsc->ctx->dc) {
-		if (dsc->ctx->dc->clk_mgr &&
-			dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz) {
-			/* dispclk is available */
-			max_dispclk_khz = dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz(dsc->ctx->dc->clk_mgr, CLK_TYPE_DISPCLK);
-		}
-	}
+	if (dsc && dsc->ctx->dc && dsc->ctx->dc->clk_mgr &&
+		dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz)
+		max_dispclk_khz =
+			dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz(
+				dsc->ctx->dc->clk_mgr, CLK_TYPE_DISPCLK);
+	else if (dsc_enc_caps->max_total_throughput_mps)
+		max_dispclk_khz = dsc_enc_caps->max_total_throughput_mps * 1000;
+	else
+		return 0;
 
  	/* consider minimum odm slices required due to
  	 * 1) display pipe throughput (dispclk)
Signature · 1 line
2.50.1

This patch lgtm.

I added other display folks to this patch.

I'm not sure if the original modification (4909b8b3846c) is already in the stable kernel; if so, it could be a good idea to send this fix to the stable kernel as well.

Thanks

#4 lore raw

Re: [PATCH 1/3] drm/amd/display: Fix refactored DSC cap calculation

Hi,

Alex Hung <[email protected]> ezt írta (időpont: 2025. júl. 25., Pén 22:26):

Quoted 6 lines

This patch may be related and conflict to
https://www.mail-archive.com/[email protected]/msg125873.html

amd-staging-drm-next should include the above patch but it is not updated for 2 weeks, so let's wait for ASDN to be updated.

Yes, it indeed looks like that patch addresses the same problem.

Quoted 68 lines · Rodrigo Siqueira
Quoted 10 lines · Timur Kristóf
Quoted 9 lines

After refactoring the DSC capability calculation, the get_min_slice_count_for_odm could crash on some GPUs due to a division by zero when max_total_throughput_mps was zero. As a result, DC was broken when connecting a GPU that doesn't support DSC to a monitor that supports DSC.
Tested on Oland (DCE 6) and Fiji (DCE 10).

This commit fixes it by returning zero instead.

Quoted 7 lines

Review

Quoted 7 lines
Fixes 4909b8b3846c ("drm/amd/display: Refactor DSC cap calculations")
---
  drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 17 +++++++++--------
  1 file changed, 9 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c

Quoted 6 lines
Quoted 6 lines

index a454d16e6586..4169ece9c535 100644

drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +0 -0
@@ -642,14 +642,15 @@ static unsigned int get_min_slice_count_for_odm(
     unsigned int max_dispclk_khz;
 
Quoted 7 lines

drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c static unsigned int get_min_slice_count_for_odm(

Quoted 7 lines
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +0 -6
     /* get max pixel rate and combine caps */
-    max_dispclk_khz = dsc_enc_caps->max_total_throughput_mps * 1000;
-    if (dsc && dsc->ctx->dc) {
-            if (dsc->ctx->dc->clk_mgr &&
-                    dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz) {
-                    /* dispclk is available */
-                    max_dispclk_khz =

dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz(dsc->ctx->dc->clk_mgr, CLK_TYPE_DISPCLK);

Quoted 9 lines

drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c static unsigned int get_min_slice_count_for_odm(

Quoted 9 lines
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +7 -2
-            }
-    }
+    if (dsc && dsc->ctx->dc && dsc->ctx->dc->clk_mgr &&
+            dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz)
+            max_dispclk_khz =
+                    dsc->ctx->dc->clk_mgr->funcs->get_max_clock_khz(
+                            dsc->ctx->dc->clk_mgr, CLK_TYPE_DISPCLK);
+    else if (dsc_enc_caps->max_total_throughput_mps)
+            max_dispclk_khz = dsc_enc_caps->max_total_throughput_mps *

1000;

Quoted 21 lines
Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +2 -1
+    else
+            return 0;
 
     /* consider minimum odm slices required due to
      * 1) display pipe throughput (dispclk)
--

2.50.1

This patch lgtm.

I added other display folks to this patch.

I'm not sure if the original modification (4909b8b3846c) is already in the stable kernel; if so, it could be a good idea to send this fix to the stable kernel as well.

Thanks

#5 lore raw

PATCH 2/3 drm/amd/display: Don't overwrite dce60_clk_mgr

In reply to Timur Kristóf

dc_clk_mgr_create accidentally overwrites the dce60_clk_mgr with the dce_clk_mgr, causing incorrect behaviour on DCE6. Fix it by removing the extra dce_clk_mgr_construct.

Fixes 62eab49faae7 ("drm/amd/display: hide VGH asic specific structs")
---
 drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +0 -1
index 33b9d36619ff..4071851f9e86 100644
@@ -158,7 +158,6 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p
 			return NULL;
 		}
 		dce60_clk_mgr_construct(ctx, clk_mgr);
-		dce_clk_mgr_construct(ctx, clk_mgr);
 		return &clk_mgr->base;
 	}
 #endif
Signature · 1 line
2.50.1
reviewer Reviewed-by on v1 2/3
#6 lore raw

Re: [PATCH 2/3] drm/amd/display: Don't overwrite dce60_clk_mgr

Quoted 2 lines · Timur Kristóf

dc_clk_mgr_create accidentally overwrites the dce60_clk_mgr with the dce_clk_mgr, causing incorrect behaviour on DCE6.

Could you ellaborate on what do you mean by incorrect behaviour?

Quoted 13 lines

Fix it by removing the extra dce_clk_mgr_construct.

Fixes 62eab49faae7 ("drm/amd/display: hide VGH asic specific structs")
---
 drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +0 -0
index 33b9d36619ff..4071851f9e86 100644

drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p · line 161

Quoted 4 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +0 -1
@@ -158,7 +158,6 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p
 			return NULL;
 		}
 		dce60_clk_mgr_construct(ctx, clk_mgr);
-		dce_clk_mgr_construct(ctx, clk_mgr);

I suppose this error was not detected at the time because of the CONFIG_DRM_AMD_DC_SI guard. This lgtm, but I guess it would be nice to test this patch with other SI devices just to be sure

I added other display folks.

Thanks

Quoted 6 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +0 -0
 		return &clk_mgr->base;
 	}
 #endif
Signature · 1 line
2.50.1
Signature · 1 line
Rodrigo Siqueira
#7 lore raw

Re: [PATCH 2/3] drm/amd/display: Don't overwrite dce60_clk_mgr

Quoted 5 lines · Rodrigo Siqueira
Quoted 2 lines · Timur Kristóf

dc_clk_mgr_create accidentally overwrites the dce60_clk_mgr with the dce_clk_mgr, causing incorrect behaviour on DCE6.

Could you ellaborate on what do you mean by incorrect behaviour?

By incorrect behaviour, I mean that the code was using dce_clk_mgr when it should have used the dce60_clk_mgr. So the DCE 6 specific functions were not correctly hooked up.

dce60_clk_mgr was added in 3ecb3b794e2c and according to that commit, the main difference is that DCE 6 doesn't have the DPREFCLK_CNTL registers.

Quoted 10 lines
Quoted 10 lines

Fix it by removing the extra dce_clk_mgr_construct.

Fixes 62eab49faae7 ("drm/amd/display: hide VGH asic specific

structs")

---
 drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 1 -

 1 file changed, 1 deletion(-)
Quoted 16 lines

drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p · line 161

Quoted 11 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +0 -0
index 33b9d36619ff..4071851f9e86 100644
@@ -158,7 +158,6 @@ struct clk_mgr *dc_clk_mgr_create(struct

dc_context *ctx, struct pp_smu_funcs *p return NULL;
  } dce60_clk_mgr_construct(ctx, clk_mgr);

drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +0 -1
-		dce_clk_mgr_construct(ctx, clk_mgr);

I suppose this error was not detected at the time because of the CONFIG_DRM_AMD_DC_SI guard. This lgtm, but I guess it would be nice to
test this patch with other SI devices just to be sure

This series just contains some obvious regression fixes that I felt were the most important and easiest to review.

SI definitely needs more work. I have a work in progress branch for this; I'll send the patches in a separate series. (The main things that are currently missing are fixing the display clock and taking pm_display_cfg into use in legacy_dpm and si_dpm to include DC display requirements in power management decisions.)

Quoted 13 lines

I added other display folks.

Thanks

Quoted 6 lines

  return &clk_mgr->base;
  }
 #endif

Signature · 1 line
2.50.1
Reviewed-by on v1 2/3
#8 lore raw

Re: [PATCH 2/3] drm/amd/display: Don't overwrite dce60_clk_mgr

In reply to Timur Kristóf
Quoted 7 lines · Timur Kristóf

dc_clk_mgr_create accidentally overwrites the dce60_clk_mgr with the dce_clk_mgr, causing incorrect behaviour on DCE6. Fix it by removing the extra dce_clk_mgr_construct.

Fixes 62eab49faae7 ("drm/amd/display: hide VGH asic specific structs")
Quoted 19 lines
---
 drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +0 -2
index 33b9d36619ff..4071851f9e86 100644
@@ -158,7 +158,6 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p
                        return NULL;
                }
                dce60_clk_mgr_construct(ctx, clk_mgr);
-               dce_clk_mgr_construct(ctx, clk_mgr);
                return &clk_mgr->base;
        }
 #endif
--

2.50.1

#9 lore raw

PATCH 3/3 drm/amd/display: Fix DCE 6.0 and 6.4 PLL programming.

In reply to Timur Kristóf

Apparently, both DCE 6.0 and 6.4 have 3 PLLs, but PLL0 can only be used for DP. Make sure to initialize the correct amount of PLLs in DC for these DCE versions and use PLL0 only for DP.

Also, on DCE 6.0 and 6.4, the PLL0 needs to be powered on at initialization as opposed to DCE 6.1 and 7.x which use a different clock source for DFS.

The following functions were used as reference from the old
radeon driver implementation of DCE 6.x:
- radeon_atom_pick_pll
- atombios_crtc_set_disp_eng_pll

---
 .../display/dc/clk_mgr/dce100/dce_clk_mgr.c   |  5 +++
 .../dc/resource/dce60/dce60_resource.c        | 34 +++++++++++--------
 2 files changed, 25 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +5 -0
index 26feefbb8990..f5ad0a177038 100644
@@ -245,6 +245,11 @@ int dce_set_clock(
 	pxl_clk_params.target_pixel_clock_100hz = requested_clk_khz * 10;
 	pxl_clk_params.pll_id = CLOCK_SOURCE_ID_DFS;
 
+	/* DCE 6.0, DCE 6.4: engine clock is the same as PLL0 */
+	if (clk_mgr_base->ctx->dce_version == DCE_VERSION_6_0 ||
+	    clk_mgr_base->ctx->dce_version == DCE_VERSION_6_4)
+		pxl_clk_params.pll_id = CLOCK_SOURCE_ID_PLL0;
+
 	if (clk_mgr_dce->dfs_bypass_active)
 		pxl_clk_params.flags.SET_DISPCLK_DFS_BYPASS = true;
 
drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c +20 -14
index 58b59d52dc9d..53b60044653f 100644
@@ -373,7 +373,7 @@ static const struct resource_caps res_cap = {
 		.num_timing_generator = 6,
 		.num_audio = 6,
 		.num_stream_encoder = 6,
-		.num_pll = 2,
+		.num_pll = 3,
 		.num_ddc = 6,
 };
 
@@ -389,7 +389,7 @@ static const struct resource_caps res_cap_64 = {
 		.num_timing_generator = 2,
 		.num_audio = 2,
 		.num_stream_encoder = 2,
-		.num_pll = 2,
+		.num_pll = 3,
 		.num_ddc = 2,
 };
 
@@ -973,21 +973,24 @@ static bool dce60_construct(
 
 	if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) {
 		pool->base.dp_clock_source =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
 
+		/* DCE 6.0 and 6.4: PLL0 can only be used with DP. Don't initialize it here. */
 		pool->base.clock_sources[0] =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], false);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
 		pool->base.clock_sources[1] =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
 		pool->base.clk_src_count = 2;
 
 	} else {
 		pool->base.dp_clock_source =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
 
 		pool->base.clock_sources[0] =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
-		pool->base.clk_src_count = 1;
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+		pool->base.clock_sources[1] =
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
+		pool->base.clk_src_count = 2;
 	}
 
 	if (pool->base.dp_clock_source == NULL) {
@@ -1365,21 +1368,24 @@ static bool dce64_construct(
 
 	if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) {
 		pool->base.dp_clock_source =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
 
+		/* DCE 6.0 and 6.4: PLL0 can only be used with DP. Don't initialize it here. */
 		pool->base.clock_sources[0] =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[0], false);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
 		pool->base.clock_sources[1] =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[1], false);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
 		pool->base.clk_src_count = 2;
 
 	} else {
 		pool->base.dp_clock_source =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[0], true);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
 
 		pool->base.clock_sources[0] =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[1], false);
-		pool->base.clk_src_count = 1;
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+		pool->base.clock_sources[1] =
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
+		pool->base.clk_src_count = 2;
 	}
 
 	if (pool->base.dp_clock_source == NULL) {
Signature · 1 line
2.50.1
reviewer Reviewed-by on v1 3/3
#10 lore raw

Re: [PATCH 3/3] drm/amd/display: Fix DCE 6.0 and 6.4 PLL programming.

Quoted 122 lines · Timur Kristóf

Apparently, both DCE 6.0 and 6.4 have 3 PLLs, but PLL0 can only be used for DP. Make sure to initialize the correct amount of PLLs in DC for these DCE versions and use PLL0 only for DP.

Also, on DCE 6.0 and 6.4, the PLL0 needs to be powered on at initialization as opposed to DCE 6.1 and 7.x which use a different clock source for DFS.

The following functions were used as reference from the old
radeon driver implementation of DCE 6.x:
- radeon_atom_pick_pll
- atombios_crtc_set_disp_eng_pll

---
 .../display/dc/clk_mgr/dce100/dce_clk_mgr.c   |  5 +++
 .../dc/resource/dce60/dce60_resource.c        | 34 +++++++++++--------
 2 files changed, 25 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +5 -0
index 26feefbb8990..f5ad0a177038 100644
@@ -245,6 +245,11 @@ int dce_set_clock(
 	pxl_clk_params.target_pixel_clock_100hz = requested_clk_khz * 10;
 	pxl_clk_params.pll_id = CLOCK_SOURCE_ID_DFS;
 
+	/* DCE 6.0, DCE 6.4: engine clock is the same as PLL0 */
+	if (clk_mgr_base->ctx->dce_version == DCE_VERSION_6_0 ||
+	    clk_mgr_base->ctx->dce_version == DCE_VERSION_6_4)
+		pxl_clk_params.pll_id = CLOCK_SOURCE_ID_PLL0;
+
 	if (clk_mgr_dce->dfs_bypass_active)
 		pxl_clk_params.flags.SET_DISPCLK_DFS_BYPASS = true;
 
drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c +20 -14
index 58b59d52dc9d..53b60044653f 100644
@@ -373,7 +373,7 @@ static const struct resource_caps res_cap = {
 		.num_timing_generator = 6,
 		.num_audio = 6,
 		.num_stream_encoder = 6,
-		.num_pll = 2,
+		.num_pll = 3,
 		.num_ddc = 6,
 };
 
@@ -389,7 +389,7 @@ static const struct resource_caps res_cap_64 = {
 		.num_timing_generator = 2,
 		.num_audio = 2,
 		.num_stream_encoder = 2,
-		.num_pll = 2,
+		.num_pll = 3,
 		.num_ddc = 2,
 };
 
@@ -973,21 +973,24 @@ static bool dce60_construct(
 
 	if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) {
 		pool->base.dp_clock_source =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
 
+		/* DCE 6.0 and 6.4: PLL0 can only be used with DP. Don't initialize it here. */
 		pool->base.clock_sources[0] =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], false);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
 		pool->base.clock_sources[1] =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
 		pool->base.clk_src_count = 2;
 
 	} else {
 		pool->base.dp_clock_source =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
 
 		pool->base.clock_sources[0] =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
-		pool->base.clk_src_count = 1;
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+		pool->base.clock_sources[1] =
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
+		pool->base.clk_src_count = 2;
 	}
 
 	if (pool->base.dp_clock_source == NULL) {
@@ -1365,21 +1368,24 @@ static bool dce64_construct(
 
 	if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) {
 		pool->base.dp_clock_source =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
 
+		/* DCE 6.0 and 6.4: PLL0 can only be used with DP. Don't initialize it here. */
 		pool->base.clock_sources[0] =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[0], false);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
 		pool->base.clock_sources[1] =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[1], false);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
 		pool->base.clk_src_count = 2;
 
 	} else {
 		pool->base.dp_clock_source =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[0], true);
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
 
 		pool->base.clock_sources[0] =
-				dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[1], false);
-		pool->base.clk_src_count = 1;
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+		pool->base.clock_sources[1] =
+			dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
+		pool->base.clk_src_count = 2;
 	}
 
 	if (pool->base.dp_clock_source == NULL) {
Signature · 1 line
2.50.1

Again, I'm adding other displays folks for further review.

Thanks

Signature · 1 line
Rodrigo Siqueira
Reviewed-by on v1 3/3
#11 lore raw

Re: [PATCH 3/3] drm/amd/display: Fix DCE 6.0 and 6.4 PLL programming.

In reply to Timur Kristóf
Quoted 9 lines · Timur Kristóf

Apparently, both DCE 6.0 and 6.4 have 3 PLLs, but PLL0 can only be used for DP. Make sure to initialize the correct amount of PLLs in DC for these DCE versions and use PLL0 only for DP.

Also, on DCE 6.0 and 6.4, the PLL0 needs to be powered on at initialization as opposed to DCE 6.1 and 7.x which use a different clock source for DFS.

Quoted 6 lines

The following functions were used as reference from the old radeon driver implementation of DCE 6.x:
- radeon_atom_pick_pll
- atombios_crtc_set_disp_eng_pll

Quoted 108 lines
---
 .../display/dc/clk_mgr/dce100/dce_clk_mgr.c   |  5 +++
 .../dc/resource/dce60/dce60_resource.c        | 34 +++++++++++--------
 2 files changed, 25 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +5 -0
index 26feefbb8990..f5ad0a177038 100644
@@ -245,6 +245,11 @@ int dce_set_clock(
        pxl_clk_params.target_pixel_clock_100hz = requested_clk_khz * 10;
        pxl_clk_params.pll_id = CLOCK_SOURCE_ID_DFS;
 
+       /* DCE 6.0, DCE 6.4: engine clock is the same as PLL0 */
+       if (clk_mgr_base->ctx->dce_version == DCE_VERSION_6_0 ||
+           clk_mgr_base->ctx->dce_version == DCE_VERSION_6_4)
+               pxl_clk_params.pll_id = CLOCK_SOURCE_ID_PLL0;
+
        if (clk_mgr_dce->dfs_bypass_active)
                pxl_clk_params.flags.SET_DISPCLK_DFS_BYPASS = true;
 
drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c +20 -15
index 58b59d52dc9d..53b60044653f 100644
@@ -373,7 +373,7 @@ static const struct resource_caps res_cap = {
                .num_timing_generator = 6,
                .num_audio = 6,
                .num_stream_encoder = 6,
-               .num_pll = 2,
+               .num_pll = 3,
                .num_ddc = 6,
 };
 
@@ -389,7 +389,7 @@ static const struct resource_caps res_cap_64 = {
                .num_timing_generator = 2,
                .num_audio = 2,
                .num_stream_encoder = 2,
-               .num_pll = 2,
+               .num_pll = 3,
                .num_ddc = 2,
 };
 
@@ -973,21 +973,24 @@ static bool dce60_construct(
 
        if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) {
                pool->base.dp_clock_source =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
 
+               /* DCE 6.0 and 6.4: PLL0 can only be used with DP. Don't initialize it here. */
                pool->base.clock_sources[0] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], false);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
                pool->base.clock_sources[1] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
                pool->base.clk_src_count = 2;
 
        } else {
                pool->base.dp_clock_source =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
 
                pool->base.clock_sources[0] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
-               pool->base.clk_src_count = 1;
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+               pool->base.clock_sources[1] =
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
+               pool->base.clk_src_count = 2;
        }
 
        if (pool->base.dp_clock_source == NULL) {
@@ -1365,21 +1368,24 @@ static bool dce64_construct(
 
        if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) {
                pool->base.dp_clock_source =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
 
+               /* DCE 6.0 and 6.4: PLL0 can only be used with DP. Don't initialize it here. */
                pool->base.clock_sources[0] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[0], false);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
                pool->base.clock_sources[1] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[1], false);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
                pool->base.clk_src_count = 2;
 
        } else {
                pool->base.dp_clock_source =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[0], true);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
 
                pool->base.clock_sources[0] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[1], false);
-               pool->base.clk_src_count = 1;
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+               pool->base.clock_sources[1] =
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
+               pool->base.clk_src_count = 2;
        }
 
        if (pool->base.dp_clock_source == NULL) {
--

2.50.1

#12 lore raw

Re: [PATCH 3/3] drm/amd/display: Fix DCE 6.0 and 6.4 PLL programming.

In reply to Timur Kristóf

Applied patches 2 and 3. Is 1 still needed with the other patch Alex mentioned?

Thanks!

Alex

Quoted 123 lines · Timur Kristóf

Apparently, both DCE 6.0 and 6.4 have 3 PLLs, but PLL0 can only be used for DP. Make sure to initialize the correct amount of PLLs in DC for these DCE versions and use PLL0 only for DP.

Also, on DCE 6.0 and 6.4, the PLL0 needs to be powered on at initialization as opposed to DCE 6.1 and 7.x which use a different clock source for DFS.

The following functions were used as reference from the old radeon driver implementation of DCE 6.x:
- radeon_atom_pick_pll
- atombios_crtc_set_disp_eng_pll

---
 .../display/dc/clk_mgr/dce100/dce_clk_mgr.c   |  5 +++
 .../dc/resource/dce60/dce60_resource.c        | 34 +++++++++++--------
 2 files changed, 25 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +5 -0
index 26feefbb8990..f5ad0a177038 100644
@@ -245,6 +245,11 @@ int dce_set_clock(
        pxl_clk_params.target_pixel_clock_100hz = requested_clk_khz * 10;
        pxl_clk_params.pll_id = CLOCK_SOURCE_ID_DFS;
 
+       /* DCE 6.0, DCE 6.4: engine clock is the same as PLL0 */
+       if (clk_mgr_base->ctx->dce_version == DCE_VERSION_6_0 ||
+           clk_mgr_base->ctx->dce_version == DCE_VERSION_6_4)
+               pxl_clk_params.pll_id = CLOCK_SOURCE_ID_PLL0;
+
        if (clk_mgr_dce->dfs_bypass_active)
                pxl_clk_params.flags.SET_DISPCLK_DFS_BYPASS = true;
 
drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c +20 -15
index 58b59d52dc9d..53b60044653f 100644
@@ -373,7 +373,7 @@ static const struct resource_caps res_cap = {
                .num_timing_generator = 6,
                .num_audio = 6,
                .num_stream_encoder = 6,
-               .num_pll = 2,
+               .num_pll = 3,
                .num_ddc = 6,
 };
 
@@ -389,7 +389,7 @@ static const struct resource_caps res_cap_64 = {
                .num_timing_generator = 2,
                .num_audio = 2,
                .num_stream_encoder = 2,
-               .num_pll = 2,
+               .num_pll = 3,
                .num_ddc = 2,
 };
 
@@ -973,21 +973,24 @@ static bool dce60_construct(
 
        if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) {
                pool->base.dp_clock_source =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
 
+               /* DCE 6.0 and 6.4: PLL0 can only be used with DP. Don't initialize it here. */
                pool->base.clock_sources[0] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], false);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
                pool->base.clock_sources[1] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
                pool->base.clk_src_count = 2;
 
        } else {
                pool->base.dp_clock_source =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
 
                pool->base.clock_sources[0] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
-               pool->base.clk_src_count = 1;
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+               pool->base.clock_sources[1] =
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
+               pool->base.clk_src_count = 2;
        }
 
        if (pool->base.dp_clock_source == NULL) {
@@ -1365,21 +1368,24 @@ static bool dce64_construct(
 
        if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) {
                pool->base.dp_clock_source =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
 
+               /* DCE 6.0 and 6.4: PLL0 can only be used with DP. Don't initialize it here. */
                pool->base.clock_sources[0] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[0], false);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
                pool->base.clock_sources[1] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[1], false);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
                pool->base.clk_src_count = 2;
 
        } else {
                pool->base.dp_clock_source =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[0], true);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
 
                pool->base.clock_sources[0] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[1], false);
-               pool->base.clk_src_count = 1;
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+               pool->base.clock_sources[1] =
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
+               pool->base.clk_src_count = 2;
        }
 
        if (pool->base.dp_clock_source == NULL) {
--

2.50.1

#13 lore raw

Re: [PATCH 3/3] drm/amd/display: Fix DCE 6.0 and 6.4 PLL programming.

Hi,

Thanks for the quick review!

No, I think patch 1 isn't going to be needed if the issue is already being addressed by the other one.

Timur

Quoted 167 lines · Alex Deucher

Applied patches 2 and 3.  Is 1 still needed with the other patch Alex mentioned?

Thanks!

Alex

Quoted 158 lines · Timur Kristóf

Apparently, both DCE 6.0 and 6.4 have 3 PLLs, but PLL0 can only be used for DP. Make sure to initialize the correct amount of PLLs in DC for these DCE versions and use PLL0 only for DP.

Also, on DCE 6.0 and 6.4, the PLL0 needs to be powered on at initialization as opposed to DCE 6.1 and 7.x which use a different clock source for DFS.

The following functions were used as reference from the old radeon driver implementation of DCE 6.x:
- radeon_atom_pick_pll
- atombios_crtc_set_disp_eng_pll

---
 .../display/dc/clk_mgr/dce100/dce_clk_mgr.c   |  5 +++ .../dc/resource/dce60/dce60_resource.c        | 34 +++++++++++----
----

 2 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c index 26feefbb8990..f5ad0a177038 100644

drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +0 -0
@@ -245,6 +245,11 @@ int dce_set_clock(

        pxl_clk_params.target_pixel_clock_100hz = requested_clk_khz
* 10;
        pxl_clk_params.pll_id = CLOCK_SOURCE_ID_DFS;

+       /* DCE 6.0, DCE 6.4: engine clock is the same as PLL0 */ +       if (clk_mgr_base->ctx->dce_version == DCE_VERSION_6_0 || +           clk_mgr_base->ctx->dce_version == DCE_VERSION_6_4) +               pxl_clk_params.pll_id = CLOCK_SOURCE_ID_PLL0; +
        if (clk_mgr_dce->dfs_bypass_active) pxl_clk_params.flags.SET_DISPCLK_DFS_BYPASS = true;

diff --git a/drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c index 58b59d52dc9d..53b60044653f 100644
---
a/drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c
+++
b/drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c

drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +2 -2
@@ -373,7 +373,7 @@ static const struct resource_caps res_cap = {
                 .num_timing_generator = 6,
                 .num_audio = 6,
                 .num_stream_encoder = 6,
-               .num_pll = 2,
+               .num_pll = 3,
                 .num_ddc = 6,
  };
 
@@ -389,7 +389,7 @@ static const struct resource_caps res_cap_64 =
 {
                 .num_timing_generator = 2,
                 .num_audio = 2,
                 .num_stream_encoder = 2,
-               .num_pll = 2,
+               .num_pll = 3,
                 .num_ddc = 2,
  };
@@ -973,21 +973,24 @@ static bool dce60_construct(
 

        if (bp->fw_info_valid && bp-

Quoted 1 line

fw_info.external_clock_source_frequency_for_dp != 0) {

                pool->base.dp_clock_source =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);

+               /* DCE 6.0 and 6.4: PLL0 can only be used with DP. Don't initialize it here. */ pool->base.clock_sources[0] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], false);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false); pool->base.clock_sources[1] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false); pool->base.clk_src_count = 2;

        } else {
                pool->base.dp_clock_source =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);

                pool->base.clock_sources[0] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
-               pool->base.clk_src_count = 1;
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+               pool->base.clock_sources[1] =
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
+               pool->base.clk_src_count = 2;
        }

        if (pool->base.dp_clock_source == NULL) {

drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +0 -0
@@ -1365,21 +1368,24 @@ static bool dce64_construct(
 

        if (bp->fw_info_valid && bp-

Quoted 1 line

fw_info.external_clock_source_frequency_for_dp != 0) {

                pool->base.dp_clock_source =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);

+               /* DCE 6.0 and 6.4: PLL0 can only be used with DP. Don't initialize it here. */ pool->base.clock_sources[0] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[0], false);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false); pool->base.clock_sources[1] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[1], false);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false); pool->base.clk_src_count = 2;

        } else {
                pool->base.dp_clock_source =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[0], true);
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);

                pool->base.clock_sources[0] =
-                               dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[1], false);
-               pool->base.clk_src_count = 1;
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
+               pool->base.clock_sources[1] =
+                       dce60_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
+               pool->base.clk_src_count = 2;
        }

        if (pool->base.dp_clock_source == NULL) {
--
2.50.1

#14 lore raw
In reply to Timur Kristóf
Quoted 11 lines · Timur Kristóf

This series fixes some regressions in DC, mainly on DCE6-8.

There is a fix for a recent regression caused by refactoring the DSC cap calculation that affects DCE8-10, as well as some fixes related to clock sources in DCE 6.

Timur Kristóf (3):
drm/amd/display: Fix refactored DSC cap calculation drm/amd/display: Don't overwrite dce60_clk_mgr drm/amd/display: Fix DCE 6.0 and 6.4 PLL programming.

Quoted 9 lines
 .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c  |  1 -
 .../display/dc/clk_mgr/dce100/dce_clk_mgr.c   |  5 +++
 drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c   | 17 +++++-----
 .../dc/resource/dce60/dce60_resource.c        | 34 +++++++++++--------
 4 files changed, 34 insertions(+), 23 deletions(-)
Signature · 1 line
2.50.1

Hi Dan,

I think this is a good candidate for next week's promotion. Tbh, I doubt you will see any issues in the ASICs that you are currently using for test. Perhaps it would be nice to have some old DCE devices for the next round of testing that includes this series?

Timur also has the following series that could be put together with this one in next week's promotion to save time. All of his patches are focused on DCE devices (but the series below could have some impact on new devices), and the last one addresses analog connector.

https://patchwork.freedesktop.org/series/152016/

Thanks

Signature · 1 line
Rodrigo Siqueira