power: regulator: Trigger probe of regulators which are always-on or boot-on
Subsystems (8)
PATCH v2 1/5 power: regulator: Trigger probe of regulators which are always-on or boot-on
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to regulator_post_bind() as the information is required early, the rest of the DT parsing has been kept in regulator_pre_probe() to avoid slowing down the boot process.
---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Kostya Porotchkin <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: - Rebase on current u-boot/next
- Update test cases to handle already started regulators correctly
--- drivers/power/regulator/regulator-uclass.c | 22 +++++++++++++++------- test/dm/panel.c | 2 +- test/dm/regulator.c | 4 ++-- 3 files changed, 18 insertions(+), 10 deletions(-)
drivers/power/regulator/regulator-uclass.c +15 -7
@@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)const char *property ="regulator-name" ; uc_pdata =dev_get_uclass_plat (dev); + uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); + uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" );/* Regulator's mandatory constraint */ uc_pdata->name =dev_read_string (dev, property);
@@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)return -EINVAL ; } -if (regulator_name_is_unique (dev, uc_pdata->name)) -return 0 ; +if (!regulator_name_is_unique (dev, uc_pdata->name)) { +debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , + property, dev->name, uc_pdata->name); +return -EINVAL ; + } -debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on) +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }static int regulator_pre_probe (struct udevice *dev)
@@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev) -ENODATA); uc_pdata->max_uA =dev_read_u32_default (dev,"regulator-max-microamp" , -ENODATA ); - uc_pdata->always_on =dev_read_bool (dev,"regulator-always-on" ); - uc_pdata->boot_on =dev_read_bool (dev,"regulator-boot-on" ); uc_pdata->ramp_delay =dev_read_u32_default (dev,"regulator-ramp-delay" ,0 ); uc_pdata->force_off =dev_read_bool (dev,"regulator-force-boot-off" );
test/dm/panel.c +1 -1
@@ -33,7 +33,7 @@ static int dm_test_panel(struct unit_test_state *uts)ut_assertok (sandbox_pwm_get_config (pwm,0 , &period_ns, &duty_ns, &enable, &polarity));ut_asserteq (false, enable); -ut_asserteq (false,regulator_get_enable (reg)); +ut_asserteq (true,regulator_get_enable (reg));ut_assertok (panel_enable_backlight (dev)); ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns,
test/dm/regulator.c +2 -2
@@ -186,7 +186,7 @@ int dm_test_power_regulator_set_enable_if_allowed(struct unit_test_state *uts)/* Get BUCK1 - always on regulator */ platname = regulator_names[BUCK1 ][PLATNAME ]; -ut_assertok (regulator_autoset_by_name (platname, &dev_autoset)); +ut_asserteq (-EALREADY ,regulator_autoset_by_name (platname, &dev_autoset));ut_assertok (regulator_get_by_platname (platname, &dev));/* Try disabling always-on regulator */
@@ -288,7 +288,7 @@ static int dm_test_power_regulator_autoset(struct unit_test_state *uts)* Expected output state: uV=1200000; uA=200000; output enabled */ platname = regulator_names[BUCK1 ][PLATNAME ]; -ut_assertok (regulator_autoset_by_name (platname, &dev_autoset)); +ut_asserteq (-EALREADY ,regulator_autoset_by_name (platname, &dev_autoset));/* Check, that the returned device is proper */ ut_assertok (regulator_get_by_platname (platname, &dev));
Signature · 1 line
2.45.2
PATCH v2 2/5 power: regulator: Convert regulators_enable_boot_on/off() to regulator_post_probe
Turn regulators_enable_boot_on() and regulators_enable_boot_off() into empty functions. Implement matching functionality in regulator_post_probe() instead. The regulator_post_probe() is called for all regulators after they probe, and regulators that have regulator-always-on or regulator-boot-on DT properties now always probe due to DM_FLAG_PROBE_AFTER_BIND being set on such regulators in regulator_post_bind().
Finally, fold regulator_unset() functionality into regulator_autoset().
---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on current u-boot/next
--- drivers/power/regulator/regulator-uclass.c | 60 +++++++--------------- 1 file changed, 19 insertions(+), 41 deletions(-)
drivers/power/regulator/regulator-uclass.c +19 -41
@@ -308,6 +308,11 @@ int regulator_autoset(struct udevice *dev)return ret; } +if (uc_pdata->force_off) { + ret =regulator_set_enable (dev, false); + goto out; + } +if (!uc_pdata->always_on && !uc_pdata->boot_on) { ret = -EMEDIUMTYPE ; goto out;
@@ -512,56 +517,28 @@ static int regulator_pre_probe(struct udevice *dev)return 0 ; } -int regulators_enable_boot_on (bool verbose) +static int regulator_post_probe (struct udevice *dev) { -struct udevice *dev; -struct uclass *uc;int ret; - ret =uclass_get (UCLASS_REGULATOR , &uc); -if (ret) + ret =regulator_autoset (dev); +if (ret && ret != -EMEDIUMTYPE && ret != -EALREADY && ret !=ENOSYS )return ret; -for (uclass_first_device (UCLASS_REGULATOR , &dev); - dev; -uclass_next_device (&dev)) { - ret =regulator_autoset (dev); -if (ret == -EMEDIUMTYPE || ret == -EALREADY ) { - ret =0 ; -continue ; - } -if (verbose) -regulator_show (dev, ret); -if (ret == -ENOSYS ) - ret =0 ; - } -return ret; +if (_DEBUG) +regulator_show (dev, ret); + +return 0 ; } -int regulators_enable_boot_off (bool verbose) +int regulators_enable_boot_on (bool verbose) { -struct udevice *dev; -struct uclass *uc; -int ret; - - ret =uclass_get (UCLASS_REGULATOR , &uc); -if (ret) -return ret; -for (uclass_first_device (UCLASS_REGULATOR , &dev); - dev; -uclass_next_device (&dev)) { - ret =regulator_unset (dev); -if (ret == -EMEDIUMTYPE ) { - ret =0 ; -continue ; - } -if (verbose) -regulator_show (dev, ret); -if (ret == -ENOSYS ) - ret =0 ; - } +return 0 ; +} -return ret; +int regulators_enable_boot_off (bool verbose) +{ +return 0 ; }UCLASS_DRIVER (regulator) = {
@@ -569,5 +546,6 @@ UCLASS_DRIVER(regulator) = { .name = "regulator", .post_bind = regulator_post_bind, .pre_probe = regulator_pre_probe, + .post_probe = regulator_post_probe, .per_device_plat_auto = sizeof(struct dm_regulator_uclass_plat), };
Signature · 1 line
2.45.2
PATCH v2 3/5 power: regulator: Exit from regulator_set_suspend_value on poorly described regulators
In reply to Marek VasutIn case the DT regulator node does not contain 'regulator-max-microvolt' property and does not contain 'regulator-state-mem' subnode (like the test.dts regul1_scmi: reg@1 {} regulator node), then regulator_pre_probe() will parse this regulator node and set uc_pdata->suspend_on = true and uc_pdata->suspend_uV = uc_pdata->max_uV, where uc_pdata->max_uV is set to -ENODATA because "regulator-max-microvolt" is missing, and therefore uc_pdata->suspend_uV is also -ENODATA. In case regulator_autoset() is used afterward, it will attempt to call regulator_set_suspend_value() with uV = uc_pdata->suspend_uV = -ENODATA and fail with -EINVAL. Check for this case in regulator_set_suspend_value() and immediately return 0, because there is no way to set meaningful suspend voltage, so do nothing and retain the existing settings of the regulator.
---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: New patch
--- drivers/power/regulator/regulator-uclass.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/power/regulator/regulator-uclass.c +4 -0
@@ -85,6 +85,10 @@ int regulator_set_suspend_value(struct udevice *dev, int uV)const struct dm_regulator_ops *ops =dev_get_driver_ops (dev);struct dm_regulator_uclass_plat *uc_pdata; +/* Regulator did not set limits, assume already configured. */ +if (uV == -ENODATA ) +return 0 ; + uc_pdata =dev_get_uclass_plat (dev);if (uc_pdata->min_uV != -ENODATA && uV < uc_pdata->min_uV)return -EINVAL ;
Signature · 1 line
2.45.2
Re: [PATCH v2 3/5] power: regulator: Exit from regulator_set_suspend_value on poorly described regulators
Hi Marek,
Quoted 4 lines · Marek Vasut
In case the DT regulator node does not contain 'regulator-max-microvolt' property and does not contain 'regulator-state-mem' subnode (like the
test.dtsregul1_scmi: reg@1 {} regulator node), thenregulator_pre_probe()will parse this regulator node and setuc_pdata->suspend_on= true and
Quoted 8 lines
uc_pdata->suspend_uV=uc_pdata->max_uV, whereuc_pdata->max_uVis set to-ENODATAbecause "regulator-max-microvolt" is missing, and thereforeuc_pdata->suspend_uVis also-ENODATA. In caseregulator_autoset()is used afterward, it will attempt to callregulator_set_suspend_value()with uV =uc_pdata->suspend_uV=-ENODATAand fail with-EINVAL. Check for this case inregulator_set_suspend_value()and immediately return 0, because there is no way to set meaningful suspend voltage, so do nothing and retain the existing settings of the regulator.
I sent a different fix for this some time ago, please check it out:
https://patchwork.ozlabs.org/patch/1964571/
Regards,
Jonas
Quoted 55 lines
Signed-off-by Marek Vasut <[email protected]>---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: New patch--- drivers/power/regulator/regulator-uclass.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/power/regulator/regulator-uclass.c +4
-0@@ -85,6 +85,10 @@ int regulator_set_suspend_value(struct udevice *dev, int uV)const struct dm_regulator_ops *ops =dev_get_driver_ops (dev);struct dm_regulator_uclass_plat *uc_pdata; +/* Regulator did not set limits, assume already configured. */ +if (uV == -ENODATA ) +return 0 ; + uc_pdata =dev_get_uclass_plat (dev);if (uc_pdata->min_uV != -ENODATA && uV < uc_pdata->min_uV)return -EINVAL ;
Re: [PATCH v2 3/5] power: regulator: Exit from regulator_set_suspend_value on poorly described regulators
Quoted 1 line · Jonas Karlman
Hi Marek,
Hi,
Quoted 14 lines · Marek Vasut
Quoted 4 lines
In case the DT regulator node does not contain 'regulator-max-microvolt' property and does not contain 'regulator-state-mem' subnode (like the
test.dtsregul1_scmi: reg@1 {} regulator node), thenregulator_pre_probe()will parse this regulator node and setuc_pdata->suspend_on= true andQuoted 8 lines
uc_pdata->suspend_uV=uc_pdata->max_uV, whereuc_pdata->max_uVis set to-ENODATAbecause "regulator-max-microvolt" is missing, and thereforeuc_pdata->suspend_uVis also-ENODATA. In caseregulator_autoset()is used afterward, it will attempt to callregulator_set_suspend_value()with uV =uc_pdata->suspend_uV=-ENODATAand fail with-EINVAL. Check for this case inregulator_set_suspend_value()and immediately return 0, because there is no way to set meaningful suspend voltage, so do nothing and retain the existing settings of the regulator.
Quoted 3 lines
I sent a different fix for this some time ago, please check it out:
That one will work too, yes.
PATCH v2 4/5 power: regulator: Drop regulator_unset()
In reply to Marek VasutThis function is never called, drop it.
---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on current u-boot/next
--- drivers/power/regulator/regulator-uclass.c | 11 ----------- include/power/regulator.h | 14 +------------- 2 files changed, 1 insertion(+), 24 deletions(-)
drivers/power/regulator/regulator-uclass.c +0 -11
@@ -343,17 +343,6 @@ out:return ret; } -int regulator_unset (struct udevice *dev) -{ -struct dm_regulator_uclass_plat *uc_pdata; - - uc_pdata =dev_get_uclass_plat (dev); -if (uc_pdata && uc_pdata->force_off) -return regulator_set_enable (dev, false); - -return -EMEDIUMTYPE ; -} -static void regulator_show (struct udevice *dev,int ret) {struct dm_regulator_uclass_plat *uc_pdata;
include/power/regulator.h +1 -13
@@ -430,7 +430,7 @@ int regulators_enable_boot_on(bool verbose);* * This disables all regulators which are marked to be off at boot time. * -* This effectively calls regulator_unset() for every regulator. +* This effectively does nothing. */ int regulators_enable_boot_off (bool verbose);
@@ -453,18 +453,6 @@ int regulators_enable_boot_off(bool verbose);*/ int regulator_autoset (struct udevice *dev); -/** -* regulator_unset: turn off a regulator -* -* The setup depends on constraints found in device's uclass's platform data -* (struct dm_regulator_uclass_platdata): -* -* - Disable - will set - if 'force_off' is set to true, -* -* The function returns on the first-encountered error. -*/ -int regulator_unset (struct udevice *dev); -/** * regulator_autoset_by_name: setup the regulator given by its uclass's * platform data name field. The setup depends on constraints found in device's
Signature · 1 line
2.45.2
PATCH v2 5/5 power: regulator: Drop regulators_enable_boot_on/off()
In reply to Marek VasutBoth regulators_enable_boot_on/off() are unused and superseded by regulator uclass regulator_post_probe(). Remove both functions.
---
Cc: Ben Wolsieffer <[email protected]>
Cc: Caleb Connolly <[email protected]>
Cc: Chris Morgan <[email protected]>
Cc: Dragan Simic <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Matteo Lisi <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Max Krummenacher <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Sam Day <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sumit Garg <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Volodymyr Babchuk <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on current u-boot/next
--- arch/arm/mach-rockchip/board.c | 8 ------ arch/arm/mach-snapdragon/board.c | 1 - arch/arm/mach-tegra/board2.c | 3 --- board/Marvell/octeontx2_cn913x/board.c | 5 ---- .../amlogic/odroid-go-ultra/odroid-go-ultra.c | 2 -- board/dhelectronics/dh_imx6/dh_imx6.c | 2 -- .../dh_imx8mp/imx8mp_dhcom_pdk2.c | 2 -- board/dhelectronics/dh_stm32mp1/board.c | 2 -- board/engicam/stm32mp1/stm32mp1.c | 3 --- board/google/veyron/veyron.c | 4 --- board/samsung/common/exynos5-dt.c | 4 --- board/st/stm32mp1/stm32mp1.c | 2 -- drivers/power/regulator/regulator-uclass.c | 10 -------- include/power/regulator.h | 25 ------------------- 14 files changed, 73 deletions(-)
arch/arm/mach-rockchip/board.c +0 -8
@@ -202,14 +202,6 @@ int board_late_init(void)int board_init (void ) { -int ret; - -#ifdef CONFIG_DM_REGULATOR - ret =regulators_enable_boot_on (false); -if (ret) -debug ("%s: Cannot enable boot on regulator\n" , __func__); -#endif -return 0 ; }
arch/arm/mach-snapdragon/board.c +0 -1
@@ -237,7 +237,6 @@ void __weak qcom_board_init(void)int board_init (void ) { -regulators_enable_boot_on (false);show_psci_version ();qcom_of_fixup_nodes ();qcom_board_init ();
arch/arm/mach-tegra/board2.c +0 -3
@@ -187,9 +187,6 @@ int board_init(void)warmboot_prepare_code (TEGRA_LP0_ADDR ,TEGRA_LP0_SIZE );#endif -/* Set up boot-on regulators */ -regulators_enable_boot_on (_DEBUG); -return nvidia_board_init (); }
board/Marvell/octeontx2_cn913x/board.c +0 -5
@@ -23,11 +23,6 @@ int board_early_init_f(void)int board_early_init_r (void ) { -if (CONFIG_IS_ENABLED (DM_REGULATOR )) { -/* Check if any existing regulator should be turned down */ -regulators_enable_boot_off (false); - } -return 0 ; }
board/amlogic/odroid-go-ultra/odroid-go-ultra.c +0 -2
@@ -16,7 +16,5 @@ int mmc_get_env_dev(void)int board_init (void ) { -regulators_enable_boot_on (_DEBUG); -return 0 ; }
board/dhelectronics/dh_imx6/dh_imx6.c +0 -2
@@ -128,8 +128,6 @@ int board_init(void)setup_fec_clock (); -regulators_enable_boot_on (_DEBUG); -return 0 ; }
board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c +0 -2
@@ -112,8 +112,6 @@ int dh_setup_mac_address(void)int board_init (void ) { -regulators_enable_boot_on (_DEBUG); -return 0 ; }
board/dhelectronics/dh_stm32mp1/board.c +0 -2
@@ -622,8 +622,6 @@ static void board_init_regulator_av96(void)static void board_init_regulator (void ) {board_init_regulator_av96 (); - -regulators_enable_boot_on (_DEBUG); }#else static inline int board_get_regulator_buck3_nvm_uv_av96 (int *uv)
board/engicam/stm32mp1/stm32mp1.c +0 -3
@@ -37,9 +37,6 @@ int checkboard(void)/* board dependent setup after realloc */ int board_init (void ) { -if (IS_ENABLED (CONFIG_DM_REGULATOR )) -regulators_enable_boot_on (_DEBUG); -return 0 ; }
board/google/veyron/veyron.c +0 -4
@@ -57,10 +57,6 @@ static int veyron_init(void)if (ret)return log_msg_ret ("s33" , ret); - ret =regulators_enable_boot_on (false); -if (ret) -return log_msg_ret ("boo" , ret); - return 0; }#endif
board/samsung/common/exynos5-dt.c +0 -4
@@ -88,10 +88,6 @@ int exynos_power_init(void)if (ret == -ENODEV )return 0 ; - ret =regulators_enable_boot_on (false); -if (ret) -return ret; - ret =exynos_set_regulator ("vdd_mif" ,1100000 );if (ret)return ret;
board/st/stm32mp1/stm32mp1.c +0 -2
@@ -665,8 +665,6 @@ int board_init(void)if (board_is_stm32mp15x_dk2 ())board_stm32mp15x_dk2_init (); -regulators_enable_boot_on (_DEBUG); -/* * sysconf initialisation done only when U-Boot is running in secure * done in TF-A for TFABOOT.
drivers/power/regulator/regulator-uclass.c +0 -10
@@ -524,16 +524,6 @@ static int regulator_post_probe(struct udevice *dev)return 0 ; } -int regulators_enable_boot_on (bool verbose) -{ -return 0 ; -} - -int regulators_enable_boot_off (bool verbose) -{ -return 0 ; -} -UCLASS_DRIVER (regulator) = { .id =UCLASS_REGULATOR , .name ="regulator" ,
include/power/regulator.h +0 -25
@@ -414,26 +414,6 @@ int regulator_get_mode(struct udevice *dev);*/ int regulator_set_mode (struct udevice *dev,int mode_id); -/** -* regulators_enable_boot_on() - enable regulators needed for boot -* -* This enables all regulators which are marked to be on at boot time. This -* only works for regulators which don't have a range for voltage/current, -* since in that case it is not possible to know which value to use. -* -* This effectively calls regulator_autoset() for every regulator. -*/ -int regulators_enable_boot_on (bool verbose); - -/** -* regulators_enable_boot_off() - disable regulators needed for boot -* -* This disables all regulators which are marked to be off at boot time. -* -* This effectively does nothing. -*/ -int regulators_enable_boot_off (bool verbose); -/** * regulator_autoset: setup the voltage/current on a regulator *
@@ -617,11 +597,6 @@ static inline int regulator_set_mode(struct udevice *dev, int mode_id)return -ENOSYS ; } -static inline int regulators_enable_boot_on (bool verbose) -{ -return -ENOSYS ; -} -static inline int regulator_autoset (struct udevice *dev) {return -ENOSYS ;
Signature · 1 line
2.45.2
Hi Marek,
Quoted 12 lines · Marek Vasut
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Signed-off-by Marek Vasut <[email protected]>
[snip]
drivers/power/regulator/regulator-uclass.c static int regulator_post_bind(struct udevice *dev) · line 460
Quoted 9 lines
drivers/power/regulator/regulator-uclass.c +6
-2-debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on)
This check for always_on _and_ boot_on does not fully match the commit message, comment or the old behavior of regulators_enable_boot_on() where any always_on _or_ boot_on would trigger autoset().
Regards,
Jonas
Quoted 6 lines
drivers/power/regulator/regulator-uclass.c +2
-1+dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND ); -return -EINVAL ; +return 0 ; }
[snip]
Quoted 1 line · Jonas Karlman
Hi Marek,
Hi,
Quoted 17 lines · Marek Vasut
Quoted 12 lines
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration.
Parsing of regulator-always-on and regulator-boot-on DT property has been moved to
regulator_post_bind()as the information is required early, the rest of the DT parsing has been kept inregulator_pre_probe()to avoid slowing down the boot process.Signed-off-by Marek Vasut <[email protected]>[snip]
Quoted 1 line
Quoted 12 lines
drivers/power/regulator/regulator-uclass.c static int regulator_post_bind(struct udevice *dev) · line 460
Quoted 8 lines
drivers/power/regulator/regulator-uclass.c +6
-2-debug ("'%s' of dev: '%s', has nonunique value: '%s\n" , - property, dev->name, uc_pdata->name); +/* +* In case the regulator has regulator-always-on or +* regulator-boot-on DT property, trigger probe() to +* configure its default state during startup. +*/ +if (uc_pdata->always_on && uc_pdata->boot_on)This check for
always_on_and_boot_ondoes not fully match the commit message, comment or the old behavior ofregulators_enable_boot_on()where anyalways_on_or_boot_onwould triggerautoset().
This should be ORR, thanks for spotting this, fixed in V3.