From 1932811f426fee71b7ece67e70aeba7e1b0ebb6d Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 10 May 2012 22:37:08 -0700 Subject: 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 --- include/linux/input/matrix_keypad.h | 38 ++++++------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-) (limited to 'include/linux/input') 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 { bool no_autorepeat; }; -/** - * 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 - * @keybit: pointer to bitmap of keys supported by input device - * - * 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, unsigned long *keybit) -{ - 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; - __set_bit(code, keybit); - } - __clear_bit(KEY_RESERVED, keybit); -} +int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, + const char *keymap_name, + unsigned int rows, unsigned int cols, + unsigned short *keymap, + struct input_dev *input_dev); -#ifdef CONFIG_INPUT_OF_MATRIX_KEYMAP +#ifdef CONFIG_OF struct matrix_keymap_data * matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname); -- cgit v1.2.3-59-g8ed1b