Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/plat-omap/include/mach/keypad.h |
| 3 | * |
| 4 | * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | #ifndef ASMARM_ARCH_KEYPAD_H |
| 11 | #define ASMARM_ARCH_KEYPAD_H |
| 12 | |
Janusz Krzysztofik | da1f026 | 2010-12-20 21:09:22 +0000 | [diff] [blame] | 13 | #ifndef CONFIG_ARCH_OMAP1 |
| 14 | #warning Please update the board to use matrix-keypad driver |
Tony Lindgren | acea7c7 | 2012-02-24 10:34:36 -0800 | [diff] [blame] | 15 | #define omap_readw(reg) 0 |
| 16 | #define omap_writew(val, reg) do {} while (0) |
Janusz Krzysztofik | da1f026 | 2010-12-20 21:09:22 +0000 | [diff] [blame] | 17 | #endif |
| 18 | #include <linux/input/matrix_keypad.h> |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 19 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 20 | struct omap_kp_platform_data { |
| 21 | int rows; |
| 22 | int cols; |
Janusz Krzysztofik | da1f026 | 2010-12-20 21:09:22 +0000 | [diff] [blame] | 23 | const struct matrix_keymap_data *keymap_data; |
| 24 | bool rep; |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 25 | unsigned long delay; |
Janusz Krzysztofik | da1f026 | 2010-12-20 21:09:22 +0000 | [diff] [blame] | 26 | bool dbounce; |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 27 | /* specific to OMAP242x*/ |
| 28 | unsigned int *row_gpios; |
| 29 | unsigned int *col_gpios; |
| 30 | }; |
| 31 | |
| 32 | /* Group (0..3) -- when multiple keys are pressed, only the |
| 33 | * keys pressed in the same group are considered as pressed. This is |
| 34 | * in order to workaround certain crappy HW designs that produce ghost |
Janusz Krzysztofik | da1f026 | 2010-12-20 21:09:22 +0000 | [diff] [blame] | 35 | * keypresses. Two free bits, not used by neither row/col nor keynum, |
| 36 | * must be available for use as group bits. The below GROUP_SHIFT |
| 37 | * macro definition is based on some prior knowledge of the |
| 38 | * matrix_keypad defined KEY() macro internals. |
| 39 | */ |
| 40 | #define GROUP_SHIFT 14 |
| 41 | #define GROUP_0 (0 << GROUP_SHIFT) |
| 42 | #define GROUP_1 (1 << GROUP_SHIFT) |
| 43 | #define GROUP_2 (2 << GROUP_SHIFT) |
| 44 | #define GROUP_3 (3 << GROUP_SHIFT) |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 45 | #define GROUP_MASK GROUP_3 |
Janusz Krzysztofik | da1f026 | 2010-12-20 21:09:22 +0000 | [diff] [blame] | 46 | #if KEY_MAX & GROUP_MASK |
| 47 | #error Group bits in conflict with keynum bits |
| 48 | #endif |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 49 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 50 | |
| 51 | #endif |
| 52 | |