Skip to content

Commit

Permalink
[ARM] pxa: add partial keypad support for mainstone
Browse files Browse the repository at this point in the history
This is partial because mainstone's keypad is really special, some of
the keys like '1', '2', ... are actually connected to two row/column
juntions, thus pressing '1' is equivalent to pressing 'A' & 'H'.

This is really brain damanged since it makes distinguishing between
pressing '1' and multiple keys pressing of 'A' & 'H' difficult.

So these special keys are not supported for the time being.

Signed-off-by: eric miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
eric miao authored and Russell King committed Apr 19, 2008
1 parent 3732098 commit 55c26e4
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions arch/arm/mach-pxa/mainstone.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <asm/arch/mmc.h>
#include <asm/arch/irda.h>
#include <asm/arch/ohci.h>
#include <asm/arch/pxa27x_keypad.h>

#include "generic.h"
#include "devices.h"
Expand Down Expand Up @@ -548,6 +549,57 @@ static struct pxaohci_platform_data mainstone_ohci_platform_data = {
.init = mainstone_ohci_init,
};

#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES)
static unsigned int mainstone_matrix_keys[] = {
KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C),
KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F),
KEY(0, 1, KEY_G), KEY(1, 1, KEY_H), KEY(2, 1, KEY_I),
KEY(3, 1, KEY_J), KEY(4, 1, KEY_K), KEY(5, 1, KEY_L),
KEY(0, 2, KEY_M), KEY(1, 2, KEY_N), KEY(2, 2, KEY_O),
KEY(3, 2, KEY_P), KEY(4, 2, KEY_Q), KEY(5, 2, KEY_R),
KEY(0, 3, KEY_S), KEY(1, 3, KEY_T), KEY(2, 3, KEY_U),
KEY(3, 3, KEY_V), KEY(4, 3, KEY_W), KEY(5, 3, KEY_X),
KEY(2, 4, KEY_Y), KEY(3, 4, KEY_Z),

KEY(0, 4, KEY_DOT), /* . */
KEY(1, 4, KEY_CLOSE), /* @ */
KEY(4, 4, KEY_SLASH),
KEY(5, 4, KEY_BACKSLASH),
KEY(0, 5, KEY_HOME),
KEY(1, 5, KEY_LEFTSHIFT),
KEY(2, 5, KEY_SPACE),
KEY(3, 5, KEY_SPACE),
KEY(4, 5, KEY_ENTER),
KEY(5, 5, KEY_BACKSPACE),

KEY(0, 6, KEY_UP),
KEY(1, 6, KEY_DOWN),
KEY(2, 6, KEY_LEFT),
KEY(3, 6, KEY_RIGHT),
KEY(4, 6, KEY_SELECT),
};

struct pxa27x_keypad_platform_data mainstone_keypad_info = {
.matrix_key_rows = 6,
.matrix_key_cols = 7,
.matrix_key_map = mainstone_matrix_keys,
.matrix_key_map_size = ARRAY_SIZE(mainstone_matrix_keys),

.enable_rotary0 = 1,
.rotary0_up_key = KEY_UP,
.rotary0_down_key = KEY_DOWN,

.debounce_interval = 30,
};

static void __init mainstone_init_keypad(void)
{
pxa_set_keypad_info(&mainstone_keypad_info);
}
#else
static inline void mainstone_init_keypad(void) {}
#endif

static void __init mainstone_init(void)
{
int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */
Expand Down Expand Up @@ -585,6 +637,8 @@ static void __init mainstone_init(void)
pxa_set_mci_info(&mainstone_mci_platform_data);
pxa_set_ficp_info(&mainstone_ficp_platform_data);
pxa_set_ohci_info(&mainstone_ohci_platform_data);

mainstone_init_keypad();
}


Expand Down

0 comments on commit 55c26e4

Please sign in to comment.