diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-11-12 19:33:48 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-11-12 19:33:48 -0500 |
commit | 4762573b934cced83b91950f0e7a9f160e3983e3 (patch) | |
tree | 3ab9a54af2bf2f66776b020eee4f7dbe897912b0 | |
parent | 29aaf90875de6a1a760d555f815b18e412b5ab98 (diff) | |
parent | 0759e80b84e34a84e7e46e2b1adb528c83d84a47 (diff) |
Merge branch 'pm-qos'
* pm-qos:
PM / QoS: Fix device resume latency framework
PM / QoS: Drop PM_QOS_FLAG_REMOTE_WAKEUP
-rw-r--r-- | Documentation/ABI/testing/sysfs-devices-power | 20 | ||||
-rw-r--r-- | Documentation/power/pm_qos_interface.txt | 13 | ||||
-rw-r--r-- | drivers/acpi/device_pm.c | 6 | ||||
-rw-r--r-- | drivers/base/cpu.c | 3 | ||||
-rw-r--r-- | drivers/base/power/domain.c | 6 | ||||
-rw-r--r-- | drivers/base/power/domain_governor.c | 40 | ||||
-rw-r--r-- | drivers/base/power/qos.c | 5 | ||||
-rw-r--r-- | drivers/base/power/runtime.c | 2 | ||||
-rw-r--r-- | drivers/base/power/sysfs.c | 53 | ||||
-rw-r--r-- | drivers/cpuidle/governors/menu.c | 4 | ||||
-rw-r--r-- | include/linux/pm_qos.h | 27 |
11 files changed, 77 insertions, 102 deletions
diff --git a/Documentation/ABI/testing/sysfs-devices-power b/Documentation/ABI/testing/sysfs-devices-power index 676fdf5f2a99..80a00f7b6667 100644 --- a/Documentation/ABI/testing/sysfs-devices-power +++ b/Documentation/ABI/testing/sysfs-devices-power | |||
@@ -211,7 +211,9 @@ Description: | |||
211 | device, after it has been suspended at run time, from a resume | 211 | device, after it has been suspended at run time, from a resume |
212 | request to the moment the device will be ready to process I/O, | 212 | request to the moment the device will be ready to process I/O, |
213 | in microseconds. If it is equal to 0, however, this means that | 213 | in microseconds. If it is equal to 0, however, this means that |
214 | the PM QoS resume latency may be arbitrary. | 214 | the PM QoS resume latency may be arbitrary and the special value |
215 | "n/a" means that user space cannot accept any resume latency at | ||
216 | all for the given device. | ||
215 | 217 | ||
216 | Not all drivers support this attribute. If it isn't supported, | 218 | Not all drivers support this attribute. If it isn't supported, |
217 | it is not present. | 219 | it is not present. |
@@ -258,19 +260,3 @@ Description: | |||
258 | 260 | ||
259 | This attribute has no effect on system-wide suspend/resume and | 261 | This attribute has no effect on system-wide suspend/resume and |
260 | hibernation. | 262 | hibernation. |
261 | |||
262 | What: /sys/devices/.../power/pm_qos_remote_wakeup | ||
263 | Date: September 2012 | ||
264 | Contact: Rafael J. Wysocki <rjw@rjwysocki.net> | ||
265 | Description: | ||
266 | The /sys/devices/.../power/pm_qos_remote_wakeup attribute | ||
267 | is used for manipulating the PM QoS "remote wakeup required" | ||
268 | flag. If set, this flag indicates to the kernel that the | ||
269 | device is a source of user events that have to be signaled from | ||
270 | its low-power states. | ||
271 | |||
272 | Not all drivers support this attribute. If it isn't supported, | ||
273 | it is not present. | ||
274 | |||
275 | This attribute has no effect on system-wide suspend/resume and | ||
276 | hibernation. | ||
diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt index 21d2d48f87a2..19c5f7b1a7ba 100644 --- a/Documentation/power/pm_qos_interface.txt +++ b/Documentation/power/pm_qos_interface.txt | |||
@@ -98,8 +98,7 @@ Values are updated in response to changes of the request list. | |||
98 | The target values of resume latency and active state latency tolerance are | 98 | The target values of resume latency and active state latency tolerance are |
99 | simply the minimum of the request values held in the parameter list elements. | 99 | simply the minimum of the request values held in the parameter list elements. |
100 | The PM QoS flags aggregate value is a gather (bitwise OR) of all list elements' | 100 | The PM QoS flags aggregate value is a gather (bitwise OR) of all list elements' |
101 | values. Two device PM QoS flags are defined currently: PM_QOS_FLAG_NO_POWER_OFF | 101 | values. One device PM QoS flag is defined currently: PM_QOS_FLAG_NO_POWER_OFF. |
102 | and PM_QOS_FLAG_REMOTE_WAKEUP. | ||
103 | 102 | ||
104 | Note: The aggregated target values are implemented in such a way that reading | 103 | Note: The aggregated target values are implemented in such a way that reading |
105 | the aggregated value does not require any locking mechanism. | 104 | the aggregated value does not require any locking mechanism. |
@@ -153,14 +152,14 @@ PM QoS list of resume latency constraints and remove sysfs attribute | |||
153 | pm_qos_resume_latency_us from the device's power directory. | 152 | pm_qos_resume_latency_us from the device's power directory. |
154 | 153 | ||
155 | int dev_pm_qos_expose_flags(device, value) | 154 | int dev_pm_qos_expose_flags(device, value) |
156 | Add a request to the device's PM QoS list of flags and create sysfs attributes | 155 | Add a request to the device's PM QoS list of flags and create sysfs attribute |
157 | pm_qos_no_power_off and pm_qos_remote_wakeup under the device's power directory | 156 | pm_qos_no_power_off under the device's power directory allowing user space to |
158 | allowing user space to change these flags' value. | 157 | change the value of the PM_QOS_FLAG_NO_POWER_OFF flag. |
159 | 158 | ||
160 | void dev_pm_qos_hide_flags(device) | 159 | void dev_pm_qos_hide_flags(device) |
161 | Drop the request added by dev_pm_qos_expose_flags() from the device's PM QoS list | 160 | Drop the request added by dev_pm_qos_expose_flags() from the device's PM QoS list |
162 | of flags and remove sysfs attributes pm_qos_no_power_off and pm_qos_remote_wakeup | 161 | of flags and remove sysfs attribute pm_qos_no_power_off from the device's power |
163 | under the device's power directory. | 162 | directory. |
164 | 163 | ||
165 | Notification mechanisms: | 164 | Notification mechanisms: |
166 | The per-device PM QoS framework has a per-device notification tree. | 165 | The per-device PM QoS framework has a per-device notification tree. |
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index fbcc73f7a099..e8c820129797 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -581,8 +581,7 @@ static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev, | |||
581 | d_min = ret; | 581 | d_min = ret; |
582 | wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid | 582 | wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid |
583 | && adev->wakeup.sleep_state >= target_state; | 583 | && adev->wakeup.sleep_state >= target_state; |
584 | } else if (dev_pm_qos_flags(dev, PM_QOS_FLAG_REMOTE_WAKEUP) != | 584 | } else { |
585 | PM_QOS_FLAGS_NONE) { | ||
586 | wakeup = adev->wakeup.flags.valid; | 585 | wakeup = adev->wakeup.flags.valid; |
587 | } | 586 | } |
588 | 587 | ||
@@ -865,8 +864,7 @@ int acpi_dev_runtime_suspend(struct device *dev) | |||
865 | if (!adev) | 864 | if (!adev) |
866 | return 0; | 865 | return 0; |
867 | 866 | ||
868 | remote_wakeup = dev_pm_qos_flags(dev, PM_QOS_FLAG_REMOTE_WAKEUP) > | 867 | remote_wakeup = acpi_device_can_wakeup(adev); |
869 | PM_QOS_FLAGS_NONE; | ||
870 | if (remote_wakeup) { | 868 | if (remote_wakeup) { |
871 | error = acpi_device_wakeup_enable(adev, ACPI_STATE_S0); | 869 | error = acpi_device_wakeup_enable(adev, ACPI_STATE_S0); |
872 | if (error) | 870 | if (error) |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 321cd7b4d817..227bac5f1191 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -377,7 +377,8 @@ int register_cpu(struct cpu *cpu, int num) | |||
377 | 377 | ||
378 | per_cpu(cpu_sys_devices, num) = &cpu->dev; | 378 | per_cpu(cpu_sys_devices, num) = &cpu->dev; |
379 | register_cpu_under_node(num, cpu_to_node(num)); | 379 | register_cpu_under_node(num, cpu_to_node(num)); |
380 | dev_pm_qos_expose_latency_limit(&cpu->dev, 0); | 380 | dev_pm_qos_expose_latency_limit(&cpu->dev, |
381 | PM_QOS_RESUME_LATENCY_NO_CONSTRAINT); | ||
381 | 382 | ||
382 | return 0; | 383 | return 0; |
383 | } | 384 | } |
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 47fb71a8066a..0c80bea05bcb 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -445,9 +445,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, | |||
445 | list_for_each_entry(pdd, &genpd->dev_list, list_node) { | 445 | list_for_each_entry(pdd, &genpd->dev_list, list_node) { |
446 | enum pm_qos_flags_status stat; | 446 | enum pm_qos_flags_status stat; |
447 | 447 | ||
448 | stat = dev_pm_qos_flags(pdd->dev, | 448 | stat = dev_pm_qos_flags(pdd->dev, PM_QOS_FLAG_NO_POWER_OFF); |
449 | PM_QOS_FLAG_NO_POWER_OFF | ||
450 | | PM_QOS_FLAG_REMOTE_WAKEUP); | ||
451 | if (stat > PM_QOS_FLAGS_NONE) | 449 | if (stat > PM_QOS_FLAGS_NONE) |
452 | return -EBUSY; | 450 | return -EBUSY; |
453 | 451 | ||
@@ -1329,7 +1327,7 @@ static struct generic_pm_domain_data *genpd_alloc_dev_data(struct device *dev, | |||
1329 | 1327 | ||
1330 | gpd_data->base.dev = dev; | 1328 | gpd_data->base.dev = dev; |
1331 | gpd_data->td.constraint_changed = true; | 1329 | gpd_data->td.constraint_changed = true; |
1332 | gpd_data->td.effective_constraint_ns = 0; | 1330 | gpd_data->td.effective_constraint_ns = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS; |
1333 | gpd_data->nb.notifier_call = genpd_dev_pm_qos_notifier; | 1331 | gpd_data->nb.notifier_call = genpd_dev_pm_qos_notifier; |
1334 | 1332 | ||
1335 | spin_lock_irq(&dev->power.lock); | 1333 | spin_lock_irq(&dev->power.lock); |
diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c index e4cca8adab32..99896fbf18e4 100644 --- a/drivers/base/power/domain_governor.c +++ b/drivers/base/power/domain_governor.c | |||
@@ -33,15 +33,10 @@ static int dev_update_qos_constraint(struct device *dev, void *data) | |||
33 | * known at this point anyway). | 33 | * known at this point anyway). |
34 | */ | 34 | */ |
35 | constraint_ns = dev_pm_qos_read_value(dev); | 35 | constraint_ns = dev_pm_qos_read_value(dev); |
36 | if (constraint_ns > 0) | 36 | constraint_ns *= NSEC_PER_USEC; |
37 | constraint_ns *= NSEC_PER_USEC; | ||
38 | } | 37 | } |
39 | 38 | ||
40 | /* 0 means "no constraint" */ | 39 | if (constraint_ns < *constraint_ns_p) |
41 | if (constraint_ns == 0) | ||
42 | return 0; | ||
43 | |||
44 | if (constraint_ns < *constraint_ns_p || *constraint_ns_p == 0) | ||
45 | *constraint_ns_p = constraint_ns; | 40 | *constraint_ns_p = constraint_ns; |
46 | 41 | ||
47 | return 0; | 42 | return 0; |
@@ -69,12 +64,12 @@ static bool default_suspend_ok(struct device *dev) | |||
69 | } | 64 | } |
70 | td->constraint_changed = false; | 65 | td->constraint_changed = false; |
71 | td->cached_suspend_ok = false; | 66 | td->cached_suspend_ok = false; |
72 | td->effective_constraint_ns = -1; | 67 | td->effective_constraint_ns = 0; |
73 | constraint_ns = __dev_pm_qos_read_value(dev); | 68 | constraint_ns = __dev_pm_qos_read_value(dev); |
74 | 69 | ||
75 | spin_unlock_irqrestore(&dev->power.lock, flags); | 70 | spin_unlock_irqrestore(&dev->power.lock, flags); |
76 | 71 | ||
77 | if (constraint_ns < 0) | 72 | if (constraint_ns == 0) |
78 | return false; | 73 | return false; |
79 | 74 | ||
80 | constraint_ns *= NSEC_PER_USEC; | 75 | constraint_ns *= NSEC_PER_USEC; |
@@ -87,25 +82,25 @@ static bool default_suspend_ok(struct device *dev) | |||
87 | device_for_each_child(dev, &constraint_ns, | 82 | device_for_each_child(dev, &constraint_ns, |
88 | dev_update_qos_constraint); | 83 | dev_update_qos_constraint); |
89 | 84 | ||
90 | if (constraint_ns == 0) { | 85 | if (constraint_ns == PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS) { |
91 | /* "No restriction", so the device is allowed to suspend. */ | 86 | /* "No restriction", so the device is allowed to suspend. */ |
92 | td->effective_constraint_ns = 0; | 87 | td->effective_constraint_ns = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS; |
93 | td->cached_suspend_ok = true; | 88 | td->cached_suspend_ok = true; |
94 | } else if (constraint_ns < 0) { | 89 | } else if (constraint_ns == 0) { |
95 | /* | 90 | /* |
96 | * This triggers if one of the children that don't belong to a | 91 | * This triggers if one of the children that don't belong to a |
97 | * domain has a negative PM QoS constraint and it's better not | 92 | * domain has a zero PM QoS constraint and it's better not to |
98 | * to suspend then. effective_constraint_ns is negative already | 93 | * suspend then. effective_constraint_ns is zero already and |
99 | * and cached_suspend_ok is false, so bail out. | 94 | * cached_suspend_ok is false, so bail out. |
100 | */ | 95 | */ |
101 | return false; | 96 | return false; |
102 | } else { | 97 | } else { |
103 | constraint_ns -= td->suspend_latency_ns + | 98 | constraint_ns -= td->suspend_latency_ns + |
104 | td->resume_latency_ns; | 99 | td->resume_latency_ns; |
105 | /* | 100 | /* |
106 | * effective_constraint_ns is negative already and | 101 | * effective_constraint_ns is zero already and cached_suspend_ok |
107 | * cached_suspend_ok is false, so if the computed value is not | 102 | * is false, so if the computed value is not positive, return |
108 | * positive, return right away. | 103 | * right away. |
109 | */ | 104 | */ |
110 | if (constraint_ns <= 0) | 105 | if (constraint_ns <= 0) |
111 | return false; | 106 | return false; |
@@ -174,13 +169,10 @@ static bool __default_power_down_ok(struct dev_pm_domain *pd, | |||
174 | td = &to_gpd_data(pdd)->td; | 169 | td = &to_gpd_data(pdd)->td; |
175 | constraint_ns = td->effective_constraint_ns; | 170 | constraint_ns = td->effective_constraint_ns; |
176 | /* | 171 | /* |
177 | * Negative values mean "no suspend at all" and this runs only | 172 | * Zero means "no suspend at all" and this runs only when all |
178 | * when all devices in the domain are suspended, so it must be | 173 | * devices in the domain are suspended, so it must be positive. |
179 | * 0 at least. | ||
180 | * | ||
181 | * 0 means "no constraint" | ||
182 | */ | 174 | */ |
183 | if (constraint_ns == 0) | 175 | if (constraint_ns == PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS) |
184 | continue; | 176 | continue; |
185 | 177 | ||
186 | if (constraint_ns <= off_on_time_ns) | 178 | if (constraint_ns <= off_on_time_ns) |
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 277d43a83f53..3382542b39b7 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c | |||
@@ -139,6 +139,9 @@ static int apply_constraint(struct dev_pm_qos_request *req, | |||
139 | 139 | ||
140 | switch(req->type) { | 140 | switch(req->type) { |
141 | case DEV_PM_QOS_RESUME_LATENCY: | 141 | case DEV_PM_QOS_RESUME_LATENCY: |
142 | if (WARN_ON(action != PM_QOS_REMOVE_REQ && value < 0)) | ||
143 | value = 0; | ||
144 | |||
142 | ret = pm_qos_update_target(&qos->resume_latency, | 145 | ret = pm_qos_update_target(&qos->resume_latency, |
143 | &req->data.pnode, action, value); | 146 | &req->data.pnode, action, value); |
144 | break; | 147 | break; |
@@ -189,7 +192,7 @@ static int dev_pm_qos_constraints_allocate(struct device *dev) | |||
189 | plist_head_init(&c->list); | 192 | plist_head_init(&c->list); |
190 | c->target_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; | 193 | c->target_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; |
191 | c->default_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; | 194 | c->default_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; |
192 | c->no_constraint_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; | 195 | c->no_constraint_value = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; |
193 | c->type = PM_QOS_MIN; | 196 | c->type = PM_QOS_MIN; |
194 | c->notifiers = n; | 197 | c->notifiers = n; |
195 | 198 | ||
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 7bcf80fa9ada..13e015905543 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -253,7 +253,7 @@ static int rpm_check_suspend_allowed(struct device *dev) | |||
253 | || (dev->power.request_pending | 253 | || (dev->power.request_pending |
254 | && dev->power.request == RPM_REQ_RESUME)) | 254 | && dev->power.request == RPM_REQ_RESUME)) |
255 | retval = -EAGAIN; | 255 | retval = -EAGAIN; |
256 | else if (__dev_pm_qos_read_value(dev) < 0) | 256 | else if (__dev_pm_qos_read_value(dev) == 0) |
257 | retval = -EPERM; | 257 | retval = -EPERM; |
258 | else if (dev->power.runtime_status == RPM_SUSPENDED) | 258 | else if (dev->power.runtime_status == RPM_SUSPENDED) |
259 | retval = 1; | 259 | retval = 1; |
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c index 156ab57bca77..e153e28b1857 100644 --- a/drivers/base/power/sysfs.c +++ b/drivers/base/power/sysfs.c | |||
@@ -218,7 +218,14 @@ static ssize_t pm_qos_resume_latency_show(struct device *dev, | |||
218 | struct device_attribute *attr, | 218 | struct device_attribute *attr, |
219 | char *buf) | 219 | char *buf) |
220 | { | 220 | { |
221 | return sprintf(buf, "%d\n", dev_pm_qos_requested_resume_latency(dev)); | 221 | s32 value = dev_pm_qos_requested_resume_latency(dev); |
222 | |||
223 | if (value == 0) | ||
224 | return sprintf(buf, "n/a\n"); | ||
225 | else if (value == PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) | ||
226 | value = 0; | ||
227 | |||
228 | return sprintf(buf, "%d\n", value); | ||
222 | } | 229 | } |
223 | 230 | ||
224 | static ssize_t pm_qos_resume_latency_store(struct device *dev, | 231 | static ssize_t pm_qos_resume_latency_store(struct device *dev, |
@@ -228,11 +235,21 @@ static ssize_t pm_qos_resume_latency_store(struct device *dev, | |||
228 | s32 value; | 235 | s32 value; |
229 | int ret; | 236 | int ret; |
230 | 237 | ||
231 | if (kstrtos32(buf, 0, &value)) | 238 | if (!kstrtos32(buf, 0, &value)) { |
232 | return -EINVAL; | 239 | /* |
240 | * Prevent users from writing negative or "no constraint" values | ||
241 | * directly. | ||
242 | */ | ||
243 | if (value < 0 || value == PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) | ||
244 | return -EINVAL; | ||
233 | 245 | ||
234 | if (value < 0) | 246 | if (value == 0) |
247 | value = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; | ||
248 | } else if (!strcmp(buf, "n/a") || !strcmp(buf, "n/a\n")) { | ||
249 | value = 0; | ||
250 | } else { | ||
235 | return -EINVAL; | 251 | return -EINVAL; |
252 | } | ||
236 | 253 | ||
237 | ret = dev_pm_qos_update_request(dev->power.qos->resume_latency_req, | 254 | ret = dev_pm_qos_update_request(dev->power.qos->resume_latency_req, |
238 | value); | 255 | value); |
@@ -309,33 +326,6 @@ static ssize_t pm_qos_no_power_off_store(struct device *dev, | |||
309 | static DEVICE_ATTR(pm_qos_no_power_off, 0644, | 326 | static DEVICE_ATTR(pm_qos_no_power_off, 0644, |
310 | pm_qos_no_power_off_show, pm_qos_no_power_off_store); | 327 | pm_qos_no_power_off_show, pm_qos_no_power_off_store); |
311 | 328 | ||
312 | static ssize_t pm_qos_remote_wakeup_show(struct device *dev, | ||
313 | struct device_attribute *attr, | ||
314 | char *buf) | ||
315 | { | ||
316 | return sprintf(buf, "%d\n", !!(dev_pm_qos_requested_flags(dev) | ||
317 | & PM_QOS_FLAG_REMOTE_WAKEUP)); | ||
318 | } | ||
319 | |||
320 | static ssize_t pm_qos_remote_wakeup_store(struct device *dev, | ||
321 | struct device_attribute *attr, | ||
322 | const char *buf, size_t n) | ||
323 | { | ||
324 | int ret; | ||
325 | |||
326 | if (kstrtoint(buf, 0, &ret)) | ||
327 | return -EINVAL; | ||
328 | |||
329 | if (ret != 0 && ret != 1) | ||
330 | return -EINVAL; | ||
331 | |||
332 | ret = dev_pm_qos_update_flags(dev, PM_QOS_FLAG_REMOTE_WAKEUP, ret); | ||
333 | return ret < 0 ? ret : n; | ||
334 | } | ||
335 | |||
336 | static DEVICE_ATTR(pm_qos_remote_wakeup, 0644, | ||
337 | pm_qos_remote_wakeup_show, pm_qos_remote_wakeup_store); | ||
338 | |||
339 | #ifdef CONFIG_PM_SLEEP | 329 | #ifdef CONFIG_PM_SLEEP |
340 | static const char _enabled[] = "enabled"; | 330 | static const char _enabled[] = "enabled"; |
341 | static const char _disabled[] = "disabled"; | 331 | static const char _disabled[] = "disabled"; |
@@ -671,7 +661,6 @@ static const struct attribute_group pm_qos_latency_tolerance_attr_group = { | |||
671 | 661 | ||
672 | static struct attribute *pm_qos_flags_attrs[] = { | 662 | static struct attribute *pm_qos_flags_attrs[] = { |
673 | &dev_attr_pm_qos_no_power_off.attr, | 663 | &dev_attr_pm_qos_no_power_off.attr, |
674 | &dev_attr_pm_qos_remote_wakeup.attr, | ||
675 | NULL, | 664 | NULL, |
676 | }; | 665 | }; |
677 | static const struct attribute_group pm_qos_flags_attr_group = { | 666 | static const struct attribute_group pm_qos_flags_attr_group = { |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 48eaf2879228..aa390404e85f 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -298,8 +298,8 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
298 | data->needs_update = 0; | 298 | data->needs_update = 0; |
299 | } | 299 | } |
300 | 300 | ||
301 | /* resume_latency is 0 means no restriction */ | 301 | if (resume_latency < latency_req && |
302 | if (resume_latency && resume_latency < latency_req) | 302 | resume_latency != PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) |
303 | latency_req = resume_latency; | 303 | latency_req = resume_latency; |
304 | 304 | ||
305 | /* Special case when user has set very strict latency requirement */ | 305 | /* Special case when user has set very strict latency requirement */ |
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 2a3acf4dba9a..6ea1ae373d77 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h | |||
@@ -28,19 +28,21 @@ enum pm_qos_flags_status { | |||
28 | PM_QOS_FLAGS_ALL, | 28 | PM_QOS_FLAGS_ALL, |
29 | }; | 29 | }; |
30 | 30 | ||
31 | #define PM_QOS_DEFAULT_VALUE -1 | 31 | #define PM_QOS_DEFAULT_VALUE (-1) |
32 | #define PM_QOS_LATENCY_ANY S32_MAX | ||
33 | #define PM_QOS_LATENCY_ANY_NS ((s64)PM_QOS_LATENCY_ANY * NSEC_PER_USEC) | ||
32 | 34 | ||
33 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | 35 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) |
34 | #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | 36 | #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) |
35 | #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 | 37 | #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 |
36 | #define PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE 0 | 38 | #define PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE 0 |
37 | #define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0 | 39 | #define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE PM_QOS_LATENCY_ANY |
40 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY | ||
41 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS PM_QOS_LATENCY_ANY_NS | ||
38 | #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 | 42 | #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 |
39 | #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) | 43 | #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) |
40 | #define PM_QOS_LATENCY_ANY ((s32)(~(__u32)0 >> 1)) | ||
41 | 44 | ||
42 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) | 45 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) |
43 | #define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1) | ||
44 | 46 | ||
45 | struct pm_qos_request { | 47 | struct pm_qos_request { |
46 | struct plist_node node; | 48 | struct plist_node node; |
@@ -175,7 +177,8 @@ static inline s32 dev_pm_qos_requested_flags(struct device *dev) | |||
175 | static inline s32 dev_pm_qos_raw_read_value(struct device *dev) | 177 | static inline s32 dev_pm_qos_raw_read_value(struct device *dev) |
176 | { | 178 | { |
177 | return IS_ERR_OR_NULL(dev->power.qos) ? | 179 | return IS_ERR_OR_NULL(dev->power.qos) ? |
178 | 0 : pm_qos_read_value(&dev->power.qos->resume_latency); | 180 | PM_QOS_RESUME_LATENCY_NO_CONSTRAINT : |
181 | pm_qos_read_value(&dev->power.qos->resume_latency); | ||
179 | } | 182 | } |
180 | #else | 183 | #else |
181 | static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, | 184 | static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, |
@@ -185,9 +188,9 @@ static inline enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, | |||
185 | s32 mask) | 188 | s32 mask) |
186 | { return PM_QOS_FLAGS_UNDEFINED; } | 189 | { return PM_QOS_FLAGS_UNDEFINED; } |
187 | static inline s32 __dev_pm_qos_read_value(struct device *dev) | 190 | static inline s32 __dev_pm_qos_read_value(struct device *dev) |
188 | { return 0; } | 191 | { return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; } |
189 | static inline s32 dev_pm_qos_read_value(struct device *dev) | 192 | static inline s32 dev_pm_qos_read_value(struct device *dev) |
190 | { return 0; } | 193 | { return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; } |
191 | static inline int dev_pm_qos_add_request(struct device *dev, | 194 | static inline int dev_pm_qos_add_request(struct device *dev, |
192 | struct dev_pm_qos_request *req, | 195 | struct dev_pm_qos_request *req, |
193 | enum dev_pm_qos_req_type type, | 196 | enum dev_pm_qos_req_type type, |
@@ -233,9 +236,15 @@ static inline int dev_pm_qos_expose_latency_tolerance(struct device *dev) | |||
233 | { return 0; } | 236 | { return 0; } |
234 | static inline void dev_pm_qos_hide_latency_tolerance(struct device *dev) {} | 237 | static inline void dev_pm_qos_hide_latency_tolerance(struct device *dev) {} |
235 | 238 | ||
236 | static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) { return 0; } | 239 | static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) |
240 | { | ||
241 | return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; | ||
242 | } | ||
237 | static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; } | 243 | static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; } |
238 | static inline s32 dev_pm_qos_raw_read_value(struct device *dev) { return 0; } | 244 | static inline s32 dev_pm_qos_raw_read_value(struct device *dev) |
245 | { | ||
246 | return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; | ||
247 | } | ||
239 | #endif | 248 | #endif |
240 | 249 | ||
241 | #endif | 250 | #endif |