summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-02-08 08:26:35 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-02-08 08:26:35 +0100
commit05261801e9cde103b3c4df843472027c007531da (patch)
tree1c138878a228f93e22ec1c8d729ef6915586b587 /include
parent6435fb09d8af3aeae7c6f8428f5e7ade15aca6f5 (diff)
parent253fb33bb81b0e88bcfa0184ef29206598fbb5d4 (diff)
downloadbarebox-05261801e9cde103b3c4df843472027c007531da.tar.gz
barebox-05261801e9cde103b3c4df843472027c007531da.tar.xz
Merge branch 'for-next/input'
Diffstat (limited to 'include')
-rw-r--r--include/input/input.h34
-rw-r--r--include/input/keyboard.h1
-rw-r--r--include/input/matrix_keypad.h35
-rw-r--r--include/matrix_keypad.h59
-rw-r--r--include/poller.h4
5 files changed, 74 insertions, 59 deletions
diff --git a/include/input/input.h b/include/input/input.h
new file mode 100644
index 0000000000..dbf3e7f574
--- /dev/null
+++ b/include/input/input.h
@@ -0,0 +1,34 @@
+#ifndef __INPUT_H
+#define __INPUT_H
+
+#include <linux/types.h>
+#include <linux/list.h>
+#include <dt-bindings/input/linux-event-codes.h>
+
+struct input_event {
+ uint16_t code;
+ uint16_t value;
+};
+
+struct input_device {
+ struct list_head list;
+ DECLARE_BITMAP(keys, KEY_CNT);
+};
+
+void input_report_key_event(struct input_device *idev, unsigned int code, int value);
+
+int input_device_register(struct input_device *);
+void input_device_unregister(struct input_device *);
+
+void input_key_get_status(unsigned long *keys, int bits);
+
+struct input_notifier {
+ void (*notify)(struct input_notifier *in, struct input_event *event);
+ struct list_head list;
+};
+
+int input_register_notfier(struct input_notifier *in);
+void input_unregister_notfier(struct input_notifier *in);
+
+#endif /* __INPUT_H */
+
diff --git a/include/input/keyboard.h b/include/input/keyboard.h
index dd04690304..d1f5bf553a 100644
--- a/include/input/keyboard.h
+++ b/include/input/keyboard.h
@@ -6,5 +6,6 @@
#define NR_KEYS 256
extern uint8_t keycode_bb_keys[NR_KEYS];
+extern uint8_t keycode_bb_shift_keys[NR_KEYS];
#endif
diff --git a/include/input/matrix_keypad.h b/include/input/matrix_keypad.h
new file mode 100644
index 0000000000..03d963af0e
--- /dev/null
+++ b/include/input/matrix_keypad.h
@@ -0,0 +1,35 @@
+#ifndef _MATRIX_KEYPAD_H
+#define _MATRIX_KEYPAD_H
+
+#define MATRIX_MAX_ROWS 32
+#define MATRIX_MAX_COLS 32
+
+#define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\
+ (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\
+ ((val) & 0xffff))
+
+#define KEY_ROW(k) (((k) >> 24) & 0xff)
+#define KEY_COL(k) (((k) >> 16) & 0xff)
+#define KEY_VAL(k) ((k) & 0xffff)
+
+#define MATRIX_SCAN_CODE(row, col, row_shift) (((row) << (row_shift)) + (col))
+
+/**
+ * struct matrix_keymap_data - keymap for matrix keyboards
+ * @keymap: pointer to array of uint32 values encoded with KEY() macro
+ * representing keymap
+ * @keymap_size: number of entries (initialized) in this keymap
+ *
+ * This structure is supposed to be used by platform code to supply
+ * keymaps to drivers that implement matrix-like keypads/keyboards.
+ */
+struct matrix_keymap_data {
+ const uint32_t *keymap;
+ unsigned int keymap_size;
+};
+
+int matrix_keypad_build_keymap(struct device_d *dev,
+ const struct matrix_keymap_data *keymap_data,
+ unsigned int row_shift, unsigned short *keymap);
+
+#endif /* _MATRIX_KEYPAD_H */
diff --git a/include/matrix_keypad.h b/include/matrix_keypad.h
deleted file mode 100644
index 60de428ae0..0000000000
--- a/include/matrix_keypad.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef _MATRIX_KEYPAD_H
-#define _MATRIX_KEYPAD_H
-
-#define MATRIX_MAX_ROWS 32
-#define MATRIX_MAX_COLS 32
-
-#define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\
- (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\
- ((val) & 0xffff))
-
-#define KEY_ROW(k) (((k) >> 24) & 0xff)
-#define KEY_COL(k) (((k) >> 16) & 0xff)
-#define KEY_VAL(k) ((k) & 0xffff)
-
-#define MATRIX_SCAN_CODE(row, col, row_shift) (((row) << (row_shift)) + (col))
-
-/**
- * struct matrix_keymap_data - keymap for matrix keyboards
- * @keymap: pointer to array of uint32 values encoded with KEY() macro
- * representing keymap
- * @keymap_size: number of entries (initialized) in this keymap
- *
- * This structure is supposed to be used by platform code to supply
- * keymaps to drivers that implement matrix-like keypads/keyboards.
- */
-struct matrix_keymap_data {
- const uint32_t *keymap;
- unsigned int keymap_size;
-};
-
-/**
- * matrix_keypad_build_keymap - convert platform keymap into matrix keymap
- * @keymap_data: keymap supplied by the platform code
- * @row_shift: number of bits to shift row value by to advance to the next
- * line in the keymap
- * @keymap: expanded version of keymap that is suitable for use by
- * matrix keyboad driver
- * This function converts platform keymap (encoded with KEY() macro) into
- * an array of keycodes that is suitable for using in a standard matrix
- * keyboard driver that uses row and col as indices.
- */
-static inline void
-matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
- unsigned int row_shift,
- unsigned short *keymap)
-{
- int i;
-
- for (i = 0; i < keymap_data->keymap_size; i++) {
- unsigned int key = keymap_data->keymap[i];
- unsigned int row = KEY_ROW(key);
- unsigned int col = KEY_COL(key);
- unsigned short code = KEY_VAL(key);
-
- keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code;
- }
-}
-
-#endif /* _MATRIX_KEYPAD_H */
diff --git a/include/poller.h b/include/poller.h
index cda5b5774b..35a2271d69 100644
--- a/include/poller.h
+++ b/include/poller.h
@@ -26,8 +26,12 @@ struct poller_async {
void (*fn)(void *);
void *ctx;
uint64_t end;
+ int active;
};
+int poller_async_register(struct poller_async *pa);
+int poller_async_unregister(struct poller_async *pa);
+
int poller_call_async(struct poller_async *pa, uint64_t delay_ns,
void (*fn)(void *), void *ctx);
int poller_async_cancel(struct poller_async *pa);