]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/display: Fix reg timeout in enc314_enable_fifo
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Thu, 27 Oct 2022 19:34:33 +0000 (15:34 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 9 Nov 2022 23:01:59 +0000 (18:01 -0500)
[Why]
The link enablement sequence can end up resetting the encoder while
the PHY symclk isn't yet on.

This means that waiting for symclk on will timeout, along with the reset
bit never asserting high.

This causes unnecessary delay when enabling the link and produces a
warning affecting multiple IGT tests.

[How]
Don't wait for the symclk to be on here because firmware already does.

Don't wait for reset if we know the symclk isn't on.

Split the reset into a helper function that checks the bit and decides
whether or not a delay is sufficient.

Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Alan Liu <HaoPing.Liu@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org # 6.0.x
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dio_stream_encoder.c

index 7e773bf7b895f05b7d5c715ddc6d2cf7aefa0b8f..38842f938bed0bc9a36bfe0254adcf5b1fa60400 100644 (file)
 #define CTX \
        enc1->base.ctx
 
+static void enc314_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 enc314_enable_fifo(struct stream_encoder *enc)
 {
        struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc);
 
-       /* TODO: Confirm if we need to wait for DIG_SYMCLK_FE_ON */
-       REG_WAIT(DIG_FE_CNTL, DIG_SYMCLK_FE_ON, 1, 10, 5000);
        REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_READ_START_LEVEL, 0x7);
-       REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_RESET, 1);
-       REG_WAIT(DIG_FIFO_CTRL0, DIG_FIFO_RESET_DONE, 1, 10, 5000);
-       REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_RESET, 0);
-       REG_WAIT(DIG_FIFO_CTRL0, DIG_FIFO_RESET_DONE, 0, 10, 5000);
+
+       enc314_reset_fifo(enc, true);
+       enc314_reset_fifo(enc, false);
+
        REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_ENABLE, 1);
 }