[PATCH 00/11] pmdomain: Add generic ->sync_state() support to genpd

Ulf Hansson
2025-04-17T14:25:32Z

If a PM domain (genpd) is powered-on during boot, there is probably a good
reason for it. Therefore it's known to be a bad idea to allow such genpd to be
powered-off before all of its consumer devices have been probed. This series
intends to fix this problem.

We have been discussing these issues at LKML and at various Linux-conferences
in the past. I have therefore tried to include the people I can recall being
involved, but I may have forgotten some (my apologies), feel free to loop them
in.

A few notes:
*)
Even if this looks good, the last patch can't go in without some additional
changes to a couple of existing genpd provider drivers. Typically genpd provider
drivers that implements ->sync_state() need to call of_genpd_sync_state(), but I
will fix this asap, if we think the series makes sense.

*)
Patch 1 -> 3 are just preparatory cleanups.

*)
I have tested this with QEMU with a bunch of local test-drivers and DT nodes.
Let me know if you want me to share this code too.

Please help review and test!
Finally, a big thanks to Saravana for all the support!

Kind regards
Ulf Hansson

Saravana Kannan (1):
driver core: Add dev_set_drv_sync_state()

Ulf Hansson (10):
pmdomain: core: Convert genpd_power_off() to void
pmdomain: core: Simplify return statement in genpd_power_off()
pmdomain: core: Use genpd->opp_table to simplify error/remove path
pmdomain: core: Add a bus and a driver for genpd providers
pmdomain: core: Use device_set_node() to assign the fwnode too
pmdomain: core: Add the genpd->dev to the genpd provider bus
pmdomain: core: Export a common ->sync_state() helper for genpd
providers
pmdomain: core: Add internal ->sync_state() support for genpd
providers
pmdomain: core: Default to use of_genpd_sync_state() for genpd
providers
pmdomain: core: Leave powered-on genpds on until ->sync_state()

drivers/pmdomain/core.c | 273 +++++++++++++++++++++++++++++++-------
include/linux/device.h | 12 ++
include/linux/pm_domain.h | 11 ++
3 files changed, 249 insertions(+), 47 deletions(-)

--
2.43.0