Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver

From: Trent Piepho
Date: Thu Apr 03 2008 - 22:08:44 EST


On Fri, 30 Nov 2007, David Brownell wrote:
On Friday 30 November 2007, Jean Delvare wrote:

So the user-space interface would be part of the generic GPIO
infrastructure? I like the idea.

I thought that would make sense too! :) Someone would need to
write the code though. Having such a mechanism would provide
another "carrot" to migrate folk towards the gpiolib core.

Here's some code to do this. It's not entirely perfect yet, but it is
usable. I create a directory in sysfs (class/gpio/<name>:<num>) for each
gpio line. The are files in this directory to allow reading/setting the
gpio value and direction. One can also see the label associated with the
gpio if gpiolib is keeping track of labels (i.e. debugfs is on). sysfs
also creates a gpio directory under the device associated with the gpio
lines (this is a new thing one needs to add) with that device's gpios. Actually, think these are "real" sysfs directories, and the ones in
/sys/class are copies made by sysfs.

----------------------------------------------------------------------------