drm/radeon/sumo: implement get_current_sclk/mclk
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 30 Sep 2014 14:58:22 +0000 (10:58 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 19 Mar 2015 16:26:34 +0000 (12:26 -0400)
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>
drivers/gpu/drm/radeon/radeon_asic.c
drivers/gpu/drm/radeon/radeon_asic.h
drivers/gpu/drm/radeon/sumo_dpm.c

index 63bbd66344b000693f494a0cfb4c1273abaf74e2..2b72c4a77be63b41d7f9b2ecddaaf673696ec3d6 100644 (file)
@@ -1489,6 +1489,8 @@ static struct radeon_asic sumo_asic = {
                .print_power_state = &sumo_dpm_print_power_state,
                .debugfs_print_current_performance_level = &sumo_dpm_debugfs_print_current_performance_level,
                .force_performance_level = &sumo_dpm_force_performance_level,
+               .get_current_sclk = &sumo_dpm_get_current_sclk,
+               .get_current_mclk = &sumo_dpm_get_current_mclk,
        },
        .pflip = {
                .page_flip = &evergreen_page_flip,
index dd4f8bcb96335b913cc835be602c65d44278c2e7..e2887eb4a4d5fdd61799696abc58292e44a0daaa 100644 (file)
@@ -589,6 +589,8 @@ void sumo_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev
                                                      struct seq_file *m);
 int sumo_dpm_force_performance_level(struct radeon_device *rdev,
                                     enum radeon_dpm_forced_level level);
+u32 sumo_dpm_get_current_sclk(struct radeon_device *rdev);
+u32 sumo_dpm_get_current_mclk(struct radeon_device *rdev);
 
 /*
  * cayman
index 25fd4ced36c83491b4cbfb841a57f30c3ae65130..cd0862809adff2f2749f90eff0b85007cc5e1d4f 100644 (file)
@@ -1837,6 +1837,34 @@ void sumo_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev
        }
 }
 
+u32 sumo_dpm_get_current_sclk(struct radeon_device *rdev)
+{
+       struct sumo_power_info *pi = sumo_get_pi(rdev);
+       struct radeon_ps *rps = &pi->current_rps;
+       struct sumo_ps *ps = sumo_get_ps(rps);
+       struct sumo_pl *pl;
+       u32 current_index =
+               (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURR_INDEX_MASK) >>
+               CURR_INDEX_SHIFT;
+
+       if (current_index == BOOST_DPM_LEVEL) {
+               pl = &pi->boost_pl;
+               return pl->sclk;
+       } else if (current_index >= ps->num_levels) {
+               return 0;
+       } else {
+               pl = &ps->levels[current_index];
+               return pl->sclk;
+       }
+}
+
+u32 sumo_dpm_get_current_mclk(struct radeon_device *rdev)
+{
+       struct sumo_power_info *pi = sumo_get_pi(rdev);
+
+       return pi->sys_info.bootup_uma_clk;
+}
+
 void sumo_dpm_fini(struct radeon_device *rdev)
 {
        int i;