diff options
| author | J. Bruce Fields <bfields@citi.umich.edu> | 2009-08-21 11:27:29 -0400 |
|---|---|---|
| committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-08-21 11:27:29 -0400 |
| commit | e9dc122166b8d863d3057a66ada04838e5548e52 (patch) | |
| tree | 749e15bf719b64bf9113db7acd8e043d9742cb26 /include/linux/input/matrix_keypad.h | |
| parent | 560ab42ef923aaf2e4347315bdfcc74b2708972c (diff) | |
| parent | 405d8f8b1d936414da2093d4149ff790ff3f84a5 (diff) | |
Merge branch 'nfs-for-2.6.32' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6 into for-2.6.32-incoming
Conflicts:
net/sunrpc/cache.c
Diffstat (limited to 'include/linux/input/matrix_keypad.h')
| -rw-r--r-- | include/linux/input/matrix_keypad.h | 66 |
1 files changed, 66 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..15d5903af2dd --- /dev/null +++ b/include/linux/input/matrix_keypad.h | |||
| @@ -0,0 +1,66 @@ | |||
| 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 | #define MATRIX_SCAN_CODE(row, col, row_shift) (((row) << (row_shift)) + (col)) | ||
| 19 | |||
| 20 | /** | ||
| 21 | * struct matrix_keymap_data - keymap for matrix keyboards | ||
| 22 | * @keymap: pointer to array of uint32 values encoded with KEY() macro | ||
| 23 | * representing keymap | ||
| 24 | * @keymap_size: number of entries (initialized) in this keymap | ||
| 25 | * | ||
| 26 | * This structure is supposed to be used by platform code to supply | ||
| 27 | * keymaps to drivers that implement matrix-like keypads/keyboards. | ||
| 28 | */ | ||
| 29 | struct matrix_keymap_data { | ||
| 30 | const uint32_t *keymap; | ||
| 31 | unsigned int 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: pointer to array of gpio numbers representing rows | ||
| 38 | * @col_gpios: pointer to 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 | */ | ||
| 48 | struct matrix_keypad_platform_data { | ||
| 49 | const struct matrix_keymap_data *keymap_data; | ||
| 50 | |||
| 51 | const unsigned int *row_gpios; | ||
| 52 | const unsigned int *col_gpios; | ||
| 53 | |||
| 54 | unsigned int num_row_gpios; | ||
| 55 | unsigned int num_col_gpios; | ||
| 56 | |||
| 57 | unsigned int col_scan_delay_us; | ||
| 58 | |||
| 59 | /* key debounce interval in milli-second */ | ||
| 60 | unsigned int debounce_ms; | ||
| 61 | |||
| 62 | bool active_low; | ||
| 63 | bool wakeup; | ||
| 64 | }; | ||
| 65 | |||
| 66 | #endif /* _MATRIX_KEYPAD_H */ | ||
