New GPIO API from upstream

Andrew Jeffery andrew at aj.id.au
Tue Feb 28 11:41:56 AEDT 2017


On Tue, 2017-02-28 at 11:03 +1030, Joel Stanley wrote:
> > The new API provides some useful stuff like
> > triggering events when a gpio line changes, etc.
> 
> Triggering from GPIO line changes is also possible with the sysfs API
> - you can poll() on the sysfs file as described in the documentation:
> 
>  https://www.kernel.org/doc/Documentation/gpio/sysfs.txt
> 
> When we're dealing with inputs, another useful interface we can use
> from the kernel is input events. We use the device tree to bind the
> gpio-keys driver to the GPIO, and this gives us an input device to
> read from:
> 
>  https://www.kernel.org/doc/Documentation/devicetree/bindings/input/gpio-keys.txt

This is primarily useful if you want to apply pinconf settings to the
GPIO, e.g. debounce periods. It does require that you assign a keycode
to the GPIO, which will then become part of the system's kernel ABI.
That's a bit of a detraction, so your use-case will play an important
role in determining whether this is the best approach.

Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20170228/dde670e7/attachment.sig>


More information about the openbmc mailing list