mirror of
https://github.com/torvalds/linux.git
synced 2026-06-09 07:03:37 +02:00
PM / devfreq: rockchip_dmc: Get policy when need to increase cpu frequency
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com> Change-Id: I60d1e7b129b56502d054f041a29438bd37e917ae
This commit is contained in:
parent
c12aebd032
commit
a2328c4f99
|
|
@ -397,32 +397,35 @@ static int rockchip_dmcfreq_target(struct device *dev, unsigned long *freq,
|
||||||
* Do this before taking the policy rwsem to avoid deadlocks between the
|
* Do this before taking the policy rwsem to avoid deadlocks between the
|
||||||
* mutex that is locked/unlocked in cpu_hotplug_disable/enable. And it
|
* mutex that is locked/unlocked in cpu_hotplug_disable/enable. And it
|
||||||
* can also avoid deadlocks between the mutex that is locked/unlocked
|
* can also avoid deadlocks between the mutex that is locked/unlocked
|
||||||
* in get/put_online_cpus (such as store_scaling_max_freq()).
|
* in cpus_read_lock/unlock (such as store_scaling_max_freq()).
|
||||||
*/
|
*/
|
||||||
get_online_cpus();
|
cpus_read_lock();
|
||||||
|
|
||||||
/*
|
if (dmcfreq->min_cpu_freq) {
|
||||||
* Go to specified cpufreq and block other cpufreq changes since
|
/*
|
||||||
* set_rate needs to complete during vblank.
|
* Go to specified cpufreq and block other cpufreq changes since
|
||||||
*/
|
* set_rate needs to complete during vblank.
|
||||||
cpu_cur = raw_smp_processor_id();
|
*/
|
||||||
policy = cpufreq_cpu_get(cpu_cur);
|
cpu_cur = raw_smp_processor_id();
|
||||||
if (!policy) {
|
policy = cpufreq_cpu_acquire(cpu_cur);
|
||||||
dev_err(dev, "cpu%d policy NULL\n", cpu_cur);
|
if (!policy) {
|
||||||
goto cpufreq;
|
dev_err(dev, "cpu%d policy NULL\n", cpu_cur);
|
||||||
}
|
goto cpufreq;
|
||||||
down_write(&policy->rwsem);
|
}
|
||||||
cpufreq_cur = cpufreq_quick_get(cpu_cur);
|
cpufreq_cur = cpufreq_quick_get(cpu_cur);
|
||||||
|
|
||||||
/* If we're thermally throttled; don't change; */
|
/* If we're thermally throttled; don't change; */
|
||||||
if (dmcfreq->min_cpu_freq && cpufreq_cur < dmcfreq->min_cpu_freq) {
|
if (cpufreq_cur < dmcfreq->min_cpu_freq) {
|
||||||
if (policy->max >= dmcfreq->min_cpu_freq) {
|
if (policy->max >= dmcfreq->min_cpu_freq) {
|
||||||
__cpufreq_driver_target(policy, dmcfreq->min_cpu_freq,
|
__cpufreq_driver_target(policy,
|
||||||
CPUFREQ_RELATION_L);
|
dmcfreq->min_cpu_freq,
|
||||||
is_cpufreq_changed = true;
|
CPUFREQ_RELATION_L);
|
||||||
} else {
|
is_cpufreq_changed = true;
|
||||||
dev_dbg(dev, "CPU may too slow for DMC (%d MHz)\n",
|
} else {
|
||||||
policy->max);
|
dev_dbg(dev,
|
||||||
|
"CPU may too slow for DMC (%d MHz)\n",
|
||||||
|
policy->max);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -503,13 +506,14 @@ static int rockchip_dmcfreq_target(struct device *dev, unsigned long *freq,
|
||||||
|
|
||||||
dmcfreq->volt = target_volt;
|
dmcfreq->volt = target_volt;
|
||||||
out:
|
out:
|
||||||
if (is_cpufreq_changed)
|
if (dmcfreq->min_cpu_freq) {
|
||||||
__cpufreq_driver_target(policy, cpufreq_cur,
|
if (is_cpufreq_changed)
|
||||||
CPUFREQ_RELATION_L);
|
__cpufreq_driver_target(policy, cpufreq_cur,
|
||||||
up_write(&policy->rwsem);
|
CPUFREQ_RELATION_L);
|
||||||
cpufreq_cpu_put(policy);
|
cpufreq_cpu_release(policy);
|
||||||
|
}
|
||||||
cpufreq:
|
cpufreq:
|
||||||
put_online_cpus();
|
cpus_read_unlock();
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user