DT GPIO numbering?

Johannes Stezenbach js at sig21.net
Tue Aug 14 23:05:47 EST 2012


On Tue, Aug 14, 2012 at 12:00:23PM +0200, Linus Walleij wrote:
> On Fri, Aug 10, 2012 at 11:34 AM, Johannes Stezenbach <js at sig21.net> wrote:
> 
> > Actually I think the kernel internal GPIO numbers shouldn't be in the
> > sysfs API, instead userspace should use the names.
> 
> This is true, but we cannot remove these numbers because they
> are now in Documentation/ABI/testing/sysfs-gpio
> 
> And while the "testing" ABI is, well for testing, it would probably
> break a lot of stuff it we removed it.
> 
> But we can sure add names. However these would still sit under
> /sys/class/gpio/gpioN/name
> 
> Or do you suggest we simply duplicate all GPIOs which have
> names under /sys/class/gpio/named/<name>
> or something like that?

I'm still not sure.  One idea was to add /proc/gpios which maps
names to numbers, then userspace can look up the number and use that.
But the more I think about it /sys/class/gpio/export is just
a debug hack and shouldn't be used.  Board code should export
the available gpio according to pinctrl setup and schematics.
The only catch here is that board code then needs to know which gpio are
for userspace and which are used by in-kernel drivers.
E.g. a LED could be set by LED Triggers or by userspace
Blinkenlight app.


Johannes


More information about the devicetree-discuss mailing list