OSDN Git Service

drm/amd/display: Add SetBacklight call to abm on dmcub
authorWyatt Wood <wyatt.wood@amd.com>
Mon, 30 Mar 2020 13:04:05 +0000 (09:04 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 22 Apr 2020 22:11:47 +0000 (18:11 -0400)
[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>
drivers/gpu/drm/amd/display/dc/core/dc_link.c
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
drivers/gpu/drm/amd/display/dc/inc/hw/abm.h

index 00f70e4..ef81842 100644 (file)
@@ -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;
index e345df6..4dae9ef 100644 (file)
@@ -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,
index 8baebb5..a19f359 100644 (file)
@@ -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);
 
index 0cae258..0dd12c4 100644 (file)
@@ -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);