Commit 67d09292 authored by Wyatt Wood's avatar Wyatt Wood Committed by Alex Deucher
Browse files

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: default avatarWyatt Wood <wyatt.wood@amd.com>
Reviewed-by: default avatarAnthony Koo <Anthony.Koo@amd.com>
Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f12f7011
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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);

+1 −1
Original line number Diff line number Diff line
@@ -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);