drm/radeon/dpm: add debugfs support for SI
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 28 Jun 2013 22:02:19 +0000 (18:02 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 1 Jul 2013 20:09:06 +0000 (16:09 -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/si_dpm.c
drivers/gpu/drm/radeon/sid.h

index 5b3a122912f79743c2912d0c373276dfa475e450..a5b244dc50cae53cff2d0f7b88e2e2f382ff6721 100644 (file)
@@ -2282,6 +2282,7 @@ static struct radeon_asic si_asic = {
                .get_sclk = &ni_dpm_get_sclk,
                .get_mclk = &ni_dpm_get_mclk,
                .print_power_state = &ni_dpm_print_power_state,
+               .debugfs_print_current_performance_level = &si_dpm_debugfs_print_current_performance_level,
        },
        .pflip = {
                .pre_page_flip = &evergreen_pre_page_flip,
index 7524edb261521c38fd2c046cac9f77ef42e52f3d..6822c7aeacaadd3e37c12413d67f35981917d613 100644 (file)
@@ -677,6 +677,8 @@ int si_dpm_set_power_state(struct radeon_device *rdev);
 void si_dpm_post_set_power_state(struct radeon_device *rdev);
 void si_dpm_fini(struct radeon_device *rdev);
 void si_dpm_display_configuration_changed(struct radeon_device *rdev);
+void si_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
+                                                   struct seq_file *m);
 
 /* DCE8 - CIK */
 void dce8_bandwidth_update(struct radeon_device *rdev);
index 6918f070eb52e9912b399e87790350ef545a0a98..46e9fc56cee7826bdf4446cc184e54519ce242d8 100644 (file)
@@ -6385,3 +6385,22 @@ void si_dpm_fini(struct radeon_device *rdev)
        r600_free_extended_power_table(rdev);
 }
 
+void si_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
+                                                   struct seq_file *m)
+{
+       struct radeon_ps *rps = rdev->pm.dpm.current_ps;
+       struct ni_ps *ps = ni_get_ps(rps);
+       struct rv7xx_pl *pl;
+       u32 current_index =
+               (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_STATE_INDEX_MASK) >>
+               CURRENT_STATE_INDEX_SHIFT;
+
+       if (current_index >= ps->performance_level_count) {
+               seq_printf(m, "invalid dpm profile %d\n", current_index);
+       } else {
+               pl = &ps->performance_levels[current_index];
+               seq_printf(m, "uvd    vclk: %d dclk: %d\n", rps->vclk, rps->dclk);
+               seq_printf(m, "power level %d    sclk: %u mclk: %u vddc: %u vddci: %u pcie gen: %u\n",
+                          current_index, pl->sclk, pl->mclk, pl->vddc, pl->vddci, pl->pcie_gen + 1);
+       }
+}
index 299d657d0168cdc5ede4396dee4fed1f5c45179d..12a20eb77d0c533b201b2bdb10beb5cc2adcd61c 100644 (file)
 #       define GFX_CLK_OFF_ACPI_D3                        (1 << 13)
 #       define DYN_LIGHT_SLEEP_EN                         (1 << 14)
 
+#define TARGET_AND_CURRENT_PROFILE_INDEX                  0x798
+#       define CURRENT_STATE_INDEX_MASK                   (0xf << 4)
+#       define CURRENT_STATE_INDEX_SHIFT                  4
+
 #define CG_FTV                                            0x7bc
 
 #define CG_FFCT_0                                         0x7c0