Commit 85a44ecd authored by Shirish S's avatar Shirish S Committed by Alex Deucher

drm/amdgpu/powerplay/smu10: refactor AMDGPU_PP_SENSOR_GPU_LOAD

refactor AMDGPU_PP_SENSOR_GPU_LOAD to ensure code consistency with other
commands
Signed-off-by: default avatarShirish S <shirish.s@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 15e16daa
......@@ -1297,19 +1297,18 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
*size = 4;
break;
case AMDGPU_PP_SENSOR_GPU_LOAD:
if (has_gfx_busy) {
if (!has_gfx_busy)
ret = -EOPNOTSUPP;
else {
ret = smum_send_msg_to_smc(hwmgr,
PPSMC_MSG_GetGfxBusy,
&activity_percent);
if (!ret)
activity_percent = activity_percent > 100 ? 100 : activity_percent;
*((uint32_t *)value) = min(activity_percent, (u32)100);
else
return -EIO;
*((uint32_t *)value) = activity_percent;
return 0;
} else {
return -EOPNOTSUPP;
ret = -EIO;
}
break;
default:
ret = -EOPNOTSUPP;
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment