diff options
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 20 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 9 |
2 files changed, 28 insertions, 1 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 86e69b7f9122..56c433e64d58 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1274,6 +1274,26 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, | |||
1274 | } | 1274 | } |
1275 | EXPORT_SYMBOL_GPL(cpufreq_driver_target); | 1275 | EXPORT_SYMBOL_GPL(cpufreq_driver_target); |
1276 | 1276 | ||
1277 | int cpufreq_driver_getavg(struct cpufreq_policy *policy) | ||
1278 | { | ||
1279 | int ret = 0; | ||
1280 | |||
1281 | policy = cpufreq_cpu_get(policy->cpu); | ||
1282 | if (!policy) | ||
1283 | return -EINVAL; | ||
1284 | |||
1285 | mutex_lock(&policy->lock); | ||
1286 | |||
1287 | if (cpu_online(policy->cpu) && cpufreq_driver->getavg) | ||
1288 | ret = cpufreq_driver->getavg(policy->cpu); | ||
1289 | |||
1290 | mutex_unlock(&policy->lock); | ||
1291 | |||
1292 | cpufreq_cpu_put(policy); | ||
1293 | return ret; | ||
1294 | } | ||
1295 | EXPORT_SYMBOL_GPL(cpufreq_driver_getavg); | ||
1296 | |||
1277 | /* | 1297 | /* |
1278 | * Locking: Must be called with the lock_cpu_hotplug() lock held | 1298 | * Locking: Must be called with the lock_cpu_hotplug() lock held |
1279 | * when "event" is CPUFREQ_GOV_LIMITS | 1299 | * when "event" is CPUFREQ_GOV_LIMITS |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index bf8aa45d4f01..291cfe9400a1 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -393,8 +393,15 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) | |||
393 | * policy. To be safe, we focus 10 points under the threshold. | 393 | * policy. To be safe, we focus 10 points under the threshold. |
394 | */ | 394 | */ |
395 | if (load < (dbs_tuners_ins.up_threshold - 10)) { | 395 | if (load < (dbs_tuners_ins.up_threshold - 10)) { |
396 | unsigned int freq_next = (policy->cur * load) / | 396 | unsigned int freq_next, freq_cur; |
397 | |||
398 | freq_cur = cpufreq_driver_getavg(policy); | ||
399 | if (!freq_cur) | ||
400 | freq_cur = policy->cur; | ||
401 | |||
402 | freq_next = (freq_cur * load) / | ||
397 | (dbs_tuners_ins.up_threshold - 10); | 403 | (dbs_tuners_ins.up_threshold - 10); |
404 | |||
398 | if (!dbs_tuners_ins.powersave_bias) { | 405 | if (!dbs_tuners_ins.powersave_bias) { |
399 | __cpufreq_driver_target(policy, freq_next, | 406 | __cpufreq_driver_target(policy, freq_next, |
400 | CPUFREQ_RELATION_L); | 407 | CPUFREQ_RELATION_L); |