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

Tom St Denis tom.stdenis at amd.com
Tue Feb 14 14:04:36 UTC 2017


On 13/02/17 07:23 PM, Samuel Pitoiset wrote:
> Totally untested but as long as read_sensor() has been recently
> implemented for dpm based boards, amdgpu_sensors can now be
> exposed.
>
> 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 | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 6f021e70f15f..1a8e3b9a2268 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3202,10 +3202,7 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf,
>  	idx = *pos >> 2;
>
>  	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
> -		return -EINVAL;
> +	r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize);
>
>  	if (size > valuesize)
>  		return -EINVAL;
>

NAK, this will oops the kernel if amdgpu.dpm=0 and on powerplay systems 
if powerplay=0.

Otherwise, it seems to work though the GPU_TEMP reads as "5000" on my 
Kaveri (meaning temp of 5C which isn't true).

I suspect the dpm code is reading the wrong register to get the temp but 
we can fix that in another change later on.

Tom


More information about the amd-gfx mailing list