Commit d2c460e7 authored by hersen wu's avatar hersen wu Committed by Alex Deucher
Browse files

drm/amd/display: Connect dig_fe to otg directly instead of calling bios



[Why] After call bios table crtc_source_select, dal will program fmt
again. The bios table program dig_source_select and other fmt register
for bios usage which is redundancy and uncessary.

[How] Program dig_soruce_select register directly

Signed-off-by: default avatarhersen wu <hersenxs.wu@amd.com>
Reviewed-by: default avatarCharlene Liu <Charlene.Liu@amd.com>
Acked-by: default avatarLeo Li <sunpeng.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0f74e484
Loading
Loading
Loading
Loading
+0 −14
Original line number Original line Diff line number Diff line
@@ -835,18 +835,6 @@ static enum bp_result bios_parser_enable_crtc(
	return bp->cmd_tbl.enable_crtc(bp, id, enable);
	return bp->cmd_tbl.enable_crtc(bp, id, enable);
}
}


static enum bp_result bios_parser_crtc_source_select(
	struct dc_bios *dcb,
	struct bp_crtc_source_select *bp_params)
{
	struct bios_parser *bp = BP_FROM_DCB(dcb);

	if (!bp->cmd_tbl.select_crtc_source)
		return BP_RESULT_FAILURE;

	return bp->cmd_tbl.select_crtc_source(bp, bp_params);
}

static enum bp_result bios_parser_enable_disp_power_gating(
static enum bp_result bios_parser_enable_disp_power_gating(
	struct dc_bios *dcb,
	struct dc_bios *dcb,
	enum controller_id controller_id,
	enum controller_id controller_id,
@@ -2842,8 +2830,6 @@ static const struct dc_vbios_funcs vbios_funcs = {


	.program_crtc_timing = bios_parser_program_crtc_timing, /* still use.  should probably retire and program directly */
	.program_crtc_timing = bios_parser_program_crtc_timing, /* still use.  should probably retire and program directly */


	.crtc_source_select = bios_parser_crtc_source_select,  /* still use.  should probably retire and program directly */

	.program_display_engine_pll = bios_parser_program_display_engine_pll,
	.program_display_engine_pll = bios_parser_program_display_engine_pll,


	.enable_disp_power_gating = bios_parser_enable_disp_power_gating,
	.enable_disp_power_gating = bios_parser_enable_disp_power_gating,
+0 −14
Original line number Original line Diff line number Diff line
@@ -1083,18 +1083,6 @@ static enum bp_result bios_parser_enable_crtc(
	return bp->cmd_tbl.enable_crtc(bp, id, enable);
	return bp->cmd_tbl.enable_crtc(bp, id, enable);
}
}


static enum bp_result bios_parser_crtc_source_select(
	struct dc_bios *dcb,
	struct bp_crtc_source_select *bp_params)
{
	struct bios_parser *bp = BP_FROM_DCB(dcb);

	if (!bp->cmd_tbl.select_crtc_source)
		return BP_RESULT_FAILURE;

	return bp->cmd_tbl.select_crtc_source(bp, bp_params);
}

static enum bp_result bios_parser_enable_disp_power_gating(
static enum bp_result bios_parser_enable_disp_power_gating(
	struct dc_bios *dcb,
	struct dc_bios *dcb,
	enum controller_id controller_id,
	enum controller_id controller_id,
@@ -1915,8 +1903,6 @@ static const struct dc_vbios_funcs vbios_funcs = {


	.program_crtc_timing = bios_parser_program_crtc_timing,
	.program_crtc_timing = bios_parser_program_crtc_timing,


	.crtc_source_select = bios_parser_crtc_source_select,

	.enable_disp_power_gating = bios_parser_enable_disp_power_gating,
	.enable_disp_power_gating = bios_parser_enable_disp_power_gating,


	.bios_parser_destroy = firmware_parser_destroy,
	.bios_parser_destroy = firmware_parser_destroy,
+0 −116
Original line number Original line Diff line number Diff line
@@ -55,7 +55,6 @@ static void init_adjust_display_pll(struct bios_parser *bp);
static void init_dac_encoder_control(struct bios_parser *bp);
static void init_dac_encoder_control(struct bios_parser *bp);
static void init_dac_output_control(struct bios_parser *bp);
static void init_dac_output_control(struct bios_parser *bp);
static void init_set_crtc_timing(struct bios_parser *bp);
static void init_set_crtc_timing(struct bios_parser *bp);
static void init_select_crtc_source(struct bios_parser *bp);
static void init_enable_crtc(struct bios_parser *bp);
static void init_enable_crtc(struct bios_parser *bp);
static void init_enable_crtc_mem_req(struct bios_parser *bp);
static void init_enable_crtc_mem_req(struct bios_parser *bp);
static void init_external_encoder_control(struct bios_parser *bp);
static void init_external_encoder_control(struct bios_parser *bp);
@@ -73,7 +72,6 @@ void dal_bios_parser_init_cmd_tbl(struct bios_parser *bp)
	init_dac_encoder_control(bp);
	init_dac_encoder_control(bp);
	init_dac_output_control(bp);
	init_dac_output_control(bp);
	init_set_crtc_timing(bp);
	init_set_crtc_timing(bp);
	init_select_crtc_source(bp);
	init_enable_crtc(bp);
	init_enable_crtc(bp);
	init_enable_crtc_mem_req(bp);
	init_enable_crtc_mem_req(bp);
	init_program_clock(bp);
	init_program_clock(bp);
@@ -1895,120 +1893,6 @@ static enum bp_result set_crtc_using_dtd_timing_v3(
	return result;
	return result;
}
}


/*******************************************************************************
 ********************************************************************************
 **
 **                  SELECT CRTC SOURCE
 **
 ********************************************************************************
 *******************************************************************************/

static enum bp_result select_crtc_source_v2(
	struct bios_parser *bp,
	struct bp_crtc_source_select *bp_params);
static enum bp_result select_crtc_source_v3(
	struct bios_parser *bp,
	struct bp_crtc_source_select *bp_params);

static void init_select_crtc_source(struct bios_parser *bp)
{
	switch (BIOS_CMD_TABLE_PARA_REVISION(SelectCRTC_Source)) {
	case 2:
		bp->cmd_tbl.select_crtc_source = select_crtc_source_v2;
		break;
	case 3:
		bp->cmd_tbl.select_crtc_source = select_crtc_source_v3;
		break;
	default:
		dm_output_to_console("Don't select_crtc_source enable_crtc for v%d\n",
			 BIOS_CMD_TABLE_PARA_REVISION(SelectCRTC_Source));
		bp->cmd_tbl.select_crtc_source = NULL;
		break;
	}
}

static enum bp_result select_crtc_source_v2(
	struct bios_parser *bp,
	struct bp_crtc_source_select *bp_params)
{
	enum bp_result result = BP_RESULT_FAILURE;
	SELECT_CRTC_SOURCE_PARAMETERS_V2 params;
	uint8_t atom_controller_id;
	uint32_t atom_engine_id;
	enum signal_type s = bp_params->signal;

	memset(&params, 0, sizeof(params));

	/* set controller id */
	if (bp->cmd_helper->controller_id_to_atom(
			bp_params->controller_id, &atom_controller_id))
		params.ucCRTC = atom_controller_id;
	else
		return BP_RESULT_FAILURE;

	/* set encoder id */
	if (bp->cmd_helper->engine_bp_to_atom(
			bp_params->engine_id, &atom_engine_id))
		params.ucEncoderID = (uint8_t)atom_engine_id;
	else
		return BP_RESULT_FAILURE;

	if (SIGNAL_TYPE_EDP == s ||
			(SIGNAL_TYPE_DISPLAY_PORT == s &&
					SIGNAL_TYPE_LVDS == bp_params->sink_signal))
		s = SIGNAL_TYPE_LVDS;

	params.ucEncodeMode =
			(uint8_t)bp->cmd_helper->encoder_mode_bp_to_atom(
					s, bp_params->enable_dp_audio);

	if (EXEC_BIOS_CMD_TABLE(SelectCRTC_Source, params))
		result = BP_RESULT_OK;

	return result;
}

static enum bp_result select_crtc_source_v3(
	struct bios_parser *bp,
	struct bp_crtc_source_select *bp_params)
{
	bool result = BP_RESULT_FAILURE;
	SELECT_CRTC_SOURCE_PARAMETERS_V3 params;
	uint8_t atom_controller_id;
	uint32_t atom_engine_id;
	enum signal_type s = bp_params->signal;

	memset(&params, 0, sizeof(params));

	if (bp->cmd_helper->controller_id_to_atom(bp_params->controller_id,
			&atom_controller_id))
		params.ucCRTC = atom_controller_id;
	else
		return result;

	if (bp->cmd_helper->engine_bp_to_atom(bp_params->engine_id,
			&atom_engine_id))
		params.ucEncoderID = (uint8_t)atom_engine_id;
	else
		return result;

	if (SIGNAL_TYPE_EDP == s ||
			(SIGNAL_TYPE_DISPLAY_PORT == s &&
					SIGNAL_TYPE_LVDS == bp_params->sink_signal))
		s = SIGNAL_TYPE_LVDS;

	params.ucEncodeMode =
			bp->cmd_helper->encoder_mode_bp_to_atom(
					s, bp_params->enable_dp_audio);
	/* Needed for VBIOS Random Spatial Dithering feature */
	params.ucDstBpc = (uint8_t)(bp_params->display_output_bit_depth);

	if (EXEC_BIOS_CMD_TABLE(SelectCRTC_Source, params))
		result = BP_RESULT_OK;

	return result;
}

/*******************************************************************************
/*******************************************************************************
 ********************************************************************************
 ********************************************************************************
 **
 **
+0 −3
Original line number Original line Diff line number Diff line
@@ -71,9 +71,6 @@ struct cmd_tbl {
	enum bp_result (*set_crtc_timing)(
	enum bp_result (*set_crtc_timing)(
		struct bios_parser *bp,
		struct bios_parser *bp,
		struct bp_hw_crtc_timing_parameters *bp_params);
		struct bp_hw_crtc_timing_parameters *bp_params);
	enum bp_result (*select_crtc_source)(
		struct bios_parser *bp,
		struct bp_crtc_source_select *bp_params);
	enum bp_result (*enable_crtc)(
	enum bp_result (*enable_crtc)(
		struct bios_parser *bp,
		struct bios_parser *bp,
		enum controller_id controller_id,
		enum controller_id controller_id,
+0 −70
Original line number Original line Diff line number Diff line
@@ -460,75 +460,6 @@ static enum bp_result set_crtc_using_dtd_timing_v3(
	return result;
	return result;
}
}


/******************************************************************************
 ******************************************************************************
 **
 **                  SELECT CRTC SOURCE
 **
 ******************************************************************************
 *****************************************************************************/


static enum bp_result select_crtc_source_v3(
	struct bios_parser *bp,
	struct bp_crtc_source_select *bp_params);

static void init_select_crtc_source(struct bios_parser *bp)
{
	switch (BIOS_CMD_TABLE_PARA_REVISION(selectcrtc_source)) {
	case 3:
		bp->cmd_tbl.select_crtc_source = select_crtc_source_v3;
		break;
	default:
		dm_output_to_console("Don't select_crtc_source enable_crtc for v%d\n",
			 BIOS_CMD_TABLE_PARA_REVISION(selectcrtc_source));
		bp->cmd_tbl.select_crtc_source = NULL;
		break;
	}
}


static enum bp_result select_crtc_source_v3(
	struct bios_parser *bp,
	struct bp_crtc_source_select *bp_params)
{
	bool result = BP_RESULT_FAILURE;
	struct select_crtc_source_parameters_v2_3 params;
	uint8_t atom_controller_id;
	uint32_t atom_engine_id;
	enum signal_type s = bp_params->signal;

	memset(&params, 0, sizeof(params));

	if (bp->cmd_helper->controller_id_to_atom(bp_params->controller_id,
			&atom_controller_id))
		params.crtc_id = atom_controller_id;
	else
		return result;

	if (bp->cmd_helper->engine_bp_to_atom(bp_params->engine_id,
			&atom_engine_id))
		params.encoder_id = (uint8_t)atom_engine_id;
	else
		return result;

	if (s == SIGNAL_TYPE_EDP ||
		(s == SIGNAL_TYPE_DISPLAY_PORT && bp_params->sink_signal ==
							SIGNAL_TYPE_LVDS))
		s = SIGNAL_TYPE_LVDS;

	params.encode_mode =
			bp->cmd_helper->encoder_mode_bp_to_atom(
					s, bp_params->enable_dp_audio);
	/* Needed for VBIOS Random Spatial Dithering feature */
	params.dst_bpc = (uint8_t)(bp_params->display_output_bit_depth);

	if (EXEC_BIOS_CMD_TABLE(selectcrtc_source, params))
		result = BP_RESULT_OK;

	return result;
}

/******************************************************************************
/******************************************************************************
 ******************************************************************************
 ******************************************************************************
 **
 **
@@ -808,7 +739,6 @@ void dal_firmware_parser_init_cmd_tbl(struct bios_parser *bp)


	init_set_crtc_timing(bp);
	init_set_crtc_timing(bp);


	init_select_crtc_source(bp);
	init_enable_crtc(bp);
	init_enable_crtc(bp);


	init_external_encoder_control(bp);
	init_external_encoder_control(bp);
Loading