cpufreq: add core param to limit kernel boot cpufreq

PD#165090: add freqmax0 and freqmax1 to limit kernel boot cpufreq
add freqmax0=1000000 to bootargs, and boot freq of cluster0 will be
limited to 1G.

Change-Id: I5cb44727f74c574669663887473a80f87ddf61a7
Signed-off-by: jianxin.pan <jianxin.pan@amlogic.com>
This commit is contained in:
jianxin.pan
2018-05-29 14:10:23 +08:00
committed by Yixun Lan
parent 874ce1dbf4
commit bd6ee8587a

View File

@@ -35,6 +35,13 @@
#endif
#include <trace/events/power.h>
#ifdef CONFIG_AMLOGIC_MODIFY
static unsigned int freqmax0;
core_param(freqmax0, freqmax0, uint, 0644);
static unsigned int freqmax1;
core_param(freqmax1, freqmax1, uint, 0644);
#endif
static LIST_HEAD(cpufreq_policy_list);
static inline bool policy_is_inactive(struct cpufreq_policy *policy)
@@ -1283,6 +1290,19 @@ static int cpufreq_online(unsigned int cpu)
down_write(&policy->rwsem);
#ifdef CONFIG_AMLOGIC_MODIFY
if (topology_physical_package_id(cpu) == 0 && freqmax0) {
if (freqmax0 >= policy->min && freqmax0 < policy->max)
policy->max = freqmax0;
pr_notice(" freqmax0:%d, max:%d\n", freqmax0, policy->max);
}
if (topology_physical_package_id(cpu) == 1 && freqmax1) {
if (freqmax1 >= policy->min && freqmax1 < policy->max)
policy->max = freqmax1;
pr_notice(" freqmax1:%d, max:%d\n", freqmax1, policy->max);
}
#endif
if (new_policy) {
/* related_cpus should at least include policy->cpus. */
cpumask_copy(policy->related_cpus, policy->cpus);