drm/amd/display: move dc_link functions in link root folder to dc_link_exports

[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>
This commit is contained in:
Wenjing Liu 2023-02-14 12:16:55 -05:00 committed by Alex Deucher
parent 36516001a7
commit 76f5dc40eb
6 changed files with 40 additions and 10 deletions

View 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);
}

View 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,

View 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 @@ struct dc_sink *dc_link_add_remote_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;

View File

@ -26,5 +26,11 @@
#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__ */

View 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,

View 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 @@ static bool dc_link_construct_phy(struct dc_link *link,
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)