pm: device_runtime: Power device on/off in pre-kernel
Devices may be initialized but started powered down for this reason is necessary to power a device on if requested even if in pre-kernel state. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
c7f5270a01
commit
e89d9d65cc
1 changed files with 16 additions and 0 deletions
|
@ -124,6 +124,22 @@ static int pm_device_request(const struct device *dev,
|
|||
* satisfied and this call just incremented the reference count
|
||||
* for this device.
|
||||
*/
|
||||
|
||||
/* Unfortunately this is not what is happening yet. There are
|
||||
* cases, for example, like the pinmux being initialized before
|
||||
* the gpio. For that reason let's power on/off the device
|
||||
* here until we don't have it properly fixed.
|
||||
*/
|
||||
if (dev->pm->usage == 1) {
|
||||
(void)pm_device_state_set(dev,
|
||||
PM_DEVICE_ACTIVE_STATE,
|
||||
NULL, NULL);
|
||||
} else if (dev->pm->usage == 0) {
|
||||
(void)pm_device_state_set(dev,
|
||||
PM_DEVICE_SUSPEND_STATE,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue