summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-09-03 10:18:08 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-04 08:26:49 +0200
commit2f8fe263824151b55487f701718ac4467240ad7a (patch)
tree68774350c087425dcb26e8a561eacddbd03260d9 /include
parentf64bd3d932ec033f02715a5e92b57f52821a4b06 (diff)
downloadbarebox-2f8fe263824151b55487f701718ac4467240ad7a.tar.gz
barebox-2f8fe263824151b55487f701718ac4467240ad7a.tar.xz
add gpiolib support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/gpio.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/include/gpio.h b/include/gpio.h
index b7d840211a..9fb11c3268 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -5,10 +5,35 @@
static inline int gpio_request(unsigned gpio, const char *label)
{
- return 0;
+ return 0;
}
static inline void gpio_free(unsigned gpio)
{
}
+
+struct gpio_chip;
+
+struct gpio_ops {
+ int (*direction_input)(struct gpio_chip *chip, unsigned offset);
+ int (*direction_output)(struct gpio_chip *chip, unsigned offset, int value);
+ int (*get)(struct gpio_chip *chip, unsigned offset);
+ void (*set)(struct gpio_chip *chip, unsigned offset, int value);
+};
+
+struct gpio_chip {
+ struct device_d *dev;
+
+ int base;
+ int ngpio;
+
+ struct gpio_ops *ops;
+
+ struct list_head list;
+};
+
+int gpiochip_add(struct gpio_chip *chip);
+
+int gpio_get_num(struct device_d *dev, int gpio);
+
#endif /* __GPIO_H */