]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd/display: Skip DPP DTO update if root clock is gated
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Fri, 28 Apr 2023 15:23:50 +0000 (11:23 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 30 Oct 2023 11:00:12 +0000 (12:00 +0100)
BugLink: https://bugs.launchpad.net/bugs/2039110
[ Upstream commit 30f90f3c1c2c63c2fa44f61233737d27b72637c2 ]

[Why]
Hardware implements root clock gating by utilizing the DPP DTO registers
with a special case of DTO enabled, phase = 0, modulo = 1. This
conflicts with our policy to always update the DPPDTO for cases where
it's expected to be disabled.

The pipes unexpectedly enter a higher power state than expected because
of this programming flow.

[How]
Guard the upper layers of HWSS against this hardware quirk with
programming the register with an internal state flag in DCCG.

While technically acting as global state for the DCCG, HWSS shouldn't be
expected to understand the hardware quirk for having DTO disabled
causing more power than DTO enabled with this specific setting.

This also prevents sequencing errors from occuring in the future if
we have to program DPP DTO in multiple locations.

Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Jun Lei <jun.lei@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dccg.c
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c
drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h

index 7d2b982506fd7ba9e820002cbee2a74e23adc461..cef32a1f91cdc83c230c31a1d87934957ac4048d 100644 (file)
@@ -47,6 +47,14 @@ void dccg31_update_dpp_dto(struct dccg *dccg, int dpp_inst, int req_dppclk)
 {
        struct dcn_dccg *dccg_dcn = TO_DCN_DCCG(dccg);
 
+       if (dccg->dpp_clock_gated[dpp_inst]) {
+               /*
+                * Do not update the DPPCLK DTO if the clock is stopped.
+                * It is treated the same as if the pipe itself were in PG.
+                */
+               return;
+       }
+
        if (dccg->ref_dppclk && req_dppclk) {
                int ref_dppclk = dccg->ref_dppclk;
                int modulo, phase;
index 081ce168f621137e0564cdbd2ca3267d8a005e8c..1f32980756c730dd132f2fa91f90e661ae73649d 100644 (file)
@@ -296,6 +296,9 @@ static void dccg314_dpp_root_clock_control(
 {
        struct dcn_dccg *dccg_dcn = TO_DCN_DCCG(dccg);
 
+       if (dccg->dpp_clock_gated[dpp_inst] == clock_on)
+               return;
+
        if (clock_on) {
                /* turn off the DTO and leave phase/modulo at max */
                REG_UPDATE(DPPCLK_DTO_CTRL, DPPCLK_DTO_ENABLE[dpp_inst], 0);
@@ -309,6 +312,8 @@ static void dccg314_dpp_root_clock_control(
                          DPPCLK0_DTO_PHASE, 0,
                          DPPCLK0_DTO_MODULO, 1);
        }
+
+       dccg->dpp_clock_gated[dpp_inst] = !clock_on;
 }
 
 static const struct dccg_funcs dccg314_funcs = {
index ad6acd1b34e1dd33eedc072b7db807ff3a40ffd3..9651cccb084a34c9a70adfae81daecd9fcb733c8 100644 (file)
@@ -68,6 +68,7 @@ struct dccg {
        const struct dccg_funcs *funcs;
        int pipe_dppclk_khz[MAX_PIPES];
        int ref_dppclk;
+       bool dpp_clock_gated[MAX_PIPES];
        //int dtbclk_khz[MAX_PIPES];/* TODO needs to be removed */
        //int audio_dtbclk_khz;/* TODO needs to be removed */
        //int ref_dtbclk_khz;/* TODO needs to be removed */