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>
This commit is contained in:
Kevin Wang 2020-07-27 09:08:22 +08:00 committed by Alex Deucher
parent 68bb3c3ff9
commit c4e0dbcb20

View File

@ -1947,6 +1947,10 @@ int smu_read_sensor(struct smu_context *smu,
mutex_lock(&smu->mutex); mutex_lock(&smu->mutex);
if (smu->ppt_funcs->read_sensor)
if (!smu->ppt_funcs->read_sensor(smu, sensor, data, size))
goto unlock;
switch (sensor) { switch (sensor) {
case AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK: case AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK:
*((uint32_t *)data) = pstate_table->gfxclk_pstate.standard * 100; *((uint32_t *)data) = pstate_table->gfxclk_pstate.standard * 100;
@ -1977,11 +1981,12 @@ int smu_read_sensor(struct smu_context *smu,
*size = 4; *size = 4;
break; break;
default: default:
if (smu->ppt_funcs->read_sensor) *size = 0;
ret = smu->ppt_funcs->read_sensor(smu, sensor, data, size); ret = -EOPNOTSUPP;
break; break;
} }
unlock:
mutex_unlock(&smu->mutex); mutex_unlock(&smu->mutex);
return ret; return ret;