[PATCH v2 5/7] power: pmic-uclass: probe every child on pmic_post_probe

Simon Glass sjg at chromium.org
Thu Jul 20 21:42:56 CEST 2023


Hi Svyatoslav,

On Thu, 20 Jul 2023 at 06:38, Svyatoslav Ryhel <clamor95 at gmail.com> wrote:
>
> Main goal is to probe all regulator childrens for their
> proper setup but if pmic has non regulator children they
> should not suffer from this either.
>
> Signed-off-by: Svyatoslav Ryhel <clamor95 at gmail.com>
> ---
>  drivers/power/pmic/pmic-uclass.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c
> index 0e2f5e1f41..8ca717bd5e 100644
> --- a/drivers/power/pmic/pmic-uclass.c
> +++ b/drivers/power/pmic/pmic-uclass.c
> @@ -16,6 +16,7 @@
>  #include <dm/device-internal.h>
>  #include <dm/uclass-internal.h>
>  #include <power/pmic.h>
> +#include <power/regulator.h>
>  #include <linux/ctype.h>

I'm not sure about this.

The idea is that power is handling automatically, e.g. a device is
probed and so its power is enabled. If you do everything at the start,
doesn't that violate the 'lazy' init side of U-Boot?

>
>  #if CONFIG_IS_ENABLED(PMIC_CHILDREN)
> @@ -198,9 +199,18 @@ static int pmic_pre_probe(struct udevice *dev)
>         return 0;
>  }
>
> +static int pmic_post_probe(struct udevice *dev)
> +{
> +       struct udevice *child;
> +
> +       device_foreach_child_probe(child, dev);
> +       return 0;
> +}
> +
>  UCLASS_DRIVER(pmic) = {
>         .id             = UCLASS_PMIC,
>         .name           = "pmic",
>         .pre_probe      = pmic_pre_probe,
> +       .post_probe     = pmic_post_probe,
>         .per_device_auto        = sizeof(struct uc_pmic_priv),
>  };
> --
> 2.39.2
>

Regards,
Simon


More information about the U-Boot mailing list