PM / QOS: Pass request type to dev_pm_qos_read_value()
In order to allow dev_pm_qos_read_value() to read values for different QoS requests, pass request type as a parameter to these routines. For now, it only supports resume-latency request type but will be extended to frequency limit (min/max) constraints later on. Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
8262331eaa
commit
2a79ea5ec5
|
@ -123,7 +123,7 @@ Will remove the element. After removal it will update the aggregate target and
|
||||||
call the notification trees if the target was changed as a result of removing
|
call the notification trees if the target was changed as a result of removing
|
||||||
the request.
|
the request.
|
||||||
|
|
||||||
s32 dev_pm_qos_read_value(device):
|
s32 dev_pm_qos_read_value(device, type):
|
||||||
Returns the aggregated value for a given device's constraints list.
|
Returns the aggregated value for a given device's constraints list.
|
||||||
|
|
||||||
enum pm_qos_flags_status dev_pm_qos_flags(device, mask)
|
enum pm_qos_flags_status dev_pm_qos_flags(device, mask)
|
||||||
|
|
|
@ -33,7 +33,7 @@ static int dev_update_qos_constraint(struct device *dev, void *data)
|
||||||
* take its current PM QoS constraint (that's the only thing
|
* take its current PM QoS constraint (that's the only thing
|
||||||
* known at this point anyway).
|
* known at this point anyway).
|
||||||
*/
|
*/
|
||||||
constraint_ns = dev_pm_qos_read_value(dev);
|
constraint_ns = dev_pm_qos_read_value(dev, DEV_PM_QOS_RESUME_LATENCY);
|
||||||
constraint_ns *= NSEC_PER_USEC;
|
constraint_ns *= NSEC_PER_USEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,18 +105,25 @@ s32 __dev_pm_qos_resume_latency(struct device *dev)
|
||||||
/**
|
/**
|
||||||
* dev_pm_qos_read_value - Get PM QoS constraint for a given device (locked).
|
* dev_pm_qos_read_value - Get PM QoS constraint for a given device (locked).
|
||||||
* @dev: Device to get the PM QoS constraint value for.
|
* @dev: Device to get the PM QoS constraint value for.
|
||||||
|
* @type: QoS request type.
|
||||||
*/
|
*/
|
||||||
s32 dev_pm_qos_read_value(struct device *dev)
|
s32 dev_pm_qos_read_value(struct device *dev, enum dev_pm_qos_req_type type)
|
||||||
{
|
{
|
||||||
|
struct dev_pm_qos *qos = dev->power.qos;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
spin_lock_irqsave(&dev->power.lock, flags);
|
spin_lock_irqsave(&dev->power.lock, flags);
|
||||||
|
|
||||||
if (IS_ERR_OR_NULL(dev->power.qos))
|
switch (type) {
|
||||||
ret = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT;
|
case DEV_PM_QOS_RESUME_LATENCY:
|
||||||
else
|
ret = IS_ERR_OR_NULL(qos) ? PM_QOS_RESUME_LATENCY_NO_CONSTRAINT
|
||||||
ret = pm_qos_read_value(&dev->power.qos->resume_latency);
|
: pm_qos_read_value(&qos->resume_latency);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
WARN_ON(1);
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
spin_unlock_irqrestore(&dev->power.lock, flags);
|
spin_unlock_irqrestore(&dev->power.lock, flags);
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ s32 pm_qos_read_value(struct pm_qos_constraints *c);
|
||||||
enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask);
|
enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask);
|
||||||
enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask);
|
enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask);
|
||||||
s32 __dev_pm_qos_resume_latency(struct device *dev);
|
s32 __dev_pm_qos_resume_latency(struct device *dev);
|
||||||
s32 dev_pm_qos_read_value(struct device *dev);
|
s32 dev_pm_qos_read_value(struct device *dev, enum dev_pm_qos_req_type type);
|
||||||
int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
|
int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
|
||||||
enum dev_pm_qos_req_type type, s32 value);
|
enum dev_pm_qos_req_type type, s32 value);
|
||||||
int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value);
|
int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value);
|
||||||
|
@ -191,8 +191,18 @@ static inline enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev,
|
||||||
{ return PM_QOS_FLAGS_UNDEFINED; }
|
{ return PM_QOS_FLAGS_UNDEFINED; }
|
||||||
static inline s32 __dev_pm_qos_resume_latency(struct device *dev)
|
static inline s32 __dev_pm_qos_resume_latency(struct device *dev)
|
||||||
{ return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; }
|
{ return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; }
|
||||||
static inline s32 dev_pm_qos_read_value(struct device *dev)
|
static inline s32 dev_pm_qos_read_value(struct device *dev,
|
||||||
{ return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; }
|
enum dev_pm_qos_req_type type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case DEV_PM_QOS_RESUME_LATENCY:
|
||||||
|
return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT;
|
||||||
|
default:
|
||||||
|
WARN_ON(1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline int dev_pm_qos_add_request(struct device *dev,
|
static inline int dev_pm_qos_add_request(struct device *dev,
|
||||||
struct dev_pm_qos_request *req,
|
struct dev_pm_qos_request *req,
|
||||||
enum dev_pm_qos_req_type type,
|
enum dev_pm_qos_req_type type,
|
||||||
|
|
Loading…
Reference in New Issue