From dad4b08a9ed12f5bee7607089ffcdbb8c43a5d19 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Wed, 26 Mar 2014 15:32:50 +0800 Subject: [PATCH] rk: cpufreq: support rockchip --- drivers/cpufreq/cpufreq_interactive.c | 23 +++++++++++++++++++++++ drivers/cpufreq/cpufreq_stats.c | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index c08831720fa9..4f61467f2421 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -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); diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 038c7cca0cf3..6fac447562ae 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -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; -- 2.34.1