mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-22 14:43:08 +00:00
pmgr: Power up parents before children
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
59e0032ba4
commit
50c808df2c
1 changed files with 16 additions and 9 deletions
13
src/pmgr.c
13
src/pmgr.c
|
@ -121,16 +121,15 @@ static int pmgr_set_mode_recursive(u8 die, u16 id, u8 target_mode, bool recurse)
|
|||
if (pmgr_find_device(id, &device))
|
||||
return -1;
|
||||
|
||||
if (!(device->flags & PMGR_FLAG_VIRTUAL)) {
|
||||
if (target_mode == 0 && !(device->flags & PMGR_FLAG_VIRTUAL)) {
|
||||
uintptr_t addr = pmgr_device_get_addr(die, device);
|
||||
if (!addr)
|
||||
return -1;
|
||||
if (pmgr_set_mode(addr, target_mode))
|
||||
return -1;
|
||||
}
|
||||
if (!recurse)
|
||||
return 0;
|
||||
|
||||
if (recurse)
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (device->parent[i]) {
|
||||
u16 parent = FIELD_GET(PMGR_DEVICE_ID, device->parent[i]);
|
||||
|
@ -140,6 +139,14 @@ static int pmgr_set_mode_recursive(u8 die, u16 id, u8 target_mode, bool recurse)
|
|||
}
|
||||
}
|
||||
|
||||
if (target_mode != 0 && !(device->flags & PMGR_FLAG_VIRTUAL)) {
|
||||
uintptr_t addr = pmgr_device_get_addr(die, device);
|
||||
if (!addr)
|
||||
return -1;
|
||||
if (pmgr_set_mode(addr, target_mode))
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue