Skip to content

Commit

Permalink
drm/amdgpu/powerplay/smu10: refactor AMDGPU_PP_SENSOR_GPU_LOAD
Browse files Browse the repository at this point in the history
refactor AMDGPU_PP_SENSOR_GPU_LOAD to ensure code consistency with other
commands

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Shirish S committed Mar 22, 2021
1 parent ccceccf commit 1c12ae8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1c12ae8

Please sign in to comment.