mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-26 04:20:23 +09:00
drm/amd/display: Fix debugfs link_settings entry
[ Upstream commit c006a1c00d ]
1. Catch invalid link_rate and link_count settings
2. Call dc interface to overwrite preferred link settings, and wait
until next stream update to apply the new settings.
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Solomon Chiu <solomon.chiu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bcefa89b3e
commit
cc6215d94d
@@ -150,7 +150,7 @@ static int parse_write_buffer_into_params(char *wr_buf, uint32_t wr_buf_size,
|
|||||||
*
|
*
|
||||||
* --- to get dp configuration
|
* --- to get dp configuration
|
||||||
*
|
*
|
||||||
* cat link_settings
|
* cat /sys/kernel/debug/dri/0/DP-x/link_settings
|
||||||
*
|
*
|
||||||
* It will list current, verified, reported, preferred dp configuration.
|
* It will list current, verified, reported, preferred dp configuration.
|
||||||
* current -- for current video mode
|
* current -- for current video mode
|
||||||
@@ -163,7 +163,7 @@ static int parse_write_buffer_into_params(char *wr_buf, uint32_t wr_buf_size,
|
|||||||
* echo <lane_count> <link_rate> > link_settings
|
* echo <lane_count> <link_rate> > link_settings
|
||||||
*
|
*
|
||||||
* for example, to force to 2 lane, 2.7GHz,
|
* for example, to force to 2 lane, 2.7GHz,
|
||||||
* echo 4 0xa > link_settings
|
* echo 4 0xa > /sys/kernel/debug/dri/0/DP-x/link_settings
|
||||||
*
|
*
|
||||||
* spread_spectrum could not be changed dynamically.
|
* spread_spectrum could not be changed dynamically.
|
||||||
*
|
*
|
||||||
@@ -171,7 +171,7 @@ static int parse_write_buffer_into_params(char *wr_buf, uint32_t wr_buf_size,
|
|||||||
* done. please check link settings after force operation to see if HW get
|
* done. please check link settings after force operation to see if HW get
|
||||||
* programming.
|
* programming.
|
||||||
*
|
*
|
||||||
* cat link_settings
|
* cat /sys/kernel/debug/dri/0/DP-x/link_settings
|
||||||
*
|
*
|
||||||
* check current and preferred settings.
|
* check current and preferred settings.
|
||||||
*
|
*
|
||||||
@@ -255,7 +255,7 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf,
|
|||||||
int max_param_num = 2;
|
int max_param_num = 2;
|
||||||
uint8_t param_nums = 0;
|
uint8_t param_nums = 0;
|
||||||
long param[2];
|
long param[2];
|
||||||
bool valid_input = false;
|
bool valid_input = true;
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -282,9 +282,9 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf,
|
|||||||
case LANE_COUNT_ONE:
|
case LANE_COUNT_ONE:
|
||||||
case LANE_COUNT_TWO:
|
case LANE_COUNT_TWO:
|
||||||
case LANE_COUNT_FOUR:
|
case LANE_COUNT_FOUR:
|
||||||
valid_input = true;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
valid_input = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,9 +294,9 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf,
|
|||||||
case LINK_RATE_RBR2:
|
case LINK_RATE_RBR2:
|
||||||
case LINK_RATE_HIGH2:
|
case LINK_RATE_HIGH2:
|
||||||
case LINK_RATE_HIGH3:
|
case LINK_RATE_HIGH3:
|
||||||
valid_input = true;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
valid_input = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,10 +310,11 @@ static ssize_t dp_link_settings_write(struct file *f, const char __user *buf,
|
|||||||
* spread spectrum will not be changed
|
* spread spectrum will not be changed
|
||||||
*/
|
*/
|
||||||
prefer_link_settings.link_spread = link->cur_link_settings.link_spread;
|
prefer_link_settings.link_spread = link->cur_link_settings.link_spread;
|
||||||
|
prefer_link_settings.use_link_rate_set = false;
|
||||||
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_link_settings(dc, &prefer_link_settings, link);
|
dc_link_set_preferred_training_settings(dc, &prefer_link_settings, NULL, link, true);
|
||||||
|
|
||||||
kfree(wr_buf);
|
kfree(wr_buf);
|
||||||
return size;
|
return size;
|
||||||
|
|||||||
Reference in New Issue
Block a user