]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/swsmu: allow asic to handle sensor type by itself
authorKevin Wang <kevin1.wang@amd.com>
Mon, 27 Jul 2020 01:08:22 +0000 (09:08 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 6 Aug 2020 20:35:56 +0000 (16:35 -0400)
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>
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c

index 2da72f333ad93101da3ddad38c826af42d939dd1..8c624f1f33baf691b7039627602da9a64a7701f9 100644 (file)
@@ -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;