Re: [PATCH V1 1/2] gpio: inverter: Add virtual controller for gpio configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 14, 2019 at 3:13 PM Enrico Weigelt, metux IT consult
<lkml@xxxxxxxxx> wrote:

> On 13.06.19 23:58, Linus Walleij wrote:
>
> > For devicetree people mostly use the device tree cell flag
> > GPIO_ACTIVE_LOW on these to work around it. But there
> > are some cases where that isn't very readable.
>
> hmm, do you recall any such case where it isn't reliable ?
> What are the problems here ?

GPIO_ACTIVE_LOW is there to tell which way the consumer acts.
If the line is counted as asserted when active low, it should be flagged
as GPIO_ACTIVE_LOW, in the strict sense.

So for example a reset line:

reset-gpios = <&gpio 4 GPIO_ACTIVE_LOW>;

Then inside Linux we assert this with
gpiod_set_value(gpiod, 1);
which will drive the line low, here "1" means "asserted".
Then we release the reset and drive the line high with
gpiod_set_value(gpiod, 0);

On schematics this will be indicated by a line above the RESET
rail or using the notation RESETN. (the N means inverted polarity).

So as is the case with regulators, device tree properties should
describe the electronic semantics of the consuming devices, not how
some random software in the operating system want to interpret
things, it is not there for software fixes, it is just being abused for
that sometimes.

> Are there any plans for removing the GPIO_ACTIVE_LOW ?

We can't do that, it is ABI. Besides it should be used to describe how
the component works.

The fact that many people use this flag as a workaround doesn't mean
it doesn't have a valid semantic when used right.

Yours,
Linus Walleij



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux