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);
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);
}
- dvfs_clk_enable_limit(clk_cpu_dvfs_node, 0, -1);
+ 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);
+ }
}
}
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)
if (cpufreq_is_ondemand(policy)) {
FREQ_DBG("queue work\n");
- dvfs_clk_enable_limit(clk_cpu_dvfs_node, 0, ~0);
+ dvfs_clk_enable_limit(clk_cpu_dvfs_node, min_rate, max_rate);
} 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);
}
static int cpufreq_reboot_notifier_event(struct notifier_block *this, unsigned long event, void *ptr)
{
- struct cpufreq_policy *policy = cpufreq_cpu_get(0);
- if (policy) {
- is_booting = false;
- policy->cur++;
- cpufreq_driver_target(policy, suspend_freq, DISABLE_FURTHER_CPUFREQ | CPUFREQ_RELATION_H);
- cpufreq_cpu_put(policy);
- }
+ 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));
return NOTIFY_OK;
}