drm/amdgpu: fall back to INPUT power for AVG power via INFO IOCTL
authorjsg <jsg@openbsd.org>
Mon, 29 Jan 2024 01:58:43 +0000 (01:58 +0000)
committerjsg <jsg@openbsd.org>
Mon, 29 Jan 2024 01:58:43 +0000 (01:58 +0000)
From Alex Deucher
836e236b878a385911db619b38393d624a4d7eae in linux-6.6.y/6.6.14
d02069850fc102b07ae923535d5e212f2c8a34e9 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c

index e47abc6..be9f213 100644 (file)
@@ -1026,7 +1026,12 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
                        if (amdgpu_dpm_read_sensor(adev,
                                                   AMDGPU_PP_SENSOR_GPU_AVG_POWER,
                                                   (void *)&ui32, &ui32_size)) {
-                               return -EINVAL;
+                               /* fall back to input power for backwards compat */
+                               if (amdgpu_dpm_read_sensor(adev,
+                                                          AMDGPU_PP_SENSOR_GPU_INPUT_POWER,
+                                                          (void *)&ui32, &ui32_size)) {
+                                       return -EINVAL;
+                               }
                        }
                        ui32 >>= 8;
                        break;