diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-12-07 01:28:35 -0500 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-12-07 01:29:22 -0500 |
commit | 6548698f929814375fa5d62ae1db96959b0418c1 (patch) | |
tree | 340924ae82cb0946aa15045b2b72186de52a8146 /include/linux/input/matrix_keypad.h | |
parent | 1d2c6cfd40b2dece3bb958cbbc405a2c1536ab75 (diff) | |
parent | 22763c5cf3690a681551162c15d34d935308c8d7 (diff) |
Merge commit 'v2.6.32' into reiserfs/kill-bkl
Merge-reason: The tree was based 2.6.31. It's better to be up to date
with 2.6.32. Although no conflicting changes were made in between,
it gives benchmarking results closer to the lastest kernel behaviour.
Diffstat (limited to 'include/linux/input/matrix_keypad.h')
-rw-r--r-- | include/linux/input/matrix_keypad.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h index 15d5903af2dd..b3cd42d50e16 100644 --- a/include/linux/input/matrix_keypad.h +++ b/include/linux/input/matrix_keypad.h | |||
@@ -63,4 +63,36 @@ struct matrix_keypad_platform_data { | |||
63 | bool wakeup; | 63 | bool wakeup; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | /** | ||
67 | * matrix_keypad_build_keymap - convert platform keymap into matrix keymap | ||
68 | * @keymap_data: keymap supplied by the platform code | ||
69 | * @row_shift: number of bits to shift row value by to advance to the next | ||
70 | * line in the keymap | ||
71 | * @keymap: expanded version of keymap that is suitable for use by | ||
72 | * matrix keyboad driver | ||
73 | * @keybit: pointer to bitmap of keys supported by input device | ||
74 | * | ||
75 | * This function converts platform keymap (encoded with KEY() macro) into | ||
76 | * an array of keycodes that is suitable for using in a standard matrix | ||
77 | * keyboard driver that uses row and col as indices. | ||
78 | */ | ||
79 | static inline void | ||
80 | matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, | ||
81 | unsigned int row_shift, | ||
82 | unsigned short *keymap, unsigned long *keybit) | ||
83 | { | ||
84 | int i; | ||
85 | |||
86 | for (i = 0; i < keymap_data->keymap_size; i++) { | ||
87 | unsigned int key = keymap_data->keymap[i]; | ||
88 | unsigned int row = KEY_ROW(key); | ||
89 | unsigned int col = KEY_COL(key); | ||
90 | unsigned short code = KEY_VAL(key); | ||
91 | |||
92 | keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code; | ||
93 | __set_bit(code, keybit); | ||
94 | } | ||
95 | __clear_bit(KEY_RESERVED, keybit); | ||
96 | } | ||
97 | |||
66 | #endif /* _MATRIX_KEYPAD_H */ | 98 | #endif /* _MATRIX_KEYPAD_H */ |