aboutsummaryrefslogtreecommitdiff
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorInderpal Singh <inderpal.singh@linaro.org>2012-01-06 17:06:50 +0530
committerTushar Behera <tushar.behera@linaro.org>2012-05-17 10:31:07 +0530
commite24b75d7de62491feee4ac0e73769738f1363610 (patch)
tree6e08f16f891413208a3d9671fac79dab4bc126a1 /drivers/cpufreq
parent9565c7c7bcf63166675dfcb7cbbdcae5892ba733 (diff)
ARM: EXYNOS: Add reboot notifier in cpufreq driver
Because of the mismatch between frequencies set by u-boot and the kernel, the soft reboot used to hang. With reboot notifier, before rebooting, this patch switches to same frequency set by the uboot at boot time. Signed-off-by: Inderpal Singh <inderpal.singh@linaro.org> [tushar.behera@linaro.org: Merged changes with exynos-cpufreq.c] Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/exynos-cpufreq.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index b243a7ee01f..7ebd6b7bdd1 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -17,6 +17,8 @@
#include <linux/regulator/consumer.h>
#include <linux/cpufreq.h>
#include <linux/suspend.h>
+#include <linux/notifier.h>
+#include <linux/reboot.h>
#include <mach/cpufreq.h>
@@ -204,6 +206,31 @@ static struct notifier_block exynos_cpufreq_nb = {
.notifier_call = exynos_cpufreq_pm_notifier,
};
+static int exynos_cpufreq_reboot_notifier(struct notifier_block *this,
+ unsigned long code, void *_cmd)
+{
+ struct cpufreq_policy *policy = cpufreq_cpu_get(0); /* boot CPU */
+ mutex_lock(&cpufreq_lock);
+
+ if (frequency_locked)
+ goto out;
+ frequency_locked = true;
+
+ if (locking_frequency) {
+ mutex_unlock(&cpufreq_lock);
+ exynos_target(policy, locking_frequency, CPUFREQ_RELATION_H);
+ mutex_lock(&cpufreq_lock);
+ }
+
+out:
+ mutex_unlock(&cpufreq_lock);
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block exynos_cpufreq_reboot_nb = {
+ .notifier_call = exynos_cpufreq_reboot_notifier,
+};
+
static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy)
{
policy->cur = policy->min = policy->max = exynos_getspeed(policy->cpu);
@@ -276,6 +303,7 @@ static int __init exynos_cpufreq_init(void)
}
register_pm_notifier(&exynos_cpufreq_nb);
+ register_reboot_notifier(&exynos_cpufreq_reboot_nb);
if (cpufreq_register_driver(&exynos_driver)) {
pr_err("%s: failed to register cpufreq driver\n", __func__);