From 2e0ea2b0e9922753302d5b33a6a825ee09eaa7b7 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Wed, 26 Feb 2014 13:42:04 +0100 Subject: [PATCH] cpufreq:LAB:ondemand: Ondemand governor adjustments necessary for correct LAB operation Ondemand code needs to be slightly modified for LAB governor operation. The biggest problem is with the update_sampling_rate function, which shall not be executed with wrong governor. Change-Id: I149204bda15b11546c57a77a75a51c4f4f8522b8 Signed-off-by: Lukasz Majewski --- drivers/cpufreq/cpufreq_governor.h | 3 +++ drivers/cpufreq/cpufreq_ondemand.c | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index a3cf7a8..256c50d4 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h @@ -290,6 +290,9 @@ void od_unregister_powersave_bias_handler(void); void od_dbs_timer(struct work_struct *work); int od_init(struct dbs_data *dbs_data); void od_exit(struct dbs_data *dbs_data); +void od_check_cpu(int cpu, unsigned int load_freq); +void update_sampling_rate(struct dbs_data *dbs_data, + unsigned int new_rate); extern struct od_ops od_ops; diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index d49855d..85c4f56 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -37,7 +37,7 @@ #define MIN_FREQUENCY_UP_THRESHOLD (11) #define MAX_FREQUENCY_UP_THRESHOLD (100) -static DEFINE_PER_CPU(struct od_cpu_dbs_info_s, od_cpu_dbs_info); +DEFINE_PER_CPU(struct od_cpu_dbs_info_s, od_cpu_dbs_info); struct od_ops od_ops; @@ -162,7 +162,7 @@ static void dbs_freq_increase(struct cpufreq_policy *p, unsigned int freq) * (default), then we try to increase frequency. Else, we adjust the frequency * proportional to load. */ -static void od_check_cpu(int cpu, unsigned int load) +void od_check_cpu(int cpu, unsigned int load) { struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu); struct cpufreq_policy *policy = dbs_info->cdbs.cur_policy; @@ -247,6 +247,9 @@ max_delay: /************************** sysfs interface ************************/ static struct common_dbs_data od_dbs_cdata; +#ifdef CONFIG_CPU_FREQ_GOV_LAB +extern struct cpufreq_governor cpufreq_gov_lab; +#endif /** * update_sampling_rate - update sampling rate effective immediately if needed. * @new_rate: new sampling rate @@ -260,7 +263,7 @@ static struct common_dbs_data od_dbs_cdata; * reducing the sampling rate, we need to make the new value effective * immediately. */ -static void update_sampling_rate(struct dbs_data *dbs_data, +void update_sampling_rate(struct dbs_data *dbs_data, unsigned int new_rate) { struct od_dbs_tuners *od_tuners = dbs_data->tuners; @@ -277,7 +280,12 @@ static void update_sampling_rate(struct dbs_data *dbs_data, policy = cpufreq_cpu_get(cpu); if (!policy) continue; +#ifdef CONFIG_CPU_FREQ_GOV_LAB + if (policy->governor != &cpufreq_gov_ondemand && + policy->governor != &cpufreq_gov_lab) { +#else if (policy->governor != &cpufreq_gov_ondemand) { +#endif cpufreq_cpu_put(policy); continue; } -- 2.7.4