drm/amd/display: Implement FIFO enable sequence on DCN32
authorDillon Varone <Dillon.Varone@amd.com>
Mon, 12 Dec 2022 18:23:00 +0000 (13:23 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 13 Jan 2023 19:57:23 +0000 (14:57 -0500)
[WHY?]
FIFO enable sequence is incomplete as it is currently implemented in FW,
and requires reset to prevent the FIFO to be enabled in an invalid
state. This cannot be done until DIG FE is connected to the BE.

[HOW?]
Add FIFO enable sequence in driver for dcn32 with reset after DIG FE is
connected to BE.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_stream_encoder.c

index d19fc93dbc75dfda2a528748e00dd7d2a38d3e62..7d09c62a405aea332eb6b12ab38344ce48615e1b 100644 (file)
@@ -421,6 +421,33 @@ static void enc32_set_dig_input_mode(struct stream_encoder *enc, unsigned int pi
        REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_OUTPUT_PIXEL_MODE, pix_per_container == 2 ? 0x1 : 0x0);
 }
 
+static void enc32_reset_fifo(struct stream_encoder *enc, bool reset)
+{
+       struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc);
+       uint32_t reset_val = reset ? 1 : 0;
+       uint32_t is_symclk_on;
+
+       REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_RESET, reset_val);
+       REG_GET(DIG_FE_CNTL, DIG_SYMCLK_FE_ON, &is_symclk_on);
+
+       if (is_symclk_on)
+               REG_WAIT(DIG_FIFO_CTRL0, DIG_FIFO_RESET_DONE, reset_val, 10, 5000);
+       else
+               udelay(10);
+}
+
+static void enc32_enable_fifo(struct stream_encoder *enc)
+{
+       struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc);
+
+       REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_READ_START_LEVEL, 0x7);
+
+       enc32_reset_fifo(enc, true);
+       enc32_reset_fifo(enc, false);
+
+       REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_ENABLE, 1);
+}
+
 static const struct stream_encoder_funcs dcn32_str_enc_funcs = {
        .dp_set_odm_combine =
                enc32_dp_set_odm_combine,
@@ -466,6 +493,7 @@ static const struct stream_encoder_funcs dcn32_str_enc_funcs = {
        .hdmi_reset_stream_attribute = enc1_reset_hdmi_stream_attribute,
 
        .set_input_mode = enc32_set_dig_input_mode,
+       .enable_fifo = enc32_enable_fifo,
 };
 
 void dcn32_dio_stream_encoder_construct(