Commit 9fb8de78 authored by Andrey Grodzovsky's avatar Andrey Grodzovsky Committed by Alex Deucher

drm/amd/display: Remove get_connector_for_link.

We can keep a 1:1 relation between a link and a physical
connector and hence skip the iteration. This function
is used in context of only physical connetors.
Signed-off-by: default avatarAndrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent dff06ddd
...@@ -148,21 +148,6 @@ static struct amdgpu_connector *get_connector_for_sink( ...@@ -148,21 +148,6 @@ static struct amdgpu_connector *get_connector_for_sink(
return NULL; return NULL;
} }
static struct amdgpu_connector *get_connector_for_link(
struct drm_device *dev,
const struct dc_link *link)
{
struct drm_connector *connector;
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
struct amdgpu_connector *aconnector = to_amdgpu_connector(connector);
if (aconnector->dc_link == link)
return aconnector;
}
return NULL;
}
static void get_payload_table( static void get_payload_table(
struct amdgpu_connector *aconnector, struct amdgpu_connector *aconnector,
struct dp_mst_stream_allocation_table *proposed_table) struct dp_mst_stream_allocation_table *proposed_table)
...@@ -363,9 +348,7 @@ bool dm_helpers_dp_mst_start_top_mgr( ...@@ -363,9 +348,7 @@ bool dm_helpers_dp_mst_start_top_mgr(
const struct dc_link *link, const struct dc_link *link,
bool boot) bool boot)
{ {
struct amdgpu_device *adev = ctx->driver_context; struct amdgpu_connector *aconnector = link->priv;
struct drm_device *dev = adev->ddev;
struct amdgpu_connector *aconnector = get_connector_for_link(dev, link);
if (!aconnector) { if (!aconnector) {
DRM_ERROR("Failed to found connector for link!"); DRM_ERROR("Failed to found connector for link!");
...@@ -388,9 +371,7 @@ void dm_helpers_dp_mst_stop_top_mgr( ...@@ -388,9 +371,7 @@ void dm_helpers_dp_mst_stop_top_mgr(
struct dc_context *ctx, struct dc_context *ctx,
const struct dc_link *link) const struct dc_link *link)
{ {
struct amdgpu_device *adev = ctx->driver_context; struct amdgpu_connector *aconnector = link->priv;
struct drm_device *dev = adev->ddev;
struct amdgpu_connector *aconnector = get_connector_for_link(dev, link);
if (!aconnector) { if (!aconnector) {
DRM_ERROR("Failed to found connector for link!"); DRM_ERROR("Failed to found connector for link!");
...@@ -412,9 +393,7 @@ bool dm_helpers_dp_read_dpcd( ...@@ -412,9 +393,7 @@ bool dm_helpers_dp_read_dpcd(
uint32_t size) uint32_t size)
{ {
struct amdgpu_device *adev = ctx->driver_context; struct amdgpu_connector *aconnector = link->priv;
struct drm_device *dev = adev->ddev;
struct amdgpu_connector *aconnector = get_connector_for_link(dev, link);
if (!aconnector) { if (!aconnector) {
DRM_ERROR("Failed to found connector for link!"); DRM_ERROR("Failed to found connector for link!");
...@@ -432,10 +411,7 @@ bool dm_helpers_dp_write_dpcd( ...@@ -432,10 +411,7 @@ bool dm_helpers_dp_write_dpcd(
const uint8_t *data, const uint8_t *data,
uint32_t size) uint32_t size)
{ {
struct amdgpu_connector *aconnector = link->priv;
struct amdgpu_device *adev = ctx->driver_context;
struct drm_device *dev = adev->ddev;
struct amdgpu_connector *aconnector = get_connector_for_link(dev, link);
if (!aconnector) { if (!aconnector) {
DRM_ERROR("Failed to found connector for link!"); DRM_ERROR("Failed to found connector for link!");
...@@ -451,9 +427,7 @@ bool dm_helpers_submit_i2c( ...@@ -451,9 +427,7 @@ bool dm_helpers_submit_i2c(
const struct dc_link *link, const struct dc_link *link,
struct i2c_command *cmd) struct i2c_command *cmd)
{ {
struct amdgpu_device *adev = ctx->driver_context; struct amdgpu_connector *aconnector = link->priv;
struct drm_device *dev = adev->ddev;
struct amdgpu_connector *aconnector = get_connector_for_link(dev, link);
struct i2c_msg *msgs; struct i2c_msg *msgs;
int i = 0; int i = 0;
int num = cmd->number_of_payloads; int num = cmd->number_of_payloads;
......
...@@ -2002,6 +2002,7 @@ int amdgpu_dm_connector_init( ...@@ -2002,6 +2002,7 @@ int amdgpu_dm_connector_init(
struct dc *dc = dm->dc; struct dc *dc = dm->dc;
const struct dc_link *link = dc_get_link_at_index(dc, link_index); const struct dc_link *link = dc_get_link_at_index(dc, link_index);
struct amdgpu_i2c_adapter *i2c; struct amdgpu_i2c_adapter *i2c;
((struct dc_link *)link)->priv = aconnector;
DRM_DEBUG_KMS("%s()\n", __func__); DRM_DEBUG_KMS("%s()\n", __func__);
......
...@@ -592,6 +592,8 @@ struct dc_link { ...@@ -592,6 +592,8 @@ struct dc_link {
struct psr_caps psr_caps; struct psr_caps psr_caps;
bool test_pattern_enabled; bool test_pattern_enabled;
union compliance_test_state compliance_test_state; union compliance_test_state compliance_test_state;
void *priv;
}; };
struct dpcd_caps { struct dpcd_caps {
......
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