GPIO expander user space access(ie. pca9552)

Patrick Williams patrick at stwcx.xyz
Wed Feb 1 05:48:08 AEDT 2017


On Tue, Jan 24, 2017 at 10:39:25AM +1030, Andrew Jeffery wrote:
> On Mon, 2017-01-23 at 09:58 -0600, Matt Barth wrote:
> > Is there a defined process/interface to access GPIO expanders from user 
> > space to be able to determine when the state changes? Possibly polling a 
> > fd or getting notified on the state change?
> > 
> > Previously this was an i2c device that was accessed over i2c and the set 
> > of interested bits were simply read into the application. An example is 
> > the use of a pca9552 for presence detection on chassis fans.
> 
> I expect it should be implemented as a gpiochip driver in the kernel
> and exposed via the usual methods to userspace (GPIO chardev and sysfs,
> though sysfs is considered deprecated).
> 
> Andrew

There is already leds-pca955x for manipulating a 9552 as an LED
controller.  That chip can also be used as a GPIO expander (moreover, 
individual bits can be configured as a GPIO).  I don't see anything
obvious in the leds-pca955x that allows manipulating the GPIO aspects.

The leds-pca955x also supports 9553 and 9554.  There is also a gpio-pca953x,
which supports the 9554, 9555, and 9556.  There does not currently
appear to be any mechanism, either using leds-... or gpio-... to
manipulate the GPIO settings of a 9552.

The 955[456] chips have an interrupt line that would typically be wired
back to the BMC.  This allow the normal GPIO interrupt to be waited on
(per Joel's email in this stream).  For chips that do not have the
interrupt line, the gpio-pca953x driver gives a 'dev_warn' if you
attempt to register an interrupt.

It isn't typical to have the same i2c chip registered in two subsystems
(leds and gpio) at the same time, is it?  So we would need to get the leds
driver enhanced to also support gpio manipulation?  Since the chip
doesn't support an interrupt line we are also stuck with polling,
correct?

-- 
Patrick Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20170131/d2d4a13a/attachment.sig>


More information about the openbmc mailing list