From 34b810143f7de87b16e6110ed24fb0818a776b88 Mon Sep 17 00:00:00 2001 From: Park Bumgyu Date: Wed, 17 Jan 2018 10:39:43 +0900 Subject: [PATCH] [COMMON] pm_qos: add pm_qos_class for cpu Change-Id: Iebb3ff8c074c45d7604bb73fa84bb4ae34d4d09b Signed-off-by: Park Bumgyu --- include/linux/pm_qos.h | 10 +++++ kernel/power/qos.c | 84 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 1 deletion(-) diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 7b2919afe017..9c2d429ac7b4 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -14,6 +14,12 @@ enum { PM_QOS_RESERVED = 0, PM_QOS_CPU_DMA_LATENCY, PM_QOS_NETWORK_LATENCY, + PM_QOS_CLUSTER0_FREQ_MIN, + PM_QOS_CLUSTER0_FREQ_MAX, + PM_QOS_CLUSTER1_FREQ_MIN, + PM_QOS_CLUSTER1_FREQ_MAX, + PM_QOS_CPU_ONLINE_MIN, + PM_QOS_CPU_ONLINE_MAX, PM_QOS_DEVICE_THROUGHPUT, PM_QOS_INTCAM_THROUGHPUT, #ifdef CONFIG_ARM_EXYNOS_DEVFREQ_DEBUG @@ -85,6 +91,10 @@ enum pm_qos_flags_status { #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) #define PM_QOS_LATENCY_ANY ((s32)(~(__u32)0 >> 1)) +#define PM_QOS_CPU_FREQ_MIN_DEFAULT_VALUE 0 +#define PM_QOS_CPU_FREQ_MAX_DEFAULT_VALUE INT_MAX +#define PM_QOS_CPU_ONLINE_MIN_DEFAULT_VALUE 1 +#define PM_QOS_CPU_ONLINE_MAX_DEFAULT_VALUE NR_CPUS #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) #define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1) diff --git a/kernel/power/qos.c b/kernel/power/qos.c index c63e1c5ee1a5..60f027b8c559 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -91,7 +91,6 @@ static struct pm_qos_object network_lat_pm_qos = { .name = "network_latency", }; - static BLOCKING_NOTIFIER_HEAD(device_throughput_notifier); static struct pm_qos_constraints device_tput_constraints = { .list = PLIST_HEAD_INIT(device_tput_constraints.list), @@ -203,6 +202,83 @@ static struct pm_qos_object memory_bandwidth_pm_qos = { .name = "memory_bandwidth", }; +static BLOCKING_NOTIFIER_HEAD(cluster1_freq_min_notifier); +static struct pm_qos_constraints cluster1_freq_min_constraints = { + .list = PLIST_HEAD_INIT(cluster1_freq_min_constraints.list), + .target_value = PM_QOS_CPU_FREQ_MIN_DEFAULT_VALUE, + .default_value = PM_QOS_CPU_FREQ_MIN_DEFAULT_VALUE, + .type = PM_QOS_MAX, + .notifiers = &cluster1_freq_min_notifier, +}; +static struct pm_qos_object cluster1_freq_min_pm_qos = { + .constraints = &cluster1_freq_min_constraints, + .name = "cluster1_freq_min", +}; + +static BLOCKING_NOTIFIER_HEAD(cluster1_freq_max_notifier); +static struct pm_qos_constraints cluster1_freq_max_constraints = { + .list = PLIST_HEAD_INIT(cluster1_freq_max_constraints.list), + .target_value = PM_QOS_CPU_FREQ_MAX_DEFAULT_VALUE, + .default_value = PM_QOS_CPU_FREQ_MAX_DEFAULT_VALUE, + .type = PM_QOS_MIN, + .notifiers = &cluster1_freq_max_notifier, +}; +static struct pm_qos_object cluster1_freq_max_pm_qos = { + .constraints = &cluster1_freq_max_constraints, + .name = "cluster1_freq_max", +}; + +static BLOCKING_NOTIFIER_HEAD(cluster0_freq_min_notifier); +static struct pm_qos_constraints cluster0_freq_min_constraints = { + .list = PLIST_HEAD_INIT(cluster0_freq_min_constraints.list), + .target_value = PM_QOS_CPU_FREQ_MIN_DEFAULT_VALUE, + .default_value = PM_QOS_CPU_FREQ_MIN_DEFAULT_VALUE, + .type = PM_QOS_MAX, + .notifiers = &cluster0_freq_min_notifier, +}; +static struct pm_qos_object cluster0_freq_min_pm_qos = { + .constraints = &cluster0_freq_min_constraints, + .name = "cluster0_freq_min", +}; + +static BLOCKING_NOTIFIER_HEAD(cluster0_freq_max_notifier); +static struct pm_qos_constraints cluster0_freq_max_constraints = { + .list = PLIST_HEAD_INIT(cluster0_freq_max_constraints.list), + .target_value = PM_QOS_CPU_FREQ_MAX_DEFAULT_VALUE, + .default_value = PM_QOS_CPU_FREQ_MAX_DEFAULT_VALUE, + .type = PM_QOS_MIN, + .notifiers = &cluster0_freq_max_notifier, +}; +static struct pm_qos_object cluster0_freq_max_pm_qos = { + .constraints = &cluster0_freq_max_constraints, + .name = "cluster0_freq_max", +}; + +static BLOCKING_NOTIFIER_HEAD(cpu_online_min_notifier); +static struct pm_qos_constraints cpu_online_min_constraints = { + .list = PLIST_HEAD_INIT(cpu_online_min_constraints.list), + .target_value = PM_QOS_CPU_ONLINE_MIN_DEFAULT_VALUE, + .default_value = PM_QOS_CPU_ONLINE_MIN_DEFAULT_VALUE, + .type = PM_QOS_MAX, + .notifiers = &cpu_online_min_notifier, +}; +static struct pm_qos_object cpu_online_min_pm_qos = { + .constraints = &cpu_online_min_constraints, + .name = "cpu_online_min", +}; + +static BLOCKING_NOTIFIER_HEAD(cpu_online_max_notifier); +static struct pm_qos_constraints cpu_online_max_constraints = { + .list = PLIST_HEAD_INIT(cpu_online_max_constraints.list), + .target_value = PM_QOS_CPU_ONLINE_MAX_DEFAULT_VALUE, + .default_value = PM_QOS_CPU_ONLINE_MAX_DEFAULT_VALUE, + .type = PM_QOS_MIN, + .notifiers = &cpu_online_max_notifier, +}; +static struct pm_qos_object cpu_online_max_pm_qos = { + .constraints = &cpu_online_max_constraints, + .name = "cpu_online_max", +}; static BLOCKING_NOTIFIER_HEAD(display_throughput_notifier); static struct pm_qos_constraints display_tput_constraints = { @@ -368,6 +444,12 @@ static struct pm_qos_object *pm_qos_array[] = { &null_pm_qos, &cpu_dma_pm_qos, &network_lat_pm_qos, + &cluster0_freq_min_pm_qos, + &cluster0_freq_max_pm_qos, + &cluster1_freq_min_pm_qos, + &cluster1_freq_max_pm_qos, + &cpu_online_min_pm_qos, + &cpu_online_max_pm_qos, &device_throughput_pm_qos, &intcam_throughput_pm_qos, #ifdef CONFIG_ARM_EXYNOS_DEVFREQ_DEBUG -- 2.20.1