diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-05-11 01:37:08 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-05-11 01:38:47 -0400 |
| commit | 1932811f426fee71b7ece67e70aeba7e1b0ebb6d (patch) | |
| tree | ffc4598961733707a89e711b4614c8cc14446ad5 /include/linux/input | |
| parent | d0a3457d38adbad37e43ffe6b763360b2bfe71d9 (diff) | |
Input: matrix-keymap - uninline and prepare for device tree support
Change matrix-keymap helper to be out-of-line, like sparse keymap,
allow the helper perform basic keymap validation and return errors,
and prepare for device tree support.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'include/linux/input')
| -rw-r--r-- | include/linux/input/matrix_keypad.h | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h index 6c07ced0af81..e8fe08ebc245 100644 --- a/include/linux/input/matrix_keypad.h +++ b/include/linux/input/matrix_keypad.h | |||
| @@ -75,39 +75,13 @@ struct matrix_keypad_platform_data { | |||
| 75 | bool no_autorepeat; | 75 | bool no_autorepeat; |
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | /** | 78 | int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, |
| 79 | * matrix_keypad_build_keymap - convert platform keymap into matrix keymap | 79 | const char *keymap_name, |
| 80 | * @keymap_data: keymap supplied by the platform code | 80 | unsigned int rows, unsigned int cols, |
| 81 | * @row_shift: number of bits to shift row value by to advance to the next | 81 | unsigned short *keymap, |
| 82 | * line in the keymap | 82 | struct input_dev *input_dev); |
| 83 | * @keymap: expanded version of keymap that is suitable for use by | ||
| 84 | * matrix keyboad driver | ||
| 85 | * @keybit: pointer to bitmap of keys supported by input device | ||
| 86 | * | ||
| 87 | * This function converts platform keymap (encoded with KEY() macro) into | ||
| 88 | * an array of keycodes that is suitable for using in a standard matrix | ||
| 89 | * keyboard driver that uses row and col as indices. | ||
| 90 | */ | ||
| 91 | static inline void | ||
| 92 | matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, | ||
| 93 | unsigned int row_shift, | ||
| 94 | unsigned short *keymap, unsigned long *keybit) | ||
| 95 | { | ||
| 96 | int i; | ||
| 97 | |||
| 98 | for (i = 0; i < keymap_data->keymap_size; i++) { | ||
| 99 | unsigned int key = keymap_data->keymap[i]; | ||
| 100 | unsigned int row = KEY_ROW(key); | ||
| 101 | unsigned int col = KEY_COL(key); | ||
| 102 | unsigned short code = KEY_VAL(key); | ||
| 103 | |||
| 104 | keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code; | ||
| 105 | __set_bit(code, keybit); | ||
| 106 | } | ||
| 107 | __clear_bit(KEY_RESERVED, keybit); | ||
| 108 | } | ||
| 109 | 83 | ||
| 110 | #ifdef CONFIG_INPUT_OF_MATRIX_KEYMAP | 84 | #ifdef CONFIG_OF |
| 111 | struct matrix_keymap_data * | 85 | struct matrix_keymap_data * |
| 112 | matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname); | 86 | matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname); |
| 113 | 87 | ||
