diff options
author | Tomeu Vizoso <tomeu.vizoso@collabora.com> | 2014-09-03 11:49:32 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-09-24 19:18:33 -0400 |
commit | 7990da71ebfa887ae6fe4464ab0d99ddeb8efacc (patch) | |
tree | 26f0b2b19119485b309fa35121872cd7bac0a62e /kernel | |
parent | 0f33be009b89d2268e94194dc4fd01a7851b6d51 (diff) |
PM / QoS: Add PM_QOS_MEMORY_BANDWIDTH class
Also adds a class type PM_QOS_SUM that aggregates the values by summing them.
It can be used by memory controllers to calculate the optimum clock frequency
based on the bandwidth needs of the different memory clients.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/qos.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 884b77058864..5f4c006c4b1e 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c | |||
@@ -105,11 +105,27 @@ static struct pm_qos_object network_throughput_pm_qos = { | |||
105 | }; | 105 | }; |
106 | 106 | ||
107 | 107 | ||
108 | static BLOCKING_NOTIFIER_HEAD(memory_bandwidth_notifier); | ||
109 | static struct pm_qos_constraints memory_bw_constraints = { | ||
110 | .list = PLIST_HEAD_INIT(memory_bw_constraints.list), | ||
111 | .target_value = PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE, | ||
112 | .default_value = PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE, | ||
113 | .no_constraint_value = PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE, | ||
114 | .type = PM_QOS_SUM, | ||
115 | .notifiers = &memory_bandwidth_notifier, | ||
116 | }; | ||
117 | static struct pm_qos_object memory_bandwidth_pm_qos = { | ||
118 | .constraints = &memory_bw_constraints, | ||
119 | .name = "memory_bandwidth", | ||
120 | }; | ||
121 | |||
122 | |||
108 | static struct pm_qos_object *pm_qos_array[] = { | 123 | static struct pm_qos_object *pm_qos_array[] = { |
109 | &null_pm_qos, | 124 | &null_pm_qos, |
110 | &cpu_dma_pm_qos, | 125 | &cpu_dma_pm_qos, |
111 | &network_lat_pm_qos, | 126 | &network_lat_pm_qos, |
112 | &network_throughput_pm_qos | 127 | &network_throughput_pm_qos, |
128 | &memory_bandwidth_pm_qos, | ||
113 | }; | 129 | }; |
114 | 130 | ||
115 | static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, | 131 | 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 = { | |||
130 | /* unlocked internal variant */ | 146 | /* unlocked internal variant */ |
131 | static inline int pm_qos_get_value(struct pm_qos_constraints *c) | 147 | static inline int pm_qos_get_value(struct pm_qos_constraints *c) |
132 | { | 148 | { |
149 | struct plist_node *node; | ||
150 | int total_value = 0; | ||
151 | |||
133 | if (plist_head_empty(&c->list)) | 152 | if (plist_head_empty(&c->list)) |
134 | return c->no_constraint_value; | 153 | return c->no_constraint_value; |
135 | 154 | ||
@@ -140,6 +159,12 @@ static inline int pm_qos_get_value(struct pm_qos_constraints *c) | |||
140 | case PM_QOS_MAX: | 159 | case PM_QOS_MAX: |
141 | return plist_last(&c->list)->prio; | 160 | return plist_last(&c->list)->prio; |
142 | 161 | ||
162 | case PM_QOS_SUM: | ||
163 | plist_for_each(node, &c->list) | ||
164 | total_value += node->prio; | ||
165 | |||
166 | return total_value; | ||
167 | |||
143 | default: | 168 | default: |
144 | /* runtime check for not using enum */ | 169 | /* runtime check for not using enum */ |
145 | BUG(); | 170 | BUG(); |