Commit a18112ae authored by Wayne Lin's avatar Wayne Lin Committed by Alex Deucher

drm/amd/display: Fix a few parts in debugfs entry

[Why & How]
1. To leverage and simplify the igt tool. Change the value of
retrain when calling preferred training settings.
Now, writing value to link settings triggers link training immediately.

2. Add dc lock when triggering link training in edp_ilr_write()
Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: default avatarAgustin Gutierrez <agustin.gutierrez@amd.com>
Signed-off-by: default avatarWayne Lin <Wayne.Lin@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 10499e40
...@@ -243,6 +243,7 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf, ...@@ -243,6 +243,7 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf,
{ {
struct amdgpu_dm_connector *connector = file_inode(f)->i_private; struct amdgpu_dm_connector *connector = file_inode(f)->i_private;
struct dc_link *link = connector->dc_link; struct dc_link *link = connector->dc_link;
struct amdgpu_device *adev = drm_to_adev(connector->base.dev);
struct dc *dc = (struct dc *)link->dc; struct dc *dc = (struct dc *)link->dc;
struct dc_link_settings prefer_link_settings; struct dc_link_settings prefer_link_settings;
char *wr_buf = NULL; char *wr_buf = NULL;
...@@ -302,6 +303,9 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf, ...@@ -302,6 +303,9 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf,
if (!valid_input) { if (!valid_input) {
kfree(wr_buf); kfree(wr_buf);
DRM_DEBUG_DRIVER("Invalid Input value No HW will be programmed\n"); DRM_DEBUG_DRIVER("Invalid Input value No HW will be programmed\n");
mutex_lock(&adev->dm.dc_lock);
dc_link_set_preferred_training_settings(dc, NULL, NULL, link, false);
mutex_unlock(&adev->dm.dc_lock);
return size; return size;
} }
...@@ -313,7 +317,9 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf, ...@@ -313,7 +317,9 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf,
prefer_link_settings.lane_count = param[0]; prefer_link_settings.lane_count = param[0];
prefer_link_settings.link_rate = param[1]; prefer_link_settings.link_rate = param[1];
dc_link_set_preferred_training_settings(dc, &prefer_link_settings, NULL, link, true); mutex_lock(&adev->dm.dc_lock);
dc_link_set_preferred_training_settings(dc, &prefer_link_settings, NULL, link, false);
mutex_unlock(&adev->dm.dc_lock);
kfree(wr_buf); kfree(wr_buf);
return size; return size;
...@@ -2883,7 +2889,9 @@ static ssize_t edp_ilr_write(struct file *f, const char __user *buf, ...@@ -2883,7 +2889,9 @@ static ssize_t edp_ilr_write(struct file *f, const char __user *buf,
kfree(wr_buf); kfree(wr_buf);
DRM_DEBUG_DRIVER("Invalid Input value. No HW will be programmed\n"); DRM_DEBUG_DRIVER("Invalid Input value. No HW will be programmed\n");
prefer_link_settings.use_link_rate_set = false; prefer_link_settings.use_link_rate_set = false;
mutex_lock(&adev->dm.dc_lock);
dc_link_set_preferred_training_settings(dc, NULL, NULL, link, false); dc_link_set_preferred_training_settings(dc, NULL, NULL, link, false);
mutex_unlock(&adev->dm.dc_lock);
return size; return size;
} }
......
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