diff options
author | Kevin Wang <kevin1.wang@amd.com> | 2020-07-27 09:08:22 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2020-08-06 16:35:56 -0400 |
commit | c4e0dbcb201a79639e5e74f456d8313893a259f5 (patch) | |
tree | 1843d7f6045ef7977bef8be65d18d0b212f5c0fc | |
parent | 68bb3c3ff9d92645488382c7261de7d477f638e9 (diff) | |
download | linux-stable-c4e0dbcb201a79639e5e74f456d8313893a259f5.tar.gz linux-stable-c4e0dbcb201a79639e5e74f456d8313893a259f5.tar.bz2 linux-stable-c4e0dbcb201a79639e5e74f456d8313893a259f5.zip |
drm/amd/swsmu: allow asic to handle sensor type by itself
1. allow asic to handle sensor type by itself.
2. if not, use smu common sensor to handle it.
Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c index 2da72f333ad9..8c624f1f33ba 100644 --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c @@ -1947,6 +1947,10 @@ int smu_read_sensor(struct smu_context *smu, mutex_lock(&smu->mutex); + if (smu->ppt_funcs->read_sensor) + if (!smu->ppt_funcs->read_sensor(smu, sensor, data, size)) + goto unlock; + switch (sensor) { case AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK: *((uint32_t *)data) = pstate_table->gfxclk_pstate.standard * 100; @@ -1977,11 +1981,12 @@ int smu_read_sensor(struct smu_context *smu, *size = 4; break; default: - if (smu->ppt_funcs->read_sensor) - ret = smu->ppt_funcs->read_sensor(smu, sensor, data, size); + *size = 0; + ret = -EOPNOTSUPP; break; } +unlock: mutex_unlock(&smu->mutex); return ret; |