Skip to content

Refactor Rockchip Power Domains to Acquire Regulators Differently

In #46 (closed), it was discovered that the upstream power domain driver for Rockchip SoCs currently does not handle regulators correctly. This was not noticed until a change in core genpd delayed turning off unused PDs until way later.

Ulf Hansson quickly whipped up a fix to restore the old behaviour for us, but a longer-term solution needs to be found.

The core issue is the following:

  • rockchip pmdomain can't acquire and enable regulators at probe time, as some of those regulators may form a cyclical dependency chain with pmdomains
  • this is why PDs with need_regulator set only acquire their regulator when enabling the PD
  • this means regulators supplying PDs that default to being powered on but aren't used by any driver don't have a relationship declared to any supply regulators by the time the regulator idle check runs
  • the regulator idle check powers off those supply regulators, deeming them unused, killing the SoC on RK3576
  • acquiring the regulators in the pmdomain off code path does not work around this, as the regulator idle check may run before the pmdomain idle check.

The new behaviour also caused a problem on RK3588, where Heiko discovered that it makes the NPU fail, but not the whole SoC.

A solution was proposed by Ulf Hansson wherein we'd register auxiliary drivers for each PD that needs a regulator, which means those auxiliary drivers can defer at will.

Beyond that, RK3576 also needs to have its pmdomains set a need_regulator on the NPU PDs, and probably some others, and have those added as domain-supply in the DT.