Commit 38077562 authored by Kaitlyn Tse's avatar Kaitlyn Tse Committed by Alex Deucher
Browse files

drm/amd/display: Implement new backlight_level_params structure



[Why]
Implement the new backlight_level_params structure as part of the VBAC
framework, the information in this structure is needed to be passed down
to the DMCUB to identify the backlight control type, to adjust the
backlight of the panel and to perform any required conversions from PWM
to nits or vice versa.

[How]
Modified existing functions to include the new backlight_level_params
structure.

Reviewed-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: default avatarKaitlyn Tse <Kaitlyn.Tse@amd.com>
Signed-off-by: default avatarZaeem Mohamed <zaeem.mohamed@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ebacc134
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -4640,7 +4640,12 @@ static void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm,
		if (!rc)
			DRM_DEBUG("DM: Failed to update backlight via AUX on eDP[%d]\n", bl_idx);
	} else {
		rc = dc_link_set_backlight_level(link, brightness, 0);
		struct set_backlight_level_params backlight_level_params = { 0 };

		backlight_level_params.backlight_pwm_u16_16 = brightness;
		backlight_level_params.transition_time_in_ms = 0;

		rc = dc_link_set_backlight_level(link, &backlight_level_params);
		if (!rc)
			DRM_DEBUG("DM: Failed to update backlight on eDP[%d]\n", bl_idx);
	}
+2 −3
Original line number Diff line number Diff line
@@ -430,11 +430,10 @@ bool dc_link_get_backlight_level_nits(struct dc_link *link,
}

bool dc_link_set_backlight_level(const struct dc_link *link,
		uint32_t backlight_pwm_u16_16,
		uint32_t frame_ramp)
		struct set_backlight_level_params *backlight_level_params)
{
	return link->dc->link_srv->edp_set_backlight_level(link,
			backlight_pwm_u16_16, frame_ramp);
			backlight_level_params);
}

bool dc_link_set_backlight_level_nits(struct dc_link *link,
+2 −2
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ struct dc_dmub_caps {
	bool subvp_psr;
	bool gecc_enable;
	uint8_t fams_ver;
	bool aux_backlight_support;
};

struct dc_scl_caps {
@@ -2210,8 +2211,7 @@ void dc_link_edp_panel_backlight_power_on(struct dc_link *link,
 * and 16 bit fractional, where 1.0 is max backlight value.
 */
bool dc_link_set_backlight_level(const struct dc_link *dc_link,
		uint32_t backlight_pwm_u16_16,
		uint32_t frame_ramp);
		struct set_backlight_level_params *backlight_level_params);

/* Set/get nits-based backlight level of an embedded panel (eDP, LVDS). */
bool dc_link_set_backlight_level_nits(struct dc_link *link,
+27 −0
Original line number Diff line number Diff line
@@ -1303,4 +1303,31 @@ struct dc_commit_streams_params {
	enum dc_power_source_type power_source;
};

struct set_backlight_level_params {
	/* backlight in pwm */
	uint32_t backlight_pwm_u16_16;
	/* brightness ramping */
	uint32_t frame_ramp;
	/* backlight control type
	 * 0: PWM backlight control
	 * 1: VESA AUX backlight control
	 * 2: AMD AUX backlight control
	 */
	enum backlight_control_type control_type;
	/* backlight in millinits */
	uint32_t backlight_millinits;
	/* transition time in ms */
	uint32_t transition_time_in_ms;
	/* minimum luminance in nits */
	uint32_t min_luminance;
	/* maximum luminance in nits */
	uint32_t max_luminance;
	/* minimum backlight in pwm */
	uint32_t min_backlight_pwm;
	/* maximum backlight in pwm */
	uint32_t max_backlight_pwm;
	/* AUX HW instance */
	uint8_t aux_inst;
};

#endif /* DC_TYPES_H_ */
+3 −3
Original line number Diff line number Diff line
@@ -3143,10 +3143,10 @@ static void dce110_set_cursor_attribute(struct pipe_ctx *pipe_ctx)
}

bool dce110_set_backlight_level(struct pipe_ctx *pipe_ctx,
	struct set_backlight_level_params *params)
	struct set_backlight_level_params *backlight_level_params)
{
	uint32_t backlight_pwm_u16_16 = params->backlight_pwm_u16_16;
	uint32_t frame_ramp = params->frame_ramp;
	uint32_t backlight_pwm_u16_16 = backlight_level_params->backlight_pwm_u16_16;
	uint32_t frame_ramp = backlight_level_params->frame_ramp;
	struct dc_link *link = pipe_ctx->stream->link;
	struct dc  *dc = link->ctx->dc;
	struct abm *abm = pipe_ctx->stream_res.abm;
Loading