[PATCH RFC 1/2] gpio: Add a block GPIO API to gpiolib
From: Stijn Devriendt <hidden>
Date: 2012-09-30 15:19:16
Also in:
lkml
On Sun, Sep 30, 2012 at 5:09 PM, Roland Stigge [off-list ref] wrote:
Hi Stijn, On 30/09/12 16:52, Stijn Devriendt wrote:quoted
quoted
One question: How did you solve the one-value-per-file in the sysfs interface?By exporting the group as a whole: /sys/.../gpiogroup248/value where value contains a decimal representing the group value. Again, this respects the ordering of the pins: Actual pins: 0x2D (b 0010 1101) Selected pins: 6 3 0 1 Readout: 6 (b 0 1 1 0) The export sysfs file does, however, accept multiple gpio IDs for groups. Not sure if this is a 'violation' per se...If I understand correctly, it's a violation (single-value should hold for read and write). To solve it, I have the following in mind: /sys/.../gpiogroupXXX/ contains files "bit0" ... "bit31" which contain a gpio number each, empty if "unconnected".
Unfortunately that means you can't atomically create a group. It also creates a mess to keep ordering intact and to either keep the current pin state or override it at allocation-time. Rules are rules, but why make the interface overly complex when the multi-value file is saner, cleaner and simpler? I know I'm on the happy/corporate side of things and I can violate whatever rule I can if it gets our product shipping, but I'd still propose to have the multi-value approach, even in mainline. Regards, Stijn