aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/power/qos.c25
-rw-r--r--include/linux/pm_qos.h5
2 files changed, 30 insertions, 0 deletions
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 86de6c50fc41..edf7687615e8 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -412,3 +412,28 @@ int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier)
412 return blocking_notifier_chain_unregister(&dev_pm_notifiers, notifier); 412 return blocking_notifier_chain_unregister(&dev_pm_notifiers, notifier);
413} 413}
414EXPORT_SYMBOL_GPL(dev_pm_qos_remove_global_notifier); 414EXPORT_SYMBOL_GPL(dev_pm_qos_remove_global_notifier);
415
416/**
417 * dev_pm_qos_add_ancestor_request - Add PM QoS request for device's ancestor.
418 * @dev: Device whose ancestor to add the request for.
419 * @req: Pointer to the preallocated handle.
420 * @value: Constraint latency value.
421 */
422int dev_pm_qos_add_ancestor_request(struct device *dev,
423 struct dev_pm_qos_request *req, s32 value)
424{
425 struct device *ancestor = dev->parent;
426 int error = -ENODEV;
427
428 while (ancestor && !ancestor->power.ignore_children)
429 ancestor = ancestor->parent;
430
431 if (ancestor)
432 error = dev_pm_qos_add_request(ancestor, req, value);
433
434 if (error)
435 req->dev = NULL;
436
437 return error;
438}
439EXPORT_SYMBOL_GPL(dev_pm_qos_add_ancestor_request);
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 83b0ea302a80..fe247b33652d 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -91,6 +91,8 @@ int dev_pm_qos_add_global_notifier(struct notifier_block *notifier);
91int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier); 91int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier);
92void dev_pm_qos_constraints_init(struct device *dev); 92void dev_pm_qos_constraints_init(struct device *dev);
93void dev_pm_qos_constraints_destroy(struct device *dev); 93void dev_pm_qos_constraints_destroy(struct device *dev);
94int dev_pm_qos_add_ancestor_request(struct device *dev,
95 struct dev_pm_qos_request *req, s32 value);
94#else 96#else
95static inline int pm_qos_update_target(struct pm_qos_constraints *c, 97static inline int pm_qos_update_target(struct pm_qos_constraints *c,
96 struct plist_node *node, 98 struct plist_node *node,
@@ -150,6 +152,9 @@ static inline void dev_pm_qos_constraints_destroy(struct device *dev)
150{ 152{
151 dev->power.power_state = PMSG_INVALID; 153 dev->power.power_state = PMSG_INVALID;
152} 154}
155static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
156 struct dev_pm_qos_request *req, s32 value)
157 { return 0; }
153#endif 158#endif
154 159
155#endif 160#endif