Merge branches 'pm-runtime' and 'pm-powercap'
Merge runtime PM updates and power capping updates for 6.17-rc1: - Document return values of suspend-related API functions in the runtime PM framework (Sakari Ailus) - Mark last busy stamp in multiple autosuspend-related functions in the runtime PM framework and update its documentation (Sakari Ailus) - Take active children into account in pm_runtime_get_if_in_use() for consistency (Rafael Wysocki) - Fix NULL pointer dereference in get_pd_power_uw() in the dtpm_cpu power capping driver (Sivan Zohar-Kotzer) - Add support for the Bartlett Lake platform to the Intel RAPL power capping driver (Qiao Wei) - Add PL4 support for Panther Lake to the intel_rapl_msr power capping driver (Zhang Rui) * pm-runtime: PM: runtime: Take active children into account in pm_runtime_get_if_in_use() Documentation: PM: *_autosuspend() functions update last busy time PM: runtime: Mark last busy stamp in pm_request_autosuspend() PM: runtime: Mark last busy stamp in pm_runtime_autosuspend() PM: runtime: Mark last busy stamp in pm_runtime_put_sync_autosuspend() PM: runtime: Mark last busy stamp in pm_runtime_put_autosuspend() PM: runtime: Document return values of suspend-related API functions * pm-powercap: powercap: dtpm_cpu: Fix NULL pointer dereference in get_pd_power_uw() powercap: intel_rapl: Add support for Bartlett Lake platform powercap: intel_rapl_msr: Add PL4 support for Panther Lakepull/1309/head
commit
3b4d4c98e5
|
|
@ -154,11 +154,9 @@ suspending the device are satisfied) and to queue up a suspend request for the
|
|||
device in that case. If there is no idle callback, or if the callback returns
|
||||
0, then the PM core will attempt to carry out a runtime suspend of the device,
|
||||
also respecting devices configured for autosuspend. In essence this means a
|
||||
call to pm_runtime_autosuspend() (do note that drivers needs to update the
|
||||
device last busy mark, pm_runtime_mark_last_busy(), to control the delay under
|
||||
this circumstance). To prevent this (for example, if the callback routine has
|
||||
started a delayed suspend), the routine must return a non-zero value. Negative
|
||||
error return codes are ignored by the PM core.
|
||||
call to pm_runtime_autosuspend(). To prevent this (for example, if the callback
|
||||
routine has started a delayed suspend), the routine must return a non-zero
|
||||
value. Negative error return codes are ignored by the PM core.
|
||||
|
||||
The helper functions provided by the PM core, described in Section 4, guarantee
|
||||
that the following constraints are met with respect to runtime PM callbacks for
|
||||
|
|
@ -330,10 +328,9 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
|
|||
'power.disable_depth' is different from 0
|
||||
|
||||
`int pm_runtime_autosuspend(struct device *dev);`
|
||||
- same as pm_runtime_suspend() except that the autosuspend delay is taken
|
||||
`into account;` if pm_runtime_autosuspend_expiration() says the delay has
|
||||
not yet expired then an autosuspend is scheduled for the appropriate time
|
||||
and 0 is returned
|
||||
- same as pm_runtime_suspend() except that a call to
|
||||
pm_runtime_mark_last_busy() is made and an autosuspend is scheduled for
|
||||
the appropriate time and 0 is returned
|
||||
|
||||
`int pm_runtime_resume(struct device *dev);`
|
||||
- execute the subsystem-level resume callback for the device; returns 0 on
|
||||
|
|
@ -357,9 +354,9 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
|
|||
success or error code if the request has not been queued up
|
||||
|
||||
`int pm_request_autosuspend(struct device *dev);`
|
||||
- schedule the execution of the subsystem-level suspend callback for the
|
||||
device when the autosuspend delay has expired; if the delay has already
|
||||
expired then the work item is queued up immediately
|
||||
- Call pm_runtime_mark_last_busy() and schedule the execution of the
|
||||
subsystem-level suspend callback for the device when the autosuspend delay
|
||||
expires
|
||||
|
||||
`int pm_schedule_suspend(struct device *dev, unsigned int delay);`
|
||||
- schedule the execution of the subsystem-level suspend callback for the
|
||||
|
|
@ -411,8 +408,9 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
|
|||
pm_request_idle(dev) and return its result
|
||||
|
||||
`int pm_runtime_put_autosuspend(struct device *dev);`
|
||||
- does the same as __pm_runtime_put_autosuspend() for now, but in the
|
||||
future, will also call pm_runtime_mark_last_busy() as well, DO NOT USE!
|
||||
- set the power.last_busy field to the current time and decrement the
|
||||
device's usage counter; if the result is 0 then run
|
||||
pm_request_autosuspend(dev) and return its result
|
||||
|
||||
`int __pm_runtime_put_autosuspend(struct device *dev);`
|
||||
- decrement the device's usage counter; if the result is 0 then run
|
||||
|
|
@ -427,7 +425,8 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
|
|||
pm_runtime_suspend(dev) and return its result
|
||||
|
||||
`int pm_runtime_put_sync_autosuspend(struct device *dev);`
|
||||
- decrement the device's usage counter; if the result is 0 then run
|
||||
- set the power.last_busy field to the current time and decrement the
|
||||
device's usage counter; if the result is 0 then run
|
||||
pm_runtime_autosuspend(dev) and return its result
|
||||
|
||||
`void pm_runtime_enable(struct device *dev);`
|
||||
|
|
@ -870,11 +869,9 @@ device is automatically suspended (the subsystem or driver still has to call
|
|||
the appropriate PM routines); rather it means that runtime suspends will
|
||||
automatically be delayed until the desired period of inactivity has elapsed.
|
||||
|
||||
Inactivity is determined based on the power.last_busy field. Drivers should
|
||||
call pm_runtime_mark_last_busy() to update this field after carrying out I/O,
|
||||
typically just before calling __pm_runtime_put_autosuspend(). The desired
|
||||
length of the inactivity period is a matter of policy. Subsystems can set this
|
||||
length initially by calling pm_runtime_set_autosuspend_delay(), but after device
|
||||
Inactivity is determined based on the power.last_busy field. The desired length
|
||||
of the inactivity period is a matter of policy. Subsystems can set this length
|
||||
initially by calling pm_runtime_set_autosuspend_delay(), but after device
|
||||
registration the length should be controlled by user space, using the
|
||||
/sys/devices/.../power/autosuspend_delay_ms attribute.
|
||||
|
||||
|
|
@ -885,12 +882,13 @@ instead of the non-autosuspend counterparts::
|
|||
|
||||
Instead of: pm_runtime_suspend use: pm_runtime_autosuspend;
|
||||
Instead of: pm_schedule_suspend use: pm_request_autosuspend;
|
||||
Instead of: pm_runtime_put use: __pm_runtime_put_autosuspend;
|
||||
Instead of: pm_runtime_put use: pm_runtime_put_autosuspend;
|
||||
Instead of: pm_runtime_put_sync use: pm_runtime_put_sync_autosuspend.
|
||||
|
||||
Drivers may also continue to use the non-autosuspend helper functions; they
|
||||
will behave normally, which means sometimes taking the autosuspend delay into
|
||||
account (see pm_runtime_idle).
|
||||
account (see pm_runtime_idle). The autosuspend variants of the functions also
|
||||
call pm_runtime_mark_last_busy().
|
||||
|
||||
Under some circumstances a driver or subsystem may want to prevent a device
|
||||
from autosuspending immediately, even though the usage counter is zero and the
|
||||
|
|
@ -922,12 +920,10 @@ Here is a schematic pseudo-code example::
|
|||
foo_io_completion(struct foo_priv *foo, void *req)
|
||||
{
|
||||
lock(&foo->private_lock);
|
||||
if (--foo->num_pending_requests == 0) {
|
||||
pm_runtime_mark_last_busy(&foo->dev);
|
||||
__pm_runtime_put_autosuspend(&foo->dev);
|
||||
} else {
|
||||
if (--foo->num_pending_requests == 0)
|
||||
pm_runtime_put_autosuspend(&foo->dev);
|
||||
else
|
||||
foo_process_next_request(foo);
|
||||
}
|
||||
unlock(&foo->private_lock);
|
||||
/* Send req result back to the user ... */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1203,10 +1203,12 @@ EXPORT_SYMBOL_GPL(__pm_runtime_resume);
|
|||
*
|
||||
* Return -EINVAL if runtime PM is disabled for @dev.
|
||||
*
|
||||
* Otherwise, if the runtime PM status of @dev is %RPM_ACTIVE and either
|
||||
* @ign_usage_count is %true or the runtime PM usage counter of @dev is not
|
||||
* zero, increment the usage counter of @dev and return 1. Otherwise, return 0
|
||||
* without changing the usage counter.
|
||||
* Otherwise, if its runtime PM status is %RPM_ACTIVE and (1) @ign_usage_count
|
||||
* is set, or (2) @dev is not ignoring children and its active child count is
|
||||
* nonero, or (3) the runtime PM usage counter of @dev is not zero, increment
|
||||
* the usage counter of @dev and return 1.
|
||||
*
|
||||
* Otherwise, return 0 without changing the usage counter.
|
||||
*
|
||||
* If @ign_usage_count is %true, this function can be used to prevent suspending
|
||||
* the device when its runtime PM status is %RPM_ACTIVE.
|
||||
|
|
@ -1228,7 +1230,8 @@ static int pm_runtime_get_conditional(struct device *dev, bool ign_usage_count)
|
|||
retval = -EINVAL;
|
||||
} else if (dev->power.runtime_status != RPM_ACTIVE) {
|
||||
retval = 0;
|
||||
} else if (ign_usage_count) {
|
||||
} else if (ign_usage_count || (!dev->power.ignore_children &&
|
||||
atomic_read(&dev->power.child_count) > 0)) {
|
||||
retval = 1;
|
||||
atomic_inc(&dev->power.usage_count);
|
||||
} else {
|
||||
|
|
@ -1261,10 +1264,16 @@ EXPORT_SYMBOL_GPL(pm_runtime_get_if_active);
|
|||
* @dev: Target device.
|
||||
*
|
||||
* Increment the runtime PM usage counter of @dev if its runtime PM status is
|
||||
* %RPM_ACTIVE and its runtime PM usage counter is greater than 0, in which case
|
||||
* it returns 1. If the device is in a different state or its usage_count is 0,
|
||||
* 0 is returned. -EINVAL is returned if runtime PM is disabled for the device,
|
||||
* in which case also the usage_count will remain unmodified.
|
||||
* %RPM_ACTIVE and its runtime PM usage counter is greater than 0 or it is not
|
||||
* ignoring children and its active child count is nonzero. 1 is returned in
|
||||
* this case.
|
||||
*
|
||||
* If @dev is in a different state or it is not in use (that is, its usage
|
||||
* counter is 0, or it is ignoring children, or its active child count is 0),
|
||||
* 0 is returned.
|
||||
*
|
||||
* -EINVAL is returned if runtime PM is disabled for the device, in which case
|
||||
* also the usage counter of @dev is not updated.
|
||||
*/
|
||||
int pm_runtime_get_if_in_use(struct device *dev)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ static u64 get_pd_power_uw(struct dtpm *dtpm)
|
|||
int i;
|
||||
|
||||
pd = em_cpu_get(dtpm_cpu->cpu);
|
||||
if (!pd)
|
||||
return 0;
|
||||
|
||||
pd_mask = em_span_cpus(pd);
|
||||
|
||||
|
|
|
|||
|
|
@ -1277,6 +1277,7 @@ static const struct x86_cpu_id rapl_ids[] __initconst = {
|
|||
X86_MATCH_VFM(INTEL_RAPTORLAKE, &rapl_defaults_core),
|
||||
X86_MATCH_VFM(INTEL_RAPTORLAKE_P, &rapl_defaults_core),
|
||||
X86_MATCH_VFM(INTEL_RAPTORLAKE_S, &rapl_defaults_core),
|
||||
X86_MATCH_VFM(INTEL_BARTLETTLAKE, &rapl_defaults_core),
|
||||
X86_MATCH_VFM(INTEL_METEORLAKE, &rapl_defaults_core),
|
||||
X86_MATCH_VFM(INTEL_METEORLAKE_L, &rapl_defaults_core),
|
||||
X86_MATCH_VFM(INTEL_SAPPHIRERAPIDS_X, &rapl_defaults_spr_server),
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ static const struct x86_cpu_id pl4_support_ids[] = {
|
|||
X86_MATCH_VFM(INTEL_METEORLAKE_L, NULL),
|
||||
X86_MATCH_VFM(INTEL_ARROWLAKE_U, NULL),
|
||||
X86_MATCH_VFM(INTEL_ARROWLAKE_H, NULL),
|
||||
X86_MATCH_VFM(INTEL_PANTHERLAKE_L, NULL),
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -345,6 +345,20 @@ static inline int pm_runtime_force_resume(struct device *dev) { return -ENXIO; }
|
|||
* Invoke the "idle check" callback of @dev and, depending on its return value,
|
||||
* set up autosuspend of @dev or suspend it (depending on whether or not
|
||||
* autosuspend has been enabled for it).
|
||||
*
|
||||
* Return:
|
||||
* * 0: Success.
|
||||
* * -EINVAL: Runtime PM error.
|
||||
* * -EACCES: Runtime PM disabled.
|
||||
* * -EAGAIN: Runtime PM usage_count non-zero, Runtime PM status change ongoing
|
||||
* or device not in %RPM_ACTIVE state.
|
||||
* * -EBUSY: Runtime PM child_count non-zero.
|
||||
* * -EPERM: Device PM QoS resume latency 0.
|
||||
* * -EINPROGRESS: Suspend already in progress.
|
||||
* * -ENOSYS: CONFIG_PM not enabled.
|
||||
* * 1: Device already suspended.
|
||||
* Other values and conditions for the above values are possible as returned by
|
||||
* Runtime PM idle and suspend callbacks.
|
||||
*/
|
||||
static inline int pm_runtime_idle(struct device *dev)
|
||||
{
|
||||
|
|
@ -354,6 +368,18 @@ static inline int pm_runtime_idle(struct device *dev)
|
|||
/**
|
||||
* pm_runtime_suspend - Suspend a device synchronously.
|
||||
* @dev: Target device.
|
||||
*
|
||||
* Return:
|
||||
* * 0: Success.
|
||||
* * -EINVAL: Runtime PM error.
|
||||
* * -EACCES: Runtime PM disabled.
|
||||
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
|
||||
* * -EBUSY: Runtime PM child_count non-zero.
|
||||
* * -EPERM: Device PM QoS resume latency 0.
|
||||
* * -ENOSYS: CONFIG_PM not enabled.
|
||||
* * 1: Device already suspended.
|
||||
* Other values and conditions for the above values are possible as returned by
|
||||
* Runtime PM suspend callbacks.
|
||||
*/
|
||||
static inline int pm_runtime_suspend(struct device *dev)
|
||||
{
|
||||
|
|
@ -361,14 +387,29 @@ static inline int pm_runtime_suspend(struct device *dev)
|
|||
}
|
||||
|
||||
/**
|
||||
* pm_runtime_autosuspend - Set up autosuspend of a device or suspend it.
|
||||
* pm_runtime_autosuspend - Update the last access time and set up autosuspend
|
||||
* of a device.
|
||||
* @dev: Target device.
|
||||
*
|
||||
* Set up autosuspend of @dev or suspend it (depending on whether or not
|
||||
* autosuspend is enabled for it) without engaging its "idle check" callback.
|
||||
* First update the last access time, then set up autosuspend of @dev or suspend
|
||||
* it (depending on whether or not autosuspend is enabled for it) without
|
||||
* engaging its "idle check" callback.
|
||||
*
|
||||
* Return:
|
||||
* * 0: Success.
|
||||
* * -EINVAL: Runtime PM error.
|
||||
* * -EACCES: Runtime PM disabled.
|
||||
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
|
||||
* * -EBUSY: Runtime PM child_count non-zero.
|
||||
* * -EPERM: Device PM QoS resume latency 0.
|
||||
* * -ENOSYS: CONFIG_PM not enabled.
|
||||
* * 1: Device already suspended.
|
||||
* Other values and conditions for the above values are possible as returned by
|
||||
* Runtime PM suspend callbacks.
|
||||
*/
|
||||
static inline int pm_runtime_autosuspend(struct device *dev)
|
||||
{
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
return __pm_runtime_suspend(dev, RPM_AUTO);
|
||||
}
|
||||
|
||||
|
|
@ -387,6 +428,18 @@ static inline int pm_runtime_resume(struct device *dev)
|
|||
*
|
||||
* Queue up a work item to run an equivalent of pm_runtime_idle() for @dev
|
||||
* asynchronously.
|
||||
*
|
||||
* Return:
|
||||
* * 0: Success.
|
||||
* * -EINVAL: Runtime PM error.
|
||||
* * -EACCES: Runtime PM disabled.
|
||||
* * -EAGAIN: Runtime PM usage_count non-zero, Runtime PM status change ongoing
|
||||
* or device not in %RPM_ACTIVE state.
|
||||
* * -EBUSY: Runtime PM child_count non-zero.
|
||||
* * -EPERM: Device PM QoS resume latency 0.
|
||||
* * -EINPROGRESS: Suspend already in progress.
|
||||
* * -ENOSYS: CONFIG_PM not enabled.
|
||||
* * 1: Device already suspended.
|
||||
*/
|
||||
static inline int pm_request_idle(struct device *dev)
|
||||
{
|
||||
|
|
@ -403,14 +456,27 @@ static inline int pm_request_resume(struct device *dev)
|
|||
}
|
||||
|
||||
/**
|
||||
* pm_request_autosuspend - Queue up autosuspend of a device.
|
||||
* pm_request_autosuspend - Update the last access time and queue up autosuspend
|
||||
* of a device.
|
||||
* @dev: Target device.
|
||||
*
|
||||
* Queue up a work item to run an equivalent pm_runtime_autosuspend() for @dev
|
||||
* asynchronously.
|
||||
* Update the last access time of a device and queue up a work item to run an
|
||||
* equivalent pm_runtime_autosuspend() for @dev asynchronously.
|
||||
*
|
||||
* Return:
|
||||
* * 0: Success.
|
||||
* * -EINVAL: Runtime PM error.
|
||||
* * -EACCES: Runtime PM disabled.
|
||||
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
|
||||
* * -EBUSY: Runtime PM child_count non-zero.
|
||||
* * -EPERM: Device PM QoS resume latency 0.
|
||||
* * -EINPROGRESS: Suspend already in progress.
|
||||
* * -ENOSYS: CONFIG_PM not enabled.
|
||||
* * 1: Device already suspended.
|
||||
*/
|
||||
static inline int pm_request_autosuspend(struct device *dev)
|
||||
{
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
return __pm_runtime_suspend(dev, RPM_ASYNC | RPM_AUTO);
|
||||
}
|
||||
|
||||
|
|
@ -472,6 +538,17 @@ static inline int pm_runtime_resume_and_get(struct device *dev)
|
|||
*
|
||||
* Decrement the runtime PM usage counter of @dev and if it turns out to be
|
||||
* equal to 0, queue up a work item for @dev like in pm_request_idle().
|
||||
*
|
||||
* Return:
|
||||
* * 0: Success.
|
||||
* * -EINVAL: Runtime PM error.
|
||||
* * -EACCES: Runtime PM disabled.
|
||||
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
|
||||
* * -EBUSY: Runtime PM child_count non-zero.
|
||||
* * -EPERM: Device PM QoS resume latency 0.
|
||||
* * -EINPROGRESS: Suspend already in progress.
|
||||
* * -ENOSYS: CONFIG_PM not enabled.
|
||||
* * 1: Device already suspended.
|
||||
*/
|
||||
static inline int pm_runtime_put(struct device *dev)
|
||||
{
|
||||
|
|
@ -486,6 +563,17 @@ DEFINE_FREE(pm_runtime_put, struct device *, if (_T) pm_runtime_put(_T))
|
|||
*
|
||||
* Decrement the runtime PM usage counter of @dev and if it turns out to be
|
||||
* equal to 0, queue up a work item for @dev like in pm_request_autosuspend().
|
||||
*
|
||||
* Return:
|
||||
* * 0: Success.
|
||||
* * -EINVAL: Runtime PM error.
|
||||
* * -EACCES: Runtime PM disabled.
|
||||
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
|
||||
* * -EBUSY: Runtime PM child_count non-zero.
|
||||
* * -EPERM: Device PM QoS resume latency 0.
|
||||
* * -EINPROGRESS: Suspend already in progress.
|
||||
* * -ENOSYS: CONFIG_PM not enabled.
|
||||
* * 1: Device already suspended.
|
||||
*/
|
||||
static inline int __pm_runtime_put_autosuspend(struct device *dev)
|
||||
{
|
||||
|
|
@ -493,16 +581,29 @@ static inline int __pm_runtime_put_autosuspend(struct device *dev)
|
|||
}
|
||||
|
||||
/**
|
||||
* pm_runtime_put_autosuspend - Drop device usage counter and queue autosuspend if 0.
|
||||
* pm_runtime_put_autosuspend - Update the last access time of a device, drop
|
||||
* its usage counter and queue autosuspend if the usage counter becomes 0.
|
||||
* @dev: Target device.
|
||||
*
|
||||
* Decrement the runtime PM usage counter of @dev and if it turns out to be
|
||||
* equal to 0, queue up a work item for @dev like in pm_request_autosuspend().
|
||||
* Update the last access time of @dev, decrement runtime PM usage counter of
|
||||
* @dev and if it turns out to be equal to 0, queue up a work item for @dev like
|
||||
* in pm_request_autosuspend().
|
||||
*
|
||||
* Return:
|
||||
* * 0: Success.
|
||||
* * -EINVAL: Runtime PM error.
|
||||
* * -EACCES: Runtime PM disabled.
|
||||
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
|
||||
* * -EBUSY: Runtime PM child_count non-zero.
|
||||
* * -EPERM: Device PM QoS resume latency 0.
|
||||
* * -EINPROGRESS: Suspend already in progress.
|
||||
* * -ENOSYS: CONFIG_PM not enabled.
|
||||
* * 1: Device already suspended.
|
||||
*/
|
||||
static inline int pm_runtime_put_autosuspend(struct device *dev)
|
||||
{
|
||||
return __pm_runtime_suspend(dev,
|
||||
RPM_GET_PUT | RPM_ASYNC | RPM_AUTO);
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
return __pm_runtime_put_autosuspend(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -514,9 +615,20 @@ static inline int pm_runtime_put_autosuspend(struct device *dev)
|
|||
* return value, set up autosuspend of @dev or suspend it (depending on whether
|
||||
* or not autosuspend has been enabled for it).
|
||||
*
|
||||
* The possible return values of this function are the same as for
|
||||
* pm_runtime_idle() and the runtime PM usage counter of @dev remains
|
||||
* decremented in all cases, even if it returns an error code.
|
||||
* The runtime PM usage counter of @dev remains decremented in all cases, even
|
||||
* if it returns an error code.
|
||||
*
|
||||
* Return:
|
||||
* * 0: Success.
|
||||
* * -EINVAL: Runtime PM error.
|
||||
* * -EACCES: Runtime PM disabled.
|
||||
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
|
||||
* * -EBUSY: Runtime PM child_count non-zero.
|
||||
* * -EPERM: Device PM QoS resume latency 0.
|
||||
* * -ENOSYS: CONFIG_PM not enabled.
|
||||
* * 1: Device already suspended.
|
||||
* Other values and conditions for the above values are possible as returned by
|
||||
* Runtime PM suspend callbacks.
|
||||
*/
|
||||
static inline int pm_runtime_put_sync(struct device *dev)
|
||||
{
|
||||
|
|
@ -530,9 +642,21 @@ static inline int pm_runtime_put_sync(struct device *dev)
|
|||
* Decrement the runtime PM usage counter of @dev and if it turns out to be
|
||||
* equal to 0, carry out runtime-suspend of @dev synchronously.
|
||||
*
|
||||
* The possible return values of this function are the same as for
|
||||
* pm_runtime_suspend() and the runtime PM usage counter of @dev remains
|
||||
* decremented in all cases, even if it returns an error code.
|
||||
* The runtime PM usage counter of @dev remains decremented in all cases, even
|
||||
* if it returns an error code.
|
||||
*
|
||||
* Return:
|
||||
* * 0: Success.
|
||||
* * -EINVAL: Runtime PM error.
|
||||
* * -EACCES: Runtime PM disabled.
|
||||
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
|
||||
* * -EAGAIN: usage_count non-zero or Runtime PM status change ongoing.
|
||||
* * -EBUSY: Runtime PM child_count non-zero.
|
||||
* * -EPERM: Device PM QoS resume latency 0.
|
||||
* * -ENOSYS: CONFIG_PM not enabled.
|
||||
* * 1: Device already suspended.
|
||||
* Other values and conditions for the above values are possible as returned by
|
||||
* Runtime PM suspend callbacks.
|
||||
*/
|
||||
static inline int pm_runtime_put_sync_suspend(struct device *dev)
|
||||
{
|
||||
|
|
@ -540,19 +664,34 @@ static inline int pm_runtime_put_sync_suspend(struct device *dev)
|
|||
}
|
||||
|
||||
/**
|
||||
* pm_runtime_put_sync_autosuspend - Drop device usage counter and autosuspend if 0.
|
||||
* pm_runtime_put_sync_autosuspend - Update the last access time of a device,
|
||||
* drop device usage counter and autosuspend if 0.
|
||||
* @dev: Target device.
|
||||
*
|
||||
* Decrement the runtime PM usage counter of @dev and if it turns out to be
|
||||
* equal to 0, set up autosuspend of @dev or suspend it synchronously (depending
|
||||
* on whether or not autosuspend has been enabled for it).
|
||||
* Update the last access time of @dev, decrement the runtime PM usage counter
|
||||
* of @dev and if it turns out to be equal to 0, set up autosuspend of @dev or
|
||||
* suspend it synchronously (depending on whether or not autosuspend has been
|
||||
* enabled for it).
|
||||
*
|
||||
* The possible return values of this function are the same as for
|
||||
* pm_runtime_autosuspend() and the runtime PM usage counter of @dev remains
|
||||
* decremented in all cases, even if it returns an error code.
|
||||
* The runtime PM usage counter of @dev remains decremented in all cases, even
|
||||
* if it returns an error code.
|
||||
*
|
||||
* Return:
|
||||
* * 0: Success.
|
||||
* * -EINVAL: Runtime PM error.
|
||||
* * -EACCES: Runtime PM disabled.
|
||||
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
|
||||
* * -EBUSY: Runtime PM child_count non-zero.
|
||||
* * -EPERM: Device PM QoS resume latency 0.
|
||||
* * -EINPROGRESS: Suspend already in progress.
|
||||
* * -ENOSYS: CONFIG_PM not enabled.
|
||||
* * 1: Device already suspended.
|
||||
* Other values and conditions for the above values are possible as returned by
|
||||
* Runtime PM suspend callbacks.
|
||||
*/
|
||||
static inline int pm_runtime_put_sync_autosuspend(struct device *dev)
|
||||
{
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
return __pm_runtime_suspend(dev, RPM_GET_PUT | RPM_AUTO);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue