aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Huang <JinHuiEric.Huang@amd.com>2017-01-24 16:59:27 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-03-29 23:52:53 -0400
commit4f9afc9bd23fce85f2022af50d0127a64121bb37 (patch)
treea8ce6bdc1230be1f5405f2f4f6266addab7e14c3
parentcd7b0c66ce35e8693a0018b4ce0bc59f46f97bd1 (diff)
drm/amd/powerplay: add power consumption display support in debugfs
The additional output are: vddc power in Watt; vddci power in Watt; max gpu power in Watt; average gpu power in Watt. Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c11
-rw-r--r--drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h8
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index fc4d61cf34c1..8a9a75a44b62 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1533,6 +1533,7 @@ void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
1533static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *adev) 1533static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *adev)
1534{ 1534{
1535 uint32_t value; 1535 uint32_t value;
1536 struct pp_gpu_power query = {0};
1536 1537
1537 /* sanity check PP is enabled */ 1538 /* sanity check PP is enabled */
1538 if (!(adev->powerplay.pp_funcs && 1539 if (!(adev->powerplay.pp_funcs &&
@@ -1549,6 +1550,16 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a
1549 seq_printf(m, "\t%u mV (VDDGFX)\n", value); 1550 seq_printf(m, "\t%u mV (VDDGFX)\n", value);
1550 if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VDDNB, (void *)&value)) 1551 if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VDDNB, (void *)&value))
1551 seq_printf(m, "\t%u mV (VDDNB)\n", value); 1552 seq_printf(m, "\t%u mV (VDDNB)\n", value);
1553 if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GPU_POWER, (void *)&query)) {
1554 seq_printf(m, "\t%u.%u W (VDDC)\n", query.vddc_power >> 8,
1555 query.vddc_power & 0xff);
1556 seq_printf(m, "\t%u.%u W (VDDCI)\n", query.vddci_power >> 8,
1557 query.vddci_power & 0xff);
1558 seq_printf(m, "\t%u.%u W (max GPU)\n", query.max_gpu_power >> 8,
1559 query.max_gpu_power & 0xff);
1560 seq_printf(m, "\t%u.%u W (average GPU)\n", query.average_gpu_power >> 8,
1561 query.average_gpu_power & 0xff);
1562 }
1552 seq_printf(m, "\n"); 1563 seq_printf(m, "\n");
1553 1564
1554 /* GPU Temp */ 1565 /* GPU Temp */
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h b/drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h
index 97009110e011..ab99013eba77 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h
@@ -46,6 +46,7 @@ enum amd_pp_sensors {
46 AMDGPU_PP_SENSOR_GPU_TEMP, 46 AMDGPU_PP_SENSOR_GPU_TEMP,
47 AMDGPU_PP_SENSOR_VCE_POWER, 47 AMDGPU_PP_SENSOR_VCE_POWER,
48 AMDGPU_PP_SENSOR_UVD_POWER, 48 AMDGPU_PP_SENSOR_UVD_POWER,
49 AMDGPU_PP_SENSOR_GPU_POWER,
49}; 50};
50 51
51enum amd_pp_event { 52enum amd_pp_event {
@@ -295,6 +296,13 @@ struct pp_states_info {
295 uint32_t states[16]; 296 uint32_t states[16];
296}; 297};
297 298
299struct pp_gpu_power {
300 uint32_t vddc_power;
301 uint32_t vddci_power;
302 uint32_t max_gpu_power;
303 uint32_t average_gpu_power;
304};
305
298#define PP_GROUP_MASK 0xF0000000 306#define PP_GROUP_MASK 0xF0000000
299#define PP_GROUP_SHIFT 28 307#define PP_GROUP_SHIFT 28
300 308