drm/radeon/dpm: retain user selected performance level across state changes
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 23 Oct 2013 21:31:42 +0000 (17:31 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 1 Nov 2013 19:25:48 +0000 (15:25 -0400)
If the user has forced the state high or low, retain that preference
even when we switch power states.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=70654

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

index 802e57986db140515ebc146978060e153a34bd4d..2baa0fa75e36ec215d129fe9e15252837e908645 100644 (file)
@@ -923,12 +923,16 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
        radeon_dpm_post_set_power_state(rdev);
 
        if (rdev->asic->dpm.force_performance_level) {
-               if (rdev->pm.dpm.thermal_active)
+               if (rdev->pm.dpm.thermal_active) {
+                       enum radeon_dpm_forced_level level = rdev->pm.dpm.forced_level;
                        /* force low perf level for thermal */
                        radeon_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_LOW);
-               else
-                       /* otherwise, enable auto */
-                       radeon_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO);
+                       /* save the user's level */
+                       rdev->pm.dpm.forced_level = level;
+               } else {
+                       /* otherwise, user selected level */
+                       radeon_dpm_force_performance_level(rdev, rdev->pm.dpm.forced_level);
+               }
        }
 
 done: