[PATCH 3/4] drm/amd/powerplay: get raven current sclk and mclk

Deucher, Alexander Alexander.Deucher at amd.com
Sat Sep 30 01:32:02 UTC 2017


> -----Original Message-----
> From: Evan Quan [mailto:evan.quan at amd.com]
> Sent: Friday, September 29, 2017 9:10 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander; Zhang, Jerry; Quan, Evan
> Subject: [PATCH 3/4] drm/amd/powerplay: get raven current sclk and mclk
> 
> Change-Id: I17120a53bc3cebd8cc7eb9f3d83124905632a409
> Signed-off-by: Evan Quan <evan.quan at amd.com>

Add a better patch description.  Something like:
Add sclk and mclk support to the read sensors interface

With that fixed:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c | 28
> ++++++++++++++++++++++++--
>  1 file changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c
> b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c
> index e2ad41d..a20a6fe 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c
> @@ -850,13 +850,37 @@ static int rv_thermal_get_temperature(struct
> pp_hwmgr *hwmgr)
>  static int rv_read_sensor(struct pp_hwmgr *hwmgr, int idx,
>  			  void *value, int *size)
>  {
> +	uint32_t sclk, mclk;
> +	int ret = 0;
> +
>  	switch (idx) {
> +	case AMDGPU_PP_SENSOR_GFX_SCLK:
> +		ret = smum_send_msg_to_smc(hwmgr->smumgr,
> PPSMC_MSG_GetGfxclkFrequency);
> +		if (!ret) {
> +			rv_read_arg_from_smc(hwmgr->smumgr, &sclk);
> +			/* in units of 10KHZ */
> +			*((uint32_t *)value) = sclk * 100;
> +			*size = 4;
> +		}
> +		break;
> +	case AMDGPU_PP_SENSOR_GFX_MCLK:
> +		ret = smum_send_msg_to_smc(hwmgr->smumgr,
> PPSMC_MSG_GetFclkFrequency);
> +		if (!ret) {
> +			rv_read_arg_from_smc(hwmgr->smumgr, &mclk);
> +			/* in units of 10KHZ */
> +			*((uint32_t *)value) = mclk * 100;
> +			*size = 4;
> +		}
> +		break;
>  	case AMDGPU_PP_SENSOR_GPU_TEMP:
>  		*((uint32_t *)value) =
> rv_thermal_get_temperature(hwmgr);
> -		return 0;
> +		break;
>  	default:
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		break;
>  	}
> +
> +	return ret;
>  }
> 
>  static const struct pp_hwmgr_func rv_hwmgr_funcs = {
> --
> 2.7.4



More information about the amd-gfx mailing list