aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2013-06-28 10:06:26 -0400
committerAlex Deucher <alexander.deucher@amd.com>2013-07-01 16:08:32 -0400
commitbd210d11cd37bee3da729e56288b5b4a038f88bd (patch)
tree06209ecc536ee057b14f30b76e9414f6ce50ba14
parent242916a5ee55a0ed49a2c74ee4d835fe9d8ca463 (diff)
drm/radeon/dpm: add debugfs support for 7xx/evergreen/btc
This allows you to look at the current DPM state via debugfs. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h2
-rw-r--r--drivers/gpu/drm/radeon/rv770_dpm.c30
-rw-r--r--drivers/gpu/drm/radeon/rv770d.h4
4 files changed, 39 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index 58d4cc5c7c97..a2a34f86434b 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -1392,6 +1392,7 @@ static struct radeon_asic rv770_asic = {
1392 .get_sclk = &rv770_dpm_get_sclk, 1392 .get_sclk = &rv770_dpm_get_sclk,
1393 .get_mclk = &rv770_dpm_get_mclk, 1393 .get_mclk = &rv770_dpm_get_mclk,
1394 .print_power_state = &rv770_dpm_print_power_state, 1394 .print_power_state = &rv770_dpm_print_power_state,
1395 .debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1395 }, 1396 },
1396 .pflip = { 1397 .pflip = {
1397 .pre_page_flip = &rs600_pre_page_flip, 1398 .pre_page_flip = &rs600_pre_page_flip,
@@ -1514,6 +1515,7 @@ static struct radeon_asic evergreen_asic = {
1514 .get_sclk = &rv770_dpm_get_sclk, 1515 .get_sclk = &rv770_dpm_get_sclk,
1515 .get_mclk = &rv770_dpm_get_mclk, 1516 .get_mclk = &rv770_dpm_get_mclk,
1516 .print_power_state = &rv770_dpm_print_power_state, 1517 .print_power_state = &rv770_dpm_print_power_state,
1518 .debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1517 }, 1519 },
1518 .pflip = { 1520 .pflip = {
1519 .pre_page_flip = &evergreen_pre_page_flip, 1521 .pre_page_flip = &evergreen_pre_page_flip,
@@ -1758,6 +1760,7 @@ static struct radeon_asic btc_asic = {
1758 .get_sclk = &btc_dpm_get_sclk, 1760 .get_sclk = &btc_dpm_get_sclk,
1759 .get_mclk = &btc_dpm_get_mclk, 1761 .get_mclk = &btc_dpm_get_mclk,
1760 .print_power_state = &rv770_dpm_print_power_state, 1762 .print_power_state = &rv770_dpm_print_power_state,
1763 .debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1761 }, 1764 },
1762 .pflip = { 1765 .pflip = {
1763 .pre_page_flip = &evergreen_pre_page_flip, 1766 .pre_page_flip = &evergreen_pre_page_flip,
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 6b1ede11ed20..39f5d96d7c49 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -476,6 +476,8 @@ u32 rv770_dpm_get_sclk(struct radeon_device *rdev, bool low);
476u32 rv770_dpm_get_mclk(struct radeon_device *rdev, bool low); 476u32 rv770_dpm_get_mclk(struct radeon_device *rdev, bool low);
477void rv770_dpm_print_power_state(struct radeon_device *rdev, 477void rv770_dpm_print_power_state(struct radeon_device *rdev,
478 struct radeon_ps *ps); 478 struct radeon_ps *ps);
479void rv770_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
480 struct seq_file *m);
479 481
480/* 482/*
481 * evergreen 483 * evergreen
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c
index 7f6fa6221234..2436b5c7e66e 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.c
+++ b/drivers/gpu/drm/radeon/rv770_dpm.c
@@ -2430,6 +2430,36 @@ void rv770_dpm_print_power_state(struct radeon_device *rdev,
2430 r600_dpm_print_ps_status(rdev, rps); 2430 r600_dpm_print_ps_status(rdev, rps);
2431} 2431}
2432 2432
2433void rv770_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
2434 struct seq_file *m)
2435{
2436 struct radeon_ps *rps = rdev->pm.dpm.current_ps;
2437 struct rv7xx_ps *ps = rv770_get_ps(rps);
2438 struct rv7xx_pl *pl;
2439 u32 current_index =
2440 (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_PROFILE_INDEX_MASK) >>
2441 CURRENT_PROFILE_INDEX_SHIFT;
2442
2443 if (current_index > 2) {
2444 seq_printf(m, "invalid dpm profile %d\n", current_index);
2445 } else {
2446 if (current_index == 0)
2447 pl = &ps->low;
2448 else if (current_index == 1)
2449 pl = &ps->medium;
2450 else /* current_index == 2 */
2451 pl = &ps->high;
2452 seq_printf(m, "uvd vclk: %d dclk: %d\n", rps->vclk, rps->dclk);
2453 if (rdev->family >= CHIP_CEDAR) {
2454 seq_printf(m, "power level %d sclk: %u mclk: %u vddc: %u vddci: %u\n",
2455 current_index, pl->sclk, pl->mclk, pl->vddc, pl->vddci);
2456 } else {
2457 seq_printf(m, "power level %d sclk: %u mclk: %u vddc: %u\n",
2458 current_index, pl->sclk, pl->mclk, pl->vddc);
2459 }
2460 }
2461}
2462
2433void rv770_dpm_fini(struct radeon_device *rdev) 2463void rv770_dpm_fini(struct radeon_device *rdev)
2434{ 2464{
2435 int i; 2465 int i;
diff --git a/drivers/gpu/drm/radeon/rv770d.h b/drivers/gpu/drm/radeon/rv770d.h
index 784eeaf315c3..6bef2b7d601b 100644
--- a/drivers/gpu/drm/radeon/rv770d.h
+++ b/drivers/gpu/drm/radeon/rv770d.h
@@ -207,6 +207,10 @@
207# define MUX_TCLK_TO_XCLK (1 << 8) 207# define MUX_TCLK_TO_XCLK (1 << 8)
208# define XTALIN_DIVIDE (1 << 9) 208# define XTALIN_DIVIDE (1 << 9)
209 209
210#define TARGET_AND_CURRENT_PROFILE_INDEX 0x66c
211# define CURRENT_PROFILE_INDEX_MASK (0xf << 4)
212# define CURRENT_PROFILE_INDEX_SHIFT 4
213
210#define S0_VID_LOWER_SMIO_CNTL 0x678 214#define S0_VID_LOWER_SMIO_CNTL 0x678
211#define S1_VID_LOWER_SMIO_CNTL 0x67c 215#define S1_VID_LOWER_SMIO_CNTL 0x67c
212#define S2_VID_LOWER_SMIO_CNTL 0x680 216#define S2_VID_LOWER_SMIO_CNTL 0x680