drm/radeon/dpm: add debugfs support for ON/LN
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 28 Jun 2013 14:47:56 +0000 (10:47 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 1 Jul 2013 20:08:41 +0000 (16:08 -0400)
This allows you to look at the current DPM state via
debugfs.

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 a2a34f86434becba3529a300a87040f83ae59dbb..6d4304cce83fe6be39bc1ff2656f09d46f9de88b 100644 (file)
@@ -1638,6 +1638,7 @@ static struct radeon_asic sumo_asic = {
                .get_sclk = &sumo_dpm_get_sclk,
                .get_mclk = &sumo_dpm_get_mclk,
                .print_power_state = &sumo_dpm_print_power_state,
+               .debugfs_print_current_performance_level = &sumo_dpm_debugfs_print_current_performance_level,
        },
        .pflip = {
                .pre_page_flip = &evergreen_pre_page_flip,
index 39f5d96d7c49527f55b6f197b36050482f554b6c..958d30f3306606e278e4b7097d1cb6384739898f 100644 (file)
@@ -565,6 +565,8 @@ u32 sumo_dpm_get_sclk(struct radeon_device *rdev, bool low);
 u32 sumo_dpm_get_mclk(struct radeon_device *rdev, bool low);
 void sumo_dpm_print_power_state(struct radeon_device *rdev,
                                struct radeon_ps *ps);
+void sumo_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
+                                                     struct seq_file *m);
 
 /*
  * cayman
index 0c3d7526cda54ec76bd5b642378040c1fc397ba0..68fefb916582aa729049e5f68c0639718fb563a5 100644 (file)
@@ -1752,6 +1752,34 @@ void sumo_dpm_print_power_state(struct radeon_device *rdev,
        r600_dpm_print_ps_status(rdev, rps);
 }
 
+void sumo_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
+                                                     struct seq_file *m)
+{
+       struct sumo_power_info *pi = sumo_get_pi(rdev);
+       struct radeon_ps *rps = rdev->pm.dpm.current_ps;
+       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;
+               seq_printf(m, "uvd    vclk: %d dclk: %d\n", rps->vclk, rps->dclk);
+               seq_printf(m, "power level %d    sclk: %u vddc: %u\n",
+                          current_index, pl->sclk,
+                          sumo_convert_voltage_index_to_value(rdev, pl->vddc_index));
+       } else if (current_index >= ps->num_levels) {
+               seq_printf(m, "invalid dpm profile %d\n", current_index);
+       } else {
+               pl = &ps->levels[current_index];
+               seq_printf(m, "uvd    vclk: %d dclk: %d\n", rps->vclk, rps->dclk);
+               seq_printf(m, "power level %d    sclk: %u vddc: %u\n",
+                          current_index, pl->sclk,
+                          sumo_convert_voltage_index_to_value(rdev, pl->vddc_index));
+       }
+}
+
 void sumo_dpm_fini(struct radeon_device *rdev)
 {
        int i;