]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: move dc_link functions in link root folder to dc_link_exports
authorWenjing Liu <wenjing.liu@amd.com>
Tue, 14 Feb 2023 17:16:55 +0000 (12:16 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 7 Mar 2023 19:22:40 +0000 (14:22 -0500)
[why]
link component should only have one interface serving dc.

[how]
We are moving dc_link functions exposed to DM to dc_link_exports
and unify link component interface in link.h with function pointer
to match the style of other dc component. This is the second step to move
dc_link functions under link root folder to dc_link_exports.

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c
drivers/gpu/drm/amd/display/dc/inc/link.h
drivers/gpu/drm/amd/display/dc/link/link_detection.c
drivers/gpu/drm/amd/display/dc/link/link_detection.h
drivers/gpu/drm/amd/display/dc/link/link_dpms.c
drivers/gpu/drm/amd/display/dc/link/link_factory.c

index 79e763b8209d6f30d0444c8b8990452667eca697..b1fedef193a0c812d4230f8c12a0ced67e30856a 100644 (file)
@@ -264,3 +264,18 @@ unsigned int dc_dp_trace_get_link_loss_count(struct dc_link *link)
 {
        return link->dc->link_srv->dp_trace_get_link_loss_count(link);
 }
+
+struct dc_sink *dc_link_add_remote_sink(
+               struct dc_link *link,
+               const uint8_t *edid,
+               int len,
+               struct dc_sink_init_data *init_data)
+{
+       return link->dc->link_srv->add_remote_sink(link, edid, len, init_data);
+}
+
+void dc_link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink)
+{
+       link->dc->link_srv->remove_remote_sink(link, sink);
+}
+
index cfe6fc48b6e9ed05793c23a500a5007db1a0b466..9c05333f62aa80734685be6406694c6316b3ee71 100644 (file)
@@ -49,6 +49,12 @@ struct link_init_data {
 };
 
 struct link_service {
+       struct dc_sink *(*add_remote_sink)(
+                       struct dc_link *link,
+                       const uint8_t *edid,
+                       int len,
+                       struct dc_sink_init_data *init_data);
+       void (*remove_remote_sink)(struct dc_link *link, struct dc_sink *sink);
        void (*dp_handle_automated_test)(struct dc_link *link);
        bool (*dp_set_test_pattern)(
                        struct dc_link *link,
index 99279e1e7330eb71ad0a39477cfa1ae39a9089cd..2a248ee0d70e4b058b5588bdf7a329d2b5f83ceb 100644 (file)
@@ -1327,7 +1327,7 @@ static bool link_add_remote_sink_helper(struct dc_link *dc_link, struct dc_sink
        return true;
 }
 
-struct dc_sink *dc_link_add_remote_sink(
+struct dc_sink *link_add_remote_sink(
                struct dc_link *link,
                const uint8_t *edid,
                int len,
@@ -1385,7 +1385,7 @@ fail_add_sink:
        return NULL;
 }
 
-void dc_link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink)
+void link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink)
 {
        int i;
 
index 1831636516fb9e09dfc7eee023c77754e9d7d45b..4b1731c4fd3dd159f99847ab3b4ee3e9c5daf275 100644 (file)
 #ifndef __DC_LINK_DETECTION_H__
 #define __DC_LINK_DETECTION_H__
 #include "link.h"
+struct dc_sink *link_add_remote_sink(
+               struct dc_link *link,
+               const uint8_t *edid,
+               int len,
+               struct dc_sink_init_data *init_data);
+void link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink);
 
 #endif /* __DC_LINK_DETECTION_H__ */
index 0039928186ffc89577cc3cd81adee25211618c31..650ac2a608ef04366f03528846eb540e69f5ee30 100644 (file)
@@ -1000,7 +1000,7 @@ static void enable_stream_features(struct pipe_ctx *pipe_ctx)
        }
 }
 
-static void dc_log_vcp_x_y(const struct dc_link *link, struct fixed31_32 avg_time_slots_per_mtp)
+static void log_vcp_x_y(const struct dc_link *link, struct fixed31_32 avg_time_slots_per_mtp)
 {
        const uint32_t VCP_Y_PRECISION = 1000;
        uint64_t vcp_x, vcp_y;
@@ -1516,7 +1516,7 @@ static enum dc_status allocate_mst_payload(struct pipe_ctx *pipe_ctx)
        pbn = get_pbn_from_timing(pipe_ctx);
        avg_time_slots_per_mtp = dc_fixpt_div(pbn, pbn_per_slot);
 
-       dc_log_vcp_x_y(link, avg_time_slots_per_mtp);
+       log_vcp_x_y(link, avg_time_slots_per_mtp);
 
        if (link_hwss->ext.set_throttled_vcp_size)
                link_hwss->ext.set_throttled_vcp_size(pipe_ctx, avg_time_slots_per_mtp);
@@ -1669,7 +1669,7 @@ static enum dc_status update_sst_payload(struct pipe_ctx *pipe_ctx,
        if (!allocate) {
                avg_time_slots_per_mtp = dc_fixpt_from_int(0);
 
-               dc_log_vcp_x_y(link, avg_time_slots_per_mtp);
+               log_vcp_x_y(link, avg_time_slots_per_mtp);
 
                if (link_hwss->ext.set_throttled_vcp_size)
                        link_hwss->ext.set_throttled_vcp_size(pipe_ctx,
@@ -1720,7 +1720,7 @@ static enum dc_status update_sst_payload(struct pipe_ctx *pipe_ctx,
                        DP_128b_132b_ENCODING) {
                avg_time_slots_per_mtp = link_calculate_sst_avg_time_slots_per_mtp(stream, link);
 
-               dc_log_vcp_x_y(link, avg_time_slots_per_mtp);
+               log_vcp_x_y(link, avg_time_slots_per_mtp);
 
                if (link_hwss->ext.set_throttled_vcp_size)
                        link_hwss->ext.set_throttled_vcp_size(pipe_ctx,
index 88fbd04e92f26f2c8563195a3b4326562ca08355..e37f271a6c72678954a4a626b66e2f0dcc14f5e5 100644 (file)
@@ -27,6 +27,7 @@
  * This file owns the creation/destruction of link structure.
  */
 #include "link_factory.h"
+#include "link_detection.h"
 #include "accessories/link_dp_cts.h"
 #include "accessories/link_dp_trace.h"
 #include "accessories/link_fpga.h"
@@ -43,6 +44,8 @@
                __VA_ARGS__)
 
 static struct link_service link_srv = {
+       .add_remote_sink = link_add_remote_sink,
+       .remove_remote_sink = link_remove_remote_sink,
        .dp_handle_automated_test = dp_handle_automated_test,
        .dp_set_test_pattern = dp_set_test_pattern,
        .dp_set_preferred_link_settings = dp_set_preferred_link_settings,
@@ -197,7 +200,7 @@ static enum channel_id get_ddc_line(struct dc_link *link)
        return channel;
 }
 
-static bool dc_link_construct_phy(struct dc_link *link,
+static bool construct_phy(struct dc_link *link,
                              const struct link_init_data *init_params)
 {
        uint8_t i;
@@ -489,7 +492,7 @@ create_fail:
        return false;
 }
 
-static bool dc_link_construct_dpia(struct dc_link *link,
+static bool construct_dpia(struct dc_link *link,
                              const struct link_init_data *init_params)
 {
        struct ddc_service_init_data ddc_service_init_data = { 0 };
@@ -559,9 +562,9 @@ static bool link_construct(struct dc_link *link,
 {
        /* Handle dpia case */
        if (init_params->is_dpia_link == true)
-               return dc_link_construct_dpia(link, init_params);
+               return construct_dpia(link, init_params);
        else
-               return dc_link_construct_phy(link, init_params);
+               return construct_phy(link, init_params);
 }
 
 struct dc_link *link_create(const struct link_init_data *init_params)