[mountd] set maintainer flag
[openwrt/svn-archive/archive.git] / target / linux / generic / files / include / linux / gpio_dev.h
1 #ifndef _GPIO_DEV_H__
2 #define _GPIO_DEV_H__
3
4 /*********************************************************************
5 *
6 * This Linux kernel header is expanded from the original driver
7 * (gpio_dev) by John Crispin. It provides an ioctl based interface to
8 * GPIO pins via the /dev/gpio char device and gpiolib within the kernel.
9 * The third argument to each ioctl is the GPIO pin number.
10 *
11 * This driver has been tested with lk 2.6.31 and works. The original
12 * driver fails quietly with this version. The protocol is now a bit
13 * different: the ioctl(fd, GPIO_REQUEST, <pin>) should be called
14 * after the open("/dev/gpio", O_RDWR) to determine if the <pin> is
15 * already in use. If the ioctl is successful (i.e. returns 0 for not
16 * in use) then the <pin> is claimed by this driver and
17 * ioctl(fd, GPIO_FREE, <pin>) should be called prior to close(fd) .
18 *
19 * See <kernel_source>/Documentation/gpio.txt
20 * Note that kernel designers prefer the use of the sysfs gpio interface.
21 * This char driver is easier to use from code and faster.
22 ********************************************************************/
23
24 /* This header can be included in both the user and kernel spaces */
25 /* The _IO macro is defined in sys/ioctl.h */
26
27 #define IOC_GPIODEV_MAGIC 'B'
28
29 #define GPIO_GET _IO(IOC_GPIODEV_MAGIC, 10)
30 #define GPIO_SET _IO(IOC_GPIODEV_MAGIC, 11)
31 #define GPIO_CLEAR _IO(IOC_GPIODEV_MAGIC, 12)
32 #define GPIO_DIR_IN _IO(IOC_GPIODEV_MAGIC, 13)
33 #define GPIO_DIR_OUT _IO(IOC_GPIODEV_MAGIC, 14)
34 /* Sets the direction out and clears the <pin> (low) */
35
36 #define GPIO_DIR_HIGH _IO(IOC_GPIODEV_MAGIC, 15)
37 /* Sets the direction out and sets the <pin> (high) */
38 #define GPIO_REQUEST _IO(IOC_GPIODEV_MAGIC, 16)
39 #define GPIO_FREE _IO(IOC_GPIODEV_MAGIC, 17)
40 #define GPIO_CAN_SLEEP _IO(IOC_GPIODEV_MAGIC, 18)
41
42 #endif