Skip to content

Commit 3be26d8

Browse files
Timur Kristófalexdeucher
authored andcommitted
drm/amd/display: Support DAC in dce110_hwseq
The dce110_hwseq is used by all DCE hardware, so add the DAC support here. When enabling/disabling a stream for a RGB signal, this will call the VBIOS to enable/disable the DAC. Additionally, when applying the controller context, call SelectCRTC_Source from VBIOS in order to direct the CRTC output to the DAC. Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 0fbe321 commit 3be26d8

1 file changed

Lines changed: 73 additions & 2 deletions

File tree

drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,20 @@ void dce110_update_info_frame(struct pipe_ctx *pipe_ctx)
659659
}
660660
}
661661

662+
static void
663+
dce110_dac_encoder_control(struct pipe_ctx *pipe_ctx, bool enable)
664+
{
665+
struct dc_link *link = pipe_ctx->stream->link;
666+
struct dc_bios *bios = link->ctx->dc_bios;
667+
struct bp_encoder_control encoder_control = {0};
668+
669+
encoder_control.action = enable ? ENCODER_CONTROL_ENABLE : ENCODER_CONTROL_DISABLE;
670+
encoder_control.engine_id = link->link_enc->analog_engine;
671+
encoder_control.pixel_clock = pipe_ctx->stream->timing.pix_clk_100hz / 10;
672+
673+
bios->funcs->encoder_control(bios, &encoder_control);
674+
}
675+
662676
void dce110_enable_stream(struct pipe_ctx *pipe_ctx)
663677
{
664678
enum dc_lane_count lane_count =
@@ -689,6 +703,9 @@ void dce110_enable_stream(struct pipe_ctx *pipe_ctx)
689703
early_control = lane_count;
690704

691705
tg->funcs->set_early_control(tg, early_control);
706+
707+
if (dc_is_rgb_signal(pipe_ctx->stream->signal))
708+
dce110_dac_encoder_control(pipe_ctx, true);
692709
}
693710

694711
static enum bp_result link_transmitter_control(
@@ -1176,7 +1193,8 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
11761193
pipe_ctx->stream_res.stream_enc->funcs->stop_dp_info_packets(
11771194
pipe_ctx->stream_res.stream_enc);
11781195

1179-
dc->hwss.disable_audio_stream(pipe_ctx);
1196+
if (!dc_is_rgb_signal(pipe_ctx->stream->signal))
1197+
dc->hwss.disable_audio_stream(pipe_ctx);
11801198

11811199
link_hwss->reset_stream_encoder(pipe_ctx);
11821200

@@ -1196,6 +1214,9 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
11961214
dccg->funcs->disable_symclk_se(dccg, stream_enc->stream_enc_inst,
11971215
link_enc->transmitter - TRANSMITTER_UNIPHY_A);
11981216
}
1217+
1218+
if (dc_is_rgb_signal(pipe_ctx->stream->signal))
1219+
dce110_dac_encoder_control(pipe_ctx, false);
11991220
}
12001221

12011222
void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,
@@ -1581,6 +1602,51 @@ static enum dc_status dce110_enable_stream_timing(
15811602
return DC_OK;
15821603
}
15831604

1605+
static void
1606+
dce110_select_crtc_source(struct pipe_ctx *pipe_ctx)
1607+
{
1608+
struct dc_link *link = pipe_ctx->stream->link;
1609+
struct dc_bios *bios = link->ctx->dc_bios;
1610+
struct bp_crtc_source_select crtc_source_select = {0};
1611+
enum engine_id engine_id = link->link_enc->preferred_engine;
1612+
uint8_t bit_depth;
1613+
1614+
if (dc_is_rgb_signal(pipe_ctx->stream->signal))
1615+
engine_id = link->link_enc->analog_engine;
1616+
1617+
switch (pipe_ctx->stream->timing.display_color_depth) {
1618+
case COLOR_DEPTH_UNDEFINED:
1619+
bit_depth = 0;
1620+
break;
1621+
case COLOR_DEPTH_666:
1622+
bit_depth = 6;
1623+
break;
1624+
default:
1625+
case COLOR_DEPTH_888:
1626+
bit_depth = 8;
1627+
break;
1628+
case COLOR_DEPTH_101010:
1629+
bit_depth = 10;
1630+
break;
1631+
case COLOR_DEPTH_121212:
1632+
bit_depth = 12;
1633+
break;
1634+
case COLOR_DEPTH_141414:
1635+
bit_depth = 14;
1636+
break;
1637+
case COLOR_DEPTH_161616:
1638+
bit_depth = 16;
1639+
break;
1640+
}
1641+
1642+
crtc_source_select.controller_id = CONTROLLER_ID_D0 + pipe_ctx->stream_res.tg->inst;
1643+
crtc_source_select.bit_depth = bit_depth;
1644+
crtc_source_select.engine_id = engine_id;
1645+
crtc_source_select.sink_signal = pipe_ctx->stream->signal;
1646+
1647+
bios->funcs->select_crtc_source(bios, &crtc_source_select);
1648+
}
1649+
15841650
enum dc_status dce110_apply_single_controller_ctx_to_hw(
15851651
struct pipe_ctx *pipe_ctx,
15861652
struct dc_state *context,
@@ -1600,6 +1666,10 @@ enum dc_status dce110_apply_single_controller_ctx_to_hw(
16001666
hws->funcs.disable_stream_gating(dc, pipe_ctx);
16011667
}
16021668

1669+
if (pipe_ctx->stream->signal == SIGNAL_TYPE_RGB) {
1670+
dce110_select_crtc_source(pipe_ctx);
1671+
}
1672+
16031673
if (pipe_ctx->stream_res.audio != NULL) {
16041674
struct audio_output audio_output = {0};
16051675

@@ -1679,7 +1749,8 @@ enum dc_status dce110_apply_single_controller_ctx_to_hw(
16791749
pipe_ctx->stream_res.tg->funcs->set_static_screen_control(
16801750
pipe_ctx->stream_res.tg, event_triggers, 2);
16811751

1682-
if (!dc_is_virtual_signal(pipe_ctx->stream->signal))
1752+
if (!dc_is_virtual_signal(pipe_ctx->stream->signal) &&
1753+
!dc_is_rgb_signal(pipe_ctx->stream->signal))
16831754
pipe_ctx->stream_res.stream_enc->funcs->dig_connect_to_otg(
16841755
pipe_ctx->stream_res.stream_enc,
16851756
pipe_ctx->stream_res.tg->inst);

0 commit comments

Comments
 (0)