OPP: Call dev_pm_opp_set_opp() for required OPPs
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 27 Oct 2023 08:47:48 +0000 (14:17 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Tue, 28 Nov 2023 10:33:19 +0000 (16:03 +0530)
commite37440e7e2c2760475d60c5556b59c8880a7fd63
tree1679ce936781eb459dc924e57373447a402e42f8
parent6d366d0e544676bf608769b9520644e3f654ff99
OPP: Call dev_pm_opp_set_opp() for required OPPs

Configuring the required OPP was never properly implemented, we just
took an exception for genpds and configured them directly, while leaving
out all other required OPP types.

Now that a standard call to dev_pm_opp_set_opp() takes care of
configuring the opp->level too, the special handling for genpds can be
avoided by simply calling dev_pm_opp_set_opp() for the required OPPs,
which shall eventually configure the corresponding level for genpds.

This also makes it possible for us to configure other type of required
OPPs (no concrete users yet though), via the same path. This is how
other frameworks take care of parent nodes, like clock, regulators, etc,
where we recursively call the same helper.

In order to call dev_pm_opp_set_opp() for the virtual genpd devices,
they must share the OPP table of the genpd. Call _add_opp_dev() for them
to get that done.

This commit also extends the struct dev_pm_opp_config to pass required
devices, for non-genpd cases, which can be used to call
dev_pm_opp_set_opp() for the non-genpd required devices.

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/core.c
drivers/opp/of.c
drivers/opp/opp.h
include/linux/pm_opp.h