drm/radeon/dpm: make sure dc performance level limits are valid (BTC-SI) (v2)
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 30 Aug 2013 20:18:35 +0000 (16:18 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 30 Aug 2013 20:31:24 +0000 (16:31 -0400)
Check to make sure the dc limits are valid before using them.
Some systems may not have a dc limits table.  In that case just
use the ac limits.  This fixes hangs on systems when the power
state is changed when on battery (dc) due to invalid performance
state parameters.

Should fix:
https://bugs.freedesktop.org/show_bug.cgi?id=68708

v2: fix up limits in dpm_init()

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/radeon/btc_dpm.c
drivers/gpu/drm/radeon/ni_dpm.c
drivers/gpu/drm/radeon/si_dpm.c

index 9953e1fbc46d74e53adf50eab2eb05e602287f54..084e69414fd15405d03417b0e73ab8e8f1488c58 100644 (file)
@@ -2699,6 +2699,12 @@ int btc_dpm_init(struct radeon_device *rdev)
        else
                rdev->pm.dpm.dyn_state.sclk_mclk_delta = 10000;
 
+       /* make sure dc limits are valid */
+       if ((rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.sclk == 0) ||
+           (rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.mclk == 0))
+               rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc =
+                       rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac;
+
        return 0;
 }
 
index 88aa41e341afaac784348b5697aaece35c9ea8dd..f7b625c9e0e9cfa355ad27b0f1f2952bc9de8427 100644 (file)
@@ -4272,6 +4272,12 @@ int ni_dpm_init(struct radeon_device *rdev)
 
        ni_pi->use_power_boost_limit = true;
 
+       /* make sure dc limits are valid */
+       if ((rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.sclk == 0) ||
+           (rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.mclk == 0))
+               rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc =
+                       rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac;
+
        return 0;
 }
 
index 51966f4590944c12439a37466e57b52474d8f267..5be9b4e723507ea1992df820b96aef9fec8de5b9 100644 (file)
@@ -6449,6 +6449,12 @@ int si_dpm_init(struct radeon_device *rdev)
 
        si_initialize_powertune_defaults(rdev);
 
+       /* make sure dc limits are valid */
+       if ((rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.sclk == 0) ||
+           (rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.mclk == 0))
+               rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc =
+                       rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac;
+
        return 0;
 }