diff options
-rw-r--r-- | Documentation/power/pm_qos_interface.txt | 4 | ||||
-rw-r--r-- | include/linux/pm_qos.h | 5 | ||||
-rw-r--r-- | kernel/power/qos.c | 27 |
3 files changed, 33 insertions, 3 deletions
diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt index a5da5c7e7128..129f7c0e1483 100644 --- a/Documentation/power/pm_qos_interface.txt +++ b/Documentation/power/pm_qos_interface.txt | |||
@@ -5,7 +5,8 @@ performance expectations by drivers, subsystems and user space applications on | |||
5 | one of the parameters. | 5 | one of the parameters. |
6 | 6 | ||
7 | Two different PM QoS frameworks are available: | 7 | Two different PM QoS frameworks are available: |
8 | 1. PM QoS classes for cpu_dma_latency, network_latency, network_throughput. | 8 | 1. PM QoS classes for cpu_dma_latency, network_latency, network_throughput, |
9 | memory_bandwidth. | ||
9 | 2. the per-device PM QoS framework provides the API to manage the per-device latency | 10 | 2. the per-device PM QoS framework provides the API to manage the per-device latency |
10 | constraints and PM QoS flags. | 11 | constraints and PM QoS flags. |
11 | 12 | ||
@@ -13,6 +14,7 @@ Each parameters have defined units: | |||
13 | * latency: usec | 14 | * latency: usec |
14 | * timeout: usec | 15 | * timeout: usec |
15 | * throughput: kbs (kilo bit / sec) | 16 | * throughput: kbs (kilo bit / sec) |
17 | * memory bandwidth: mbs (mega bit / sec) | ||
16 | 18 | ||
17 | 19 | ||
18 | 1. PM QoS framework | 20 | 1. PM QoS framework |
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 9ab4bf7c4646..636e82834506 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h | |||
@@ -15,6 +15,7 @@ enum { | |||
15 | PM_QOS_CPU_DMA_LATENCY, | 15 | PM_QOS_CPU_DMA_LATENCY, |
16 | PM_QOS_NETWORK_LATENCY, | 16 | PM_QOS_NETWORK_LATENCY, |
17 | PM_QOS_NETWORK_THROUGHPUT, | 17 | PM_QOS_NETWORK_THROUGHPUT, |
18 | PM_QOS_MEMORY_BANDWIDTH, | ||
18 | 19 | ||
19 | /* insert new class ID */ | 20 | /* insert new class ID */ |
20 | PM_QOS_NUM_CLASSES, | 21 | PM_QOS_NUM_CLASSES, |
@@ -32,6 +33,7 @@ enum pm_qos_flags_status { | |||
32 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | 33 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) |
33 | #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | 34 | #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) |
34 | #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 | 35 | #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 |
36 | #define PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE 0 | ||
35 | #define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0 | 37 | #define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0 |
36 | #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 | 38 | #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 |
37 | #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) | 39 | #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) |
@@ -69,7 +71,8 @@ struct dev_pm_qos_request { | |||
69 | enum pm_qos_type { | 71 | enum pm_qos_type { |
70 | PM_QOS_UNITIALIZED, | 72 | PM_QOS_UNITIALIZED, |
71 | PM_QOS_MAX, /* return the largest value */ | 73 | PM_QOS_MAX, /* return the largest value */ |
72 | PM_QOS_MIN /* return the smallest value */ | 74 | PM_QOS_MIN, /* return the smallest value */ |
75 | PM_QOS_SUM /* return the sum */ | ||
73 | }; | 76 | }; |
74 | 77 | ||
75 | /* | 78 | /* |
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(); |