cpuquiet: PM QoS: Add max/min online cpus as PM QoS parameter
authorHuang, Tao <huangtao@rock-chips.com>
Mon, 18 May 2015 09:08:55 +0000 (17:08 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 18 May 2015 09:08:55 +0000 (17:08 +0800)
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
include/linux/pm_qos.h
kernel/power/qos.c

index 5a95013905c8c9ab96fde04c3dc8a914b78119da..7030558e8375ab9546577c3cd2e042dd1ce04bb9 100644 (file)
@@ -15,6 +15,10 @@ enum {
        PM_QOS_CPU_DMA_LATENCY,
        PM_QOS_NETWORK_LATENCY,
        PM_QOS_NETWORK_THROUGHPUT,
+#ifdef CONFIG_CPUQUIET_FRAMEWORK
+       PM_QOS_MIN_ONLINE_CPUS,
+       PM_QOS_MAX_ONLINE_CPUS,
+#endif
 
        /* insert new class ID */
        PM_QOS_NUM_CLASSES,
@@ -32,6 +36,10 @@ enum pm_qos_flags_status {
 #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE       (2000 * USEC_PER_SEC)
 #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE       (2000 * USEC_PER_SEC)
 #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE        0
+#ifdef CONFIG_CPUQUIET_FRAMEWORK
+#define PM_QOS_MIN_ONLINE_CPUS_DEFAULT_VALUE   0
+#define PM_QOS_MAX_ONLINE_CPUS_DEFAULT_VALUE   INT_MAX
+#endif
 #define PM_QOS_DEV_LAT_DEFAULT_VALUE           0
 
 #define PM_QOS_FLAG_NO_POWER_OFF       (1 << 0)
index 8703fc729fb41bfbefc0cea6c662b9ae326e1b21..0565679b574bb5d4a2e278464cafd3e9259fcb32 100644 (file)
@@ -100,12 +100,43 @@ static struct pm_qos_object network_throughput_pm_qos = {
        .name = "network_throughput",
 };
 
+#ifdef CONFIG_CPUQUIET_FRAMEWORK
+static BLOCKING_NOTIFIER_HEAD(min_online_cpus_notifier);
+static struct pm_qos_constraints min_online_cpus_constraints = {
+       .list = PLIST_HEAD_INIT(min_online_cpus_constraints.list),
+       .target_value = PM_QOS_MIN_ONLINE_CPUS_DEFAULT_VALUE,
+       .default_value = PM_QOS_MIN_ONLINE_CPUS_DEFAULT_VALUE,
+       .type = PM_QOS_MAX,
+       .notifiers = &min_online_cpus_notifier,
+};
+static struct pm_qos_object min_online_cpus_pm_qos = {
+       .constraints = &min_online_cpus_constraints,
+       .name = "min_online_cpus",
+};
+
+static BLOCKING_NOTIFIER_HEAD(max_online_cpus_notifier);
+static struct pm_qos_constraints max_online_cpus_constraints = {
+       .list = PLIST_HEAD_INIT(max_online_cpus_constraints.list),
+       .target_value = PM_QOS_MAX_ONLINE_CPUS_DEFAULT_VALUE,
+       .default_value = PM_QOS_MAX_ONLINE_CPUS_DEFAULT_VALUE,
+       .type = PM_QOS_MIN,
+       .notifiers = &max_online_cpus_notifier,
+};
+static struct pm_qos_object max_online_cpus_pm_qos = {
+       .constraints = &max_online_cpus_constraints,
+       .name = "max_online_cpus",
+};
+#endif
 
 static struct pm_qos_object *pm_qos_array[] = {
        &null_pm_qos,
        &cpu_dma_pm_qos,
        &network_lat_pm_qos,
-       &network_throughput_pm_qos
+       &network_throughput_pm_qos,
+#ifdef CONFIG_CPUQUIET_FRAMEWORK
+       &min_online_cpus_pm_qos,
+       &max_online_cpus_pm_qos,
+#endif
 };
 
 static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,