From 92b44ecc89f5ee138afa332729c6e0c0b8c4cf5b Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Mon, 20 Dec 2010 15:53:54 -0800 Subject: ARM: tegra: cpufreq: Change function signature for CPU speed throttling The NCT1008 driver is now passed a function pointer from the board file's platform data to be called when alarms are asserted or deasserted. Switch to a single function for throttling enable/disable suitable for calling via the temperature alarm callback. Change-Id: Ic0eb1566a68e151216e26dfb6ed6f4bc7a273ddb Signed-off-by: Todd Poynor --- arch/arm/mach-tegra/cpu-tegra.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) (limited to 'arch/arm/mach-tegra/cpu-tegra.c') diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c index 8e86009b4ac1..c2f9ca4bffea 100644 --- a/arch/arm/mach-tegra/cpu-tegra.c +++ b/arch/arm/mach-tegra/cpu-tegra.c @@ -103,49 +103,30 @@ static void tegra_throttle_work_func(struct work_struct *work) mutex_unlock(&tegra_cpu_lock); } -/** +/* * tegra_throttling_enable * This function may sleep */ -void tegra_throttling_enable(void) +void tegra_throttling_enable(bool enable) { mutex_lock(&throttling_lock); - if (!is_throttling) { + if (enable && !is_throttling) { is_throttling = true; queue_delayed_work(workqueue, &throttle_work, NO_DELAY); - } - - mutex_unlock(&throttling_lock); -} -EXPORT_SYMBOL_GPL(tegra_throttling_enable); - -/** - * tegra_throttling_disable - * This function may sleep - */ -void tegra_throttling_disable(void) -{ - mutex_lock(&throttling_lock); - - if (is_throttling) { + } else if (!enable && is_throttling) { cancel_delayed_work_sync(&throttle_work); is_throttling = false; } mutex_unlock(&throttling_lock); } -EXPORT_SYMBOL_GPL(tegra_throttling_disable); +EXPORT_SYMBOL_GPL(tegra_throttling_enable); #ifdef CONFIG_DEBUG_FS static int throttle_debug_set(void *data, u64 val) { - if (val) { - tegra_throttling_enable(); - } else { - tegra_throttling_disable(); - } - + tegra_throttling_enable(val); return 0; } static int throttle_debug_get(void *data, u64 *val) @@ -187,6 +168,10 @@ module_exit(tegra_cpu_debug_exit); #else /* CONFIG_TEGRA_THERMAL_THROTTLE */ #define tegra_cpu_is_throttling() (0) + +void tegra_throttling_enable(bool enable) +{ +} #endif /* CONFIG_TEGRA_THERMAL_THROTTLE */ int tegra_verify_speed(struct cpufreq_policy *policy) -- cgit v1.2.3