From 04de428e09fd502d1c7a78c69f0f98b945fc15bf Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=99=88=E4=BA=AE?= Date: Sun, 4 May 2014 02:00:29 -0700 Subject: [PATCH] Revert "cpufreq: set core volt to 1.0V when reboot, and make sure core rate will not change any more" reboot limit core rate at cpufreq.c may happen while ddr freq limit core rate. it cause dvfs_clk_enable_limit restore wrong min && max; This reverts commit 4cc5af311c35403c6fe6bce846c890dc04902418. --- arch/arm/mach-rockchip/ddr_freq.c | 10 +--------- drivers/cpufreq/rockchip-cpufreq.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-rockchip/ddr_freq.c b/arch/arm/mach-rockchip/ddr_freq.c index 41d2d04eeb9e..c371a042fcaa 100755 --- a/arch/arm/mach-rockchip/ddr_freq.c +++ b/arch/arm/mach-rockchip/ddr_freq.c @@ -78,9 +78,6 @@ static noinline void ddrfreq_clear_sys_status(int status) static void ddrfreq_mode(bool auto_self_refresh, unsigned long *target_rate, char *name) { - unsigned int min_rate, max_rate; - int freq_limit_en; - ddr.mode = name; if (auto_self_refresh != ddr.auto_self_refresh) { ddr_set_auto_self_refresh(auto_self_refresh); @@ -88,17 +85,12 @@ static void ddrfreq_mode(bool auto_self_refresh, unsigned long *target_rate, cha dprintk(DEBUG_DDR, "change auto self refresh to %d when %s\n", auto_self_refresh, name); } if (*target_rate != dvfs_clk_get_rate(ddr.clk_dvfs_node)) { - freq_limit_en = dvfs_clk_get_limit(clk_cpu_dvfs_node, &min_rate, &max_rate); dvfs_clk_enable_limit(clk_cpu_dvfs_node, 600000000, -1); if (dvfs_clk_set_rate(ddr.clk_dvfs_node, *target_rate) == 0) { *target_rate = dvfs_clk_get_rate(ddr.clk_dvfs_node); dprintk(DEBUG_DDR, "change freq to %lu MHz when %s\n", *target_rate / MHZ, name); } - if (freq_limit_en) { - dvfs_clk_enable_limit(clk_cpu_dvfs_node, min_rate, max_rate); - } else { - dvfs_clk_disable_limit(clk_cpu_dvfs_node); - } + dvfs_clk_enable_limit(clk_cpu_dvfs_node, 0, -1); } } diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c index c8496eabba66..22a7baedd8a5 100644 --- a/drivers/cpufreq/rockchip-cpufreq.c +++ b/drivers/cpufreq/rockchip-cpufreq.c @@ -109,7 +109,6 @@ static unsigned int get_freq_from_table(unsigned int max_freq) static int cpufreq_notifier_policy(struct notifier_block *nb, unsigned long val, void *data) { - static unsigned int min_rate=0, max_rate=-1; struct cpufreq_policy *policy = data; if (val != CPUFREQ_ADJUST) @@ -117,10 +116,9 @@ static int cpufreq_notifier_policy(struct notifier_block *nb, unsigned long val, if (cpufreq_is_ondemand(policy)) { FREQ_DBG("queue work\n"); - dvfs_clk_enable_limit(clk_cpu_dvfs_node, min_rate, max_rate); + dvfs_clk_enable_limit(clk_cpu_dvfs_node, 0, ~0); } else { FREQ_DBG("cancel work\n"); - dvfs_clk_get_limit(clk_cpu_dvfs_node, &min_rate, &max_rate); dvfs_clk_disable_limit(clk_cpu_dvfs_node); } @@ -387,10 +385,14 @@ static struct notifier_block cpufreq_pm_notifier = { static int cpufreq_reboot_notifier_event(struct notifier_block *this, unsigned long event, void *ptr) { + struct cpufreq_policy *policy = cpufreq_cpu_get(0); - dvfs_clk_enable_limit(clk_cpu_dvfs_node, 1000*suspend_freq, 1000*suspend_freq); - printk("cpufreq: reboot set core rate=%lu, volt=%d\n", dvfs_clk_get_rate(clk_cpu_dvfs_node), - regulator_get_voltage(clk_cpu_dvfs_node->vd->regulator)); + if (policy) { + is_booting = false; + policy->cur++; + cpufreq_driver_target(policy, suspend_freq, DISABLE_FURTHER_CPUFREQ | CPUFREQ_RELATION_H); + cpufreq_cpu_put(policy); + } return NOTIFY_OK; } -- 2.34.1