]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd/amdgpu: fix the GPU power print error in pm info
authorLi Ma <li.ma@amd.com>
Tue, 24 Oct 2023 10:28:24 +0000 (18:28 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 26 Oct 2023 23:04:45 +0000 (19:04 -0400)
Modify the print format of the fractional part to avoid display error.

Signed-off-by: Li Ma <li.ma@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/amdgpu_pm.c

index 358bb5e485f23463d039905289c2601d211f0e4b..517b9fb4624c4586406fb5c883f5c6b775bf2c9f 100644 (file)
@@ -4290,10 +4290,10 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a
                seq_printf(m, "\t%u mV (VDDNB)\n", value);
        size = sizeof(uint32_t);
        if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GPU_AVG_POWER, (void *)&query, &size))
-               seq_printf(m, "\t%u.%u W (average GPU)\n", query >> 8, query & 0xff);
+               seq_printf(m, "\t%u.%02u W (average GPU)\n", query >> 8, query & 0xff);
        size = sizeof(uint32_t);
        if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GPU_INPUT_POWER, (void *)&query, &size))
-               seq_printf(m, "\t%u.%u W (current GPU)\n", query >> 8, query & 0xff);
+               seq_printf(m, "\t%u.%02u W (current GPU)\n", query >> 8, query & 0xff);
        size = sizeof(value);
        seq_printf(m, "\n");