drm/radeon: disable force performance state when thermal state is active
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 23 Oct 2013 21:22:29 +0000 (17:22 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 1 Nov 2013 19:25:47 +0000 (15:25 -0400)
If the thermal state is active, we are in the lowest performance level
to cool down the chip.  Don't let the user force it higher.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/radeon_pm.c

index 3ddd2c8ed9287d83e13bca8c4d25d7c9da492356..802e57986db140515ebc146978060e153a34bd4d 100644 (file)
@@ -508,17 +508,21 @@ static ssize_t radeon_set_dpm_forced_performance_level(struct device *dev,
        } else if (strncmp("auto", buf, strlen("auto")) == 0) {
                level = RADEON_DPM_FORCED_LEVEL_AUTO;
        } else {
-               mutex_unlock(&rdev->pm.mutex);
                count = -EINVAL;
                goto fail;
        }
        if (rdev->asic->dpm.force_performance_level) {
+               if (rdev->pm.dpm.thermal_active) {
+                       count = -EINVAL;
+                       goto fail;
+               }
                ret = radeon_dpm_force_performance_level(rdev, level);
                if (ret)
                        count = -EINVAL;
        }
-       mutex_unlock(&rdev->pm.mutex);
 fail:
+       mutex_unlock(&rdev->pm.mutex);
+
        return count;
 }