summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/cpu-tegra.c
diff options
context:
space:
mode:
authorAlex Frid <afrid@nvidia.com>2011-07-09 21:33:37 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:47:48 -0800
commitec8491e25fe2d34a991b42463aea0472a0c85b9b (patch)
treee8a1013777b25ee49edb1f127b228a3a5400d42d /arch/arm/mach-tegra/cpu-tegra.c
parent5148ccbfc900ba1152f2c9adb8f8ec5d6fc051d3 (diff)
ARM: tegra: clock: Unify CPU set rate paths
Made sure that CPU thermal and edp limits are applied on all CPU set rate paths: cpufreq governor, thermal throttling, edp notification, power management notification. Also included auto-hotplug governor state update in all these paths (current code does not apply the limits, or does not include auto-hotplug on some rate change paths). One exception - keep current functionality for suspend notification: set pre-defined CPU rate, and force auto-hotplug idle state. Original-Change-Id: I54531f8f919ce248b2b56f5aa56f39e2efcb568a Reviewed-on: http://git-master/r/40533 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: R1471a5f318644fa5a7f436d8ed73c12de8b76245
Diffstat (limited to 'arch/arm/mach-tegra/cpu-tegra.c')
-rw-r--r--arch/arm/mach-tegra/cpu-tegra.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c
index 154a4056bc27..746add6661d6 100644
--- a/arch/arm/mach-tegra/cpu-tegra.c
+++ b/arch/arm/mach-tegra/cpu-tegra.c
@@ -55,7 +55,6 @@ static bool is_suspended;
static int suspend_index;
unsigned int tegra_getspeed(unsigned int cpu);
-static int tegra_update_cpu_speed(unsigned long rate);
#ifdef CONFIG_TEGRA_THERMAL_THROTTLE
/* CPU frequency is gradually lowered when throttling is enabled */
@@ -80,7 +79,7 @@ static void tegra_throttle_work_func(struct work_struct *work)
throttle_index = throttle_next_index;
if (freq_table[throttle_index].frequency < current_freq)
- tegra_update_cpu_speed(freq_table[throttle_index].frequency);
+ tegra_cpu_set_speed_cap(NULL);
if (throttle_index > throttle_lowest_index) {
throttle_next_index = throttle_index - 1;
@@ -276,7 +275,7 @@ static int tegra_cpu_edp_notify(
cpu_speed = tegra_getspeed(0);
new_speed = edp_governor_speed(cpu_speed);
if (new_speed < cpu_speed) {
- ret = tegra_update_cpu_speed(new_speed);
+ ret = tegra_cpu_set_speed_cap(NULL);
if (ret) {
cpu_clear(cpu, edp_cpumask);
edp_update_limit();
@@ -443,13 +442,21 @@ unsigned long tegra_cpu_highest_speed(void) {
int tegra_cpu_set_speed_cap(unsigned int *speed_cap)
{
+ int ret = 0;
unsigned int new_speed = tegra_cpu_highest_speed();
+ if (is_suspended)
+ return -EBUSY;
+
new_speed = throttle_governor_speed(new_speed);
new_speed = edp_governor_speed(new_speed);
if (speed_cap)
*speed_cap = new_speed;
- return tegra_update_cpu_speed(new_speed);
+
+ ret = tegra_update_cpu_speed(new_speed);
+ if (ret == 0)
+ tegra_auto_hotplug_governor(new_speed, false);
+ return ret;
}
static int tegra_target(struct cpufreq_policy *policy,
@@ -463,11 +470,6 @@ static int tegra_target(struct cpufreq_policy *policy,
mutex_lock(&tegra_cpu_lock);
- if (is_suspended) {
- ret = -EBUSY;
- goto out;
- }
-
cpufreq_frequency_table_target(policy, freq_table, target_freq,
relation, &idx);
@@ -475,9 +477,7 @@ static int tegra_target(struct cpufreq_policy *policy,
target_cpu_speed[policy->cpu] = freq;
ret = tegra_cpu_set_speed_cap(&new_speed);
- if (ret == 0)
- tegra_auto_hotplug_governor(new_speed, false);
-out:
+
mutex_unlock(&tegra_cpu_lock);
return ret;