As part of the effort of stopping using raw edid, this commit move the
copy of the edid in DC to a dedicated function that will allow the usage
of drm_edid in the next steps.

v7:
- linux-specific func should be in dm_helpers not in a new file (Harry)

Signed-off-by: Rodrigo Siqueira <[email protected]>
Co-developer-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Melissa Wen <[email protected]>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 8 ++++++++
 drivers/gpu/drm/amd/display/dc/dm_helpers.h               | 3 +++
 drivers/gpu/drm/amd/display/dc/link/link_detection.c      | 3 +--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index f3cc6ea11c6f..a7ad93c2eb5f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -999,6 +999,14 @@ bool dm_helpers_is_same_edid(struct dc_sink *prev_sink,
                       new_edid->raw_edid, new_edid->length) == 0);
 }
 
+void dm_helpers_copy_edid_to_dc(struct dc_sink *dc_sink,
+                               const void *edid,
+                               int len)
+{
+       memmove(dc_sink->dc_edid.raw_edid, edid, len);
+       dc_sink->dc_edid.length = len;
+}
+
 enum dc_edid_status dm_helpers_read_local_edid(
                struct dc_context *ctx,
                struct dc_link *link,
diff --git a/drivers/gpu/drm/amd/display/dc/dm_helpers.h 
b/drivers/gpu/drm/amd/display/dc/dm_helpers.h
index 2fb445933350..0415cb50fe32 100644
--- a/drivers/gpu/drm/amd/display/dc/dm_helpers.h
+++ b/drivers/gpu/drm/amd/display/dc/dm_helpers.h
@@ -65,6 +65,9 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct dc_link 
*link,
 /* Compare two EDIDs */
 bool dm_helpers_is_same_edid(struct dc_sink *prev_sink,
                             struct dc_sink *current_sink);
+void dm_helpers_copy_edid_to_dc(struct dc_sink *dc_sink,
+                               const void *edid, int len);
+
 
 /*
  * Update DP branch info
diff --git a/drivers/gpu/drm/amd/display/dc/link/link_detection.c 
b/drivers/gpu/drm/amd/display/dc/link/link_detection.c
index 616540acc6ee..2ab1f28d0d19 100644
--- a/drivers/gpu/drm/amd/display/dc/link/link_detection.c
+++ b/drivers/gpu/drm/amd/display/dc/link/link_detection.c
@@ -1554,8 +1554,7 @@ struct dc_sink *link_add_remote_sink(
        if (!dc_sink)
                return NULL;
 
-       memmove(dc_sink->dc_edid.raw_edid, (const uint8_t *) edid, len);
-       dc_sink->dc_edid.length = len;
+       dm_helpers_copy_edid_to_dc(dc_sink, edid, len);
 
        if (!link_add_remote_sink_helper(
                        link,
-- 
2.51.0

Reply via email to