Re: How to use mpc8xxx_gpio.c device driver
From: Ira W. Snyder <hidden>
Date: 2010-08-11 16:48:06
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