Re: [PATCH v7] regulator: fixed: Convert to use GPIO descriptor only

From: Fabio Estevam
Date: Mon Oct 01 2018 - 16:36:47 EST


Hi Linus,

On Mon, Oct 1, 2018 at 5:17 PM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:

> > reg_enet_3v3: regulator-enet-3v3 {
> > compatible = "regulator-fixed";
> > pinctrl-names = "default";
> > pinctrl-0 = <&pinctrl_enet_3v3>;
> > regulator-name = "enet_3v3";
> > regulator-min-microvolt = <3300000>;
> > regulator-max-microvolt = <3300000>;
> > gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
> > };
>
> This is a bit odd actually, the GPIO_ACTIVE_LOW flag will
> be ignored as you see:

Yes, the flag will be ignored by the regulator driver, but the dts
description is correct: it is an active low GPIO that turns on the
reg_enet_3v3 regulator.

The 'enable-active-high' flag needs to be passed to indicate an active
high polarity.

> > [ 0.153171] reg_fixed_voltage_probe(179): regulator-enet-3v3 call gpiod_get_optional gflags=0x7 ena_gpio_invert
> > [ 0.153218] regulator-enet-3v3 GPIO handle specifies active low - ignored
> > [ 0.153233] of_gpio_flags_quirks(83): regulator-enet-3v3 set active low because !enable-active-high
>
> Because regulators don't specify active high/low in the second
> cell because of legacy bindings.
>
> So this should not be in the device tree anyway, it should be
> GPIO_ACTIVE_HIGH or just 0.

Then it would provide a wrong description that does not describe the reality.