drm/amd/display: Call DMUB for eDP power control
authorChris Park <Chris.Park@amd.com>
Mon, 10 Aug 2020 18:20:16 +0000 (14:20 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 26 Aug 2020 20:40:17 +0000 (16:40 -0400)
[Why]
If DMUB is used, LVTMA VBIOS call can be used to control eDP instead
of tranditional transmitter control. Interface is agreed with VBIOS
for eDP to use this new path to program LVTMA registers.

[How]
Expose DAL interface to send DMUB command for LVTMA control that VBIOS
currently uses.

Signed-off-by: Chris Park <Chris.Park@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Eryk Brol <eryk.brol@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/bios/command_table2.c

index a91d7be5d86e0cc84d6b199f514358e5711c3fd8..25bdf1c38e0ad8ffd905b736fdb911ce1e42d97b 100644 (file)
@@ -920,11 +920,39 @@ static void init_enable_lvtma_control(struct bios_parser *bp)
 
 }
 
+static void enable_lvtma_control_dmcub(
+       struct dc_dmub_srv *dmcub,
+       uint8_t uc_pwr_on)
+{
+
+       union dmub_rb_cmd cmd;
+
+       memset(&cmd, 0, sizeof(cmd));
+
+       cmd.cmd_common.header.type = DMUB_CMD__VBIOS;
+       cmd.cmd_common.header.sub_type =
+                       DMUB_CMD__VBIOS_LVTMA_CONTROL;
+       cmd.cmd_common.cmd_buffer[0] =
+                       uc_pwr_on;
+
+       dc_dmub_srv_cmd_queue(dmcub, &cmd);
+       dc_dmub_srv_cmd_execute(dmcub);
+       dc_dmub_srv_wait_idle(dmcub);
+
+}
+
 static enum bp_result enable_lvtma_control(
        struct bios_parser *bp,
        uint8_t uc_pwr_on)
 {
        enum bp_result result = BP_RESULT_FAILURE;
+
+       if (bp->base.ctx->dc->ctx->dmub_srv &&
+           bp->base.ctx->dc->debug.dmub_command_table) {
+               enable_lvtma_control_dmcub(bp->base.ctx->dmub_srv,
+                               uc_pwr_on);
+               return BP_RESULT_OK;
+       }
        return result;
 }