From: Chen Liang Date: Fri, 1 Jul 2016 07:47:14 +0000 (+0800) Subject: ARM64: cpufreq_sched: implement event CPUFREQ_GOV_LIMIT for governor X-Git-Tag: firefly_0821_release~2198 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d94634b0ab1bd61cc4088de63608287938a8fec2;p=firefly-linux-kernel-4.4.55.git ARM64: cpufreq_sched: implement event CPUFREQ_GOV_LIMIT for governor If we do not limit the freqency immediately when the cpu is overheat, thermal driver will lost the control of temperature. So implement event CPUFREQ_GOV_LIMIT for governor to limit the freqency immediately. Change-Id: Id709edd377226417ead92ead2ae3d3d19b3eeabf Signed-off-by: Chen Liang --- diff --git a/kernel/sched/cpufreq_sched.c b/kernel/sched/cpufreq_sched.c index e1d208e101ed..c608a9265d6a 100644 --- a/kernel/sched/cpufreq_sched.c +++ b/kernel/sched/cpufreq_sched.c @@ -327,6 +327,20 @@ static int cpufreq_sched_stop(struct cpufreq_policy *policy) return 0; } +static int cpufreq_sched_limits(struct cpufreq_policy *policy) +{ + if (policy->max < policy->cur) + __cpufreq_driver_target(policy, + policy->max, + CPUFREQ_RELATION_H); + else if (policy->min > policy->cur) + __cpufreq_driver_target(policy, + policy->min, + CPUFREQ_RELATION_L); + + return 0; +} + static int cpufreq_sched_setup(struct cpufreq_policy *policy, unsigned int event) { @@ -340,7 +354,7 @@ static int cpufreq_sched_setup(struct cpufreq_policy *policy, case CPUFREQ_GOV_STOP: return cpufreq_sched_stop(policy); case CPUFREQ_GOV_LIMITS: - break; + return cpufreq_sched_limits(policy); } return 0; }