]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/power/qos.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
[karo-tx-linux.git] / kernel / power / qos.c
index 884b77058864cd3596dd6f67d5d8c1dda77dedaf..5f4c006c4b1ea737497e4647be5e3c355cf2bd3a 100644 (file)
@@ -105,11 +105,27 @@ static struct pm_qos_object network_throughput_pm_qos = {
 };
 
 
+static BLOCKING_NOTIFIER_HEAD(memory_bandwidth_notifier);
+static struct pm_qos_constraints memory_bw_constraints = {
+       .list = PLIST_HEAD_INIT(memory_bw_constraints.list),
+       .target_value = PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE,
+       .default_value = PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE,
+       .no_constraint_value = PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE,
+       .type = PM_QOS_SUM,
+       .notifiers = &memory_bandwidth_notifier,
+};
+static struct pm_qos_object memory_bandwidth_pm_qos = {
+       .constraints = &memory_bw_constraints,
+       .name = "memory_bandwidth",
+};
+
+
 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,
+       &memory_bandwidth_pm_qos,
 };
 
 static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
@@ -130,6 +146,9 @@ static const struct file_operations pm_qos_power_fops = {
 /* unlocked internal variant */
 static inline int pm_qos_get_value(struct pm_qos_constraints *c)
 {
+       struct plist_node *node;
+       int total_value = 0;
+
        if (plist_head_empty(&c->list))
                return c->no_constraint_value;
 
@@ -140,6 +159,12 @@ static inline int pm_qos_get_value(struct pm_qos_constraints *c)
        case PM_QOS_MAX:
                return plist_last(&c->list)->prio;
 
+       case PM_QOS_SUM:
+               plist_for_each(node, &c->list)
+                       total_value += node->prio;
+
+               return total_value;
+
        default:
                /* runtime check for not using enum */
                BUG();