Re: [PATCH 3/4] gpio: add core support for pull-up/pull-down configuration

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

 



On Tue, Jan 8, 2019 at 3:04 PM Thomas Petazzoni
<thomas.petazzoni@xxxxxxxxxxx> wrote:

> > > +/* Bit 4 express pull up */
> > > +#define GPIO_PULL_UP 16
> > > +
> > > +/* Bit 5 express pull down */
> > > +#define GPIO_PULL_DOWN 32
> > > +
> >
> > > +   GPIO_PULL_UP = (1 << 4),
> > > +   GPIO_PULL_DOWN = (1 << 5),
> >
> > > +   OF_GPIO_PULL_UP = 0x10,
> > > +   OF_GPIO_PULL_DOWN = 0x20,
> >
> > I understand that it's already there, but I wonder if this duplication can
> > be removed. Am I missing something, perhaps a reason why
> > include/linux/of_gpio.h and include/dt-bindings/gpio/gpio.h are separate
> > files?
>
> I also wondered why there was such duplication when writing the
> patches. I've assumed it was done so that
> include/dt-bindings/gpio/gpio.h is "clean" enough to be included in DT,
> while include/linux/of_gpio.h some more elaborate definitions. But
> indeed <linux/of_gpio.h> could include <dt-bindings/gpio/gpio.h>.
> Perhaps there's a good reason for this duplication? Let's see the
> feedback of GPIO maintainers about this.

There is a good reason for this.

The reason is that DT ABI is written in clay, userspace ABI is
written in stone and kernel internal API is written in water.

For the last one see Documentation/process/stable-api-nonsense.rst

For the DT the clay tablet hardens when devices are mass produced
and shipped with a DT in flash.

For the userspace ABI, that will never change until the chardevice
disappears.

So these ABIs are essentially versioned according to completely
different rules and for this reason they are kept separate.

They overlap considerably, but for this reason we are keeping the
definitions separately and also explicitly translating between them
so that we can still change the internal kernel representation of
these flags if we need.

Yours,
Linus Walleij



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux