From: Jingwen Zhu <jingwen....@amd.com>

[Why]
We don't include this eDP FEC init on fastboot.

[How]
Set the fec to init value when stopping driver &get the fec register value to 
check should enable FEC.

Co-authored-by: Jingwen Zhu <jingwen....@amd.com>
Reviewed-by: Wenjing Liu <wenjing....@amd.com>
Acked-by: Alex Hung <alex.h...@amd.com>
Signed-off-by: Jingwen Zhu <jingwen....@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 26 +++++++++----------
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c |  6 ++++-
 .../drm/amd/display/dc/dcn31/dcn31_hwseq.c    |  6 ++++-
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index bbaa5abdf888..c7c4d9867c52 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -4683,22 +4683,20 @@ bool dc_link_is_fec_supported(const struct dc_link 
*link)
 
 bool dc_link_should_enable_fec(const struct dc_link *link)
 {
-       bool is_fec_disable = false;
-       bool ret = false;
+       bool force_disable = false;
 
-       if ((link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT_MST &&
+       if (link->fec_state == dc_link_fec_enabled)
+               force_disable = false;
+       else if (link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT_MST &&
                        link->local_sink &&
-                       link->local_sink->edid_caps.panel_patch.disable_fec) ||
-                       (link->connector_signal == SIGNAL_TYPE_EDP
-                               // enable FEC for EDP if DSC is supported
-                               && 
link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_SUPPORT == false
-                               ))
-               is_fec_disable = true;
-
-       if (dc_link_is_fec_supported(link) && !link->dc->debug.disable_fec && 
!is_fec_disable)
-               ret = true;
-
-       return ret;
+                       link->local_sink->edid_caps.panel_patch.disable_fec)
+               force_disable = true;
+       else if (link->connector_signal == SIGNAL_TYPE_EDP
+                       && link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.
+                        dsc_support.DSC_SUPPORT == false)
+               force_disable = true;
+
+       return !force_disable && dc_link_is_fec_supported(link);
 }
 
 uint32_t dc_bandwidth_in_kbps_from_timing(
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index ad757b59e00e..911c5d103c64 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -1493,8 +1493,12 @@ void dcn10_init_hw(struct dc *dc)
 
                /* Check for enabled DIG to identify enabled display */
                if (link->link_enc->funcs->is_dig_enabled &&
-                       link->link_enc->funcs->is_dig_enabled(link->link_enc))
+                       link->link_enc->funcs->is_dig_enabled(link->link_enc)) {
                        link->link_status.link_active = true;
+                       if (link->link_enc->funcs->fec_is_active &&
+                                       
link->link_enc->funcs->fec_is_active(link->link_enc))
+                               link->fec_state = dc_link_fec_enabled;
+               }
        }
 
        /* Power gate DSCs */
diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c 
b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c
index 4be228680909..b57f657c4e44 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c
@@ -188,8 +188,12 @@ void dcn31_init_hw(struct dc *dc)
 
                /* Check for enabled DIG to identify enabled display */
                if (link->link_enc->funcs->is_dig_enabled &&
-                       link->link_enc->funcs->is_dig_enabled(link->link_enc))
+                       link->link_enc->funcs->is_dig_enabled(link->link_enc)) {
                        link->link_status.link_active = true;
+                       if (link->link_enc->funcs->fec_is_active &&
+                                       
link->link_enc->funcs->fec_is_active(link->link_enc))
+                               link->fec_state = dc_link_fec_enabled;
+               }
        }
 
        /* Enables outbox notifications for usb4 dpia */
-- 
2.35.1

Reply via email to