aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2012-11-29 20:27:50 -0500
committerAlex Deucher <alexander.deucher@amd.com>2013-06-27 19:15:51 -0400
commit7cf36de9eb584e7d0b4956b1c17d46a083bb30c4 (patch)
tree0bff80e8d4764b4f60f11261875ada9968b5d139
parentdrm/radeon/dpm: track whether we are on AC or battery (diff)
downloadlinux-dev-7cf36de9eb584e7d0b4956b1c17d46a083bb30c4.tar.xz
linux-dev-7cf36de9eb584e7d0b4956b1c17d46a083bb30c4.zip
drm/radeon/dpm: fixup dynamic state adjust for sumo
Use a dedicated copy of the current power state since we may have to adjust it on the fly. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/radeon/radeon.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c13
-rw-r--r--drivers/gpu/drm/radeon/sumo_dpm.c5
-rw-r--r--drivers/gpu/drm/radeon/sumo_dpm.h1
4 files changed, 19 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index db31f20e2204..0c33887ca2ba 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1289,6 +1289,7 @@ struct radeon_dpm {
struct radeon_ps *boot_ps;
/* default uvd power state */
struct radeon_ps *uvd_ps;
+ struct radeon_ps hw_ps;
enum radeon_pm_state_type state;
enum radeon_pm_state_type user_state;
u32 platform_caps;
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 79e35d6a40e3..196c65a9df3b 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -684,6 +684,17 @@ restart_search:
return NULL;
}
+static void radeon_dpm_update_requested_ps(struct radeon_device *rdev,
+ struct radeon_ps *ps)
+{
+ /* copy the ps to the hw ps and point the requested ps
+ * at the hw state in case the driver wants to modify
+ * the state dynamically.
+ */
+ rdev->pm.dpm.hw_ps = *ps;
+ rdev->pm.dpm.requested_ps = &rdev->pm.dpm.hw_ps;
+}
+
static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
{
int i;
@@ -704,7 +715,7 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
ps = radeon_dpm_pick_power_state(rdev, dpm_state);
if (ps)
- rdev->pm.dpm.requested_ps = ps;
+ radeon_dpm_update_requested_ps(rdev, ps);
else
return;
diff --git a/drivers/gpu/drm/radeon/sumo_dpm.c b/drivers/gpu/drm/radeon/sumo_dpm.c
index 7bd3fca175de..9e4248c50514 100644
--- a/drivers/gpu/drm/radeon/sumo_dpm.c
+++ b/drivers/gpu/drm/radeon/sumo_dpm.c
@@ -1072,6 +1072,11 @@ static void sumo_apply_state_adjust_rules(struct radeon_device *rdev)
u32 sclk_in_sr = pi->sys_info.min_sclk; /* ??? */
u32 i;
+ /* point to the hw copy since this function will modify the ps */
+ pi->hw_ps = *ps;
+ rdev->pm.dpm.hw_ps.ps_priv = &pi->hw_ps;
+ ps = &pi->hw_ps;
+
if (rps->class & ATOM_PPLIB_CLASSIFICATION_THERMAL)
return sumo_patch_thermal_state(rdev, ps, current_ps);
diff --git a/drivers/gpu/drm/radeon/sumo_dpm.h b/drivers/gpu/drm/radeon/sumo_dpm.h
index d041a6cf11ba..a40b62ae0957 100644
--- a/drivers/gpu/drm/radeon/sumo_dpm.h
+++ b/drivers/gpu/drm/radeon/sumo_dpm.h
@@ -129,6 +129,7 @@ struct sumo_power_info {
bool enable_dynamic_patch_ps;
bool enable_dpm;
bool enable_boost;
+ struct sumo_ps hw_ps;
};
#define SUMO_UTC_DFLT_00 0x48