1
0

PM: runtime: Mark last busy stamp in pm_runtime_autosuspend()

Set device's last busy timestamp to current time in
pm_runtime_autosuspend().

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patch.msgid.link/20250616061212.2286741-5-sakari.ailus@linux.intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Sakari Ailus
2025-06-16 09:12:10 +03:00
committed by Rafael J. Wysocki
parent e24e0630b5
commit 08071e64cb
2 changed files with 12 additions and 12 deletions

View File

@@ -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 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, 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 also respecting devices configured for autosuspend. In essence this means a
call to pm_runtime_autosuspend() (do note that drivers needs to update the call to pm_runtime_autosuspend(). To prevent this (for example, if the callback
device last busy mark, pm_runtime_mark_last_busy(), to control the delay under routine has started a delayed suspend), the routine must return a non-zero
this circumstance). To prevent this (for example, if the callback routine has value. Negative error return codes are ignored by the PM core.
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 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 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 'power.disable_depth' is different from 0
`int pm_runtime_autosuspend(struct device *dev);` `int pm_runtime_autosuspend(struct device *dev);`
- same as pm_runtime_suspend() except that the autosuspend delay is taken - same as pm_runtime_suspend() except that a call to
`into account;` if pm_runtime_autosuspend_expiration() says the delay has pm_runtime_mark_last_busy() is made and an autosuspend is scheduled for
not yet expired then an autosuspend is scheduled for the appropriate time the appropriate time and 0 is returned
and 0 is returned
`int pm_runtime_resume(struct device *dev);` `int pm_runtime_resume(struct device *dev);`
- execute the subsystem-level resume callback for the device; returns 0 on - execute the subsystem-level resume callback for the device; returns 0 on

View File

@@ -379,11 +379,13 @@ 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. * @dev: Target device.
* *
* Set up autosuspend of @dev or suspend it (depending on whether or not * First update the last access time, then set up autosuspend of @dev or suspend
* autosuspend is enabled for it) without engaging its "idle check" callback. * it (depending on whether or not autosuspend is enabled for it) without
* engaging its "idle check" callback.
* *
* Return: * Return:
* * 0: Success. * * 0: Success.
@@ -399,6 +401,7 @@ static inline int pm_runtime_suspend(struct device *dev)
*/ */
static inline int pm_runtime_autosuspend(struct device *dev) static inline int pm_runtime_autosuspend(struct device *dev)
{ {
pm_runtime_mark_last_busy(dev);
return __pm_runtime_suspend(dev, RPM_AUTO); return __pm_runtime_suspend(dev, RPM_AUTO);
} }