From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM list <linux-pm@vger.kernel.org>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [RFC/RFT][PATCH v2 6/6] PM / QoS: Add type to dev_pm_qos_add_ancestor_request() arguments
Date: Thu, 23 Jan 2014 14:40:27 +0100 [thread overview]
Message-ID: <1440212.NuPsDCRgku@vostro.rjw.lan> (raw)
In-Reply-To: <1447517.8AFrWcAgld@vostro.rjw.lan>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
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>
---
Documentation/power/pm_qos_interface.txt | 6 ++++--
drivers/base/power/qos.c | 22 +++++++++++++++++-----
drivers/input/touchscreen/st1232.c | 3 ++-
include/linux/pm_qos.h | 7 +++++--
4 files changed, 28 insertions(+), 10 deletions(-)
Index: linux-pm/include/linux/pm_qos.h
===================================================================
--- linux-pm.orig/include/linux/pm_qos.h
+++ linux-pm/include/linux/pm_qos.h
@@ -148,7 +148,8 @@ int dev_pm_qos_remove_global_notifier(st
void dev_pm_qos_constraints_init(struct device *dev);
void dev_pm_qos_constraints_destroy(struct device *dev);
int dev_pm_qos_add_ancestor_request(struct device *dev,
- struct dev_pm_qos_request *req, s32 value);
+ struct dev_pm_qos_request *req,
+ enum dev_pm_qos_req_type type, s32 value);
#else
static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev,
s32 mask)
@@ -191,7 +192,9 @@ static inline void dev_pm_qos_constraint
dev->power.power_state = PMSG_INVALID;
}
static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
- struct dev_pm_qos_request *req, s32 value)
+ struct dev_pm_qos_request *req,
+ enum dev_pm_qos_req_type type,
+ s32 value)
{ return 0; }
#endif
Index: linux-pm/drivers/base/power/qos.c
===================================================================
--- linux-pm.orig/drivers/base/power/qos.c
+++ linux-pm/drivers/base/power/qos.c
@@ -565,20 +565,32 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_remove_glob
* dev_pm_qos_add_ancestor_request - Add PM QoS request for device's ancestor.
* @dev: Device whose ancestor to add the request for.
* @req: Pointer to the preallocated handle.
+ * @type: Type of the request.
* @value: Constraint latency value.
*/
int dev_pm_qos_add_ancestor_request(struct device *dev,
- struct dev_pm_qos_request *req, s32 value)
+ struct dev_pm_qos_request *req,
+ enum dev_pm_qos_req_type type, s32 value)
{
struct device *ancestor = dev->parent;
int ret = -ENODEV;
- while (ancestor && !ancestor->power.ignore_children)
- ancestor = ancestor->parent;
+ switch (type) {
+ case DEV_PM_QOS_RESUME_LATENCY:
+ while (ancestor && !ancestor->power.ignore_children)
+ ancestor = ancestor->parent;
+ break;
+ case DEV_PM_QOS_LATENCY_TOLERANCE:
+ while (ancestor && !ancestor->power.set_latency_tolerance)
+ ancestor = ancestor->parent;
+
+ break;
+ default:
+ ancestor = NULL;
+ }
if (ancestor)
- ret = dev_pm_qos_add_request(ancestor, req,
- DEV_PM_QOS_RESUME_LATENCY, value);
+ ret = dev_pm_qos_add_request(ancestor, req, type, value);
if (ret < 0)
req->dev = NULL;
Index: linux-pm/Documentation/power/pm_qos_interface.txt
===================================================================
--- linux-pm.orig/Documentation/power/pm_qos_interface.txt
+++ linux-pm/Documentation/power/pm_qos_interface.txt
@@ -134,9 +134,11 @@ The meaning of the return values is as f
PM_QOS_FLAGS_UNDEFINED: The device's PM QoS structure has not been
initialized or the list of requests is empty.
-int dev_pm_qos_add_ancestor_request(dev, handle, value)
+int dev_pm_qos_add_ancestor_request(dev, handle, type, value)
Add a PM QoS request for the first direct ancestor of the given device whose
-power.ignore_children flag is unset.
+power.ignore_children flag is unset (for DEV_PM_QOS_RESUME_LATENCY requests)
+or whose power.set_latency_tolerance callback pointer is not NULL (for
+DEV_PM_QOS_LATENCY_TOLERANCE requests).
int dev_pm_qos_expose_latency_limit(device, value)
Add a request to the device's PM QoS list of resume latency constraints and
Index: linux-pm/drivers/input/touchscreen/st1232.c
===================================================================
--- linux-pm.orig/drivers/input/touchscreen/st1232.c
+++ linux-pm/drivers/input/touchscreen/st1232.c
@@ -134,7 +134,8 @@ static irqreturn_t st1232_ts_irq_handler
} else if (!ts->low_latency_req.dev) {
/* First contact, request 100 us latency. */
dev_pm_qos_add_ancestor_request(&ts->client->dev,
- &ts->low_latency_req, 100);
+ &ts->low_latency_req,
+ DEV_PM_QOS_RESUME_LATENCY, 100);
}
/* SYN_REPORT */
next prev parent reply other threads:[~2014-01-23 13:29 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-17 14:42 [RFC/RFT][PATCH 0/5] PM / QoS: Introduce latency tolerance device PM QoS type Rafael J. Wysocki
2014-01-17 14:43 ` [RFC/RFT][PATCH 1/5] PM / QoS: Rename device resume latency QoS items Rafael J. Wysocki
2014-01-17 14:44 ` [RFC/RFT][PATCH 2/5] PM / QoS: Add no_constraints_value field to struct pm_qos_constraints Rafael J. Wysocki
2014-01-17 14:45 ` [RFC/RFT][PATCH 3/5] PM / QoS: Introduce latency tolerance device PM QoS type Rafael J. Wysocki
2014-01-17 14:46 ` [RFC/RFT][PATCH 4/5] ACPI / LPSS: Support for device latency tolerance PM QoS Rafael J. Wysocki
2014-01-20 11:15 ` Mika Westerberg
2014-01-20 13:10 ` Rafael J. Wysocki
2014-01-21 23:23 ` Rafael J. Wysocki
2014-01-21 23:24 ` [RFC/RFT][PATCH 4-1/5] ACPI / scan: Add bind/unbind callbacks to struct acpi_scan_handler Rafael J. Wysocki
2014-01-21 23:25 ` [RFC/RFT][PATCH 4-2/5] ACPI / LPSS: Support for device latency tolerance PM QoS Rafael J. Wysocki
2014-01-17 14:49 ` [RFC/RFT][PATCH 5/5] PM / QoS: Add type to dev_pm_qos_add_ancestor_request() arguments Rafael J. Wysocki
2014-01-23 13:34 ` [RFC/RFT][PATCH v2 0/6] PM / QoS: Introduce latency tolerance device PM QoS type Rafael J. Wysocki
2014-01-23 13:36 ` [RFC/RFT][PATCH v2 1/6] PM / QoS: Rename device resume latency QoS items Rafael J. Wysocki
2014-01-23 13:37 ` [RFC/RFT][PATCH v2 2/6] PM / QoS: Add no_constraints_value field to struct pm_qos_constraints Rafael J. Wysocki
2014-01-23 13:37 ` [RFC/RFT][PATCH v2 3/6] PM / QoS: Introcuce latency tolerance device PM QoS type Rafael J. Wysocki
2014-01-24 22:30 ` [Update][RFC/RFT][PATCH " Rafael J. Wysocki
2014-01-23 13:38 ` [RFC/RFT][PATCH v2 4/6] ACPI / scan: Add bind/unbind callbacks to struct acpi_scan_handler Rafael J. Wysocki
2014-01-23 13:39 ` [RFC/RFT][PATCH v2 5/6] ACPI / LPSS: Support for device latency tolerance PM QoS Rafael J. Wysocki
2014-01-24 22:31 ` [Update][RFC/RFT][PATCH " Rafael J. Wysocki
2014-01-23 13:40 ` Rafael J. Wysocki [this message]
2014-01-24 14:19 ` [RFC/RFT][PATCH v2 0/6] PM / QoS: Introduce latency tolerance device PM QoS type Mika Westerberg
2014-01-24 15:30 ` Rafael J. Wysocki
2014-02-06 13:22 ` [PATCH v3 " Rafael J. Wysocki
2014-02-06 13:23 ` [PATCH v3 1/6] PM / QoS: Rename device resume latency QoS items Rafael J. Wysocki
2014-02-06 13:23 ` [PATCH v3 2/6] PM / QoS: Add no_constraints_value field to struct pm_qos_constraints Rafael J. Wysocki
2014-02-06 13:24 ` [PATCH v3 3/6] PM / QoS: Introcuce latency tolerance device PM QoS type Rafael J. Wysocki
2014-02-06 13:25 ` [PATCH v3 4/6] ACPI / scan: Add bind/unbind callbacks to struct acpi_scan_handler Rafael J. Wysocki
2014-02-06 13:26 ` [PATCH v3 5/6] ACPI / LPSS: Support for device latency tolerance PM QoS Rafael J. Wysocki
2014-02-07 1:22 ` [Update][PATCH " Rafael J. Wysocki
2014-02-06 13:27 ` [PATCH v3 6/6] PM / QoS: Add type to dev_pm_qos_add_ancestor_request() arguments Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440212.NuPsDCRgku@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).