]> git.hungrycats.org Git - linux/commitdiff
drm/amd/display: Rewrite dccg42_init
authorMatthew Stewart <Matthew.Stewart2@amd.com>
Mon, 8 Jun 2026 15:22:02 +0000 (11:22 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 1 Jul 2026 15:16:45 +0000 (11:16 -0400)
[why]

DCN42 reuses dccg42_init, which causes problems due to undefined masks.

[how]

- Read res_pool to determine the quantities of the respective resources
- Remove the physymclk root_clock_optimization check, as it seems like
  it shouldn't do anything (defaults to disabled already).

Reviewed-by: Ovidiu (Ovi) Bunea <ovidiu.bunea@amd.com>
Signed-off-by: Matthew Stewart <Matthew.Stewart2@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dccg/dcn42/dcn42_dccg.c

index adc453c81831c4e6430fa3614144c58290017329..8989761c607895f85d15e3acdbf1467e1f5ce104 100644 (file)
@@ -269,37 +269,26 @@ void dccg42_trigger_dio_fifo_resync(struct dccg *dccg)
 
 static void dccg42_init(struct dccg *dccg)
 {
-       int otg_inst;
-       struct dcn_dccg *dccg_dcn = TO_DCN_DCCG(dccg);
+       unsigned int i;
+       struct resource_pool *res_pool = dccg->ctx->dc->res_pool;
 
        /* Set HPO stream encoder to use refclk to avoid case where PHY is
         * disabled and SYMCLK32 for HPO SE is sourced from PHYD32CLK which
         * will cause DCN to hang.
         */
-       for (otg_inst = 0; otg_inst < 4; otg_inst++)
-               dccg35_disable_symclk32_se(dccg, otg_inst);
+       for (i = 0; i < res_pool->hpo_dp_stream_enc_count; i++)
+               dccg35_disable_symclk32_se(dccg, i);
 
        if (dccg->ctx->dc->debug.root_clock_optimization.bits.symclk32_le) {
-               dccg401_disable_symclk32_le(dccg, 0);
-               dccg401_disable_symclk32_le(dccg, 1);
-               dccg401_disable_symclk32_le(dccg, 2);
-               dccg401_disable_symclk32_le(dccg, 3);
+               for (i = 0; i < res_pool->hpo_dp_link_enc_count; i++)
+                       dccg401_disable_symclk32_le(dccg, i);
        }
 
        if (dccg->ctx->dc->debug.root_clock_optimization.bits.dpstream) {
-               dccg401_disable_dpstreamclk(dccg, 0);
-               dccg401_disable_dpstreamclk(dccg, 1);
-               dccg401_disable_dpstreamclk(dccg, 2);
-               dccg401_disable_dpstreamclk(dccg, 3);
-       }
-       if (!dccg->ctx->dc->debug.root_clock_optimization.bits.physymclk) {
-               REG_UPDATE_5(DCCG_GATE_DISABLE_CNTL2,
-                       PHYASYMCLK_ROOT_GATE_DISABLE, 1,
-                       PHYBSYMCLK_ROOT_GATE_DISABLE, 1,
-                       PHYCSYMCLK_ROOT_GATE_DISABLE, 1,
-                       PHYDSYMCLK_ROOT_GATE_DISABLE, 1,
-                       PHYESYMCLK_ROOT_GATE_DISABLE, 1);
+               for (i = 0; i < res_pool->hpo_dp_stream_enc_count; i++)
+                       dccg401_disable_dpstreamclk(dccg, i);
        }
+
        dccg42_disable_hdmistreamclk(dccg);
        if (dccg->ctx->dc->debug.root_clock_optimization.bits.hdmichar)
                dccg42_disable_hdmicharclk(dccg, 0);