[PATCH v2] drm/amdgpu: expose amdgpu_sensors on pre-powerplay chips

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Feb 14 15:08:28 UTC 2017

Totally untested but as long as read_sensor() has been recently
implemented for dpm based boards, amdgpu_sensors can now be

v2: - make sure read_sensor is not NULL on dpm chips
    - keep sanity check for powerplay chips

Cc: Tom St Denis <tom.stdenis at amd.com>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 6f021e70f15f..80821b436aeb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3204,6 +3204,9 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf,
 	valuesize = sizeof(values);
 	if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->read_sensor)
 		r = adev->powerplay.pp_funcs->read_sensor(adev->powerplay.pp_handle, idx, &values[0], &valuesize);
+	else if (adev->pm.funcs && adev->pm.funcs->read_sensor)
+		r = adev->pm.funcs->read_sensor(adev, idx, &values[0],
+						&valuesize);
 		return -EINVAL;

More information about the amd-gfx mailing list