Please enable JavaScript.
Coggle requires JavaScript to display documents.
dvfs # (kernel/msm-3.18/drivers/cpufreq/qcom-cpufreq.c
static int set…
kernel/msm-3.18/drivers/cpufreq/qcom-cpufreq.cstatic int set_cpu_freq(struct cpufreq_policy *policy, unsigned int new_freq,unsigned int index)
{
freqs.old = policy->cur;
freqs.new = new_freq;
freqs.cpu = policy->cpu;
cpufreq_freq_transition_begin(policy, &freqs);
......
clk_set_rate(cpu_clk[policy->cpu], rate);//set cpufreq to cpu hw register
cpufreq_freq_transition_end(policy, &freqs, ret);
}
kernel/msm-3.18/drivers/cpufreq/qcom-cpufreq.cstatic int msm_cpufreq_target(struct cpufreq_policy *policy,
unsigned int target_freq,unsigned int relation)
{
struct cpufreq_frequency_table *table;
table = cpufreq_frequency_get_table(policy->cpu);
cpufreq_frequency_table_target(policy, table, target_freq, relation,&index);
set_cpu_freq(policy, table[index].frequency,table[index].driver_data);
}
kernel/msm-3.18/drivers/cpufreq/qcom-cpufreq.c
static struct cpufreq_driver msm_cpufreq_driver = {
.flags = CPUFREQ_STICKY | CPUFREQ_CONST_LOOPS,
.init = msm_cpufreq_init,
.verify = msm_cpufreq_verify,
.target = msm_cpufreq_target,
.get = msm_cpufreq_get_freq,
.name = "msm",
.attr = msm_freq_attr,
}
kernel/msm-3.18/drivers/cpufreq/qcom-cpufreq.cstatic int __init msm_cpufreq_register(void)
{
register_pm_notifier(&msm_cpufreq_pm_notifier);
cpufreq_register_driver(&msm_cpufreq_driver);
}
subsys_initcall(msm_cpufreq_register);
-
kernel/msm-3.18/drivers/cpufreq/cpufreq.c
int __cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int target_freq,unsigned int relation)
{
if (cpufreq_driver->target) {
cpufreq_driver->target(policy, target_freq, relation);
} else if(cpufreq_driver->target_index) {
__target_index(policy, freq_table, index);
}
}
kernel/msm-3.18/drivers/cpufreq/cpufreq_interactive.c
static int cpufreq_interactive_speedchange_task(void *data)
{
while (1) {
for_each_cpu(cpu, &tmp_mask) {
if (ppol->target_freq != ppol->policy->cur) {
__cpufreq_driver_target(ppol->policy,
ppol->target_freq,CPUFREQ_RELATION_H);
}}}
}
kernel/msm-3.18/drivers/cpufreq/cpufreq_interactive.c
static void cpufreq_interactive_timer(unsigned long data)
{
for_each_cpu(cpu, ppol->policy->cpus) {
update_load(cpu);
cputime_speedadj = pcpu->cputime_speedadj;
do_div(cputime_speedadj, delta_time);
t_prevlaf = (unsigned int)cputime_speedadj * 100;
prev_l = t_prevlaf / ppol->target_freq;
pcpu->loadadjfreq = max(t_prevlaf, t_predlaf);
choose_freq(ppol, prev_laf);//target_load-->target_freq
new_freq = chosen_freq;
cpufreq_frequency_table_target(&ppol->p_nolim,
ppol->freq_table,new_freq, CPUFREQ_RELATION_L,&index);
new_freq = ppol->freq_table[index].frequency;
ppol->target_freq = new_freq;
wake_up_process_no_notif(speedchange_task);
}
}
kernel/msm-3.18/drivers/cpufreq/cpufreq_interactive.cstatic void cpufreq_interactive_timer_start(
struct cpufreq_interactive_tunables *tunables, int cpu)
{
ppol->policy_timer.expires = expires;
add_timer(&ppol->policy_timer);
}
kernel/msm-3.18/drivers/cpufreq/cpufreq_interactive.cstatic int cpufreq_governor_interactive(struct cpufreq_policy *policy,
unsigned int event)
{
switch (event) {
case CPUFREQ_GOV_POLICY_INIT:
ppol = get_policyinfo(policy);
policy->governor_data = tunables;
sysfs_create_group();//create policy related sys node
cpufreq_register_notifier(&cpufreq_notifier_block,CPUFREQ_TRANSITION_NOTIFIER);
break;
case CPUFREQ_GOV_POLICY_EXIT:
policy->governor_data = NULL;
break;
case CPUFREQ_GOV_START:
ppol->policy = policy;
ppol->policy_timer.data = policy->cpu;
cpufreq_interactive_timer_start(tunables, policy->cpu);
break;
case CPUFREQ_GOV_STOP:
ppol->target_freq = 0;
break;
case CPUFREQ_GOV_LIMITS:
__cpufreq_driver_target(policy,ppol->target_freq, CPUFREQ_RELATION_L);
break;
}
}
kernel/msm-3.18/drivers/cpufreq/cpufreq_interactive.c
struct cpufreq_governor cpufreq_gov_interactive = {
{
.name = "interactive",
.governor = cpufreq_governor_interactive,
.max_transition_latency = 10000000,
.owner = THIS_MODULE,
}
- 2 more items...
kernel/msm-3.18/drivers/cpufreq/cpufreq_interactive.c
static struct cpufreq_interactive_policyinfo *get_policyinfo(struct cpufreq_policy *policy)
{
init_timer_deferrable(&ppol->policy_timer);
ppol->policy_timer.function = cpufreq_interactive_timer;
for_each_cpu(i, policy->related_cpus)
per_cpu(polinfo, i) = ppol;
}
-
kernel/msm-3.18/drivers/cpufreq/qcom-cpufreq.c
static struct notifier_block msm_cpufreq_pm_notifier = {
.notifier_call = msm_cpufreq_pm_event,
}
kernel/msm-3.18/drivers/cpufreq/qcom-cpufreq.c
static int msm_cpufreq_pm_event(struct notifier_block this,unsigned long event, void ptr)
{
switch (event) {
case PM_POST_HIBERNATION:
case PM_POST_SUSPEND:
return msm_cpufreq_resume();
case PM_HIBERNATION_PREPARE:
case PM_SUSPEND_PREPARE:
return msm_cpufreq_suspend();
default:
return NOTIFY_DONE;
}
}
kernel/msm-3.18/drivers/cpufreq/qcom-cpufreq.cstatic int msm_cpufreq_resume(void)
{
for_each_online_cpu(cpu) {
cpufreq_get_policy(&policy, cpu);
cpufreq_update_policy(cpu);
}
} #
-