Re: [PATCH 02/21] regulator: fixed: Convert to use GPIO descriptor only

From: Linus Walleij
Date: Thu Apr 19 2018 - 08:36:07 EST


On Mon, Feb 12, 2018 at 4:13 PM, Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

>> +static struct gpiod_lookup_table bcm43xx_vmmc_gpio_table = {
>> + .dev_id = "reg-fixed-voltage.0",
>
> I'm not sure this will be always like this.
> We have DEVID_AUTO, which theoretically can be anything.
>
> Okay, it looks like we have only one static regulator for now for Intel
> MID. Though it's fragile if anything will change in the future (quite
> unlikely).

OK let's hope this doesn't blow up in our face :/
Then I have to think of something.

>> + cfg.ena_gpiod = devm_gpiod_get_optional(&pdev->dev, NULL,
>> gflags);
>
> Shouldn't we be a little bit more stricter here, i.e. require "enable"
> name?

It sadly won't work.

The reason is the way the regulator device tree bindings look,
specifying just:

Optional properties:
- gpio: gpio to use for enable control
- startup-delay-us: startup time in microseconds
- enable-active-high: Polarity of GPIO is Active high
If this property is missing, the default assumed is Active low.
- gpio-open-drain: GPIO is open drain type.
If this property is missing then default assumption is false.
-vin-supply: Input supply name.

Not "enable-gpios" as we would write it today.

So it has to retrieve the first (and only) GPIO.

This is another of those historical artifacts, I have tried to
contain some of them, but I don't know if I can do much
about this one :/

Yours,
Linus Walleij