drm/amd/display: Fix dpstreamclk programming
authorMichael Strauss <michael.strauss@amd.com>
Fri, 10 Jun 2022 20:28:03 +0000 (16:28 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 25 Jul 2022 21:17:10 +0000 (17:17 -0400)
[WHY]
Currently programming incorrect hpo inst as well as selecting incorrect source

[HOW]
Use hpo inst instead of otg inst to select dpstreamclk inst

Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Michael Strauss <michael.strauss@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dccg.c
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dccg.h
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dccg.c
drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h
drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_dp.c

index 799a383a26840783e77b87fb81070ff024aba67f..7f34418e63081810335c40ee0bdeabcb1f648989 100644 (file)
@@ -158,9 +158,11 @@ static void dccg31_disable_dpstreamclk(struct dccg *dccg, int otg_inst)
        }
 }
 
-void dccg31_set_dpstreamclk(struct dccg *dccg,
-                           enum streamclk_source src,
-                           int otg_inst)
+void dccg31_set_dpstreamclk(
+               struct dccg *dccg,
+               enum streamclk_source src,
+               int otg_inst,
+               int dp_hpo_inst)
 {
        if (src == REFCLK)
                dccg31_disable_dpstreamclk(dccg, otg_inst);
index 32b5593b14604fd818fdc67bdbf0edfdb618b990..0902ce5eb8a116c3e302112aba5497ae52376d44 100644 (file)
@@ -161,11 +161,6 @@ struct dccg *dccg31_create(
 
 void dccg31_init(struct dccg *dccg);
 
-void dccg31_set_dpstreamclk(
-               struct dccg *dccg,
-               enum streamclk_source src,
-               int otg_inst);
-
 void dccg31_enable_symclk32_se(
                struct dccg *dccg,
                int hpo_se_inst,
@@ -207,7 +202,8 @@ void dccg31_get_dccg_ref_freq(
 void dccg31_set_dpstreamclk(
        struct dccg *dccg,
        enum streamclk_source src,
-       int otg_inst);
+       int otg_inst,
+       int dp_hpo_inst);
 
 void dccg31_set_dtbclk_dto(
                struct dccg *dccg,
index 3852a6d59b978b2e24ad82c966b65d382ee9ee5a..232cc15979dda16fbc600ff4b4d554d1b8bd8c56 100644 (file)
@@ -184,7 +184,8 @@ void dccg314_set_dtbclk_dto(
 void dccg314_set_dpstreamclk(
                struct dccg *dccg,
                enum streamclk_source src,
-               int otg_inst)
+               int otg_inst,
+               int dp_hpo_inst)
 {
        struct dcn_dccg *dccg_dcn = TO_DCN_DCCG(dccg);
 
@@ -192,26 +193,26 @@ void dccg314_set_dpstreamclk(
        dccg314_set_dtbclk_p_src(dccg, src, otg_inst);
 
        /* enabled to select one of the DTBCLKs for pipe */
-       switch (otg_inst) {
+       switch (dp_hpo_inst) {
        case 0:
                REG_UPDATE_2(DPSTREAMCLK_CNTL,
                                        DPSTREAMCLK0_EN, (src == REFCLK) ? 0 : 1,
-                                       DPSTREAMCLK0_SRC_SEL, 0);
+                                       DPSTREAMCLK0_SRC_SEL, otg_inst);
                break;
        case 1:
                REG_UPDATE_2(DPSTREAMCLK_CNTL,
                                        DPSTREAMCLK1_EN, (src == REFCLK) ? 0 : 1,
-                                       DPSTREAMCLK1_SRC_SEL, 1);
+                                       DPSTREAMCLK1_SRC_SEL, otg_inst);
                break;
        case 2:
                REG_UPDATE_2(DPSTREAMCLK_CNTL,
                                        DPSTREAMCLK2_EN, (src == REFCLK) ? 0 : 1,
-                                       DPSTREAMCLK2_SRC_SEL, 2);
+                                       DPSTREAMCLK2_SRC_SEL, otg_inst);
                break;
        case 3:
                REG_UPDATE_2(DPSTREAMCLK_CNTL,
                                        DPSTREAMCLK3_EN, (src == REFCLK) ? 0 : 1,
-                                       DPSTREAMCLK3_SRC_SEL, 3);
+                                       DPSTREAMCLK3_SRC_SEL, otg_inst);
                break;
        default:
                BREAK_TO_DEBUGGER();
index 12fc3afd9acd41ac83b9ffb3d24e252b38f166f6..a31c64b50410b5158b156b0416a26aca9b54cde6 100644 (file)
@@ -211,7 +211,8 @@ static void dccg32_get_dccg_ref_freq(struct dccg *dccg,
 void dccg32_set_dpstreamclk(
                struct dccg *dccg,
                enum streamclk_source src,
-               int otg_inst)
+               int otg_inst,
+               int dp_hpo_inst)
 {
        struct dcn_dccg *dccg_dcn = TO_DCN_DCCG(dccg);
 
index c2d116cce119b11608caf9e2e8d1931ecfd83975..ce006762f2571e9b2dd8ae84eaec854ab5fa639c 100644 (file)
@@ -101,7 +101,8 @@ struct dccg_funcs {
        void (*set_dpstreamclk)(
                        struct dccg *dccg,
                        enum streamclk_source src,
-                       int otg_inst);
+                       int otg_inst,
+                       int dp_hpo_inst);
 
        void (*enable_symclk32_se)(
                        struct dccg *dccg,
index ea6cf8bfce304ba3a83c11ab8212ab892f1f3ad2..db7b0b155374a0f2a1f05cc48bf2da08dc95a5a9 100644 (file)
@@ -116,7 +116,7 @@ static void setup_hpo_dp_stream_encoder(struct pipe_ctx *pipe_ctx)
        dto_params.timing = &pipe_ctx->stream->timing;
        dto_params.ref_dtbclk_khz = dc->clk_mgr->funcs->get_dtb_ref_clk_frequency(dc->clk_mgr);
 
-       dccg->funcs->set_dpstreamclk(dccg, DTBCLK0, tg->inst);
+       dccg->funcs->set_dpstreamclk(dccg, DTBCLK0, tg->inst, link_enc->inst);
        dccg->funcs->enable_symclk32_se(dccg, stream_enc->inst, phyd32clk);
        dccg->funcs->set_dtbclk_dto(dccg, &dto_params);
        stream_enc->funcs->enable_stream(stream_enc);
@@ -137,7 +137,7 @@ static void reset_hpo_dp_stream_encoder(struct pipe_ctx *pipe_ctx)
        stream_enc->funcs->disable(stream_enc);
        dccg->funcs->set_dtbclk_dto(dccg, &dto_params);
        dccg->funcs->disable_symclk32_se(dccg, stream_enc->inst);
-       dccg->funcs->set_dpstreamclk(dccg, REFCLK, tg->inst);
+       dccg->funcs->set_dpstreamclk(dccg, REFCLK, tg->inst,  pipe_ctx->link_res.hpo_dp_link_enc->inst);
 }
 
 static void setup_hpo_dp_stream_attribute(struct pipe_ctx *pipe_ctx)