Re: [PATCH] gpio: 74x164: add lines-initial-states property

From: Linus Walleij
Date: Thu Aug 16 2018 - 04:11:54 EST


Hi David,

On Wed, Aug 15, 2018 at 10:19 PM David Bauer <mail@xxxxxxxxxxxxxxx> wrote:

> This adds the ability to define the initial state of each output line on
> device probe.
>
> Signed-off-by: David Bauer <mail@xxxxxxxxxxxxxxx>

(...)
> Optional properties:
> - enable-gpios: GPIO connected to the OE (Output Enable) pin.
> +- lines-initial-states: Bitmask that specifies the initial state of
> + each line. When a bit is set to zero, the corresponding output line
> + is initialized LOW. When a bit is set to one, the corresponding
> + output line is initialized HIGH. In case this property is not
> + defined, all lines will be initialized as LOW.

This sounds like something that should be generic, and not use
a bitmask, but offsets. It should work even if the number of
GPIOs from the chip is > 32.

Is the usecase different from hogs?
See Documentation/devicetree/bindings/gpio.txt

There has been extensive discussion about supporting initial values
with something similar to hogs, but I haven't got anything ACKed
by the DT maintainers so it has kind of stalled.

I would make sure to both make it generic, get ACK from the DT
mainatiners, and make sure to implement it in
drivers/gpio/gpiolib-of.c and not locally in drivers.

Yours,
Linus Walleij