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 <wyatt.wood@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Wyatt Wood 2020-03-30 09:04:05 -04:00 committed by Alex Deucher
parent f12f70117a
commit 67d09292f8
4 changed files with 9 additions and 9 deletions

View File

@ -2455,16 +2455,16 @@ bool dc_link_set_backlight_level(const struct dc_link *link,
struct abm *abm = dc->res_pool->abm; struct abm *abm = dc->res_pool->abm;
struct dmcu *dmcu = dc->res_pool->dmcu; struct dmcu *dmcu = dc->res_pool->dmcu;
unsigned int controller_id = 0; unsigned int controller_id = 0;
bool use_smooth_brightness = true; bool fw_set_brightness = true;
int i; int i;
DC_LOGGER_INIT(link->ctx->logger); DC_LOGGER_INIT(link->ctx->logger);
if ((dmcu == NULL) || if ((dmcu == NULL && abm == NULL) ||
(abm == NULL) ||
(abm->funcs->set_backlight_level_pwm == NULL)) (abm->funcs->set_backlight_level_pwm == NULL))
return false; 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", DC_LOG_BACKLIGHT("New Backlight level: %d (0x%X)\n",
backlight_pwm_u16_16, backlight_pwm_u16_16); 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, backlight_pwm_u16_16,
frame_ramp, frame_ramp,
controller_id, controller_id,
use_smooth_brightness); fw_set_brightness);
} }
return true; return true;

View File

@ -420,7 +420,7 @@ static bool dce_abm_set_backlight_level_pwm(
unsigned int backlight_pwm_u16_16, unsigned int backlight_pwm_u16_16,
unsigned int frame_ramp, unsigned int frame_ramp,
unsigned int controller_id, unsigned int controller_id,
bool use_smooth_brightness) bool fw_set_brightness)
{ {
struct dce_abm *abm_dce = TO_DCE_ABM(abm); 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); backlight_pwm_u16_16, backlight_pwm_u16_16);
/* If DMCU is in reset state, DMCU is uninitialized */ /* If DMCU is in reset state, DMCU is uninitialized */
if (use_smooth_brightness) if (fw_set_brightness)
dmcu_set_backlight_level(abm_dce, dmcu_set_backlight_level(abm_dce,
backlight_pwm_u16_16, backlight_pwm_u16_16,
frame_ramp, frame_ramp,

View File

@ -338,7 +338,7 @@ static bool dmub_abm_set_backlight_level_pwm(
unsigned int backlight_pwm_u16_16, unsigned int backlight_pwm_u16_16,
unsigned int frame_ramp, unsigned int frame_ramp,
unsigned int otg_inst, unsigned int otg_inst,
bool use_smooth_brightness) bool fw_set_brightness)
{ {
struct dce_abm *dce_abm = TO_DMUB_ABM(abm); struct dce_abm *dce_abm = TO_DMUB_ABM(abm);

View File

@ -56,7 +56,7 @@ struct abm_funcs {
unsigned int backlight_pwm_u16_16, unsigned int backlight_pwm_u16_16,
unsigned int frame_ramp, unsigned int frame_ramp,
unsigned int controller_id, unsigned int controller_id,
bool use_smooth_brightness); bool fw_set_brightness);
unsigned int (*get_current_backlight)(struct abm *abm); unsigned int (*get_current_backlight)(struct abm *abm);
unsigned int (*get_target_backlight)(struct abm *abm); unsigned int (*get_target_backlight)(struct abm *abm);