summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
diff options
context:
space:
mode:
authorWyatt Wood <wyatt.wood@amd.com>2020-04-05 16:40:43 -0400
committerAlex Deucher <alexander.deucher@amd.com>2020-04-09 10:43:16 -0400
commitc5d5b0ecf9c849c23e167965d88e609958cd805d (patch)
tree36449f8c49dd3b02c46a1f478bde94a66efea44b /drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
parentc06a545ae531bd8f791dc41b787822512eb65c5d (diff)
downloadlinux-c5d5b0ecf9c849c23e167965d88e609958cd805d.tar.bz2
drm/amd/display: Implement abm config table copy to dmcub
[Why] Driver must pass abm config table to dmub fw. This provides various parameters for abm functionality. [How] There is too much data to be passed in an inbox message, so we must pass this data using an indirect buffer. Copy the table to cw7 via x86, driver copies to fw_state structure. Signed-off-by: Wyatt Wood <wyatt.wood@amd.com> Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com> Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> Acked-by: Tony Cheng <Tony.Cheng@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c')
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
index 81c967917c5b..06435ecaf6a3 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
@@ -348,11 +348,30 @@ static bool dmub_abm_set_backlight_level_pwm(
return true;
}
-static bool dmub_abm_load_config(struct abm *abm,
- unsigned int start_offset,
+static bool dmub_abm_init_config(struct abm *abm,
const char *src,
unsigned int bytes)
{
+ union dmub_rb_cmd cmd;
+ struct dc_context *dc = abm->ctx;
+
+ // TODO: Optimize by only reading back final 4 bytes
+ dmub_flush_buffer_mem(&dc->dmub_srv->dmub->scratch_mem_fb);
+
+ // Copy iramtable into cw7
+ memcpy(dc->dmub_srv->dmub->scratch_mem_fb.cpu_addr, (void *)src, bytes);
+
+ // Fw will copy from cw7 to fw_state
+ cmd.abm_init_config.header.type = DMUB_CMD__ABM;
+ cmd.abm_init_config.header.sub_type = DMUB_CMD__ABM_INIT_CONFIG;
+ cmd.abm_init_config.abm_init_config_data.src.quad_part = dc->dmub_srv->dmub->scratch_mem_fb.gpu_addr;
+ cmd.abm_init_config.abm_init_config_data.bytes = bytes;
+ cmd.abm_init_config.header.payload_bytes = sizeof(struct dmub_cmd_abm_init_config_data);
+
+ dc_dmub_srv_cmd_queue(dc->dmub_srv, &cmd.abm_init_config.header);
+ dc_dmub_srv_cmd_execute(dc->dmub_srv);
+ dc_dmub_srv_wait_idle(dc->dmub_srv);
+
return true;
}
@@ -365,7 +384,7 @@ static const struct abm_funcs abm_funcs = {
.get_current_backlight = dmub_abm_get_current_backlight,
.get_target_backlight = dmub_abm_get_target_backlight,
.set_abm_immediate_disable = dmub_abm_immediate_disable,
- .load_abm_config = dmub_abm_load_config,
+ .init_abm_config = dmub_abm_init_config,
};
static void dmub_abm_construct(