aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-07-08 12:32:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-07-08 12:32:41 -0400
commit5e75c5f5d723074b1ceefe916c3005888e431d12 (patch)
treed929d72d9e4f0abcd74cd65922b35123cd3455d5 /include
parentd6d4655172f9c5b9402bb453ed9145a7ab5c46d0 (diff)
parenteeafa5ef6de5acf678624a21f7dba7d43ba73845 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: gpio_mouse - use standard driver registration method Input: mark serio and i8042 as suspended when hibernating too Input: add support for generic GPIO-based matrix keypad Input: arrange keyboards alphabetically Input: gpio-keys - avoid possibility of sleeping in timer function Input: gpio-keys - revert 'change timer to workqueue' Input: dm355evm_keys - fix kconfig symbol names Input: wacom - add DTF720a support and fix rotation on Intuos3 Input: i8042 - more reset quirks for MSI Wind-clone netbooks
Diffstat (limited to 'include')
-rw-r--r--include/linux/input/matrix_keypad.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
new file mode 100644
index 000000000000..7964516c6954
--- /dev/null
+++ b/include/linux/input/matrix_keypad.h
@@ -0,0 +1,65 @@
1#ifndef _MATRIX_KEYPAD_H
2#define _MATRIX_KEYPAD_H
3
4#include <linux/types.h>
5#include <linux/input.h>
6
7#define MATRIX_MAX_ROWS 16
8#define MATRIX_MAX_COLS 16
9
10#define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\
11 (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\
12 (val & 0xffff))
13
14#define KEY_ROW(k) (((k) >> 24) & 0xff)
15#define KEY_COL(k) (((k) >> 16) & 0xff)
16#define KEY_VAL(k) ((k) & 0xffff)
17
18/**
19 * struct matrix_keymap_data - keymap for matrix keyboards
20 * @keymap: pointer to array of uint32 values encoded with KEY() macro
21 * representing keymap
22 * @keymap_size: number of entries (initialized) in this keymap
23 * @max_keymap_size: maximum size of keymap supported by the device
24 *
25 * This structure is supposed to be used by platform code to supply
26 * keymaps to drivers that implement matrix-like keypads/keyboards.
27 */
28struct matrix_keymap_data {
29 const uint32_t *keymap;
30 unsigned int keymap_size;
31 unsigned int max_keymap_size;
32};
33
34/**
35 * struct matrix_keypad_platform_data - platform-dependent keypad data
36 * @keymap_data: pointer to &matrix_keymap_data
37 * @row_gpios: array of gpio numbers reporesenting rows
38 * @col_gpios: array of gpio numbers reporesenting colums
39 * @num_row_gpios: actual number of row gpios used by device
40 * @num_col_gpios: actual number of col gpios used by device
41 * @col_scan_delay_us: delay, measured in microseconds, that is
42 * needed before we can keypad after activating column gpio
43 * @debounce_ms: debounce interval in milliseconds
44 *
45 * This structure represents platform-specific data that use used by
46 * matrix_keypad driver to perform proper initialization.
47 */
48struct matrix_keypad_platform_data {
49 const struct matrix_keymap_data *keymap_data;
50
51 unsigned int row_gpios[MATRIX_MAX_ROWS];
52 unsigned int col_gpios[MATRIX_MAX_COLS];
53 unsigned int num_row_gpios;
54 unsigned int num_col_gpios;
55
56 unsigned int col_scan_delay_us;
57
58 /* key debounce interval in milli-second */
59 unsigned int debounce_ms;
60
61 bool active_low;
62 bool wakeup;
63};
64
65#endif /* _MATRIX_KEYPAD_H */