Skip to content

Commit

Permalink
drm/amd/display: Connect dig_fe to otg directly instead of calling bios
Browse files Browse the repository at this point in the history
[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: hersen wu <hersenxs.wu@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
hersen wu authored and Alex Deucher committed Jan 25, 2019
1 parent 0f74e48 commit d2c460e
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 280 deletions.
14 changes: 0 additions & 14 deletions drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,18 +835,6 @@ static enum bp_result bios_parser_enable_crtc(
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(
struct dc_bios *dcb,
enum controller_id controller_id,
Expand Down Expand Up @@ -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 */

.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,

.enable_disp_power_gating = bios_parser_enable_disp_power_gating,
Expand Down
14 changes: 0 additions & 14 deletions drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,18 +1083,6 @@ static enum bp_result bios_parser_enable_crtc(
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(
struct dc_bios *dcb,
enum controller_id controller_id,
Expand Down Expand Up @@ -1915,8 +1903,6 @@ static const struct dc_vbios_funcs vbios_funcs = {

.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,

.bios_parser_destroy = firmware_parser_destroy,
Expand Down
116 changes: 0 additions & 116 deletions drivers/gpu/drm/amd/display/dc/bios/command_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_output_control(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_mem_req(struct bios_parser *bp);
static void init_external_encoder_control(struct bios_parser *bp);
Expand All @@ -73,7 +72,6 @@ void dal_bios_parser_init_cmd_tbl(struct bios_parser *bp)
init_dac_encoder_control(bp);
init_dac_output_control(bp);
init_set_crtc_timing(bp);
init_select_crtc_source(bp);
init_enable_crtc(bp);
init_enable_crtc_mem_req(bp);
init_program_clock(bp);
Expand Down Expand Up @@ -1895,120 +1893,6 @@ static enum bp_result set_crtc_using_dtd_timing_v3(
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;
}

/*******************************************************************************
********************************************************************************
**
Expand Down
3 changes: 0 additions & 3 deletions drivers/gpu/drm/amd/display/dc/bios/command_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ struct cmd_tbl {
enum bp_result (*set_crtc_timing)(
struct bios_parser *bp,
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)(
struct bios_parser *bp,
enum controller_id controller_id,
Expand Down
70 changes: 0 additions & 70 deletions drivers/gpu/drm/amd/display/dc/bios/command_table2.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,75 +460,6 @@ static enum bp_result set_crtc_using_dtd_timing_v3(
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;
}

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

init_set_crtc_timing(bp);

init_select_crtc_source(bp);
init_enable_crtc(bp);

init_external_encoder_control(bp);
Expand Down
3 changes: 0 additions & 3 deletions drivers/gpu/drm/amd/display/dc/bios/command_table2.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ struct cmd_tbl {
enum bp_result (*set_crtc_timing)(
struct bios_parser *bp,
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)(
struct bios_parser *bp,
enum controller_id controller_id,
Expand Down
4 changes: 0 additions & 4 deletions drivers/gpu/drm/amd/display/dc/dc_bios_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ struct dc_vbios_funcs {
enum bp_result (*program_crtc_timing)(
struct dc_bios *bios,
struct bp_hw_crtc_timing_parameters *bp_params);

enum bp_result (*crtc_source_select)(
struct dc_bios *bios,
struct bp_crtc_source_select *bp_params);
enum bp_result (*program_display_engine_pll)(
struct dc_bios *bios,
struct bp_pixel_clock_parameters *bp_params);
Expand Down
10 changes: 9 additions & 1 deletion drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,14 @@ static void setup_stereo_sync(
REG_UPDATE(DIG_FE_CNTL, DIG_STEREOSYNC_GATE_EN, !enable);
}

static void dig_connect_to_otg(
struct stream_encoder *enc,
int tg_inst)
{
struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc);

REG_UPDATE(DIG_FE_CNTL, DIG_SOURCE_SELECT, tg_inst);
}

static const struct stream_encoder_funcs dce110_str_enc_funcs = {
.dp_set_stream_attribute =
Expand Down Expand Up @@ -1618,7 +1626,7 @@ static const struct stream_encoder_funcs dce110_str_enc_funcs = {
.hdmi_audio_disable = dce110_se_hdmi_audio_disable,
.setup_stereo_sync = setup_stereo_sync,
.set_avmute = dce110_stream_encoder_set_avmute,

.dig_connect_to_otg = dig_connect_to_otg,
};

void dce110_stream_encoder_construct(
Expand Down
8 changes: 6 additions & 2 deletions drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@
SE_SF(DP_SEC_CNTL, DP_SEC_ATP_ENABLE, mask_sh),\
SE_SF(DP_SEC_CNTL, DP_SEC_AIP_ENABLE, mask_sh),\
SE_SF(DP_SEC_CNTL, DP_SEC_ACM_ENABLE, mask_sh),\
SE_SF(AFMT_AUDIO_PACKET_CONTROL, AFMT_AUDIO_SAMPLE_SEND, mask_sh)
SE_SF(AFMT_AUDIO_PACKET_CONTROL, AFMT_AUDIO_SAMPLE_SEND, mask_sh),\
SE_SF(DIG_FE_CNTL, DIG_SOURCE_SELECT, mask_sh)

#define SE_COMMON_MASK_SH_LIST_DCE_COMMON(mask_sh)\
SE_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(mask_sh)
Expand Down Expand Up @@ -284,7 +285,8 @@
SE_SF(DIG0_DIG_FE_CNTL, TMDS_PIXEL_ENCODING, mask_sh),\
SE_SF(DIG0_DIG_FE_CNTL, TMDS_COLOR_FORMAT, mask_sh),\
SE_SF(DIG0_DIG_FE_CNTL, DIG_STEREOSYNC_SELECT, mask_sh),\
SE_SF(DIG0_DIG_FE_CNTL, DIG_STEREOSYNC_GATE_EN, mask_sh)
SE_SF(DIG0_DIG_FE_CNTL, DIG_STEREOSYNC_GATE_EN, mask_sh),\
SE_SF(DIG0_DIG_FE_CNTL, DIG_SOURCE_SELECT, mask_sh)

#define SE_COMMON_MASK_SH_LIST_SOC(mask_sh)\
SE_COMMON_MASK_SH_LIST_SOC_BASE(mask_sh)
Expand Down Expand Up @@ -494,6 +496,7 @@ struct dce_stream_encoder_shift {
uint8_t HDMI_DB_DISABLE;
uint8_t DP_VID_N_MUL;
uint8_t DP_VID_M_DOUBLE_VALUE_EN;
uint8_t DIG_SOURCE_SELECT;
};

struct dce_stream_encoder_mask {
Expand Down Expand Up @@ -624,6 +627,7 @@ struct dce_stream_encoder_mask {
uint32_t HDMI_DB_DISABLE;
uint32_t DP_VID_N_MUL;
uint32_t DP_VID_M_DOUBLE_VALUE_EN;
uint32_t DIG_SOURCE_SELECT;
};

struct dce110_stream_enc_registers {
Expand Down
Loading

0 comments on commit d2c460e

Please sign in to comment.