aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2013-06-28 09:28:39 -0400
committerAlex Deucher <alexander.deucher@amd.com>2013-07-01 16:08:15 -0400
commit1316b79256062f7a2e66f0833dcb9728ec748805 (patch)
tree5f4b90cfa115ec92e5ffc7806ae21140c9f4097a
parent7ad8d0687bb5030c3328bc7229a3183ce179ab25 (diff)
drm/radeon/dpm: add infrastructure to support debugfs info
This lays the frameworks to report realtime power level feedback. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/radeon/radeon.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c40
2 files changed, 29 insertions, 13 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 7e3fef4e6938..f51807f04f65 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1667,6 +1667,7 @@ struct radeon_asic {
1667 u32 (*get_sclk)(struct radeon_device *rdev, bool low); 1667 u32 (*get_sclk)(struct radeon_device *rdev, bool low);
1668 u32 (*get_mclk)(struct radeon_device *rdev, bool low); 1668 u32 (*get_mclk)(struct radeon_device *rdev, bool low);
1669 void (*print_power_state)(struct radeon_device *rdev, struct radeon_ps *ps); 1669 void (*print_power_state)(struct radeon_device *rdev, struct radeon_ps *ps);
1670 void (*debugfs_print_current_performance_level)(struct radeon_device *rdev, struct seq_file *m);
1670 } dpm; 1671 } dpm;
1671 /* pageflipping */ 1672 /* pageflipping */
1672 struct { 1673 struct {
@@ -2433,6 +2434,7 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v);
2433#define radeon_dpm_get_sclk(rdev, l) rdev->asic->dpm.get_sclk((rdev), (l)) 2434#define radeon_dpm_get_sclk(rdev, l) rdev->asic->dpm.get_sclk((rdev), (l))
2434#define radeon_dpm_get_mclk(rdev, l) rdev->asic->dpm.get_mclk((rdev), (l)) 2435#define radeon_dpm_get_mclk(rdev, l) rdev->asic->dpm.get_mclk((rdev), (l))
2435#define radeon_dpm_print_power_state(rdev, ps) rdev->asic->dpm.print_power_state((rdev), (ps)) 2436#define radeon_dpm_print_power_state(rdev, ps) rdev->asic->dpm.print_power_state((rdev), (ps))
2437#define radeon_dpm_debugfs_print_current_performance_level(rdev, m) rdev->asic->dpm.debugfs_print_current_performance_level((rdev), (m))
2436 2438
2437/* Common functions */ 2439/* Common functions */
2438/* AGP */ 2440/* AGP */
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 9737baeb711d..075f2fa56897 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -1062,6 +1062,11 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev)
1062 ret = device_create_file(rdev->dev, &dev_attr_power_method); 1062 ret = device_create_file(rdev->dev, &dev_attr_power_method);
1063 if (ret) 1063 if (ret)
1064 DRM_ERROR("failed to create device file for power method\n"); 1064 DRM_ERROR("failed to create device file for power method\n");
1065
1066 if (radeon_debugfs_pm_init(rdev)) {
1067 DRM_ERROR("Failed to register debugfs file for dpm!\n");
1068 }
1069
1065 DRM_INFO("radeon: dpm initialized\n"); 1070 DRM_INFO("radeon: dpm initialized\n");
1066 } 1071 }
1067 1072
@@ -1389,19 +1394,28 @@ static int radeon_debugfs_pm_info(struct seq_file *m, void *data)
1389 struct drm_device *dev = node->minor->dev; 1394 struct drm_device *dev = node->minor->dev;
1390 struct radeon_device *rdev = dev->dev_private; 1395 struct radeon_device *rdev = dev->dev_private;
1391 1396
1392 seq_printf(m, "default engine clock: %u0 kHz\n", rdev->pm.default_sclk); 1397 if (rdev->pm.dpm_enabled) {
1393 /* radeon_get_engine_clock is not reliable on APUs so just print the current clock */ 1398 mutex_lock(&rdev->pm.mutex);
1394 if ((rdev->family >= CHIP_PALM) && (rdev->flags & RADEON_IS_IGP)) 1399 if (rdev->asic->dpm.debugfs_print_current_performance_level)
1395 seq_printf(m, "current engine clock: %u0 kHz\n", rdev->pm.current_sclk); 1400 radeon_dpm_debugfs_print_current_performance_level(rdev, m);
1396 else 1401 else
1397 seq_printf(m, "current engine clock: %u0 kHz\n", radeon_get_engine_clock(rdev)); 1402 seq_printf(m, "Unsupported\n");
1398 seq_printf(m, "default memory clock: %u0 kHz\n", rdev->pm.default_mclk); 1403 mutex_unlock(&rdev->pm.mutex);
1399 if (rdev->asic->pm.get_memory_clock) 1404 } else {
1400 seq_printf(m, "current memory clock: %u0 kHz\n", radeon_get_memory_clock(rdev)); 1405 seq_printf(m, "default engine clock: %u0 kHz\n", rdev->pm.default_sclk);
1401 if (rdev->pm.current_vddc) 1406 /* radeon_get_engine_clock is not reliable on APUs so just print the current clock */
1402 seq_printf(m, "voltage: %u mV\n", rdev->pm.current_vddc); 1407 if ((rdev->family >= CHIP_PALM) && (rdev->flags & RADEON_IS_IGP))
1403 if (rdev->asic->pm.get_pcie_lanes) 1408 seq_printf(m, "current engine clock: %u0 kHz\n", rdev->pm.current_sclk);
1404 seq_printf(m, "PCIE lanes: %d\n", radeon_get_pcie_lanes(rdev)); 1409 else
1410 seq_printf(m, "current engine clock: %u0 kHz\n", radeon_get_engine_clock(rdev));
1411 seq_printf(m, "default memory clock: %u0 kHz\n", rdev->pm.default_mclk);
1412 if (rdev->asic->pm.get_memory_clock)
1413 seq_printf(m, "current memory clock: %u0 kHz\n", radeon_get_memory_clock(rdev));
1414 if (rdev->pm.current_vddc)
1415 seq_printf(m, "voltage: %u mV\n", rdev->pm.current_vddc);
1416 if (rdev->asic->pm.get_pcie_lanes)
1417 seq_printf(m, "PCIE lanes: %d\n", radeon_get_pcie_lanes(rdev));
1418 }
1405 1419
1406 return 0; 1420 return 0;
1407} 1421}