aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-02-10 18:36:00 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-02-10 18:36:00 -0500
commit71d821fdaec08afcbfb3cf258c0d64ea0e336ff3 (patch)
tree1c743bfedc41b264fb1dbc4f1383c7e9bf001c93
parent1a8f83515c1646e134163f0ab310362fae49fcca (diff)
PM / QoS: Add type to dev_pm_qos_add_ancestor_request() arguments
Rework dev_pm_qos_add_ancestor_request() so that device PM QoS type is passed to it as the third argument and make it support the DEV_PM_QOS_LATENCY_TOLERANCE device PM QoS type (in addition to DEV_PM_QOS_RESUME_LATENCY). That will allow the drivers of devices without latency tolerance hardware support to use their ancestors having it as proxies for their latency tolerance requirements. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--Documentation/power/pm_qos_interface.txt6
-rw-r--r--drivers/base/power/qos.c22
-rw-r--r--drivers/input/touchscreen/st1232.c3
-rw-r--r--include/linux/pm_qos.h7
4 files changed, 28 insertions, 10 deletions
diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt
index ed743bbad87c..a5da5c7e7128 100644
--- a/Documentation/power/pm_qos_interface.txt
+++ b/Documentation/power/pm_qos_interface.txt
@@ -134,9 +134,11 @@ The meaning of the return values is as follows:
134 PM_QOS_FLAGS_UNDEFINED: The device's PM QoS structure has not been 134 PM_QOS_FLAGS_UNDEFINED: The device's PM QoS structure has not been
135 initialized or the list of requests is empty. 135 initialized or the list of requests is empty.
136 136
137int dev_pm_qos_add_ancestor_request(dev, handle, value) 137int dev_pm_qos_add_ancestor_request(dev, handle, type, value)
138Add a PM QoS request for the first direct ancestor of the given device whose 138Add a PM QoS request for the first direct ancestor of the given device whose
139power.ignore_children flag is unset. 139power.ignore_children flag is unset (for DEV_PM_QOS_RESUME_LATENCY requests)
140or whose power.set_latency_tolerance callback pointer is not NULL (for
141DEV_PM_QOS_LATENCY_TOLERANCE requests).
140 142
141int dev_pm_qos_expose_latency_limit(device, value) 143int dev_pm_qos_expose_latency_limit(device, value)
142Add a request to the device's PM QoS list of resume latency constraints and 144Add a request to the device's PM QoS list of resume latency constraints and
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 84756f7f09d9..36b9eb4862cb 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -565,20 +565,32 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_remove_global_notifier);
565 * dev_pm_qos_add_ancestor_request - Add PM QoS request for device's ancestor. 565 * dev_pm_qos_add_ancestor_request - Add PM QoS request for device's ancestor.
566 * @dev: Device whose ancestor to add the request for. 566 * @dev: Device whose ancestor to add the request for.
567 * @req: Pointer to the preallocated handle. 567 * @req: Pointer to the preallocated handle.
568 * @type: Type of the request.
568 * @value: Constraint latency value. 569 * @value: Constraint latency value.
569 */ 570 */
570int dev_pm_qos_add_ancestor_request(struct device *dev, 571int dev_pm_qos_add_ancestor_request(struct device *dev,
571 struct dev_pm_qos_request *req, s32 value) 572 struct dev_pm_qos_request *req,
573 enum dev_pm_qos_req_type type, s32 value)
572{ 574{
573 struct device *ancestor = dev->parent; 575 struct device *ancestor = dev->parent;
574 int ret = -ENODEV; 576 int ret = -ENODEV;
575 577
576 while (ancestor && !ancestor->power.ignore_children) 578 switch (type) {
577 ancestor = ancestor->parent; 579 case DEV_PM_QOS_RESUME_LATENCY:
580 while (ancestor && !ancestor->power.ignore_children)
581 ancestor = ancestor->parent;
578 582
583 break;
584 case DEV_PM_QOS_LATENCY_TOLERANCE:
585 while (ancestor && !ancestor->power.set_latency_tolerance)
586 ancestor = ancestor->parent;
587
588 break;
589 default:
590 ancestor = NULL;
591 }
579 if (ancestor) 592 if (ancestor)
580 ret = dev_pm_qos_add_request(ancestor, req, 593 ret = dev_pm_qos_add_request(ancestor, req, type, value);
581 DEV_PM_QOS_RESUME_LATENCY, value);
582 594
583 if (ret < 0) 595 if (ret < 0)
584 req->dev = NULL; 596 req->dev = NULL;
diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
index 5c342b3139e8..3c0f57efe7b1 100644
--- a/drivers/input/touchscreen/st1232.c
+++ b/drivers/input/touchscreen/st1232.c
@@ -134,7 +134,8 @@ static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id)
134 } else if (!ts->low_latency_req.dev) { 134 } else if (!ts->low_latency_req.dev) {
135 /* First contact, request 100 us latency. */ 135 /* First contact, request 100 us latency. */
136 dev_pm_qos_add_ancestor_request(&ts->client->dev, 136 dev_pm_qos_add_ancestor_request(&ts->client->dev,
137 &ts->low_latency_req, 100); 137 &ts->low_latency_req,
138 DEV_PM_QOS_RESUME_LATENCY, 100);
138 } 139 }
139 140
140 /* SYN_REPORT */ 141 /* SYN_REPORT */
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 0b476019be55..9ab4bf7c4646 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -149,7 +149,8 @@ int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier);
149void dev_pm_qos_constraints_init(struct device *dev); 149void dev_pm_qos_constraints_init(struct device *dev);
150void dev_pm_qos_constraints_destroy(struct device *dev); 150void dev_pm_qos_constraints_destroy(struct device *dev);
151int dev_pm_qos_add_ancestor_request(struct device *dev, 151int dev_pm_qos_add_ancestor_request(struct device *dev,
152 struct dev_pm_qos_request *req, s32 value); 152 struct dev_pm_qos_request *req,
153 enum dev_pm_qos_req_type type, s32 value);
153#else 154#else
154static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, 155static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev,
155 s32 mask) 156 s32 mask)
@@ -192,7 +193,9 @@ static inline void dev_pm_qos_constraints_destroy(struct device *dev)
192 dev->power.power_state = PMSG_INVALID; 193 dev->power.power_state = PMSG_INVALID;
193} 194}
194static inline int dev_pm_qos_add_ancestor_request(struct device *dev, 195static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
195 struct dev_pm_qos_request *req, s32 value) 196 struct dev_pm_qos_request *req,
197 enum dev_pm_qos_req_type type,
198 s32 value)
196 { return 0; } 199 { return 0; }
197#endif 200#endif
198 201