2010/6/6 Rafał Miłecki <[email protected]>:
> 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 <[email protected]>
I actually had almost the exact same patch in my tree (broken out from
my voltage step patch), I just hadn't gotten around to sending it.
Mine is against drm-linus and has the default voltage level set. See
attached.
Alex
> ---
> 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
>
>
From 043d35d6dca6f9c967bd9fc70abd47516e0649ad Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Fri, 4 Jun 2010 12:45:22 -0400
Subject: [PATCH] drm/radeon/kms/pm: track current voltage
track the current voltage level and avoid setting it
if the requested voltage is already set.
Signed-off-by: Alex Deucher <[email protected]>
---
drivers/gpu/drm/radeon/evergreen.c | 7 +++++--
drivers/gpu/drm/radeon/r600.c | 8 +++++---
drivers/gpu/drm/radeon/radeon.h | 1 +
drivers/gpu/drm/radeon/radeon_atombios.c | 1 +
drivers/gpu/drm/radeon/radeon_pm.c | 1 +
drivers/gpu/drm/radeon/rv770.c | 7 +++++--
6 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 2fa10a2..86a89d5 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -62,8 +62,11 @@ void evergreen_pm_misc(struct radeon_device *rdev)
struct radeon_power_state *ps = &rdev->pm.power_state[requested_index];
struct radeon_voltage *voltage = &ps->clock_info[0].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 668e750..d1c4c3d 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -576,9 +576,11 @@ void r600_pm_misc(struct radeon_device *rdev)
struct radeon_power_state *ps = &rdev->pm.power_state[requested_index];
struct radeon_voltage *voltage = &ps->clock_info[0].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 8b35a3b..67eea10 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -758,6 +758,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_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 821c319..0616e39 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -1977,6 +1977,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
rdev->pm.current_power_state_index = rdev->pm.default_power_state_index;
rdev->pm.current_clock_mode_index = 0;
+ rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage;
}
void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable)
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 19a796d..1547796 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -474,6 +474,7 @@ void radeon_pm_resume(struct radeon_device *rdev)
rdev->pm.current_clock_mode_index = 0;
rdev->pm.current_sclk = rdev->clock.default_sclk;
rdev->pm.current_mclk = rdev->clock.default_mclk;
+ rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage;
mutex_unlock(&rdev->pm.mutex);
radeon_pm_compute_clocks(rdev);
}
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index c89d192..ca56a4d 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -63,8 +63,11 @@ void rv770_pm_misc(struct radeon_device *rdev)
struct radeon_power_state *ps = &rdev->pm.power_state[requested_index];
struct radeon_voltage *voltage = &ps->clock_info[0].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.7.0.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel