Commit 4ab27b01 authored by Ivan Lipski's avatar Ivan Lipski Committed by Alex Deucher
Browse files

drm/amd/display: Remove unused encoder types



[Why&How]
We only support ENCODER_ID_INTERNAL_UNIPHY encoders now, so NUTMEG & TRAVIS
can be removed from translate_encoder_to_transmitter.

Also refactor to use local variables of transmitter to exit early.

V2: Fix construct_phy check for  TRANSMITTER_UKNOWN

Signed-off-by: default avatarIvan Lipski <ivan.lipski@amd.com>
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Tested-by: default avatarDan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 3880d8e3
Loading
Loading
Loading
Loading
+12 −35
Original line number Diff line number Diff line
@@ -354,24 +354,6 @@ static enum transmitter translate_encoder_to_transmitter(
			return TRANSMITTER_UNKNOWN;
		}
	break;
	case ENCODER_ID_EXTERNAL_NUTMEG:
		switch (encoder.enum_id) {
		case ENUM_ID_1:
			return TRANSMITTER_NUTMEG_CRT;
		default:
			return TRANSMITTER_UNKNOWN;
		}
	break;
	case ENCODER_ID_EXTERNAL_TRAVIS:
		switch (encoder.enum_id) {
		case ENUM_ID_1:
			return TRANSMITTER_TRAVIS_CRT;
		case ENUM_ID_2:
			return TRANSMITTER_TRAVIS_LCD;
		default:
			return TRANSMITTER_UNKNOWN;
		}
	break;
	default:
		return TRANSMITTER_UNKNOWN;
	}
@@ -481,14 +463,6 @@ static enum engine_id find_analog_engine(struct dc_link *link)
	return ENGINE_ID_UNKNOWN;
}

static bool transmitter_supported(const enum transmitter transmitter)
{
	return transmitter != TRANSMITTER_UNKNOWN &&
		transmitter != TRANSMITTER_NUTMEG_CRT &&
		transmitter != TRANSMITTER_TRAVIS_CRT &&
		transmitter != TRANSMITTER_TRAVIS_LCD;
}

static bool analog_engine_supported(const enum engine_id engine_id)
{
	return engine_id == ENGINE_ID_DACA ||
@@ -506,6 +480,8 @@ static bool construct_phy(struct dc_link *link,
	struct dc_bios *bios = init_params->dc->ctx->dc_bios;
	const struct dc_vbios_funcs *bp_funcs = bios->funcs;
	struct bp_disp_connector_caps_info disp_connect_caps_info = { 0 };
	struct graphics_object_id link_encoder = { 0 };
	enum transmitter transmitter_from_encoder;

	DC_LOGGER_INIT(dc_ctx->logger);

@@ -526,21 +502,21 @@ static bool construct_phy(struct dc_link *link,
	link->link_id =
		bios->funcs->get_connector_id(bios, init_params->connector_index);

	link->ep_type = DISPLAY_ENDPOINT_PHY;

	DC_LOG_DC("BIOS object table - link_id: %d", link->link_id.id);

	/* Determine early if the link has any supported encoders,
	 * so that we avoid initializing DDC and HPD, etc.
	 */
	bp_funcs->get_src_obj(bios, link->link_id, 0, &enc_init_data.encoder);
	enc_init_data.transmitter = translate_encoder_to_transmitter(enc_init_data.encoder);
	bp_funcs->get_src_obj(bios, link->link_id, 0, &link_encoder);
	transmitter_from_encoder = translate_encoder_to_transmitter(link_encoder);
	enc_init_data.analog_engine = find_analog_engine(link);

	link->ep_type = DISPLAY_ENDPOINT_PHY;

	DC_LOG_DC("BIOS object table - link_id: %d", link->link_id.id);

	if (!transmitter_supported(enc_init_data.transmitter) &&
	if (transmitter_from_encoder == TRANSMITTER_UNKNOWN &&
	    !analog_engine_supported(enc_init_data.analog_engine)) {
		DC_LOG_WARNING("link_id %d has unsupported encoder\n", link->link_id.id);
		goto unsupported_fail;
		goto create_fail;
	}

	if (bios->funcs->get_disp_connector_caps_info) {
@@ -674,6 +650,8 @@ static bool construct_phy(struct dc_link *link,
	enc_init_data.connector = link->link_id;
	enc_init_data.channel = get_ddc_line(link);
	enc_init_data.hpd_source = get_hpd_line(link);
	enc_init_data.transmitter = transmitter_from_encoder;
	enc_init_data.encoder = link_encoder;

	link->hpd_src = enc_init_data.hpd_source;

@@ -810,7 +788,6 @@ static bool construct_phy(struct dc_link *link,
		link->hpd_gpio = NULL;
	}

unsupported_fail:
	DC_LOG_DC("BIOS object table - %s failed.\n", __func__);
	return false;
}