Skip to content

Commit 0e789b4

Browse files
author
Ulf Hansson
committed
pmdomain: core: Leave powered-on genpds on until sync_state
Powering-off a genpd that was on during boot, before all of its consumer devices have been probed, is certainly prone to problems. For OF based platforms we can rely on using the sync_state mechanism that the fw_devlink provides, to understand when all consumers for a genpd provider have been probed. Let's therefore prevent these genpds from being powered-off until the ->sync_state() callback gets called. Note that, for non-OF based platform we will keep relying on the late_initcall_sync, which seems to be the best we can do for now. Suggested-by: Saravana Kannan <saravanak@google.com> Tested-by: Hiago De Franco <hiago.franco@toradex.com> # Colibri iMX8X Tested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> # TI AM62A,Xilinx ZynqMP ZCU106 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250701114733.636510-23-ulf.hansson@linaro.org
1 parent 13a4b7f commit 0e789b4

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/pmdomain/core.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,7 @@ static int genpd_runtime_resume(struct device *dev)
13241324
return ret;
13251325
}
13261326

1327+
#ifndef CONFIG_PM_GENERIC_DOMAINS_OF
13271328
static bool pd_ignore_unused;
13281329
static int __init pd_ignore_unused_setup(char *__unused)
13291330
{
@@ -1359,6 +1360,7 @@ static int __init genpd_power_off_unused(void)
13591360
return 0;
13601361
}
13611362
late_initcall_sync(genpd_power_off_unused);
1363+
#endif
13621364

13631365
#ifdef CONFIG_PM_SLEEP
13641366

@@ -3459,6 +3461,7 @@ void of_genpd_sync_state(struct device_node *np)
34593461
list_for_each_entry(genpd, &gpd_list, gpd_list_node) {
34603462
if (genpd->provider == of_fwnode_handle(np)) {
34613463
genpd_lock(genpd);
3464+
genpd->stay_on = false;
34623465
genpd_power_off(genpd, false, 0);
34633466
genpd_unlock(genpd);
34643467
}
@@ -3486,6 +3489,7 @@ static void genpd_provider_sync_state(struct device *dev)
34863489

34873490
case GENPD_SYNC_STATE_SIMPLE:
34883491
genpd_lock(genpd);
3492+
genpd->stay_on = false;
34893493
genpd_power_off(genpd, false, 0);
34903494
genpd_unlock(genpd);
34913495
break;

0 commit comments

Comments
 (0)