Commit d0778ebf authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher

drm/amd/display: Roll core_link into dc_link

Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e12cfcb1
......@@ -563,7 +563,7 @@ struct amdgpu_connector {
/* The 'old' sink - before an HPD.
* The 'current' sink is in dc_link->sink. */
const struct dc_sink *dc_sink;
const struct dc_link *dc_link;
struct dc_link *dc_link;
const struct dc_sink *dc_em_sink;
const struct dc_stream *stream;
void *con_priv;
......
......@@ -1874,7 +1874,7 @@ void amdgpu_dm_connector_init_helper(
struct amdgpu_display_manager *dm,
struct amdgpu_connector *aconnector,
int connector_type,
const struct dc_link *link,
struct dc_link *link,
int link_index)
{
struct amdgpu_device *adev = dm->ddev->dev_private;
......@@ -1997,7 +1997,7 @@ int amdgpu_dm_connector_init(
int res = 0;
int connector_type;
struct dc *dc = dm->dc;
const struct dc_link *link = dc_get_link_at_index(dc, link_index);
struct dc_link *link = dc_get_link_at_index(dc, link_index);
struct amdgpu_i2c_adapter *i2c;
((struct dc_link *)link)->priv = aconnector;
......
......@@ -114,7 +114,7 @@ void amdgpu_dm_connector_init_helper(
struct amdgpu_display_manager *dm,
struct amdgpu_connector *aconnector,
int connector_type,
const struct dc_link *link,
struct dc_link *link,
int link_index);
int amdgpu_dm_connector_mode_valid(
......
......@@ -94,7 +94,7 @@ static bool create_links(
for (i = 0; i < connectors_num; i++) {
struct link_init_data link_init_params = {0};
struct core_link *link;
struct dc_link *link;
link_init_params.ctx = dc->ctx;
/* next BIOS object table connector */
......@@ -111,7 +111,7 @@ static bool create_links(
}
for (i = 0; i < num_virtual_links; i++) {
struct core_link *link = dm_alloc(sizeof(*link));
struct dc_link *link = dm_alloc(sizeof(*link));
struct encoder_init_data enc_init = {0};
if (link == NULL) {
......@@ -121,7 +121,7 @@ static bool create_links(
link->ctx = dc->ctx;
link->dc = dc;
link->public.connector_signal = SIGNAL_TYPE_VIRTUAL;
link->connector_signal = SIGNAL_TYPE_VIRTUAL;
link->link_id.type = OBJECT_TYPE_CONNECTOR;
link->link_id.id = CONNECTOR_ID_VIRTUAL;
link->link_id.enum_id = ENUM_ID_1;
......@@ -137,7 +137,7 @@ static bool create_links(
enc_init.encoder.enum_id = ENUM_ID_1;
virtual_link_encoder_construct(link->link_enc, &enc_init);
link->public.link_index = dc->link_count;
link->link_index = dc->link_count;
dc->links[dc->link_count] = link;
dc->link_count++;
}
......@@ -278,14 +278,14 @@ static void set_drive_settings(struct dc *dc,
int i;
for (i = 0; i < core_dc->link_count; i++) {
if (&core_dc->links[i]->public == link)
if (core_dc->links[i] == link)
break;
}
if (i >= core_dc->link_count)
ASSERT_CRITICAL(false);
dc_link_dp_set_drive_settings(&core_dc->links[i]->public, lt_settings);
dc_link_dp_set_drive_settings(core_dc->links[i], lt_settings);
}
static void perform_link_training(struct dc *dc,
......@@ -297,20 +297,17 @@ static void perform_link_training(struct dc *dc,
for (i = 0; i < core_dc->link_count; i++)
dc_link_dp_perform_link_training(
&core_dc->links[i]->public,
core_dc->links[i],
link_setting,
skip_video_pattern);
}
static void set_preferred_link_settings(struct dc *dc,
struct dc_link_settings *link_setting,
const struct dc_link *link)
struct dc_link *link)
{
struct core_link *core_link = DC_LINK_TO_CORE(link);
core_link->public.preferred_link_setting =
*link_setting;
dp_retrain_link_dp_test(core_link, link_setting, false);
link->preferred_link_setting = *link_setting;
dp_retrain_link_dp_test(link, link_setting, false);
}
static void enable_hpd(const struct dc_link *link)
......@@ -325,7 +322,7 @@ static void disable_hpd(const struct dc_link *link)
static void set_test_pattern(
const struct dc_link *link,
struct dc_link *link,
enum dp_test_pattern test_pattern,
const struct link_training_settings *p_link_settings,
const unsigned char *p_custom_pattern,
......@@ -345,9 +342,8 @@ void set_dither_option(const struct dc_stream *dc_stream,
{
struct core_stream *stream = DC_STREAM_TO_CORE(dc_stream);
struct bit_depth_reduction_params params;
struct core_link *core_link = DC_LINK_TO_CORE(stream->status.link);
struct pipe_ctx *pipes =
core_link->dc->current_context->res_ctx.pipe_ctx;
struct dc_link *link = stream->status.link;
struct pipe_ctx *pipes = link->dc->current_context->res_ctx.pipe_ctx;
memset(&params, 0, sizeof(params));
if (!stream)
......@@ -1693,10 +1689,10 @@ struct dc_stream *dc_get_stream_at_index(const struct dc *dc, uint8_t i)
return NULL;
}
const struct dc_link *dc_get_link_at_index(const struct dc *dc, uint32_t link_index)
struct dc_link *dc_get_link_at_index(const struct dc *dc, uint32_t link_index)
{
struct core_dc *core_dc = DC_TO_CORE(dc);
return &core_dc->links[link_index]->public;
return core_dc->links[link_index];
}
const struct graphics_object_id dc_get_link_id_at_index(
......@@ -1710,7 +1706,7 @@ enum dc_irq_source dc_get_hpd_irq_source_at_index(
struct dc *dc, uint32_t link_index)
{
struct core_dc *core_dc = DC_TO_CORE(dc);
return core_dc->links[link_index]->public.irq_source_hpd;
return core_dc->links[link_index]->irq_source_hpd;
}
const struct audio **dc_get_audios(struct dc *dc)
......@@ -1796,9 +1792,9 @@ bool dc_read_aux_dpcd(
{
struct core_dc *core_dc = DC_TO_CORE(dc);
struct core_link *link = core_dc->links[link_index];
struct dc_link *link = core_dc->links[link_index];
enum ddc_result r = dal_ddc_service_read_dpcd_data(
link->public.ddc,
link->ddc,
false,
I2C_MOT_UNDEF,
address,
......@@ -1815,10 +1811,10 @@ bool dc_write_aux_dpcd(
uint32_t size)
{
struct core_dc *core_dc = DC_TO_CORE(dc);
struct core_link *link = core_dc->links[link_index];
struct dc_link *link = core_dc->links[link_index];
enum ddc_result r = dal_ddc_service_write_dpcd_data(
link->public.ddc,
link->ddc,
false,
I2C_MOT_UNDEF,
address,
......@@ -1837,9 +1833,9 @@ bool dc_read_aux_i2c(
{
struct core_dc *core_dc = DC_TO_CORE(dc);
struct core_link *link = core_dc->links[link_index];
struct dc_link *link = core_dc->links[link_index];
enum ddc_result r = dal_ddc_service_read_dpcd_data(
link->public.ddc,
link->ddc,
true,
mot,
address,
......@@ -1857,10 +1853,10 @@ bool dc_write_aux_i2c(
uint32_t size)
{
struct core_dc *core_dc = DC_TO_CORE(dc);
struct core_link *link = core_dc->links[link_index];
struct dc_link *link = core_dc->links[link_index];
enum ddc_result r = dal_ddc_service_write_dpcd_data(
link->public.ddc,
link->ddc,
true,
mot,
address,
......@@ -1880,10 +1876,10 @@ bool dc_query_ddc_data(
struct core_dc *core_dc = DC_TO_CORE(dc);
struct core_link *link = core_dc->links[link_index];
struct dc_link *link = core_dc->links[link_index];
bool result = dal_ddc_service_query_ddc_data(
link->public.ddc,
link->ddc,
address,
write_buf,
write_size,
......@@ -1900,8 +1896,8 @@ bool dc_submit_i2c(
{
struct core_dc *core_dc = DC_TO_CORE(dc);
struct core_link *link = core_dc->links[link_index];
struct ddc_service *ddc = link->public.ddc;
struct dc_link *link = core_dc->links[link_index];
struct ddc_service *ddc = link->ddc;
return dal_i2caux_submit_i2c_command(
ddc->ctx->i2caux,
......@@ -1909,10 +1905,8 @@ bool dc_submit_i2c(
cmd);
}
static bool link_add_remote_sink_helper(struct core_link *core_link, struct dc_sink *sink)
static bool link_add_remote_sink_helper(struct dc_link *dc_link, struct dc_sink *sink)
{
struct dc_link *dc_link = &core_link->public;
if (dc_link->sink_count >= MAX_SINKS_PER_LINK) {
BREAK_TO_DEBUGGER();
return false;
......@@ -1927,14 +1921,13 @@ static bool link_add_remote_sink_helper(struct core_link *core_link, struct dc_s
}
struct dc_sink *dc_link_add_remote_sink(
const struct dc_link *link,
struct dc_link *link,
const uint8_t *edid,
int len,
struct dc_sink_init_data *init_data)
{
struct dc_sink *dc_sink;
enum dc_edid_status edid_status;
struct core_link *core_link = DC_LINK_TO_LINK(link);
if (len > MAX_EDID_BUFFER_SIZE) {
dm_error("Max EDID buffer size breached!\n");
......@@ -1960,12 +1953,12 @@ struct dc_sink *dc_link_add_remote_sink(
dc_sink->dc_edid.length = len;
if (!link_add_remote_sink_helper(
core_link,
link,
dc_sink))
goto fail_add_sink;
edid_status = dm_helpers_parse_edid_caps(
core_link->ctx,
link->ctx,
&dc_sink->dc_edid,
&dc_sink->edid_caps);
......@@ -1980,43 +1973,38 @@ struct dc_sink *dc_link_add_remote_sink(
return NULL;
}
void dc_link_set_sink(const struct dc_link *link, struct dc_sink *sink)
void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink)
{
struct core_link *core_link = DC_LINK_TO_LINK(link);
struct dc_link *dc_link = &core_link->public;
dc_link->local_sink = sink;
link->local_sink = sink;
if (sink == NULL) {
dc_link->type = dc_connection_none;
link->type = dc_connection_none;
} else {
dc_link->type = dc_connection_single;
link->type = dc_connection_single;
}
}
void dc_link_remove_remote_sink(const struct dc_link *link, const struct dc_sink *sink)
void dc_link_remove_remote_sink(struct dc_link *link, const struct dc_sink *sink)
{
int i;
struct core_link *core_link = DC_LINK_TO_LINK(link);
struct dc_link *dc_link = &core_link->public;
if (!link->sink_count) {
BREAK_TO_DEBUGGER();
return;
}
for (i = 0; i < dc_link->sink_count; i++) {
if (dc_link->remote_sinks[i] == sink) {
for (i = 0; i < link->sink_count; i++) {
if (link->remote_sinks[i] == sink) {
dc_sink_release(sink);
dc_link->remote_sinks[i] = NULL;
link->remote_sinks[i] = NULL;
/* shrink array to remove empty place */
while (i < dc_link->sink_count - 1) {
dc_link->remote_sinks[i] = dc_link->remote_sinks[i+1];
while (i < link->sink_count - 1) {
link->remote_sinks[i] = link->remote_sinks[i+1];
i++;
}
dc_link->remote_sinks[i] = NULL;
dc_link->sink_count--;
link->remote_sinks[i] = NULL;
link->sink_count--;
return;
}
}
......
......@@ -354,7 +354,7 @@ static uint32_t defer_delay_converter_wa(
struct ddc_service *ddc,
uint32_t defer_delay)
{
struct core_link *link = ddc->link;
struct dc_link *link = ddc->link;
if (link->dpcd_caps.branch_dev_id == DP_BRANCH_DEVICE_ID_4 &&
!memcmp(link->dpcd_caps.branch_dev_name,
......@@ -423,7 +423,7 @@ static bool i2c_read(
return dm_helpers_submit_i2c(
ddc->ctx,
&ddc->link->public,
ddc->link,
&command);
}
......@@ -624,7 +624,7 @@ bool dal_ddc_service_query_ddc_data(
ret = dm_helpers_submit_i2c(
ddc->ctx,
&ddc->link->public,
ddc->link,
&command);
dal_ddc_i2c_payloads_destroy(&payloads);
......
......@@ -16,13 +16,13 @@
#include "dpcd_defs.h"
enum dc_status core_link_read_dpcd(
struct core_link* link,
struct dc_link *link,
uint32_t address,
uint8_t *data,
uint32_t size)
{
if (!dm_helpers_dp_read_dpcd(link->ctx,
&link->public,
link,
address, data, size))
return DC_ERROR_UNEXPECTED;
......@@ -30,20 +30,20 @@ enum dc_status core_link_read_dpcd(
}
enum dc_status core_link_write_dpcd(
struct core_link* link,
struct dc_link *link,
uint32_t address,
const uint8_t *data,
uint32_t size)
{
if (!dm_helpers_dp_write_dpcd(link->ctx,
&link->public,
link,
address, data, size))
return DC_ERROR_UNEXPECTED;
return DC_OK;
}
void dp_receiver_power_ctrl(struct core_link *link, bool on)
void dp_receiver_power_ctrl(struct dc_link *link, bool on)
{
uint8_t state;
......@@ -54,7 +54,7 @@ void dp_receiver_power_ctrl(struct core_link *link, bool on)
}
void dp_enable_link_phy(
struct core_link *link,
struct dc_link *link,
enum signal_type signal,
enum clock_source_id clock_source,
const struct dc_link_settings *link_settings)
......@@ -107,7 +107,7 @@ void dp_enable_link_phy(
dp_receiver_power_ctrl(link, true);
}
void dp_disable_link_phy(struct core_link *link, enum signal_type signal)
void dp_disable_link_phy(struct dc_link *link, enum signal_type signal)
{
if (!link->wa_flags.dp_keep_receiver_powered)
dp_receiver_power_ctrl(link, false);
......@@ -120,11 +120,11 @@ void dp_disable_link_phy(struct core_link *link, enum signal_type signal)
link->link_enc->funcs->disable_output(link->link_enc, signal);
/* Clear current link setting.*/
memset(&link->public.cur_link_settings, 0,
sizeof(link->public.cur_link_settings));
memset(&link->cur_link_settings, 0,
sizeof(link->cur_link_settings));
}
void dp_disable_link_phy_mst(struct core_link *link, enum signal_type signal)
void dp_disable_link_phy_mst(struct dc_link *link, enum signal_type signal)
{
/* MST disable link only when no stream use the link */
if (link->mst_stream_alloc_table.stream_count > 0)
......@@ -137,7 +137,7 @@ void dp_disable_link_phy_mst(struct core_link *link, enum signal_type signal)
}
bool dp_set_hw_training_pattern(
struct core_link *link,
struct dc_link *link,
enum hw_dp_training_pattern pattern)
{
enum dp_test_pattern test_pattern = DP_TEST_PATTERN_UNSUPPORTED;
......@@ -165,7 +165,7 @@ bool dp_set_hw_training_pattern(
}
void dp_set_hw_lane_settings(
struct core_link *link,
struct dc_link *link,
const struct link_training_settings *link_settings)
{
struct link_encoder *encoder = link->link_enc;
......@@ -174,13 +174,13 @@ void dp_set_hw_lane_settings(
encoder->funcs->dp_set_lane_settings(encoder, link_settings);
}
enum dp_panel_mode dp_get_panel_mode(struct core_link *link)
enum dp_panel_mode dp_get_panel_mode(struct dc_link *link)
{
/* We need to explicitly check that connector
* is not DP. Some Travis_VGA get reported
* by video bios as DP.
*/
if (link->public.connector_signal != SIGNAL_TYPE_DISPLAY_PORT) {
if (link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT) {
switch (link->dpcd_caps.branch_dev_id) {
case DP_BRANCH_DEVICE_ID_2:
......@@ -215,7 +215,7 @@ enum dp_panel_mode dp_get_panel_mode(struct core_link *link)
}
void dp_set_hw_test_pattern(
struct core_link *link,
struct dc_link *link,
enum dp_test_pattern test_pattern,
uint8_t *custom_pattern,
uint32_t custom_pattern_size)
......@@ -231,7 +231,7 @@ void dp_set_hw_test_pattern(
encoder->funcs->dp_set_phy_pattern(encoder, &pattern_param);
}
void dp_retrain_link_dp_test(struct core_link *link,
void dp_retrain_link_dp_test(struct dc_link *link,
struct dc_link_settings *link_setting,
bool skip_video_pattern)
{
......@@ -263,8 +263,8 @@ void dp_retrain_link_dp_test(struct core_link *link,
SIGNAL_TYPE_DISPLAY_PORT);
/* Clear current link setting. */
memset(&link->public.cur_link_settings, 0,
sizeof(link->public.cur_link_settings));
memset(&link->cur_link_settings, 0,
sizeof(link->cur_link_settings));
link->link_enc->funcs->enable_dp_output(
link->link_enc,
......@@ -274,11 +274,11 @@ void dp_retrain_link_dp_test(struct core_link *link,
dp_receiver_power_ctrl(link, true);
dc_link_dp_perform_link_training(
&link->public,
link,
link_setting,
skip_video_pattern);
link->public.cur_link_settings = *link_setting;
link->cur_link_settings = *link_setting;
link->dc->hwss.enable_stream(&pipes[i]);
......
......@@ -1269,7 +1269,7 @@ static struct stream_encoder *find_first_free_match_stream_enc_for_link(
{
int i;
int j = -1;
struct core_link *link = stream->sink->link;
struct dc_link *link = stream->sink->link;
for (i = 0; i < pool->stream_enc_count; i++) {
if (!res_ctx->is_stream_enc_acquired[i] &&
......@@ -1322,9 +1322,7 @@ static void update_stream_signal(struct core_stream *stream)
const struct dc_sink *dc_sink = stream->public.sink;
if (dc_sink->sink_signal == SIGNAL_TYPE_NONE)
stream->signal =
stream->sink->link->
public.connector_signal;
stream->signal = stream->sink->link->connector_signal;
else
stream->signal = dc_sink->sink_signal;
} else {
......@@ -1380,7 +1378,7 @@ static struct core_stream *find_pll_sharable_stream(
if (resource_are_streams_timing_synchronizable(
stream_needs_pll, stream_has_pll)
&& !dc_is_dp_signal(stream_has_pll->signal)
&& stream_has_pll->sink->link->public.connector_signal
&& stream_has_pll->sink->link->connector_signal
!= SIGNAL_TYPE_VIRTUAL)
return stream_has_pll;
......
......@@ -54,15 +54,14 @@ static void destruct(struct sink *sink)
static bool construct(struct sink *sink, const struct dc_sink_init_data *init_params)
{
struct core_link *core_link = DC_LINK_TO_LINK(init_params->link);
struct dc_link *link = init_params->link;
if (!core_link) {
if (!link)
return false;
}
sink->protected.public.sink_signal = init_params->sink_signal;
sink->protected.link = core_link;
sink->protected.ctx = core_link->ctx;
sink->protected.link = link;
sink->protected.ctx = link->ctx;
sink->protected.public.dongle_max_pix_clk = init_params->dongle_max_pix_clk;
sink->protected.public.converter_disable_audio =
init_params->converter_disable_audio;
......
......@@ -91,7 +91,7 @@ static bool construct(struct core_stream *stream,
/* EDID CAP translation for HDMI 2.0 */
stream->public.timing.flags.LTE_340MCSC_SCRAMBLE = dc_sink_data->edid_caps.lte_340mcsc_scramble;
stream->status.link = &stream->sink->link->public;
stream->status.link = stream->sink->link;
return true;
}
......@@ -355,5 +355,5 @@ void dc_stream_log(
dm_logger_write(dm_logger,
log_type,
"\tlink: %d\n",
core_stream->sink->link->public.link_index);
core_stream->sink->link->link_index);
}
......@@ -31,6 +31,7 @@
#include "logger_types.h"
#include "gpio_types.h"
#include "link_service_types.h"
#include "grph_object_ctrl_defs.h"
#define MAX_SURFACES 3
#define MAX_STREAMS 6
......@@ -141,11 +142,11 @@ struct dc_link_funcs {
bool skip_video_pattern);
void (*set_preferred_link_settings)(struct dc *dc,
struct dc_link_settings *link_setting,
const struct dc_link *link);
struct dc_link *link);
void (*enable_hpd)(const struct dc_link *link);
void (*disable_hpd)(const struct dc_link *link);
void (*set_test_pattern)(
const struct dc_link *link,
struct dc_link *link,
enum dp_test_pattern test_pattern,
const struct link_training_settings *p_link_settings,
const unsigned char *p_custom_pattern,
......@@ -641,7 +642,7 @@ struct dc_stream_status {
/*
* link this stream passes through
*/
const struct dc_link *link;
struct dc_link *link;
};
struct dc_stream_status *dc_stream_get_status(
......@@ -662,6 +663,50 @@ void dc_release_validate_context(struct validate_context *context);
* Link Interfaces
******************************************************************************/
struct dpcd_caps {
union dpcd_rev dpcd_rev;
union max_lane_count max_ln_count;
union max_down_spread max_down_spread;
/* dongle type (DP converter, CV smart dongle) */
enum display_dongle_type dongle_type;
/* Dongle's downstream count. */
union sink_count sink_count;
/* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
struct dc_dongle_caps dongle_caps;
uint32_t sink_dev_id;
uint32_t branch_dev_id;
int8_t branch_dev_name[6];
int8_t branch_hw_revision;
bool allow_invalid_MSA_timing_param;
bool panel_mode_edp;
};
struct dc_link_status {
struct dpcd_caps *dpcd_caps;
};
/* DP MST stream allocation (payload bandwidth number) */
struct link_mst_stream_allocation {
/* DIG front */
const struct stream_encoder *stream_enc;
/* associate DRM payload table with DC stream encoder */
uint8_t vcp_id;
/* number of slots required for the DP stream in transport packet */
uint8_t slot_count;
};
/* DP MST stream allocation table */
struct link_mst_stream_allocation_table {
/* number of DP video streams */
int stream_count;
/* array of stream allocations */
struct link_mst_stream_allocation stream_allocations[MAX_CONTROLLER_NUM];
};
/*
* A link contains one or more sinks and their connected status.
* The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
......@@ -699,32 +744,31 @@ struct dc_link {
struct ddc_service *ddc;
bool aux_mode;
};
struct dpcd_caps {
union dpcd_rev dpcd_rev;
union max_lane_count max_ln_count;
union max_down_spread max_down_spread;
/* Private to DC core */
/* dongle type (DP converter, CV smart dongle) */
enum display_dongle_type dongle_type;
/* Dongle's downstream count. */
union sink_count sink_count;
/* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
struct dc_dongle_caps dongle_caps;
const struct core_dc *dc;
uint32_t sink_dev_id;
uint32_t branch_dev_id;
int8_t branch_dev_name[6];
int8_t branch_hw_revision;
struct dc_context *ctx;
bool allow_invalid_MSA_timing_param;
bool panel_mode_edp;
};
struct link_encoder *link_enc;
struct graphics_object_id link_id;
union ddi_channel_mapping ddi_channel_mapping;
struct connector_device_tag_info device_tag;
struct dpcd_caps dpcd_caps;
unsigned int dpcd_sink_count;
enum edp_revision edp_revision;
bool psr_enabled;
/* MST record stream using this link */
struct link_flags {
bool dp_keep_receiver_powered;
} wa_flags;
struct link_mst_stream_allocation_table mst_stream_alloc_table;
struct dc_link_status link_status;
struct dc_link_status {
struct dpcd_caps *dpcd_caps;
};
const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link);
......@@ -734,7 +778,7 @@ const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link);
* boot time. They cannot be created or destroyed.
* Use dc_get_caps() to get number of links.
*/
const struct dc_link *dc_get_link_at_index(const struct dc *dc, uint32_t link_index);
struct dc_link *dc_get_link_at_index(const struct dc *dc, uint32_t link_index);
/* Return id of physical connector represented by a dc_link at link_index.*/
const struct graphics_object_id dc_get_link_id_at_index(
......@@ -750,7 +794,7 @@ bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable);
bool dc_link_get_psr_state(const struct dc_link *dc_link, uint32_t *psr_state);
bool dc_link_setup_psr(const struct dc_link *dc_link,
bool dc_link_setup_psr(struct dc_link *dc_link,
const struct dc_stream *stream, struct psr_config *psr_config,
struct psr_context *psr_context);
......@@ -760,7 +804,7 @@ bool dc_link_setup_psr(const struct dc_link *dc_link,
* true otherwise. True meaning further action is required (status update
* and OS notification).
*/
bool dc_link_detect(const struct dc_link *dc_link, bool boot);
bool dc_link_detect(struct dc_link *dc_link, bool boot);
/* Notify DC about DP RX Interrupt (aka Short Pulse Interrupt).
* Return:
......@@ -768,26 +812,26 @@ bool dc_link_detect(const struct dc_link *dc_link, bool boot);
* detection.
* false - no change in Downstream port status. No further action required
* from DM. */
bool dc_link_handle_hpd_rx_irq(const struct dc_link *dc_link,
bool dc_link_handle_hpd_rx_irq(struct dc_link *dc_link,
union hpd_irq_data *hpd_irq_dpcd_data);
struct dc_sink_init_data;
struct dc_sink *dc_link_add_remote_sink(
const struct dc_link *dc_link,
struct dc_link *dc_link,
const uint8_t *edid,
int len,
struct dc_sink_init_data *init_data);
void dc_link_remove_remote_sink(
const struct dc_link *link,
struct dc_link *link,
const struct dc_sink *sink);
/* Used by diagnostics for virtual link at the moment */
void dc_link_set_sink(const struct dc_link *link, struct dc_sink *sink);
void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink);
void dc_link_dp_set_drive_settings(
const struct dc_link *link,
struct dc_link *link,
struct link_training_settings *lt_settings);
enum link_training_result dc_link_dp_perform_link_training(
......@@ -800,7 +844,7 @@ void dc_link_dp_enable_hpd(const struct dc_link *link);
void dc_link_dp_disable_hpd(const struct dc_link *link);
bool dc_link_dp_set_test_pattern(
const struct dc_link *link,
struct dc_link *link,
enum dp_test_pattern test_pattern,
const struct link_training_settings *p_link_settings,
const unsigned char *p_custom_pattern,
......@@ -844,7 +888,7 @@ const struct audio **dc_get_audios(struct dc *dc);
struct dc_sink_init_data {
enum signal_type sink_signal;
const struct dc_link *link;
struct dc_link *link;
uint32_t dongle_max_pix_clk;
bool converter_disable_audio;
};
......
......@@ -105,7 +105,7 @@ struct ddc_service {
enum ddc_transaction_type transaction_type;
enum display_dongle_type dongle_type;
struct dc_context *ctx;
struct core_link *link;
struct dc_link *link;
uint32_t address;
uint32_t edid_buf_len;
......
......@@ -142,7 +142,7 @@ static void dce_dmcu_set_psr_enable(struct dmcu *dmcu, bool enable)
}
static void dce_dmcu_setup_psr(struct dmcu *dmcu,
struct core_link *link,
struct dc_link *link,
struct psr_context *psr_context)
{
struct dce_dmcu *dmcu_dce = TO_DCE_DMCU(dmcu);
......@@ -382,7 +382,7 @@ static void dcn10_dmcu_set_psr_enable(struct dmcu *dmcu, bool enable)
}
static void dcn10_dmcu_setup_psr(struct dmcu *dmcu,
struct core_link *link,
struct dc_link *link,
struct psr_context *psr_context)
{
struct dce_dmcu *dmcu_dce = TO_DCE_DMCU(dmcu);
......
......@@ -1020,7 +1020,7 @@ bool dce110_link_encoder_validate_output_with_stream(
case SIGNAL_TYPE_DVI_DUAL_LINK:
is_valid = dce110_link_encoder_validate_dvi_output(
enc110,
stream->sink->link->public.connector_signal,
stream->sink->link->connector_signal,
pipe_ctx->stream->signal,
&stream->public.timing);
break;
......
......@@ -661,7 +661,7 @@ static enum dc_status validate_mapped_resource(
for (i = 0; i < context->stream_count; i++) {
struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link;
struct dc_link *link = stream->sink->link;
if (old_context && resource_is_stream_unchanged(old_context, stream))
continue;
......
......@@ -700,10 +700,10 @@ void dce110_update_info_frame(struct pipe_ctx *pipe_ctx)
void dce110_enable_stream(struct pipe_ctx *pipe_ctx)
{
enum dc_lane_count lane_count =
pipe_ctx->stream->sink->link->public.cur_link_settings.lane_count;
pipe_ctx->stream->sink->link->cur_link_settings.lane_count;
struct dc_crtc_timing *timing = &pipe_ctx->stream->public.timing;
struct core_link *link = pipe_ctx->stream->sink->link;
struct dc_link *link = pipe_ctx->stream->sink->link;
/* 1. update AVI info frame (HDMI, DP)
* we always need to update info frame
......@@ -746,7 +746,7 @@ void dce110_enable_stream(struct pipe_ctx *pipe_ctx)
void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
{
struct core_stream *stream = pipe_ctx->stream;
struct core_link *link = stream->sink->link;
struct dc_link *link = stream->sink->link;
if (pipe_ctx->audio) {
pipe_ctx->audio->funcs->az_disable(pipe_ctx->audio);
......@@ -1111,7 +1111,7 @@ static enum dc_status apply_single_controller_ctx_to_hw(
dce110_update_info_frame(pipe_ctx);
if (dc_is_dp_signal(pipe_ctx->stream->signal))
dce110_unblank_stream(pipe_ctx,
&stream->sink->link->public.cur_link_settings);
&stream->sink->link->cur_link_settings);
}
pipe_ctx->scl_data.lb_params.alpha_en = pipe_ctx->bottom_pipe != 0;
......@@ -2220,7 +2220,7 @@ static void init_hw(struct core_dc *dc)
/* Power up AND update implementation according to the
* required signal (which may be different from the
* default signal on connector). */
struct core_link *link = dc->links[i];
struct dc_link *link = dc->links[i];
link->link_enc->funcs->hw_init(link->link_enc);
}
......@@ -2283,11 +2283,11 @@ void dce110_fill_display_configs(
cfg->transmitter =
stream->sink->link->link_enc->transmitter;
cfg->link_settings.lane_count =
stream->sink->link->public.cur_link_settings.lane_count;
stream->sink->link->cur_link_settings.lane_count;
cfg->link_settings.link_rate =
stream->sink->link->public.cur_link_settings.link_rate;
stream->sink->link->cur_link_settings.link_rate;
cfg->link_settings.link_spread =
stream->sink->link->public.cur_link_settings.link_spread;
stream->sink->link->cur_link_settings.link_spread;
cfg->sym_clock = stream->phy_pix_clk;
/* Round v_refresh*/
cfg->v_refresh = stream->public.timing.pix_clk_khz * 1000;
......
......@@ -781,7 +781,7 @@ static enum dc_status validate_mapped_resource(
for (i = 0; i < context->stream_count; i++) {
struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link;
struct dc_link *link = stream->sink->link;
if (old_context && resource_is_stream_unchanged(old_context, stream))
continue;
......
......@@ -730,7 +730,7 @@ static enum dc_status validate_mapped_resource(
for (i = 0; i < context->stream_count; i++) {
struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link;
struct dc_link *link = stream->sink->link;
if (old_context && resource_is_stream_unchanged(old_context, stream))
continue;
......
......@@ -677,7 +677,7 @@ static enum dc_status validate_mapped_resource(
for (i = 0; i < context->stream_count; i++) {
struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link;
struct dc_link *link = stream->sink->link;
if (old_context && resource_is_stream_unchanged(old_context, stream))
continue;
......
......@@ -628,7 +628,7 @@ static void dcn10_init_hw(struct core_dc *dc)
* required signal (which may be different from the
* default signal on connector).
*/
struct core_link *link = dc->links[i];
struct dc_link *link = dc->links[i];
link->link_enc->funcs->hw_init(link->link_enc);
}
......@@ -2259,7 +2259,7 @@ static void dcn10_config_stereo_parameters(
timing_3d_format == TIMING_3D_FORMAT_DP_HDMI_INBAND_FA ||
timing_3d_format == TIMING_3D_FORMAT_SIDEBAND_FA) {
enum display_dongle_type dongle = \
stream->sink->link->public.ddc->dongle_type;
stream->sink->link->ddc->dongle_type;
if (dongle == DISPLAY_DONGLE_DP_VGA_CONVERTER ||
dongle == DISPLAY_DONGLE_DP_DVI_CONVERTER ||
dongle == DISPLAY_DONGLE_DP_HDMI_CONVERTER)
......
......@@ -845,7 +845,7 @@ static enum dc_status validate_mapped_resource(
for (i = 0; i < context->stream_count; i++) {
struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link;
struct dc_link *link = stream->sink->link;
if (old_context && resource_is_stream_unchanged(old_context, stream)) {
if (stream != NULL && old_context->streams[i] != NULL) {
......
......@@ -20,7 +20,7 @@ struct core_dc {
struct dc_context *ctx;
uint8_t link_count;
struct core_link *links[MAX_PIPES * 2];
struct dc_link *links[MAX_PIPES * 2];
struct validate_context *current_context;
struct resource_pool *res_pool;
......
......@@ -92,13 +92,11 @@ struct core_sink {
/** The 'protected' area - read/write access, for use only inside DC **/
/* not used for now */
struct core_link *link;
struct dc_link *link;
struct dc_context *ctx;
};
/************ link *****************/
#define DC_LINK_TO_CORE(dc_link) container_of(dc_link, struct core_link, public)
struct link_init_data {
const struct core_dc *dc;
struct dc_context *ctx; /* TODO: remove 'dal' when DC is complete. */
......@@ -107,61 +105,15 @@ struct link_init_data {
TODO: remove it when DC is complete. */
};
/* DP MST stream allocation (payload bandwidth number) */
struct link_mst_stream_allocation {
/* DIG front */
const struct stream_encoder *stream_enc;
/* associate DRM payload table with DC stream encoder */
uint8_t vcp_id;
/* number of slots required for the DP stream in transport packet */
uint8_t slot_count;
};
/* DP MST stream allocation table */
struct link_mst_stream_allocation_table {
/* number of DP video streams */
int stream_count;
/* array of stream allocations */
struct link_mst_stream_allocation
stream_allocations[MAX_CONTROLLER_NUM];
};
struct core_link {
struct dc_link public;
const struct core_dc *dc;
struct dc_context *ctx; /* TODO: AUTO remove 'dal' when DC is complete*/
struct link_encoder *link_enc;
struct graphics_object_id link_id;
union ddi_channel_mapping ddi_channel_mapping;
struct connector_device_tag_info device_tag;
struct dpcd_caps dpcd_caps;
unsigned int dpcd_sink_count;
enum edp_revision edp_revision;
bool psr_enabled;
/* MST record stream using this link */
struct link_flags {
bool dp_keep_receiver_powered;
} wa_flags;
struct link_mst_stream_allocation_table mst_stream_alloc_table;
struct dc_link_status link_status;
};
#define DC_LINK_TO_LINK(dc_link) container_of(dc_link, struct core_link, public)
struct core_link *link_create(const struct link_init_data *init_params);
void link_destroy(struct core_link **link);
struct dc_link *link_create(const struct link_init_data *init_params);
void link_destroy(struct dc_link **link);
enum dc_status dc_link_validate_mode_timing(
const struct core_stream *stream,
struct core_link *link,
struct dc_link *link,
const struct dc_crtc_timing *timing);
void core_link_resume(struct core_link *link);
void core_link_resume(struct dc_link *link);
void core_link_enable_stream(struct pipe_ctx *pipe_ctx);
......
......@@ -84,7 +84,7 @@ void dal_ddc_aux_payloads_add(
struct ddc_service_init_data {
struct graphics_object_id id;
struct dc_context *ctx;
struct core_link *link;
struct dc_link *link;
};
struct ddc_service *dal_ddc_service_create(
......
......@@ -29,12 +29,12 @@
#define LINK_TRAINING_ATTEMPTS 4
#define LINK_TRAINING_RETRY_DELAY 50 /* ms */
struct core_link;
struct dc_link;
struct core_stream;
struct dc_link_settings;
bool dp_hbr_verify_link_cap(
struct core_link *link,
struct dc_link *link,
struct dc_link_settings *known_limit_link_setting);
bool decide_fallback_link_setting(struct dc_link_settings link_setting_init,
......@@ -46,7 +46,7 @@ struct dc_link_settings get_common_supported_link_settings (
struct dc_link_settings link_setting_b);
bool dp_validate_mode_timing(
struct core_link *link,
struct dc_link *link,
const struct dc_crtc_timing *timing);
void decide_link_settings(
......@@ -54,17 +54,17 @@ void decide_link_settings(
struct dc_link_settings *link_setting);
bool perform_link_training_with_retries(
struct core_link *link,
struct dc_link *link,
const struct dc_link_settings *link_setting,
bool skip_video_pattern,
int attempts);
bool is_mst_supported(struct core_link *link);
bool is_mst_supported(struct dc_link *link);
void detect_dp_sink_caps(struct core_link *link);
void detect_dp_sink_caps(struct dc_link *link);
bool is_dp_active_dongle(const struct core_link *link);
bool is_dp_active_dongle(const struct dc_link *link);
void dp_enable_mst_on_sink(struct core_link *link, bool enable);
void dp_enable_mst_on_sink(struct dc_link *link, bool enable);
#endif /* __DC_LINK_DP_H__ */
......@@ -39,7 +39,7 @@ struct dmcu_funcs {
unsigned int bytes);
void (*set_psr_enable)(struct dmcu *dmcu, bool enable);
void (*setup_psr)(struct dmcu *dmcu,
struct core_link *link,
struct dc_link *link,
struct psr_context *psr_context);
void (*get_psr_state)(struct dmcu *dmcu, uint32_t *psr_state);
void (*set_psr_wait_loop)(struct dmcu *dmcu,
......
......@@ -29,46 +29,46 @@
#include "inc/core_status.h"
enum dc_status core_link_read_dpcd(
struct core_link* link,
struct dc_link *link,
uint32_t address,
uint8_t *data,
uint32_t size);
enum dc_status core_link_write_dpcd(
struct core_link* link,
struct dc_link *link,
uint32_t address,
const uint8_t *data,
uint32_t size);
void dp_enable_link_phy(
struct core_link *link,
struct dc_link *link,
enum signal_type signal,
enum clock_source_id clock_source,
const struct dc_link_settings *link_settings);
void dp_receiver_power_ctrl(struct core_link *link, bool on);
void dp_receiver_power_ctrl(struct dc_link *link, bool on);
void dp_disable_link_phy(struct core_link *link, enum signal_type signal);
void dp_disable_link_phy(struct dc_link *link, enum signal_type signal);
void dp_disable_link_phy_mst(struct core_link *link, enum signal_type signal);
void dp_disable_link_phy_mst(struct dc_link *link, enum signal_type signal);
bool dp_set_hw_training_pattern(
struct core_link *link,
struct dc_link *link,
enum hw_dp_training_pattern pattern);
void dp_set_hw_lane_settings(
struct core_link *link,
struct dc_link *link,
const struct link_training_settings *link_settings);
void dp_set_hw_test_pattern(
struct core_link *link,
struct dc_link *link,
enum dp_test_pattern test_pattern,
uint8_t *custom_pattern,
uint32_t custom_pattern_size);
enum dp_panel_mode dp_get_panel_mode(struct core_link *link);
enum dp_panel_mode dp_get_panel_mode(struct dc_link *link);
void dp_retrain_link_dp_test(struct core_link *link,
void dp_retrain_link_dp_test(struct dc_link *link,
struct dc_link_settings *link_setting,
bool skip_video_pattern);
......
......@@ -140,19 +140,19 @@ void context_clock_trace(
*/
#define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \
dc_conn_log(link->ctx, &link->public, hex_data, hex_len, \
dc_conn_log(link->ctx, link, hex_data, hex_len, \
LOG_EVENT_DETECTION, ##__VA_ARGS__)
#define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \
dc_conn_log(link->ctx, &link->public, hex_data, hex_len, \
dc_conn_log(link->ctx, link, hex_data, hex_len, \
LOG_EVENT_LINK_LOSS, ##__VA_ARGS__)
#define CONN_MSG_LT(link, ...) \
dc_conn_log(link->ctx, &link->public, NULL, 0, \
dc_conn_log(link->ctx, link, NULL, 0, \
LOG_EVENT_LINK_TRAINING, ##__VA_ARGS__)
#define CONN_MSG_MODE(link, ...) \
dc_conn_log(link->ctx, &link->public, NULL, 0, \
dc_conn_log(link->ctx, link, NULL, 0, \
LOG_EVENT_MODE_SET, ##__VA_ARGS__)
#endif /* __DAL_LOGGER_INTERFACE_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment