aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2014-09-30 11:21:23 -0400
committerAlex Deucher <alexander.deucher@amd.com>2015-03-19 12:26:36 -0400
commit9b23bad03263c5496bac2cbb2c2630cb3b8b38be (patch)
tree72fb80e60891350eba25817a06c3c9bd66d067c7 /drivers/gpu/drm
parent7ce9cdaec35db4c13f2f34dcb63d8bf6f290ffd0 (diff)
drm/radeon/kv: implement get_current_sclk/mclk
Will be used for exposing current clocks via INFO ioctl. Tested-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/radeon/kv_dpm.c23
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h2
3 files changed, 27 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index 0e236d067d66..2d71da448487 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -2820,6 +2820,29 @@ void kv_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
2820 } 2820 }
2821} 2821}
2822 2822
2823u32 kv_dpm_get_current_sclk(struct radeon_device *rdev)
2824{
2825 struct kv_power_info *pi = kv_get_pi(rdev);
2826 u32 current_index =
2827 (RREG32_SMC(TARGET_AND_CURRENT_PROFILE_INDEX) & CURR_SCLK_INDEX_MASK) >>
2828 CURR_SCLK_INDEX_SHIFT;
2829 u32 sclk;
2830
2831 if (current_index >= SMU__NUM_SCLK_DPM_STATE) {
2832 return 0;
2833 } else {
2834 sclk = be32_to_cpu(pi->graphics_level[current_index].SclkFrequency);
2835 return sclk;
2836 }
2837}
2838
2839u32 kv_dpm_get_current_mclk(struct radeon_device *rdev)
2840{
2841 struct kv_power_info *pi = kv_get_pi(rdev);
2842
2843 return pi->sys_info.bootup_uma_clk;
2844}
2845
2823void kv_dpm_print_power_state(struct radeon_device *rdev, 2846void kv_dpm_print_power_state(struct radeon_device *rdev,
2824 struct radeon_ps *rps) 2847 struct radeon_ps *rps)
2825{ 2848{
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index ce0cbd5823e9..466a7715e286 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -2249,6 +2249,8 @@ static struct radeon_asic kv_asic = {
2249 .force_performance_level = &kv_dpm_force_performance_level, 2249 .force_performance_level = &kv_dpm_force_performance_level,
2250 .powergate_uvd = &kv_dpm_powergate_uvd, 2250 .powergate_uvd = &kv_dpm_powergate_uvd,
2251 .enable_bapm = &kv_dpm_enable_bapm, 2251 .enable_bapm = &kv_dpm_enable_bapm,
2252 .get_current_sclk = &kv_dpm_get_current_sclk,
2253 .get_current_mclk = &kv_dpm_get_current_mclk,
2252 }, 2254 },
2253 .pflip = { 2255 .pflip = {
2254 .page_flip = &evergreen_page_flip, 2256 .page_flip = &evergreen_page_flip,
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index bab229377264..4259daf94d91 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -908,6 +908,8 @@ int kv_dpm_force_performance_level(struct radeon_device *rdev,
908 enum radeon_dpm_forced_level level); 908 enum radeon_dpm_forced_level level);
909void kv_dpm_powergate_uvd(struct radeon_device *rdev, bool gate); 909void kv_dpm_powergate_uvd(struct radeon_device *rdev, bool gate);
910void kv_dpm_enable_bapm(struct radeon_device *rdev, bool enable); 910void kv_dpm_enable_bapm(struct radeon_device *rdev, bool enable);
911u32 kv_dpm_get_current_sclk(struct radeon_device *rdev);
912u32 kv_dpm_get_current_mclk(struct radeon_device *rdev);
911 913
912/* uvd v1.0 */ 914/* uvd v1.0 */
913uint32_t uvd_v1_0_get_rptr(struct radeon_device *rdev, 915uint32_t uvd_v1_0_get_rptr(struct radeon_device *rdev,