From: jsg Date: Mon, 29 Jan 2024 01:58:43 +0000 (+0000) Subject: drm/amdgpu: fall back to INPUT power for AVG power via INFO IOCTL X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=da5a99b8aa74eb4fdeafb418d20a5d10b3cd939c;p=openbsd drm/amdgpu: fall back to INPUT power for AVG power via INFO IOCTL From Alex Deucher 836e236b878a385911db619b38393d624a4d7eae in linux-6.6.y/6.6.14 d02069850fc102b07ae923535d5e212f2c8a34e9 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c index e47abc6c445..be9f213f162 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c @@ -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;