[PATCH v2 0/4] PM: domains: Avoid boilerplate code for DVFS in subsystem/drivers

Ulf Hansson
2021-06-03T09:35:48Z

Various discussions on LKML have pointed out that many subsystem/drivers for
devices that may be attached to a genpd and which manages DVFS/OPP though the
genpd performance states, would need very similar updates.

More precisely, they would likely have to call dev_pm_opp_set_rate|opp() to
drop and restore OPPs (which propagates upwards into performance states votes
in genpd), every time their devices should enter/exit a low power state, via
their device PM callbacks.

Rather than having to add the boilerplate code for these things into the
subsystems/drivers, this series implements the logic internally into genpd.

Concerns have been raised about this approach, mostly by myself, around that it
limits flexibility. On the other hand, it starts to look like more and more
people are requesting this to be manged internally in genpd, for good reasons.
So, I think it's worth to give this a try.

In the long run, if it turns out that the flexibility was indeed needed, we can
always deal with that as special cases on top.

Test and reviews are of course greatly appreciated!

Kind regards
Ulf Hansson

Ulf Hansson (4):
PM: domains: Split code in dev_pm_genpd_set_performance_state()
PM: domains: Return early if perf state is already set for the device
PM: domains: Drop/restore performance state votes for devices at
runtime PM
PM: domains: Drop/restore performance state votes for devices at
system PM

drivers/base/power/domain.c | 70 +++++++++++++++++++++++++++++--------
include/linux/pm_domain.h | 2 ++
2 files changed, 58 insertions(+), 14 deletions(-)

--
2.25.1