Re: [PATCH v2 3/7] regulator: sy7636a: wait for power good on enable
From: Pablo Mazzini
Date: Mon Nov 02 2026 - 14:28:59 EST
Right, I will skip the wait when power good is already high.
On Mon, Nov 2, 2026 at 1:30 PM Mark Brown <broonie@xxxxxxxxxx> wrote:
>
> > Wait for power good on enable, as the TPS65185 and FP9931 drivers do,
> > so that consumers can use the rails once the enable returns.
>
> > +static int sy7636a_enable(struct regulator_dev *rdev)
> > +{
> > + struct sy7636a_data *data = dev_get_drvdata(rdev->dev.parent);
> > + int ret;
> > +
> > + reinit_completion(&data->pgood_completion);
> > + ret = regulator_enable_regmap(rdev);
> > + if (ret)
> > + return ret;
> > +
> > + wait_for_completion_timeout(&data->pgood_completion,
> > + msecs_to_jiffies(PGOOD_TIMEOUT_MSECS));
> > + ret = gpiod_get_value_cansleep(data->pgood_gpio);
> > + if (ret <= 0) {
> > + regulator_disable_regmap(rdev);
> > + return ret ? ret : -ETIMEDOUT;
> > + }
> > +
> > + return 0;
> > +}
>
> One thing here is that if the regulator was already enabled on power up
> we'll get the full delay during startup if the regulator was configured
> as boot on but already enabled.
>
> --
> Mark Brown <broonie@xxxxxxxxxx>