diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-05-30 13:43:01 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-05-30 23:13:00 +0200 |
commit | 0fc784fb09f6db8d6650aac137daa779da25c73b (patch) | |
tree | 2896a3243e31b5a220acbad7fb11c6a828243273 /drivers/cpuidle/governor.c | |
parent | cf7eeea947efaf2348dd87542508b1d426b948cd (diff) | |
download | blackbird-obmc-linux-0fc784fb09f6db8d6650aac137daa779da25c73b.tar.gz blackbird-obmc-linux-0fc784fb09f6db8d6650aac137daa779da25c73b.zip |
cpuidle: governors: Consolidate PM QoS handling
There is some code duplication related to the PM QoS handling between
the existing cpuidle governors, so move that code to a common helper
function and call that from the governors.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle/governor.c')
-rw-r--r-- | drivers/cpuidle/governor.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c index 5d359aff3cc5..9fed1b829292 100644 --- a/drivers/cpuidle/governor.c +++ b/drivers/cpuidle/governor.c @@ -8,8 +8,10 @@ * This code is licenced under the GPL. */ -#include <linux/mutex.h> +#include <linux/cpu.h> #include <linux/cpuidle.h> +#include <linux/mutex.h> +#include <linux/pm_qos.h> #include "cpuidle.h" @@ -93,3 +95,16 @@ int cpuidle_register_governor(struct cpuidle_governor *gov) return ret; } + +/** + * cpuidle_governor_latency_req - Compute a latency constraint for CPU + * @cpu: Target CPU + */ +int cpuidle_governor_latency_req(unsigned int cpu) +{ + int global_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); + struct device *device = get_cpu_device(cpu); + int device_req = dev_pm_qos_raw_read_value(device); + + return device_req < global_req ? device_req : global_req; +} |