aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorKent Russell <kent.russell@amd.com>2019-04-01 06:43:39 -0400
committerAlex Deucher <alexander.deucher@amd.com>2019-04-03 11:00:31 -0400
commitbbdf38cc0dce5c68658e20b777720b8611dc286c (patch)
tree873d9ade28a9d4253e67cc4f39fa5762a6d38e31 /drivers/gpu/drm/amd
parent233d3ee4ba3636c0215714ee9f282e08147a452b (diff)
drm/amdgpu: Allow switching to CUSTOM profile on Vega10 v2
Don't return an error if the CUSTOM profile is selected, just apply it with the values saved to the GPU. But ensure that we zero out the copy stored in adev to ensure that a valid profile has been submitted at some point first v2: Fix comment that wasn't updated from previous patch Signed-off-by: Kent Russell <kent.russell@amd.com> Reviewed-by: Evan Quan <evan.quan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index 85a536924571..476a072027a6 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -1427,6 +1427,15 @@ static int vega10_setup_default_dpm_tables(struct pp_hwmgr *hwmgr)
1427 1427
1428 vega10_setup_default_pcie_table(hwmgr); 1428 vega10_setup_default_pcie_table(hwmgr);
1429 1429
1430 /* Zero out the saved copy of the CUSTOM profile
1431 * This will be checked when trying to set the profile
1432 * and will require that new values be passed in
1433 */
1434 data->custom_profile_mode[0] = 0;
1435 data->custom_profile_mode[1] = 0;
1436 data->custom_profile_mode[2] = 0;
1437 data->custom_profile_mode[3] = 0;
1438
1430 /* save a copy of the default DPM table */ 1439 /* save a copy of the default DPM table */
1431 memcpy(&(data->golden_dpm_table), &(data->dpm_table), 1440 memcpy(&(data->golden_dpm_table), &(data->dpm_table),
1432 sizeof(struct vega10_dpm_table)); 1441 sizeof(struct vega10_dpm_table));
@@ -4910,9 +4919,20 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
4910 1 << power_profile_mode); 4919 1 << power_profile_mode);
4911 4920
4912 if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) { 4921 if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
4913 if (size == 0 || size > 4) 4922 if (size != 0 && size != 4)
4914 return -EINVAL; 4923 return -EINVAL;
4915 4924
4925 /* If size = 0 and the CUSTOM profile has been set already
4926 * then just apply the profile. The copy stored in the hwmgr
4927 * is zeroed out on init
4928 */
4929 if (size == 0) {
4930 if (data->custom_profile_mode[0] != 0)
4931 goto out;
4932 else
4933 return -EINVAL;
4934 }
4935
4916 data->custom_profile_mode[0] = busy_set_point = input[0]; 4936 data->custom_profile_mode[0] = busy_set_point = input[0];
4917 data->custom_profile_mode[1] = FPS = input[1]; 4937 data->custom_profile_mode[1] = FPS = input[1];
4918 data->custom_profile_mode[2] = use_rlc_busy = input[2]; 4938 data->custom_profile_mode[2] = use_rlc_busy = input[2];
@@ -4923,6 +4943,7 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
4923 use_rlc_busy << 16 | min_active_level<<24); 4943 use_rlc_busy << 16 | min_active_level<<24);
4924 } 4944 }
4925 4945
4946out:
4926 hwmgr->power_profile_mode = power_profile_mode; 4947 hwmgr->power_profile_mode = power_profile_mode;
4927 4948
4928 return 0; 4949 return 0;