Commit 68178644 authored by Alex Deucher's avatar Alex Deucher
Browse files

drm/amd/display: add a no_hpd link_encoder_funcs variant



For link encoders without HPD (analog or LVDS), add a
link_encoder_funcs structure with no hpd enable callbacks.

The enable and disable hpd callbacks are currently not used
outside of a special case in debugfs which checks if the hpd
is valid before using it, but this will protect us if they
ever are.

Reviewed-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a3057aa9
Loading
Loading
Loading
Loading
+62 −2
Original line number Diff line number Diff line
@@ -122,6 +122,33 @@ static const struct link_encoder_funcs dce110_lnk_enc_funcs = {
	.program_hpd_filter = dce110_program_hpd_filter,
};

static const struct link_encoder_funcs dce110_lnk_enc_funcs_no_hpd = {
	.validate_output_with_stream =
		dce110_link_encoder_validate_output_with_stream,
	.hw_init = dce110_link_encoder_hw_init,
	.setup = dce110_link_encoder_setup,
	.enable_tmds_output = dce110_link_encoder_enable_tmds_output,
	.enable_dp_output = dce110_link_encoder_enable_dp_output,
	.enable_dp_mst_output = dce110_link_encoder_enable_dp_mst_output,
	.enable_lvds_output = dce110_link_encoder_enable_lvds_output,
	.enable_analog_output = dce110_link_encoder_enable_analog_output,
	.disable_output = dce110_link_encoder_disable_output,
	.dp_set_lane_settings = dce110_link_encoder_dp_set_lane_settings,
	.dp_set_phy_pattern = dce110_link_encoder_dp_set_phy_pattern,
	.update_mst_stream_allocation_table =
		dce110_link_encoder_update_mst_stream_allocation_table,
	.psr_program_dp_dphy_fast_training =
			dce110_psr_program_dp_dphy_fast_training,
	.psr_program_secondary_packet = dce110_psr_program_secondary_packet,
	.connect_dig_be_to_fe = dce110_link_encoder_connect_dig_be_to_fe,
	.is_dig_enabled = dce110_is_dig_enabled,
	.destroy = dce110_link_encoder_destroy,
	.get_max_link_cap = dce110_link_encoder_get_max_link_cap,
	.get_dig_frontend = dce110_get_dig_frontend,
	.get_hpd_state = dce110_get_hpd_state,
	.program_hpd_filter = dce110_program_hpd_filter,
};

static enum bp_result link_transmitter_control(
	struct dce110_link_encoder *enc110,
	struct bp_transmitter_control *cntl)
@@ -865,7 +892,10 @@ void dce110_link_encoder_construct(
	const struct dc_vbios_funcs *bp_funcs = init_data->ctx->dc_bios->funcs;
	enum bp_result result = BP_RESULT_OK;

	if (hpd_regs)
		enc110->base.funcs = &dce110_lnk_enc_funcs;
	else
		enc110->base.funcs = &dce110_lnk_enc_funcs_no_hpd;
	enc110->base.ctx = init_data->ctx;
	enc110->base.id = init_data->encoder;
	enc110->base.analog_id = init_data->analog_encoder;
@@ -1855,6 +1885,33 @@ static const struct link_encoder_funcs dce60_lnk_enc_funcs = {
	.program_hpd_filter = dce110_program_hpd_filter,
};

static const struct link_encoder_funcs dce60_lnk_enc_funcs_no_hpd = {
	.validate_output_with_stream =
		dce110_link_encoder_validate_output_with_stream,
	.hw_init = dce110_link_encoder_hw_init,
	.setup = dce110_link_encoder_setup,
	.enable_tmds_output = dce110_link_encoder_enable_tmds_output,
	.enable_dp_output = dce60_link_encoder_enable_dp_output,
	.enable_dp_mst_output = dce60_link_encoder_enable_dp_mst_output,
	.enable_lvds_output = dce110_link_encoder_enable_lvds_output,
	.enable_analog_output = dce110_link_encoder_enable_analog_output,
	.disable_output = dce110_link_encoder_disable_output,
	.dp_set_lane_settings = dce110_link_encoder_dp_set_lane_settings,
	.dp_set_phy_pattern = dce60_link_encoder_dp_set_phy_pattern,
	.update_mst_stream_allocation_table =
		dce110_link_encoder_update_mst_stream_allocation_table,
	.psr_program_dp_dphy_fast_training =
			dce110_psr_program_dp_dphy_fast_training,
	.psr_program_secondary_packet = dce110_psr_program_secondary_packet,
	.connect_dig_be_to_fe = dce110_link_encoder_connect_dig_be_to_fe,
	.is_dig_enabled = dce110_is_dig_enabled,
	.destroy = dce110_link_encoder_destroy,
	.get_max_link_cap = dce110_link_encoder_get_max_link_cap,
	.get_dig_frontend = dce110_get_dig_frontend,
	.get_hpd_state = dce110_get_hpd_state,
	.program_hpd_filter = dce110_program_hpd_filter,
};

void dce60_link_encoder_construct(
	struct dce110_link_encoder *enc110,
	const struct encoder_init_data *init_data,
@@ -1867,7 +1924,10 @@ void dce60_link_encoder_construct(
	const struct dc_vbios_funcs *bp_funcs = init_data->ctx->dc_bios->funcs;
	enum bp_result result = BP_RESULT_OK;

	if (hpd_regs)
		enc110->base.funcs = &dce60_lnk_enc_funcs;
	else
		enc110->base.funcs = &dce60_lnk_enc_funcs_no_hpd;
	enc110->base.ctx = init_data->ctx;
	enc110->base.id = init_data->encoder;
	enc110->base.analog_id = init_data->analog_encoder;