pm_qos: Add PM_QOS_CPU_FREQUENCY pm_qos to guarantee required CPU frequency
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 11 Jul 2014 01:03:01 +0000 (10:03 +0900)
committerChanho Park <chanho61.park@samsung.com>
Fri, 8 Aug 2014 06:25:41 +0000 (15:25 +0900)
This patch add PM_QOS_CPU_FREQUENCY to quarantee required CPU frequency.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
include/linux/pm_qos.h
kernel/power/qos.c

index caa4e98..6071297 100644 (file)
@@ -16,6 +16,7 @@ enum {
        PM_QOS_NETWORK_LATENCY,
        PM_QOS_NETWORK_THROUGHPUT,
        PM_QOS_BUS_FREQUENCY,
+       PM_QOS_CPU_FREQUENCY,
 
        /* insert new class ID */
        PM_QOS_NUM_CLASSES,
@@ -40,6 +41,10 @@ enum pm_qos_flags_status {
 #define PM_QOS_BUS_FREQUENCY_MIN_VALUE         100000
 #define PM_QOS_BUS_FREQUENCY_DEFAULT_VALUE     PM_QOS_BUS_FREQUENCY_MIN_VALUE
 
+#define PM_QOS_CPU_FREQUENCY_MAX_VALUE         1000000
+#define PM_QOS_CPU_FREQUENCY_MIN_VALUE         100000
+#define PM_QOS_CPU_FREQUENCY_DEFAULT_VALUE     PM_QOS_CPU_FREQUENCY_MIN_VALUE
+
 #define PM_QOS_FLAG_NO_POWER_OFF       (1 << 0)
 #define PM_QOS_FLAG_REMOTE_WAKEUP      (1 << 1)
 
index 789e69f..457d0f2 100644 (file)
@@ -113,12 +113,26 @@ static struct pm_qos_object bus_frequency_pm_qos = {
        .name = "bus_frequency",
 };
 
+static BLOCKING_NOTIFIER_HEAD(cpu_frequency_notifier);
+static struct pm_qos_constraints cpu_frequency_constraints = {
+       .list = PLIST_HEAD_INIT(cpu_frequency_constraints.list),
+       .target_value = PM_QOS_CPU_FREQUENCY_DEFAULT_VALUE,
+       .default_value = PM_QOS_CPU_FREQUENCY_DEFAULT_VALUE,
+       .type = PM_QOS_MAX,
+       .notifiers = &cpu_frequency_notifier,
+};
+static struct pm_qos_object cpu_frequency_pm_qos = {
+       .constraints = &cpu_frequency_constraints,
+       .name = "cpu_frequency",
+};
+
 static struct pm_qos_object *pm_qos_array[] = {
        &null_pm_qos,
        &cpu_dma_pm_qos,
        &network_lat_pm_qos,
        &network_throughput_pm_qos,
        &bus_frequency_pm_qos,
+       &cpu_frequency_pm_qos,
 };
 
 static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,