summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-02-11 21:49:38 +0800
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-02-16 18:17:30 +0800
commitef654d161766c13e002f2bf738007ccf44d84749 (patch)
tree7832b5c0be73693de74382f6c896496ba0c665da /include
parent4b06ebc820aa9a46dfb73c7050b073d8224b4b70 (diff)
downloadbarebox-ef654d161766c13e002f2bf738007ccf44d84749.tar.gz
barebox-ef654d161766c13e002f2bf738007ccf44d84749.tar.xz
add gpio keyboard support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'include')
-rw-r--r--include/driver.h5
-rw-r--r--include/gpio_keys.h30
2 files changed, 35 insertions, 0 deletions
diff --git a/include/driver.h b/include/driver.h
index 1b8b16dd16..51d63936c8 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -260,6 +260,11 @@ static inline struct device_d *add_generic_usb_ehci_device(int id,
return add_usb_ehci_device(id, base + 0x100, base + 0x140, pdata);
}
+static inline struct device_d *add_gpio_keys_device(int id, void *pdata)
+{
+ return add_generic_device_res("gpio_keys", id, 0, 0, pdata);
+}
+
/* linear list over all available devices
*/
extern struct list_head device_list;
diff --git a/include/gpio_keys.h b/include/gpio_keys.h
new file mode 100644
index 0000000000..fc548fabcd
--- /dev/null
+++ b/include/gpio_keys.h
@@ -0,0 +1,30 @@
+#ifndef _GPIO_KEYS_H
+#define _GPIO_KEYS_H
+
+#include <poller.h>
+#include <kfifo.h>
+
+struct gpio_keys_button {
+ /* Configuration parameters */
+ int code;
+
+ int gpio;
+ int active_low;
+
+ /* internal */
+ int previous_state;
+};
+
+struct gpio_keys_platform_data {
+ struct gpio_keys_button *buttons;
+ int nbuttons;
+
+ /* optional */
+ int fifo_size;
+
+ struct kfifo *recv_fifo;
+ struct poller_struct poller;
+ struct console_device cdev;
+};
+
+#endif