Commit d0206985 authored by Alex Deucher's avatar Alex Deucher
Browse files

drm/amdgpu: fall back to INPUT power for AVG power via INFO IOCTL

For backwards compatibility with userspace.

Fixes: 47f1724d ("drm/amd: Introduce `AMDGPU_PP_SENSOR_GPU_INPUT_POWER`")
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2897


Reviewed-by: default avatarYang Wang <kevinyang.wang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 25852d4b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1105,8 +1105,13 @@ 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)) {
				/* 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;
		case AMDGPU_INFO_SENSOR_VDDNB: