Commit aa7397df authored by Amy Zhang's avatar Amy Zhang Committed by Alex Deucher
Browse files

drm/amd/display: Disable ABM when eDP is disabled



- Add immediate ABM disable when eDP is disabled
- Fix purple screen when ABM is mistakenly enabled
on non eDP display

Signed-off-by: default avatarAmy Zhang <Amy.Zhang@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e806208d
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1415,6 +1415,22 @@ bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level,
	return true;
}


bool dc_link_set_abm_disable(const struct dc_link *dc_link)
{
	struct core_link *link = DC_LINK_TO_CORE(dc_link);
	struct core_dc *core_dc = DC_TO_CORE(link->ctx->dc);
	struct abm *abm = core_dc->res_pool->abm;

	if ((abm == NULL) || (abm->funcs->set_backlight_level == NULL))
		return false;

	abm->funcs->set_abm_immediate_disable(abm);

	return true;
}


bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable)
{
	struct core_link *link = DC_LINK_TO_CORE(dc_link);
+2 −0
Original line number Diff line number Diff line
@@ -714,6 +714,8 @@ const struct graphics_object_id dc_get_link_id_at_index(
bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level,
		uint32_t frame_ramp, const struct dc_stream *stream);

bool dc_link_set_abm_disable(const struct dc_link *dc_link);

bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable);

bool dc_link_setup_psr(const struct dc_link *dc_link,
+21 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@
#define MCP_ABM_PIPE_SET 0x66
#define MCP_BL_SET 0x67

#define MCP_DISABLE_ABM_IMMEDIATELY 255

struct abm_backlight_registers {
	unsigned int BL_PWM_CNTL;
	unsigned int BL_PWM_CNTL2;
@@ -315,6 +317,24 @@ static bool dce_abm_set_level(struct abm *abm, uint32_t level)
	return true;
}

static bool dce_abm_immediate_disable(struct abm *abm)
{
	struct dce_abm *abm_dce = TO_DCE_ABM(abm);

	REG_WAIT(MASTER_COMM_CNTL_REG, MASTER_COMM_INTERRUPT, 0,
			100, 800);

	/* setDMCUParam_ABMLevel */
	REG_UPDATE_2(MASTER_COMM_CMD_REG,
			MASTER_COMM_CMD_REG_BYTE0, MCP_ABM_LEVEL_SET,
			MASTER_COMM_CMD_REG_BYTE2, MCP_DISABLE_ABM_IMMEDIATELY);

	/* notifyDMCUMsg */
	REG_UPDATE(MASTER_COMM_CNTL_REG, MASTER_COMM_INTERRUPT, 1);

	return true;
}

static bool dce_abm_init_backlight(struct abm *abm)
{
	struct dce_abm *abm_dce = TO_DCE_ABM(abm);
@@ -414,6 +434,7 @@ static const struct abm_funcs dce_funcs = {
	.init_backlight = dce_abm_init_backlight,
	.set_backlight_level = dce_abm_set_backlight_level,
	.get_current_backlight_8_bit = dce_abm_get_current_backlight_8_bit,
	.set_abm_immediate_disable = dce_abm_immediate_disable,
	.is_dmcu_initialized = is_dmcu_initialized
};

+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ struct abm {
struct abm_funcs {
	void (*abm_init)(struct abm *abm);
	bool (*set_abm_level)(struct abm *abm, unsigned int abm_level);
	bool (*set_abm_immediate_disable)(struct abm *abm);
	bool (*init_backlight)(struct abm *abm);
	bool (*set_backlight_level)(struct abm *abm,
			unsigned int backlight_level,