aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2013-07-02 18:43:53 -0400
committerAlex Deucher <alexander.deucher@amd.com>2013-07-05 18:09:38 -0400
commit170a47f010182152bed6f44f3878dd0423df2b78 (patch)
treea21b39332085c37c78d3c0593e49d884d25307cf /drivers/gpu
parent8b5e6b7f0ec81f237d87cf9632309db9481c6fb5 (diff)
drm/radeon/dpm: implement force performance level for cayman
Allows you to force a performance level via sysfs. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/ni_dpm.c38
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h2
3 files changed, 34 insertions, 7 deletions
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index a4cb99c2da85..bd96eaa3f015 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -1037,13 +1037,37 @@ static int ni_restrict_performance_levels_before_switch(struct radeon_device *rd
1037 0 : -EINVAL; 1037 0 : -EINVAL;
1038} 1038}
1039 1039
1040static int ni_unrestrict_performance_levels_after_switch(struct radeon_device *rdev) 1040int ni_dpm_force_performance_level(struct radeon_device *rdev,
1041 enum radeon_dpm_forced_level level)
1041{ 1042{
1042 if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) 1043 struct radeon_ps *rps = rdev->pm.dpm.current_ps;
1043 return -EINVAL; 1044 struct ni_ps *ps = ni_get_ps(rps);
1045 u32 levels;
1044 1046
1045 return (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) == PPSMC_Result_OK) ? 1047 if (level == RADEON_DPM_FORCED_LEVEL_HIGH) {
1046 0 : -EINVAL; 1048 if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK)
1049 return -EINVAL;
1050
1051 if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 1) != PPSMC_Result_OK)
1052 return -EINVAL;
1053 } else if (level == RADEON_DPM_FORCED_LEVEL_LOW) {
1054 if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK)
1055 return -EINVAL;
1056
1057 levels = ps->performance_level_count - 1;
1058 if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK)
1059 return -EINVAL;
1060 } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) {
1061 if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK)
1062 return -EINVAL;
1063
1064 if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK)
1065 return -EINVAL;
1066 }
1067
1068 rdev->pm.dpm.forced_level = level;
1069
1070 return 0;
1047} 1071}
1048 1072
1049static void ni_stop_smc(struct radeon_device *rdev) 1073static void ni_stop_smc(struct radeon_device *rdev)
@@ -3831,9 +3855,9 @@ int ni_dpm_set_power_state(struct radeon_device *rdev)
3831 return ret; 3855 return ret;
3832 } 3856 }
3833 3857
3834 ret = ni_unrestrict_performance_levels_after_switch(rdev); 3858 ret = ni_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO);
3835 if (ret) { 3859 if (ret) {
3836 DRM_ERROR("ni_unrestrict_performance_levels_after_switch failed\n"); 3860 DRM_ERROR("ni_dpm_force_performance_level failed\n");
3837 return ret; 3861 return ret;
3838 } 3862 }
3839 3863
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index 221a0b31e649..9c1b7b1c0268 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -1940,6 +1940,7 @@ static struct radeon_asic cayman_asic = {
1940 .get_mclk = &ni_dpm_get_mclk, 1940 .get_mclk = &ni_dpm_get_mclk,
1941 .print_power_state = &ni_dpm_print_power_state, 1941 .print_power_state = &ni_dpm_print_power_state,
1942 .debugfs_print_current_performance_level = &ni_dpm_debugfs_print_current_performance_level, 1942 .debugfs_print_current_performance_level = &ni_dpm_debugfs_print_current_performance_level,
1943 .force_performance_level = &ni_dpm_force_performance_level,
1943 }, 1944 },
1944 .pflip = { 1945 .pflip = {
1945 .pre_page_flip = &evergreen_pre_page_flip, 1946 .pre_page_flip = &evergreen_pre_page_flip,
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index a053dc1e7866..2bacc777d549 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -617,6 +617,8 @@ void ni_dpm_print_power_state(struct radeon_device *rdev,
617 struct radeon_ps *ps); 617 struct radeon_ps *ps);
618void ni_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev, 618void ni_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
619 struct seq_file *m); 619 struct seq_file *m);
620int ni_dpm_force_performance_level(struct radeon_device *rdev,
621 enum radeon_dpm_forced_level level);
620int trinity_dpm_init(struct radeon_device *rdev); 622int trinity_dpm_init(struct radeon_device *rdev);
621int trinity_dpm_enable(struct radeon_device *rdev); 623int trinity_dpm_enable(struct radeon_device *rdev);
622void trinity_dpm_disable(struct radeon_device *rdev); 624void trinity_dpm_disable(struct radeon_device *rdev);