[PATCH 1/2] drm/radeon/kms/r600+: do not set the same voltage as current one

Rafał Miłecki zajec5 at gmail.com
Sun Jun 6 05:39:23 PDT 2010


We have similar tracking for engine and memory. We could think about some
solution for older GPUs as well, however there are not strict voltage values
set.

Signed-off-by: Rafał Miłecki <zajec5 at gmail.com>
---
 drivers/gpu/drm/radeon/evergreen.c |    8 ++++++--
 drivers/gpu/drm/radeon/r600.c      |    8 ++++++--
 drivers/gpu/drm/radeon/radeon.h    |    1 +
 drivers/gpu/drm/radeon/radeon_pm.c |    2 ++
 drivers/gpu/drm/radeon/rv770.c     |    8 ++++++--
 5 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 174f718..c444808 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -46,8 +46,12 @@ void evergreen_pm_misc(struct radeon_device *rdev)
 	struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx];
 	struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage;
 
-	if ((voltage->type == VOLTAGE_SW) && voltage->voltage)
-		radeon_atom_set_voltage(rdev, voltage->voltage);
+	if (voltage->voltage != rdev->pm.current_vddc) {
+		if ((voltage->type == VOLTAGE_SW) && voltage->voltage) {
+			radeon_atom_set_voltage(rdev, voltage->voltage);
+			rdev->pm.current_vddc = voltage->voltage;
+		}
+	}
 }
 
 void evergreen_pm_prepare(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 94c27d0..e49bebe 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -480,8 +480,12 @@ void r600_pm_misc(struct radeon_device *rdev)
 	struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx];
 	struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage;
 
-	if ((voltage->type == VOLTAGE_SW) && voltage->voltage)
-		radeon_atom_set_voltage(rdev, voltage->voltage);
+	if (voltage->voltage != rdev->pm.current_vddc) {
+		if ((voltage->type == VOLTAGE_SW) && voltage->voltage) {
+			radeon_atom_set_voltage(rdev, voltage->voltage);
+			rdev->pm.current_vddc = voltage->voltage;
+		}
+	}
 }
 
 bool r600_gui_idle(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 084221d..04bc867 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -745,6 +745,7 @@ struct radeon_pm {
 	int                     default_power_state_index;
 	u32                     current_sclk;
 	u32                     current_mclk;
+	u32                     current_vddc;
 	struct radeon_i2c_chan *i2c_bus;
 	/* selected pm method */
 	enum radeon_pm_method     pm_method;
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 0228126..a046fe7 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -381,6 +381,7 @@ void radeon_pm_suspend(struct radeon_device *rdev)
 	rdev->pm.current_clock_mode_index = -1;
 	rdev->pm.current_sclk = 0;
 	rdev->pm.current_mclk = 0;
+	rdev->pm.current_vddc = 0;
 	mutex_unlock(&rdev->pm.mutex);
 }
 
@@ -400,6 +401,7 @@ int radeon_pm_init(struct radeon_device *rdev)
 	rdev->pm.dynpm_can_downclock = true;
 	rdev->pm.current_sclk = 0;
 	rdev->pm.current_mclk = 0;
+	rdev->pm.current_vddc = 0;
 
 	if (rdev->bios) {
 		if (rdev->is_atom_bios)
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index f002848..f310fa8 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -49,8 +49,12 @@ void rv770_pm_misc(struct radeon_device *rdev)
 	struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx];
 	struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage;
 
-	if ((voltage->type == VOLTAGE_SW) && voltage->voltage)
-		radeon_atom_set_voltage(rdev, voltage->voltage);
+	if (voltage->voltage != rdev->pm.current_vddc) {
+		if ((voltage->type == VOLTAGE_SW) && voltage->voltage) {
+			radeon_atom_set_voltage(rdev, voltage->voltage);
+			rdev->pm.current_vddc = voltage->voltage;
+		}
+	}
 }
 
 /*
-- 
1.6.4.2



More information about the dri-devel mailing list