drm/amd/display: Add debug option to force fclk request
authorHugo Hu <hugo.hu@amd.com>
Wed, 21 Nov 2018 06:34:10 +0000 (14:34 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 14 Jan 2019 20:04:35 +0000 (15:04 -0500)
[Why]
So that we can adjust fclk for debugging purposes.

[How]
Add option to force adjust fclk request to pplib.

Signed-off-by: Hugo Hu <hugo.hu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c

index b4ad48b0bff311ca0c45b6d3e2240d69bcf02315..da08c7122497759d88553cfa1433d77f4ea812fe 100644 (file)
@@ -255,6 +255,7 @@ struct dc_debug_options {
        bool scl_reset_length10;
        bool hdmi20_disable;
        bool skip_detection_link_training;
+       unsigned int force_fclk_khz;
 };
 
 struct dc_debug_data {
index 54abedbf1b43f7f2946ec574970d0654b037d169..c39db5bfa7cf8421de9464bceb3b67ba92f84396 100644 (file)
@@ -218,6 +218,7 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr,
                        bool safe_to_lower)
 {
        struct dc *dc = clk_mgr->ctx->dc;
+       struct dc_debug_options *debug = &dc->debug;
        struct dc_clocks *new_clocks = &context->bw.dcn.clk;
        struct pp_smu_display_requirement_rv *smu_req_cur =
                        &dc->res_pool->pp_smu_req;
@@ -261,6 +262,9 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr,
        }
 
        // F Clock
+       if (debug->force_fclk_khz != 0)
+               new_clocks->fclk_khz = debug->force_fclk_khz;
+
        if (should_set_clock(safe_to_lower, new_clocks->fclk_khz, clk_mgr->clks.fclk_khz)) {
                clk_mgr->clks.fclk_khz = new_clocks->fclk_khz;
                smu_req.hard_min_fclk_mhz = new_clocks->fclk_khz / 1000;