Commit 45a1261b authored by Jake Wang's avatar Jake Wang Committed by Alex Deucher
Browse files

drm/amd/display: Refactored DC interfaces to support multiple eDP



[Why & How]
Some existing DC interfaces are optimized to return a single eDP
link/stream. Refactored those DC interfaces to support multiple eDP.

Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarJake Wang <haonan.wang2@amd.com>
Reviewed-by: default avatarNicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent cca912e0
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -87,12 +87,16 @@ int clk_mgr_helper_get_active_plane_cnt(

void clk_mgr_exit_optimized_pwr_state(const struct dc *dc, struct clk_mgr *clk_mgr)
{
	struct dc_link *edp_link = get_edp_link(dc);
	struct dc_link *edp_links[MAX_NUM_EDP];
	struct dc_link *edp_link = NULL;
	int edp_num;

	get_edp_links(dc, edp_links, &edp_num);
	if (dc->hwss.exit_optimized_pwr_state)
		dc->hwss.exit_optimized_pwr_state(dc, dc->current_state);

	if (edp_link) {
	if (edp_num) {
		edp_link = edp_links[0];
		clk_mgr->psr_allow_active_cache = edp_link->psr_settings.psr_allow_active;
		dc_link_set_psr_allow_active(edp_link, false, false, false);
	}
@@ -101,11 +105,16 @@ void clk_mgr_exit_optimized_pwr_state(const struct dc *dc, struct clk_mgr *clk_m

void clk_mgr_optimize_pwr_state(const struct dc *dc, struct clk_mgr *clk_mgr)
{
	struct dc_link *edp_link = get_edp_link(dc);
	struct dc_link *edp_links[MAX_NUM_EDP];
	struct dc_link *edp_link = NULL;
	int edp_num;

	if (edp_link)
	get_edp_links(dc, edp_links, &edp_num);
	if (edp_num) {
		edp_link = edp_links[0];
		dc_link_set_psr_allow_active(edp_link,
				clk_mgr->psr_allow_active_cache, false, false);
	}

	if (dc->hwss.optimize_pwr_state)
		dc->hwss.optimize_pwr_state(dc, dc->current_state);
+11 −7
Original line number Diff line number Diff line
@@ -1012,22 +1012,26 @@ struct dc *dc_create(const struct dc_init_data *init_params)

static void detect_edp_presence(struct dc *dc)
{
	struct dc_link *edp_link = get_edp_link(dc);
	struct dc_link *edp_links[MAX_NUM_EDP];
	struct dc_link *edp_link = NULL;
	int i;
	int edp_num;
	bool edp_sink_present = true;

	if (!edp_link)
	get_edp_links(dc, edp_links, &edp_num);
	if (!edp_num)
		return;

	if (dc->config.edp_not_connected) {
			edp_sink_present = false;
	} else {
		enum dc_connection_type type;
		for (i = 0; i < edp_num; i++) {
			edp_link = edp_links[i];
			dc_link_detect_sink(edp_link, &type);
		if (type == dc_connection_none)
			edp_sink_present = false;
			edp_link->edp_sink_present = (type != dc_connection_none);
		}
	}

	edp_link->edp_sink_present = edp_sink_present;
}

void dc_hardware_init(struct dc *dc)
+1 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ struct aux_payload;
#define MAX_STREAMS 6
#define MAX_SINKS_PER_LINK 4
#define MIN_VIEWPORT_SIZE 12
#define MAX_NUM_EDP 2

/*******************************************************************************
 * Display Core Interfaces
+10 −5
Original line number Diff line number Diff line
@@ -187,16 +187,21 @@ static inline struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_
	return dc->links[link_index];
}

static inline struct dc_link *get_edp_link(const struct dc *dc)
static inline void get_edp_links(const struct dc *dc,
		struct dc_link **edp_links,
		int *edp_num)
{
	int i;

	// report any eDP links, even unconnected DDI's
	*edp_num = 0;
	for (i = 0; i < dc->link_count; i++) {
		if (dc->links[i]->connector_signal == SIGNAL_TYPE_EDP)
			return dc->links[i];
		// report any eDP links, even unconnected DDI's
		if (dc->links[i]->connector_signal == SIGNAL_TYPE_EDP) {
			edp_links[*edp_num] = dc->links[i];
			if (++(*edp_num) == MAX_NUM_EDP)
				return;
		}
	}
	return NULL;
}

/* Set backlight level of an embedded panel (eDP, LVDS).
+1 −0
Original line number Diff line number Diff line
@@ -216,6 +216,7 @@ static bool dmub_psr_copy_settings(struct dmub_psr *dmub,
		    res_ctx->pipe_ctx[i].stream->link == link &&
		    res_ctx->pipe_ctx[i].stream->link->connector_signal == SIGNAL_TYPE_EDP) {
			pipe_ctx = &res_ctx->pipe_ctx[i];
			//TODO: refactor for multi edp support
			break;
		}
	}
Loading