Re: userspace GPIO access (WAS: [patch/rfc 2/4] pcf875x ...)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ben Nizette <bn@...>
Cc: Trent Piepho <tpiepho@...>, Jean Delvare <khali@...>, Linux Kernel list <linux-kernel@...>, Mike Frysinger <vapier.adi@...>
Date: Saturday, April 5, 2008 - 12:05 am

On Thursday 03 April 2008, Ben Nizette wrote:

I won't much care about /dev/... vs /sys/... though I'd
probably have used sysfs myself (just because it's much
simpler and doesn't need to imply mdev/udev and classes).

The configuration part of each driver bothers me:

 - Mike's simple_gpio requires manual kernel config
   to set up the platform_device nodes ... and thus
   rules out the first usage scenarios I ever heard
   of for such a userspace mechanism.

 - Trent's gpio_class exposes all GPIOs, even ones
   that are claimed by kernel drivers ... and thus
   makes it easy to clobber kernel driver state.
   (Plus it won't work on most built-in GPIOs, since
   they by and large don't have parent devices.)

What I'd like to see is userspace config commands to
cause the gpio_request() ... *maybe* something like

    echo 42 foo 0 > .../gpio_config

	... causing error-checked versions of:

    gpio_request(42, "foo")
    gpio_direction_output(42, 0)

	... then some .../gpio42 file, read/write, appears

and

    echo 84 bar in > .../gpio_config

	... causing error-checked versions of:

    gpio_request(84, "bar")
    gpio_direction_input(84)

	... then some .../gpio84 file, read-only, appears

Though arguably the label could just always be "userspace"
(it's mostly for /sys/kernel/debug/gpio), and the default could
be to configure as an input (unless an output value was given).
Plus, there should be some way to cause gpio_free() too.

A potential advantage of the /dev/... node approach would be
that it's easier to support an IRQ-backed poll() mechanism
for inputs.

- Dave

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch/rfc 2/4] pcf875x I2C GPIO expander driver, David Brownell, (Mon Oct 29, 9:51 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Jean Delvare, (Fri Nov 30, 8:32 am)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, David Brownell, (Fri Nov 30, 2:40 pm)
Re: [patch/rfc 2/4] pcf857x I2C GPIO expander driver, David Brownell, (Wed Dec 5, 11:03 pm)
Re: [patch/rfc 2/4] pcf857x I2C GPIO expander driver, Jean Delvare, (Thu Dec 6, 7:17 pm)
Re: [patch/rfc 2/4] pcf857x I2C GPIO expander driver, David Brownell, (Fri Dec 7, 12:02 am)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Jean Delvare, (Fri Nov 30, 4:13 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, David Brownell, (Fri Nov 30, 4:59 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Trent Piepho, (Thu Apr 3, 10:06 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Jean Delvare, (Fri Apr 4, 4:09 am)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, David Brownell, (Fri Apr 4, 10:53 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Trent Piepho, (Fri Apr 4, 3:07 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, David Brownell, (Fri Apr 4, 10:51 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Jean Delvare, (Fri Apr 4, 3:36 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Trent Piepho, (Fri Apr 4, 4:18 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Ben Nizette, (Thu Apr 3, 10:45 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Trent Piepho, (Thu Apr 3, 11:33 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Ben Nizette, (Fri Apr 4, 12:57 am)
Re: userspace GPIO access (WAS: [patch/rfc 2/4] pcf875x ...), David Brownell, (Sat Apr 5, 12:05 am)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Bill Gatliff, (Fri Nov 30, 9:04 am)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Jean Delvare, (Fri Nov 30, 9:36 am)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Bill Gatliff, (Fri Nov 30, 10:09 am)