diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2014-09-30 10:58:22 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-03-19 12:26:34 -0400 |
commit | 2f8e1eb7d665ca060fc93e9dfd268dee59bd8697 (patch) | |
tree | bcef8117777f356d9eb082272d5f912e72a70dae | |
parent | dbbd3c81b042ea2e87b37a6945ed8a31aaaaafec (diff) |
drm/radeon/sumo: 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>
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_asic.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_asic.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/sumo_dpm.c | 28 |
3 files changed, 32 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index 63bbd66344b0..2b72c4a77be6 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -1489,6 +1489,8 @@ static struct radeon_asic sumo_asic = { | |||
1489 | .print_power_state = &sumo_dpm_print_power_state, | 1489 | .print_power_state = &sumo_dpm_print_power_state, |
1490 | .debugfs_print_current_performance_level = &sumo_dpm_debugfs_print_current_performance_level, | 1490 | .debugfs_print_current_performance_level = &sumo_dpm_debugfs_print_current_performance_level, |
1491 | .force_performance_level = &sumo_dpm_force_performance_level, | 1491 | .force_performance_level = &sumo_dpm_force_performance_level, |
1492 | .get_current_sclk = &sumo_dpm_get_current_sclk, | ||
1493 | .get_current_mclk = &sumo_dpm_get_current_mclk, | ||
1492 | }, | 1494 | }, |
1493 | .pflip = { | 1495 | .pflip = { |
1494 | .page_flip = &evergreen_page_flip, | 1496 | .page_flip = &evergreen_page_flip, |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index dd4f8bcb9633..e2887eb4a4d5 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -589,6 +589,8 @@ void sumo_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev | |||
589 | struct seq_file *m); | 589 | struct seq_file *m); |
590 | int sumo_dpm_force_performance_level(struct radeon_device *rdev, | 590 | int sumo_dpm_force_performance_level(struct radeon_device *rdev, |
591 | enum radeon_dpm_forced_level level); | 591 | enum radeon_dpm_forced_level level); |
592 | u32 sumo_dpm_get_current_sclk(struct radeon_device *rdev); | ||
593 | u32 sumo_dpm_get_current_mclk(struct radeon_device *rdev); | ||
592 | 594 | ||
593 | /* | 595 | /* |
594 | * cayman | 596 | * cayman |
diff --git a/drivers/gpu/drm/radeon/sumo_dpm.c b/drivers/gpu/drm/radeon/sumo_dpm.c index 25fd4ced36c8..cd0862809adf 100644 --- a/drivers/gpu/drm/radeon/sumo_dpm.c +++ b/drivers/gpu/drm/radeon/sumo_dpm.c | |||
@@ -1837,6 +1837,34 @@ void sumo_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev | |||
1837 | } | 1837 | } |
1838 | } | 1838 | } |
1839 | 1839 | ||
1840 | u32 sumo_dpm_get_current_sclk(struct radeon_device *rdev) | ||
1841 | { | ||
1842 | struct sumo_power_info *pi = sumo_get_pi(rdev); | ||
1843 | struct radeon_ps *rps = &pi->current_rps; | ||
1844 | struct sumo_ps *ps = sumo_get_ps(rps); | ||
1845 | struct sumo_pl *pl; | ||
1846 | u32 current_index = | ||
1847 | (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURR_INDEX_MASK) >> | ||
1848 | CURR_INDEX_SHIFT; | ||
1849 | |||
1850 | if (current_index == BOOST_DPM_LEVEL) { | ||
1851 | pl = &pi->boost_pl; | ||
1852 | return pl->sclk; | ||
1853 | } else if (current_index >= ps->num_levels) { | ||
1854 | return 0; | ||
1855 | } else { | ||
1856 | pl = &ps->levels[current_index]; | ||
1857 | return pl->sclk; | ||
1858 | } | ||
1859 | } | ||
1860 | |||
1861 | u32 sumo_dpm_get_current_mclk(struct radeon_device *rdev) | ||
1862 | { | ||
1863 | struct sumo_power_info *pi = sumo_get_pi(rdev); | ||
1864 | |||
1865 | return pi->sys_info.bootup_uma_clk; | ||
1866 | } | ||
1867 | |||
1840 | void sumo_dpm_fini(struct radeon_device *rdev) | 1868 | void sumo_dpm_fini(struct radeon_device *rdev) |
1841 | { | 1869 | { |
1842 | int i; | 1870 | int i; |