Re: [PATCH v2] pinctrl: bcm2835: Start GPIO numeration at zero

From: Linus Walleij
Date: Fri Oct 31 2014 - 05:49:35 EST


On Tue, Oct 28, 2014 at 12:05 AM, Matthias Klein
<matthias.klein@xxxxxxxxx> wrote:
> Am 27.10.2014 um 23:44 schrieb Stephen Warren:

>> What's the motivation for this? The GPIO IDs should all come from DT,
>> which encodes everything as an ID relative to a particular controllers, and
>> hence the actual value of the base address should be irrelevant.
>
> - To be in sync with the GPIO numbers in the datasheet / documentation

We are moving away from global GPIO numbers because they are
an eternal pain. We would replace them with a local offset number
just as the second column in /proc/interrupts

Hm we should patch <debugfs/gpio> to show local offsets...

> - For userland applications which rely on these GPIO numbers

ARGH!!!

A much better idea is to add labels to your GPIOs so you can
identify them by name. Augment the driver with labeling capability
if need be, see e.g. commit 781f6d710d4482eab05cfaad50060a0ea8c0e4e0
"gpio: generic: Add label to platform data"

You just need to figure out how to do the same naming from the
device tree. Maybe some new binding is needed, others are
discussing how to do exporting of GPIOs from devicetree
anyway, see the mailing list.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/