rk: cpufreq: support rockchip
author黄涛 <huangtao@rock-chips.com>
Wed, 26 Mar 2014 07:32:50 +0000 (15:32 +0800)
committer黄涛 <huangtao@rock-chips.com>
Wed, 26 Mar 2014 07:51:04 +0000 (15:51 +0800)
drivers/cpufreq/cpufreq_interactive.c
drivers/cpufreq/cpufreq_stats.c

index c08831720fa92d3263fa43c2fbef66240854e2ac..4f61467f2421f0851ff8b3b2f5501a9bc9fd5cb3 100644 (file)
@@ -364,6 +364,10 @@ static void cpufreq_interactive_timer(unsigned long data)
        cpu_load = loadadjfreq / pcpu->target_freq;
        boosted = tunables->boost_val || now < tunables->boostpulse_endtime;
 
+#ifdef CONFIG_ARCH_ROCKCHIP
+       pcpu->target_freq = pcpu->policy->cur;
+#endif
+
        if (cpu_load >= tunables->go_hispeed_load || boosted) {
                if (pcpu->target_freq < tunables->hispeed_freq) {
                        new_freq = tunables->hispeed_freq;
@@ -1158,6 +1162,25 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
                tunables->boostpulse_duration_val = DEFAULT_MIN_SAMPLE_TIME;
                tunables->timer_slack_val = DEFAULT_TIMER_SLACK;
 
+#ifdef CONFIG_ARCH_ROCKCHIP
+               {
+                       unsigned int index;
+                       freq_table = cpufreq_frequency_get_table(policy->cpu);
+                       tunables->hispeed_freq = policy->max;
+                       if (policy->min < 816000)
+                               tunables->hispeed_freq = 816000;
+                       else if (cpufreq_frequency_table_target(policy, freq_table, policy->min + 1, CPUFREQ_RELATION_L, &index) == 0)
+                               tunables->hispeed_freq = freq_table[index].frequency;
+                       if (policy->max > 1416000) {
+                               tunables->timer_slack_val = 20 * USEC_PER_MSEC;
+                               tunables->min_sample_time = 40 * USEC_PER_MSEC;
+                               tunables->above_hispeed_delay[0] = 80 * USEC_PER_MSEC;
+                               store_target_loads(tunables, "70 1200000:80 1416000:99", 0);
+                       }
+                       tunables->boostpulse_duration_val = 500 * USEC_PER_MSEC;
+               }
+#endif
+
                spin_lock_init(&tunables->target_loads_lock);
                spin_lock_init(&tunables->above_hispeed_delay_lock);
 
index 038c7cca0cf3ea239d84d3ae44d196b09fe368d2..6fac447562ae54115c3b7fa97d62aa84d986d1ff 100644 (file)
@@ -325,6 +325,10 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb,
        old_index = stat->last_index;
        new_index = freq_table_get_index(stat, freq->new);
 
+#ifdef CONFIG_ARCH_ROCKCHIP
+       if (old_index == -1)
+               stat->last_index = new_index;
+#endif
        /* We can't do stat->time_in_state[-1]= .. */
        if (old_index == -1 || new_index == -1)
                return 0;