pm: device_runtime: detect power up failures
Check that the device we are trying to use has successfully powered up when it is on a power domain. If it has not, release the request for the power domain to be powered to ensure we do not have dangling requests. As a result of this, `PM_DEVICE_ACTION_RESUME` will not be run on a device if `PM_DEVICE_ACTION_TURN_ON` has already failed. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
317679031d
commit
962eca65af
1 changed files with 6 additions and 0 deletions
|
@ -142,6 +142,12 @@ int pm_device_runtime_get(const struct device *dev)
|
|||
if (ret != 0) {
|
||||
goto unlock;
|
||||
}
|
||||
/* Check if powering up this device failed */
|
||||
if (atomic_test_bit(&pm->flags, PM_DEVICE_FLAG_TURN_ON_FAILED)) {
|
||||
(void)pm_device_runtime_put(PM_DOMAIN(pm));
|
||||
ret = -EAGAIN;
|
||||
goto unlock;
|
||||
}
|
||||
}
|
||||
|
||||
pm->usage++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue