[PATCH v2 0/7] General regulator and pmic uclass improvements

Svyatoslav Ryhel clamor95 at gmail.com
Thu Jul 20 14:37:37 CEST 2023


This patchset derives from discussion of TPS65913 bringup and aims to
cycle all regulator management inside uclass removing need of any board
calls for regulators.

My hw setup is Tegra 3 LG Optimus Vu P895 (PMIC is MAX77663) with native
spl u-boot build.

power: regulator: expand basic reference counter onto all uclass
Commit is basically expansion of 4fcba5d ("regulator: implement basic
reference counter") onto all regulators.
 - my testing on hw has shown no issues so far with both pmic regulators
 and fixed regulators. Counting works as expected, dm test is set in
 test of regulator_set_enable_if_allowed.

power: regulator-uclass: perform regulator setup inside uclass
All self-sufficient regulators are set to probe after bind to perform
initial setup later in post-probe with pdata from device tree.
 - self-sufficient regulator is one that is not dependent on any other
 device (this category does not include pmic regulators for example).
 I have tested fixed regulators and got correct probing and setup
 according to device tree. DM test is set by checking regulators data
 without pre-configuring them manually

power: pmic-uclass: probe every child on pmic_post_probe
All non self-sufficient regulators must be probed after main device is
probed (in this case it is pmic_post_probe). In all other aspects pmic
regulators behave same.
 - tested with MAX77663 ldo and sd regulators, no errors or inconsistencies
 were tracked, regulator props (boot-on, always-on etc) and consumer calls
 work as expected. DM test is set by checking regulators data without pre-
 configuring them manually just after pmic probe.

power: regulator-uclass: remove all deprecated API use
This is where everything gets tricky. All board dedicated API of regulators
has to be removed. System presented above should cover all regulators setup
but non the less this should be disscussed with maintainers and tested on
affected boards. This commit removes and cleans most of those API traces.

---
Changes from v1:
 - adapted description of regulator_set_enable
 - remove uc_pdata->enable_count from post_probe
 - added tests from counter and regulators post_probe
---

Svyatoslav Ryhel (7):
  power: regulator: expand basic reference counter onto all uclass
  test: dm: regulator: test counter in set_enable_if_allowed test
  power: regulator-uclass: perform regulator setup inside uclass
  test: dm: regulator: provide test of auto setup
  power: pmic-uclass: probe every child on pmic_post_probe
  test: dm: pmic: provide test of child autosetup
  power: regulator-uclass: remove all deprecated API use

 arch/arm/mach-rockchip/board.c                |   8 -
 arch/arm/mach-rockchip/rk3399/rk3399.c        |  10 -
 board/Marvell/octeontx2_cn913x/board.c        |   5 -
 .../amlogic/odroid-go-ultra/odroid-go-ultra.c |   2 -
 board/dhelectronics/dh_stm32mp1/board.c       |   2 -
 board/engicam/stm32mp1/stm32mp1.c             |   3 -
 board/google/veyron/veyron.c                  |   6 -
 board/samsung/common/exynos5-dt.c             |   4 -
 board/samsung/odroid/odroid.c                 |  10 -
 board/st/stm32mp1/stm32mp1.c                  |   9 -
 drivers/power/pmic/pmic-uclass.c              |  10 +
 drivers/power/regulator/regulator-uclass.c    | 253 +++++++-----------
 drivers/power/regulator/regulator_common.c    |  22 --
 drivers/power/regulator/regulator_common.h    |  21 --
 drivers/video/bridge/ps862x.c                 |  12 +-
 drivers/video/rockchip/rk_vop.c               |   6 +-
 include/power/regulator.h                     | 121 +--------
 include/power/sandbox_pmic.h                  |   2 +-
 test/dm/pmic.c                                |  34 +++
 test/dm/regulator.c                           | 148 +++-------
 20 files changed, 204 insertions(+), 484 deletions(-)

-- 
2.39.2



More information about the U-Boot mailing list