pmdomain: rockchip: add regulator support
authorSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 20 Feb 2025 18:58:10 +0000 (19:58 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Fri, 28 Feb 2025 12:10:28 +0000 (13:10 +0100)
commitdb6df2e3fc16263e319a0869fc0334c9c2290ddb
treef9cdc4677d2c75deb0ac9889ded2c8063f9e4b8d
parent6b2690df3f032d91546841dcca44d5acdb7ace1e
pmdomain: rockchip: add regulator support

Some power domains require extra voltages to be applied. For example
trying to enable the GPU power domain on RK3588 fails when the SoC
does not have VDD GPU enabled. The same is expected to happen for
the NPU, which also has a dedicated supply line.

We get the regulator using devm_of_regulator_get(), so a missing
dependency in the devicetree is handled gracefully by printing a warning
and creating a dummy regulator. This is necessary, since existing DTs do
not have the regulator described. They might still work if the regulator
is marked as always-on. It is also working if the regulator is enabled
at boot time and the GPU driver is probed before the kernel disables
unused regulators.

The regulator itself is not acquired at driver probe time, since that
creates an unsolvable circular dependency. The power domain driver must
be probed early, since SoC peripherals need it. Regulators on the other
hand depend on SoC peripherals like SPI, I2C or GPIO. MediaTek does not
run into this, since they have two power domain drivers.

Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20250220-rk3588-gpu-pwr-domain-regulator-v6-7-a4f9c24e5b81@kernel.org
[Ulf: Fixed conflict when applying]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/pmdomain/rockchip/pm-domains.c