]> git.itanic.dy.fi Git - linux-stable/commitdiff
drm/amd/display: Init clock value by current vbios CLKs
authorBrandon Syu <Brandon.Syu@amd.com>
Thu, 12 Nov 2020 07:35:52 +0000 (15:35 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 3 Dec 2020 03:53:01 +0000 (22:53 -0500)
[Why]
While booting into OS, driver updates DPP/DISP CLKs.
But init clock value is zero which is invalid.

[How]
Get current clocks value to update init clocks.
To avoid underflow.

Signed-off-by: Brandon Syu <Brandon.Syu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c

index 2f8fee05547ac56ed82bc0132bc55ac9db5a39eb..c001307b0a59aea67df1982aee26f5cd10e4b149 100644 (file)
@@ -163,8 +163,17 @@ void rn_update_clocks(struct clk_mgr *clk_mgr_base,
                        new_clocks->dppclk_khz = 100000;
        }
 
-       if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) {
-               if (clk_mgr->base.clks.dppclk_khz > new_clocks->dppclk_khz)
+       /*
+        * Temporally ignore thew 0 cases for disp and dpp clks.
+        * We may have a new feature that requires 0 clks in the future.
+        */
+       if (new_clocks->dppclk_khz == 0 || new_clocks->dispclk_khz == 0) {
+               new_clocks->dppclk_khz = clk_mgr_base->clks.dppclk_khz;
+               new_clocks->dispclk_khz = clk_mgr_base->clks.dispclk_khz;
+       }
+
+       if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr_base->clks.dppclk_khz)) {
+               if (clk_mgr_base->clks.dppclk_khz > new_clocks->dppclk_khz)
                        dpp_clock_lowered = true;
                clk_mgr_base->clks.dppclk_khz = new_clocks->dppclk_khz;
                update_dppclk = true;