drm/amd/display: Register init
authorIgor Kravchenko <Igor.Kravchenko@amd.com>
Mon, 8 Jun 2020 21:32:27 +0000 (17:32 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 8 Jul 2020 13:01:38 +0000 (09:01 -0400)
[Why]
Driver re-initialize registers already set in FW

[How]
Transfer init to FW

Signed-off-by: Igor Kravchenko <Igor.Kravchenko@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Eryk Brol <eryk.brol@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c

index cb45f05a031942dcb569fe2d6bc714a8e7764591..6711ff908bcfd1e571d3c5472c1af4430458fd68 100644 (file)
@@ -1255,6 +1255,7 @@ void dcn10_init_hw(struct dc *dc)
        struct dc_bios *dcb = dc->ctx->dc_bios;
        struct resource_pool *res_pool = dc->res_pool;
        uint32_t backlight = MAX_BACKLIGHT_LEVEL;
+       bool   is_optimized_init_done = false;
 
        if (dc->clk_mgr && dc->clk_mgr->funcs->init_clocks)
                dc->clk_mgr->funcs->init_clocks(dc->clk_mgr);
@@ -1288,7 +1289,9 @@ void dcn10_init_hw(struct dc *dc)
        if (!dcb->funcs->is_accelerated_mode(dcb))
                hws->funcs.disable_vga(dc->hwseq);
 
-       if (!dc_dmub_srv_optimized_init_done(dc->ctx->dmub_srv))
+       is_optimized_init_done = dc_dmub_srv_optimized_init_done(dc->ctx->dmub_srv);
+
+       if (!is_optimized_init_done)
                hws->funcs.bios_golden_init(dc);
 
        if (dc->ctx->dc_bios->fw_info_valid) {
@@ -1323,7 +1326,8 @@ void dcn10_init_hw(struct dc *dc)
                 */
                struct dc_link *link = dc->links[i];
 
-               link->link_enc->funcs->hw_init(link->link_enc);
+               if (!is_optimized_init_done)
+                       link->link_enc->funcs->hw_init(link->link_enc);
 
                /* Check for enabled DIG to identify enabled display */
                if (link->link_enc->funcs->is_dig_enabled &&
@@ -1332,9 +1336,11 @@ void dcn10_init_hw(struct dc *dc)
        }
 
        /* Power gate DSCs */
-       for (i = 0; i < res_pool->res_cap->num_dsc; i++)
-               if (hws->funcs.dsc_pg_control != NULL)
-                       hws->funcs.dsc_pg_control(hws, res_pool->dscs[i]->inst, false);
+       if (!is_optimized_init_done) {
+               for (i = 0; i < res_pool->res_cap->num_dsc; i++)
+                       if (hws->funcs.dsc_pg_control != NULL)
+                               hws->funcs.dsc_pg_control(hws, res_pool->dscs[i]->inst, false);
+       }
 
        /* we want to turn off all dp displays before doing detection */
        if (dc->config.power_down_display_on_boot) {
@@ -1379,10 +1385,12 @@ void dcn10_init_hw(struct dc *dc)
         * everything down.
         */
        if (dcb->funcs->is_accelerated_mode(dcb) || dc->config.power_down_display_on_boot) {
-               hws->funcs.init_pipes(dc, dc->current_state);
-               if (dc->res_pool->hubbub->funcs->allow_self_refresh_control)
-                       dc->res_pool->hubbub->funcs->allow_self_refresh_control(dc->res_pool->hubbub,
-                                       !dc->res_pool->hubbub->ctx->dc->debug.disable_stutter);
+               if (!is_optimized_init_done) {
+                       hws->funcs.init_pipes(dc, dc->current_state);
+                       if (dc->res_pool->hubbub->funcs->allow_self_refresh_control)
+                               dc->res_pool->hubbub->funcs->allow_self_refresh_control(dc->res_pool->hubbub,
+                                               !dc->res_pool->hubbub->ctx->dc->debug.disable_stutter);
+               }
        }
 
        /* In headless boot cases, DIG may be turned
@@ -1417,30 +1425,34 @@ void dcn10_init_hw(struct dc *dc)
                }
        }
 
-       for (i = 0; i < res_pool->audio_count; i++) {
-               struct audio *audio = res_pool->audios[i];
+       if (!is_optimized_init_done) {
 
-               audio->funcs->hw_init(audio);
-       }
+               for (i = 0; i < res_pool->audio_count; i++) {
+                       struct audio *audio = res_pool->audios[i];
 
-       for (i = 0; i < dc->link_count; i++) {
-               struct dc_link *link = dc->links[i];
+                       audio->funcs->hw_init(audio);
+               }
 
-               if (link->panel_cntl)
-                       backlight = link->panel_cntl->funcs->hw_init(link->panel_cntl);
-       }
+               for (i = 0; i < dc->link_count; i++) {
+                       struct dc_link *link = dc->links[i];
 
-       if (abm != NULL)
-               abm->funcs->abm_init(abm, backlight);
+                       if (link->panel_cntl)
+                               backlight = link->panel_cntl->funcs->hw_init(link->panel_cntl);
+               }
 
-       if (dmcu != NULL && !dmcu->auto_load_dmcu)
-               dmcu->funcs->dmcu_init(dmcu);
+               if (abm != NULL)
+                       abm->funcs->abm_init(abm, backlight);
+
+               if (dmcu != NULL && !dmcu->auto_load_dmcu)
+                       dmcu->funcs->dmcu_init(dmcu);
+       }
 
        if (abm != NULL && dmcu != NULL)
                abm->dmcu_is_running = dmcu->funcs->is_dmcu_initialized(dmcu);
 
        /* power AFMT HDMI memory TODO: may move to dis/en output save power*/
-       REG_WRITE(DIO_MEM_PWR_CTRL, 0);
+       if (!is_optimized_init_done)
+               REG_WRITE(DIO_MEM_PWR_CTRL, 0);
 
        if (!dc->debug.disable_clock_gate) {
                /* enable all DCN clock gating */