opp: Attach genpds to devices from within OPP core
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 8 May 2019 09:49:13 +0000 (15:19 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 20 May 2019 06:20:39 +0000 (11:50 +0530)
commit6319aee10e530315689db7609a7d4c444124ff22
treea1705e4da9869cf512168b92f85a16caff3e2aa4
parenta188339ca5a396acc588e5851ed7e19f66b0ebd9
opp: Attach genpds to devices from within OPP core

The OPP core requires the virtual device pointers to set performance
state on behalf of the device, for the multiple power domain case. The
genpd API (dev_pm_domain_attach_by_name()) has evolved now to support
even the single power domain case and that lets us add common code for
handling both the cases more efficiently.

The virtual device structure returned by dev_pm_domain_attach_by_name()
isn't normally used by the cpufreq drivers as they don't manage power
on/off of the domains and so is only useful for the OPP core.

This patch moves all the complexity into the OPP core to make the end
drivers simple. The earlier APIs dev_pm_opp_{set|put}_genpd_virt_dev()
are reworked into dev_pm_opp_{attach|detach}_genpd(). The new helper
dev_pm_opp_attach_genpd() accepts a NULL terminated array of strings
which contains names of all the genpd's to attach. It then attaches all
the domains and saves the pointers to the virtual devices. The other
helper undo the work done by this helper.

Tested-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/core.c
include/linux/pm_opp.h