How to use mpc8xxx_gpio.c device driver

Ira W. Snyder iws at ovro.caltech.edu
Thu Aug 12 02:25:09 EST 2010


On Wed, Aug 11, 2010 at 07:49:40PM +0530, Ravi Gupta wrote:
> Also, when I try to export a gpio in sysfs
> 
> echo 9 > /sys/class/gpio/export
> 
> It gives me an error in dmesg
> gpio_request: gpio-9 (sysfs) status -22
> export_store: status -22
> 
> Here is a look of sysfs on my machine
> 
> # ls /sys/class/gpio/ -la
> drwxr-xr-x    4 root     root            0 Jan  1 00:00 .
> drwxr-xr-x   24 root     root            0 Jan  1 00:00 ..
> --w-------    1 root     root         4096 Jan  1 00:10 export
> drwxr-xr-x    3 root     root            0 Jan  1 00:00 gpiochip192
> drwxr-xr-x    3 root     root            0 Jan  1 00:00 gpiochip224
> --w-------    1 root     root         4096 Jan  1 00:00 unexport


Your GPIO pins are numbered from 192-223 on one GPIO chip, and 224-255
on the next GPIO chip. You should be exporting GPIO pin 200 or 201
(192+8 or 192+9), depending on whether your pins are numbered from zero
or one.

"status -22" is -EINVAL: Invalid Argument. You're doing something which
is invalid, so this makes sense. There is no "pin 9".

Ira


More information about the Linuxppc-dev mailing list