summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorAlex Frid <afrid@nvidia.com>2011-07-09 21:33:37 -0700
committerVarun Colbert <vcolbert@nvidia.com>2011-07-22 17:35:13 -0700
commita0d977ac86e67a584a1988d8a3be8b6ee76914e1 (patch)
tree7b7ba229fce38bbb9c9038924fcf74bc4e43aec0 /arch/arm
parentccecf664be75053ce020293914aa77e71181eacd (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. Change-Id: I54531f8f919ce248b2b56f5aa56f39e2efcb568a Reviewed-on: http://git-master/r/40533 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
Diffstat (limited to 'arch/arm')
-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 2c58a4b9499d..52b5a7583663 100644
--- a/arch/arm/mach-tegra/cpu-tegra.c
+++ b/arch/arm/mach-tegra/cpu-tegra.c
@@ -57,7 +57,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 */
@@ -82,7 +81,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;
@@ -278,7 +277,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();
@@ -445,13 +444,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,
@@ -465,11 +472,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);
@@ -477,9 +479,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;