drm/amd/powerplay: add power consumption display support in debugfs
authorEric Huang <JinHuiEric.Huang@amd.com>
Tue, 24 Jan 2017 21:59:27 +0000 (16:59 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 30 Mar 2017 03:52:53 +0000 (23:52 -0400)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h

index fc4d61cf34c10a0ae8b0b6e2e2edaabd2a32bc59..8a9a75a44b626063c1561feba663e46e17ee1868 100644 (file)
@@ -1533,6 +1533,7 @@ void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
 static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *adev)
 {
        uint32_t value;
+       struct pp_gpu_power query = {0};
 
        /* sanity check PP is enabled */
        if (!(adev->powerplay.pp_funcs &&
@@ -1549,6 +1550,16 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a
                seq_printf(m, "\t%u mV (VDDGFX)\n", value);
        if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VDDNB, (void *)&value))
                seq_printf(m, "\t%u mV (VDDNB)\n", value);
+       if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GPU_POWER, (void *)&query)) {
+               seq_printf(m, "\t%u.%u W (VDDC)\n", query.vddc_power >> 8,
+                               query.vddc_power & 0xff);
+               seq_printf(m, "\t%u.%u W (VDDCI)\n", query.vddci_power >> 8,
+                               query.vddci_power & 0xff);
+               seq_printf(m, "\t%u.%u W (max GPU)\n", query.max_gpu_power >> 8,
+                               query.max_gpu_power & 0xff);
+               seq_printf(m, "\t%u.%u W (average GPU)\n", query.average_gpu_power >> 8,
+                               query.average_gpu_power & 0xff);
+       }
        seq_printf(m, "\n");
 
        /* GPU Temp */
index 97009110e011d48d86c2e1f0e046a636636fe368..ab99013eba77a632c0cc5ef97f241e7b292a2d0d 100644 (file)
@@ -46,6 +46,7 @@ enum amd_pp_sensors {
        AMDGPU_PP_SENSOR_GPU_TEMP,
        AMDGPU_PP_SENSOR_VCE_POWER,
        AMDGPU_PP_SENSOR_UVD_POWER,
+       AMDGPU_PP_SENSOR_GPU_POWER,
 };
 
 enum amd_pp_event {
@@ -295,6 +296,13 @@ struct pp_states_info {
        uint32_t states[16];
 };
 
+struct pp_gpu_power {
+       uint32_t vddc_power;
+       uint32_t vddci_power;
+       uint32_t max_gpu_power;
+       uint32_t average_gpu_power;
+};
+
 #define PP_GROUP_MASK        0xF0000000
 #define PP_GROUP_SHIFT       28