From 67d09292f857d47e3577e69236e426cbc31439f0 Mon Sep 17 00:00:00 2001 From: Wyatt Wood Date: Mon, 30 Mar 2020 09:04:05 -0400 Subject: [PATCH] drm/amd/display: Add SetBacklight call to abm on dmcub [Why] Set backlight calls to firmware are are being prevented by dmcu == null check. Dmcu is expected to be null in this case. [How] Only prevent call if dmcu and abm are null. Also rename variable 'use_smooth_brightness' to 'fw_set_brightness' as it's more appropriate. Signed-off-by: Wyatt Wood Reviewed-by: Anthony Koo Acked-by: Rodrigo Siqueira Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 10 +++++----- drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 4 ++-- drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 2 +- drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c index 00f70e43ed76..ef8184296a7e 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -2455,16 +2455,16 @@ bool dc_link_set_backlight_level(const struct dc_link *link, struct abm *abm = dc->res_pool->abm; struct dmcu *dmcu = dc->res_pool->dmcu; unsigned int controller_id = 0; - bool use_smooth_brightness = true; + bool fw_set_brightness = true; int i; DC_LOGGER_INIT(link->ctx->logger); - if ((dmcu == NULL) || - (abm == NULL) || + if ((dmcu == NULL && abm == NULL) || (abm->funcs->set_backlight_level_pwm == NULL)) return false; - use_smooth_brightness = dmcu->funcs->is_dmcu_initialized(dmcu); + if (dmcu) + fw_set_brightness = dmcu->funcs->is_dmcu_initialized(dmcu); DC_LOG_BACKLIGHT("New Backlight level: %d (0x%X)\n", backlight_pwm_u16_16, backlight_pwm_u16_16); @@ -2496,7 +2496,7 @@ bool dc_link_set_backlight_level(const struct dc_link *link, backlight_pwm_u16_16, frame_ramp, controller_id, - use_smooth_brightness); + fw_set_brightness); } return true; diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c index e345df621a6a..4dae9efebb6f 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c @@ -420,7 +420,7 @@ static bool dce_abm_set_backlight_level_pwm( unsigned int backlight_pwm_u16_16, unsigned int frame_ramp, unsigned int controller_id, - bool use_smooth_brightness) + bool fw_set_brightness) { struct dce_abm *abm_dce = TO_DCE_ABM(abm); @@ -428,7 +428,7 @@ static bool dce_abm_set_backlight_level_pwm( backlight_pwm_u16_16, backlight_pwm_u16_16); /* If DMCU is in reset state, DMCU is uninitialized */ - if (use_smooth_brightness) + if (fw_set_brightness) dmcu_set_backlight_level(abm_dce, backlight_pwm_u16_16, frame_ramp, 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 8baebb594de5..a19f359e45d7 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c @@ -338,7 +338,7 @@ static bool dmub_abm_set_backlight_level_pwm( unsigned int backlight_pwm_u16_16, unsigned int frame_ramp, unsigned int otg_inst, - bool use_smooth_brightness) + bool fw_set_brightness) { struct dce_abm *dce_abm = TO_DMUB_ABM(abm); diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/abm.h b/drivers/gpu/drm/amd/display/dc/inc/hw/abm.h index 0cae258a903e..0dd12c4fc23c 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/hw/abm.h +++ b/drivers/gpu/drm/amd/display/dc/inc/hw/abm.h @@ -56,7 +56,7 @@ struct abm_funcs { unsigned int backlight_pwm_u16_16, unsigned int frame_ramp, unsigned int controller_id, - bool use_smooth_brightness); + bool fw_set_brightness); unsigned int (*get_current_backlight)(struct abm *abm); unsigned int (*get_target_backlight)(struct abm *abm);