cpufreq(7)_performance 功能 源码分析

driverscpufreqcpufreq_performance.c

功能

直接选用cpufreq_driver->target_index的最大档

源码分析

注册governor

cpufreq_governor_list:所有可用的cpufreq governor

1
2
3
cpufreq_gov_performance_init
cpufreq_register_governor(&cpufreq_gov_performance);
list_add(&governor->governor_list, &cpufreq_governor_list);

Policy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cpufreq_gov_performance_limits
__cpufreq_driver_target(policy, policy->max, CPUFREQ_RELATION_H); // policy->max在cpufreq_driver->init中进行设置
// 找到cpufreq_frequency_table中最接近target的index
index = cpufreq_frequency_table_target(policy, target_freq, relation);
return cpufreq_table_find_index_h(policy, target_freq);
// 根据cpufreq_frequency_table选择,例如s5pv210-cpufreq.c中该表为降序排列
return cpufreq_table_find_index_dh(policy, target_freq);
// call cpufreq_drvier->target_index
__target_index(policy, index);
cpufreq_driver->target_index(policy, index);

static struct cpufreq_gov_performance = {
.limits = cpufreq_gov_performance_limits,
};