Commit da1f026b authored by Janusz Krzysztofik's avatar Janusz Krzysztofik Committed by Tony Lindgren
Browse files

Keyboard: omap-keypad: use matrix_keypad.h



Most keypad drivers make use of the <linux/input/matrix_keypad.h>
defined macros, structures and inline functions.

Convert omap-keypad driver to use those as well, as suggested by a
compile time warning, hardcoded into the OMAP <palt/keypad.h>.

Created against linux-2.6.37-rc5.
Tested on Amstrad Delta.
Compile tested with omap1_defconfig and omap2plus_defconfig shrinked to
board-h4.
Signed-off-by: default avatarJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Reviewed-by: default avatarAaro Koskinen <aaro.koskinen@nokia.com>
Acked-by: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 4e012e5f
......@@ -43,84 +43,82 @@
static u8 ams_delta_latch1_reg;
static u16 ams_delta_latch2_reg;
static int ams_delta_keymap[] = {
static const unsigned int ams_delta_keymap[] = {
KEY(0, 0, KEY_F1), /* Advert */
KEY(3, 0, KEY_COFFEE), /* Games */
KEY(2, 0, KEY_QUESTION), /* Directory */
KEY(3, 2, KEY_CONNECT), /* Internet */
KEY(2, 1, KEY_SHOP), /* Services */
KEY(0, 3, KEY_COFFEE), /* Games */
KEY(0, 2, KEY_QUESTION), /* Directory */
KEY(2, 3, KEY_CONNECT), /* Internet */
KEY(1, 2, KEY_SHOP), /* Services */
KEY(1, 1, KEY_PHONE), /* VoiceMail */
KEY(1, 0, KEY_DELETE), /* Delete */
KEY(0, 1, KEY_DELETE), /* Delete */
KEY(2, 2, KEY_PLAY), /* Play */
KEY(0, 1, KEY_PAGEUP), /* Up */
KEY(3, 1, KEY_PAGEDOWN), /* Down */
KEY(0, 2, KEY_EMAIL), /* ReadEmail */
KEY(1, 2, KEY_STOP), /* Stop */
KEY(1, 0, KEY_PAGEUP), /* Up */
KEY(1, 3, KEY_PAGEDOWN), /* Down */
KEY(2, 0, KEY_EMAIL), /* ReadEmail */
KEY(2, 1, KEY_STOP), /* Stop */
/* Numeric keypad portion */
KEY(7, 0, KEY_KP1),
KEY(6, 0, KEY_KP2),
KEY(5, 0, KEY_KP3),
KEY(7, 1, KEY_KP4),
KEY(6, 1, KEY_KP5),
KEY(5, 1, KEY_KP6),
KEY(7, 2, KEY_KP7),
KEY(6, 2, KEY_KP8),
KEY(5, 2, KEY_KP9),
KEY(6, 3, KEY_KP0),
KEY(7, 3, KEY_KPASTERISK),
KEY(5, 3, KEY_KPDOT), /* # key */
KEY(2, 7, KEY_NUMLOCK), /* Mute */
KEY(1, 7, KEY_KPMINUS), /* Recall */
KEY(1, 6, KEY_KPPLUS), /* Redial */
KEY(6, 7, KEY_KPSLASH), /* Handsfree */
KEY(0, 6, KEY_ENTER), /* Video */
KEY(4, 7, KEY_CAMERA), /* Photo */
KEY(4, 0, KEY_F2), /* Home */
KEY(4, 1, KEY_F3), /* Office */
KEY(4, 2, KEY_F4), /* Mobile */
KEY(0, 7, KEY_KP1),
KEY(0, 6, KEY_KP2),
KEY(0, 5, KEY_KP3),
KEY(1, 7, KEY_KP4),
KEY(1, 6, KEY_KP5),
KEY(1, 5, KEY_KP6),
KEY(2, 7, KEY_KP7),
KEY(2, 6, KEY_KP8),
KEY(2, 5, KEY_KP9),
KEY(3, 6, KEY_KP0),
KEY(3, 7, KEY_KPASTERISK),
KEY(3, 5, KEY_KPDOT), /* # key */
KEY(7, 2, KEY_NUMLOCK), /* Mute */
KEY(7, 1, KEY_KPMINUS), /* Recall */
KEY(6, 1, KEY_KPPLUS), /* Redial */
KEY(7, 6, KEY_KPSLASH), /* Handsfree */
KEY(6, 0, KEY_ENTER), /* Video */
KEY(7, 4, KEY_CAMERA), /* Photo */
KEY(0, 4, KEY_F2), /* Home */
KEY(1, 4, KEY_F3), /* Office */
KEY(2, 4, KEY_F4), /* Mobile */
KEY(7, 7, KEY_F5), /* SMS */
KEY(5, 7, KEY_F6), /* Email */
KEY(7, 5, KEY_F6), /* Email */
/* QWERTY portion of keypad */
KEY(4, 3, KEY_Q),
KEY(3, 4, KEY_Q),
KEY(3, 3, KEY_W),
KEY(2, 3, KEY_E),
KEY(1, 3, KEY_R),
KEY(0, 3, KEY_T),
KEY(7, 4, KEY_Y),
KEY(6, 4, KEY_U),
KEY(5, 4, KEY_I),
KEY(3, 2, KEY_E),
KEY(3, 1, KEY_R),
KEY(3, 0, KEY_T),
KEY(4, 7, KEY_Y),
KEY(4, 6, KEY_U),
KEY(4, 5, KEY_I),
KEY(4, 4, KEY_O),
KEY(3, 4, KEY_P),
KEY(4, 3, KEY_P),
KEY(2, 4, KEY_A),
KEY(1, 4, KEY_S),
KEY(0, 4, KEY_D),
KEY(7, 5, KEY_F),
KEY(6, 5, KEY_G),
KEY(4, 2, KEY_A),
KEY(4, 1, KEY_S),
KEY(4, 0, KEY_D),
KEY(5, 7, KEY_F),
KEY(5, 6, KEY_G),
KEY(5, 5, KEY_H),
KEY(4, 5, KEY_J),
KEY(3, 5, KEY_K),
KEY(2, 5, KEY_L),
KEY(5, 4, KEY_J),
KEY(5, 3, KEY_K),
KEY(5, 2, KEY_L),
KEY(1, 5, KEY_Z),
KEY(0, 5, KEY_X),
KEY(7, 6, KEY_C),
KEY(5, 1, KEY_Z),
KEY(5, 0, KEY_X),
KEY(6, 7, KEY_C),
KEY(6, 6, KEY_V),
KEY(5, 6, KEY_B),
KEY(4, 6, KEY_N),
KEY(3, 6, KEY_M),
KEY(2, 6, KEY_SPACE),
KEY(6, 5, KEY_B),
KEY(6, 4, KEY_N),
KEY(6, 3, KEY_M),
KEY(6, 2, KEY_SPACE),
KEY(0, 7, KEY_LEFTSHIFT), /* Vol up */
KEY(3, 7, KEY_LEFTCTRL), /* Vol down */
0
KEY(7, 0, KEY_LEFTSHIFT), /* Vol up */
KEY(7, 3, KEY_LEFTCTRL), /* Vol down */
};
void ams_delta_latch1_write(u8 mask, u8 value)
......@@ -189,11 +187,15 @@ static struct resource ams_delta_kp_resources[] = {
},
};
static const struct matrix_keymap_data ams_delta_keymap_data = {
.keymap = ams_delta_keymap,
.keymap_size = ARRAY_SIZE(ams_delta_keymap),
};
static struct omap_kp_platform_data ams_delta_kp_data = {
.rows = 8,
.cols = 8,
.keymap = ams_delta_keymap,
.keymapsize = ARRAY_SIZE(ams_delta_keymap),
.keymap_data = &ams_delta_keymap_data,
.delay = 9,
};
......
......@@ -69,36 +69,35 @@
#define fsample_cpld_clear(bit) \
fsample_cpld_write(0xf0 | ((bit) & 15), FSAMPLE_CPLD_SET_CLR)
static int fsample_keymap[] = {
KEY(0,0,KEY_UP),
KEY(0,1,KEY_RIGHT),
KEY(0,2,KEY_LEFT),
KEY(0,3,KEY_DOWN),
KEY(0,4,KEY_ENTER),
KEY(1,0,KEY_F10),
KEY(1,1,KEY_SEND),
KEY(1,2,KEY_END),
KEY(1,3,KEY_VOLUMEDOWN),
KEY(1,4,KEY_VOLUMEUP),
KEY(1,5,KEY_RECORD),
KEY(2,0,KEY_F9),
KEY(2,1,KEY_3),
KEY(2,2,KEY_6),
KEY(2,3,KEY_9),
KEY(2,4,KEY_KPDOT),
KEY(3,0,KEY_BACK),
KEY(3,1,KEY_2),
KEY(3,2,KEY_5),
KEY(3,3,KEY_8),
KEY(3,4,KEY_0),
KEY(3,5,KEY_KPSLASH),
KEY(4,0,KEY_HOME),
KEY(4,1,KEY_1),
KEY(4,2,KEY_4),
KEY(4,3,KEY_7),
KEY(4,4,KEY_KPASTERISK),
KEY(4,5,KEY_POWER),
0
static const unsigned int fsample_keymap[] = {
KEY(0, 0, KEY_UP),
KEY(1, 0, KEY_RIGHT),
KEY(2, 0, KEY_LEFT),
KEY(3, 0, KEY_DOWN),
KEY(4, 0, KEY_ENTER),
KEY(0, 1, KEY_F10),
KEY(1, 1, KEY_SEND),
KEY(2, 1, KEY_END),
KEY(3, 1, KEY_VOLUMEDOWN),
KEY(4, 1, KEY_VOLUMEUP),
KEY(5, 1, KEY_RECORD),
KEY(0, 2, KEY_F9),
KEY(1, 2, KEY_3),
KEY(2, 2, KEY_6),
KEY(3, 2, KEY_9),
KEY(4, 2, KEY_KPDOT),
KEY(0, 3, KEY_BACK),
KEY(1, 3, KEY_2),
KEY(2, 3, KEY_5),
KEY(3, 3, KEY_8),
KEY(4, 3, KEY_0),
KEY(5, 3, KEY_KPSLASH),
KEY(0, 4, KEY_HOME),
KEY(1, 4, KEY_1),
KEY(2, 4, KEY_4),
KEY(3, 4, KEY_7),
KEY(4, 4, KEY_KPASTERISK),
KEY(5, 4, KEY_POWER),
};
static struct smc91x_platdata smc91x_info = {
......@@ -253,11 +252,15 @@ static struct resource kp_resources[] = {
},
};
static const struct matrix_keymap_data fsample_keymap_data = {
.keymap = fsample_keymap,
.keymap_size = ARRAY_SIZE(fsample_keymap),
};
static struct omap_kp_platform_data kp_data = {
.rows = 8,
.cols = 8,
.keymap = fsample_keymap,
.keymapsize = ARRAY_SIZE(fsample_keymap),
.keymap_data = &fsample_keymap_data,
.delay = 4,
};
......
......@@ -52,43 +52,42 @@
/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
#define OMAP1610_ETHR_START 0x04000300
static int h2_keymap[] = {
static const unsigned int h2_keymap[] = {
KEY(0, 0, KEY_LEFT),
KEY(0, 1, KEY_RIGHT),
KEY(0, 2, KEY_3),
KEY(0, 3, KEY_F10),
KEY(0, 4, KEY_F5),
KEY(0, 5, KEY_9),
KEY(1, 0, KEY_DOWN),
KEY(1, 0, KEY_RIGHT),
KEY(2, 0, KEY_3),
KEY(3, 0, KEY_F10),
KEY(4, 0, KEY_F5),
KEY(5, 0, KEY_9),
KEY(0, 1, KEY_DOWN),
KEY(1, 1, KEY_UP),
KEY(1, 2, KEY_2),
KEY(1, 3, KEY_F9),
KEY(1, 4, KEY_F7),
KEY(1, 5, KEY_0),
KEY(2, 0, KEY_ENTER),
KEY(2, 1, KEY_6),
KEY(2, 1, KEY_2),
KEY(3, 1, KEY_F9),
KEY(4, 1, KEY_F7),
KEY(5, 1, KEY_0),
KEY(0, 2, KEY_ENTER),
KEY(1, 2, KEY_6),
KEY(2, 2, KEY_1),
KEY(2, 3, KEY_F2),
KEY(2, 4, KEY_F6),
KEY(2, 5, KEY_HOME),
KEY(3, 0, KEY_8),
KEY(3, 1, KEY_5),
KEY(3, 2, KEY_F12),
KEY(3, 2, KEY_F2),
KEY(4, 2, KEY_F6),
KEY(5, 2, KEY_HOME),
KEY(0, 3, KEY_8),
KEY(1, 3, KEY_5),
KEY(2, 3, KEY_F12),
KEY(3, 3, KEY_F3),
KEY(3, 4, KEY_F8),
KEY(3, 5, KEY_END),
KEY(4, 0, KEY_7),
KEY(4, 1, KEY_4),
KEY(4, 2, KEY_F11),
KEY(4, 3, KEY_F1),
KEY(4, 3, KEY_F8),
KEY(5, 3, KEY_END),
KEY(0, 4, KEY_7),
KEY(1, 4, KEY_4),
KEY(2, 4, KEY_F11),
KEY(3, 4, KEY_F1),
KEY(4, 4, KEY_F4),
KEY(4, 5, KEY_ESC),
KEY(5, 0, KEY_F13),
KEY(5, 1, KEY_F14),
KEY(5, 2, KEY_F15),
KEY(5, 3, KEY_F16),
KEY(5, 4, KEY_SLEEP),
0
KEY(5, 4, KEY_ESC),
KEY(0, 5, KEY_F13),
KEY(1, 5, KEY_F14),
KEY(2, 5, KEY_F15),
KEY(3, 5, KEY_F16),
KEY(4, 5, KEY_SLEEP),
};
static struct mtd_partition h2_nor_partitions[] = {
......@@ -270,14 +269,18 @@ static struct resource h2_kp_resources[] = {
},
};
static const struct matrix_keymap_data h2_keymap_data = {
.keymap = h2_keymap,
.keymap_size = ARRAY_SIZE(h2_keymap),
};
static struct omap_kp_platform_data h2_kp_data = {
.rows = 8,
.cols = 8,
.keymap = h2_keymap,
.keymapsize = ARRAY_SIZE(h2_keymap),
.rep = 1,
.keymap_data = &h2_keymap_data,
.rep = true,
.delay = 9,
.dbounce = 1,
.dbounce = true,
};
static struct platform_device h2_kp_device = {
......
......@@ -56,43 +56,42 @@
#define H3_TS_GPIO 48
static int h3_keymap[] = {
static const unsigned int h3_keymap[] = {
KEY(0, 0, KEY_LEFT),
KEY(0, 1, KEY_RIGHT),
KEY(0, 2, KEY_3),
KEY(0, 3, KEY_F10),
KEY(0, 4, KEY_F5),
KEY(0, 5, KEY_9),
KEY(1, 0, KEY_DOWN),
KEY(1, 0, KEY_RIGHT),
KEY(2, 0, KEY_3),
KEY(3, 0, KEY_F10),
KEY(4, 0, KEY_F5),
KEY(5, 0, KEY_9),
KEY(0, 1, KEY_DOWN),
KEY(1, 1, KEY_UP),
KEY(1, 2, KEY_2),
KEY(1, 3, KEY_F9),
KEY(1, 4, KEY_F7),
KEY(1, 5, KEY_0),
KEY(2, 0, KEY_ENTER),
KEY(2, 1, KEY_6),
KEY(2, 1, KEY_2),
KEY(3, 1, KEY_F9),
KEY(4, 1, KEY_F7),
KEY(5, 1, KEY_0),
KEY(0, 2, KEY_ENTER),
KEY(1, 2, KEY_6),
KEY(2, 2, KEY_1),
KEY(2, 3, KEY_F2),
KEY(2, 4, KEY_F6),
KEY(2, 5, KEY_HOME),
KEY(3, 0, KEY_8),
KEY(3, 1, KEY_5),
KEY(3, 2, KEY_F12),
KEY(3, 2, KEY_F2),
KEY(4, 2, KEY_F6),
KEY(5, 2, KEY_HOME),
KEY(0, 3, KEY_8),
KEY(1, 3, KEY_5),
KEY(2, 3, KEY_F12),
KEY(3, 3, KEY_F3),
KEY(3, 4, KEY_F8),
KEY(3, 5, KEY_END),
KEY(4, 0, KEY_7),
KEY(4, 1, KEY_4),
KEY(4, 2, KEY_F11),
KEY(4, 3, KEY_F1),
KEY(4, 3, KEY_F8),
KEY(5, 3, KEY_END),
KEY(0, 4, KEY_7),
KEY(1, 4, KEY_4),
KEY(2, 4, KEY_F11),
KEY(3, 4, KEY_F1),
KEY(4, 4, KEY_F4),
KEY(4, 5, KEY_ESC),
KEY(5, 0, KEY_F13),
KEY(5, 1, KEY_F14),
KEY(5, 2, KEY_F15),
KEY(5, 3, KEY_F16),
KEY(5, 4, KEY_SLEEP),
0
KEY(5, 4, KEY_ESC),
KEY(0, 5, KEY_F13),
KEY(1, 5, KEY_F14),
KEY(2, 5, KEY_F15),
KEY(3, 5, KEY_F16),
KEY(4, 5, KEY_SLEEP),
};
......@@ -305,14 +304,18 @@ static struct resource h3_kp_resources[] = {
},
};
static const struct matrix_keymap_data h3_keymap_data = {
.keymap = h3_keymap,
.keymap_size = ARRAY_SIZE(h3_keymap),
};
static struct omap_kp_platform_data h3_kp_data = {
.rows = 8,
.cols = 8,
.keymap = h3_keymap,
.keymapsize = ARRAY_SIZE(h3_keymap),
.rep = 1,
.keymap_data = &h3_keymap_data,
.rep = true,
.delay = 9,
.dbounce = 1,
.dbounce = true,
};
static struct platform_device h3_kp_device = {
......
......@@ -180,64 +180,68 @@
/* Keyboard definition */
static int htc_herald_keymap[] = {
static const unsigned int htc_herald_keymap[] = {
KEY(0, 0, KEY_RECORD), /* Mail button */
KEY(0, 1, KEY_CAMERA), /* Camera */
KEY(0, 2, KEY_PHONE), /* Send key */
KEY(0, 3, KEY_VOLUMEUP), /* Volume up */
KEY(0, 4, KEY_F2), /* Right bar (landscape) */
KEY(0, 5, KEY_MAIL), /* Win key (portrait) */
KEY(0, 6, KEY_DIRECTORY), /* Right bar (protrait) */
KEY(1, 0, KEY_LEFTCTRL), /* Windows key */
KEY(1, 0, KEY_CAMERA), /* Camera */
KEY(2, 0, KEY_PHONE), /* Send key */
KEY(3, 0, KEY_VOLUMEUP), /* Volume up */
KEY(4, 0, KEY_F2), /* Right bar (landscape) */
KEY(5, 0, KEY_MAIL), /* Win key (portrait) */
KEY(6, 0, KEY_DIRECTORY), /* Right bar (protrait) */
KEY(0, 1, KEY_LEFTCTRL), /* Windows key */
KEY(1, 1, KEY_COMMA),
KEY(1, 2, KEY_M),
KEY(1, 3, KEY_K),
KEY(1, 4, KEY_SLASH), /* OK key */
KEY(1, 5, KEY_I),
KEY(1, 6, KEY_U),
KEY(2, 0, KEY_LEFTALT),
KEY(2, 1, KEY_TAB),
KEY(2, 1, KEY_M),
KEY(3, 1, KEY_K),
KEY(4, 1, KEY_SLASH), /* OK key */
KEY(5, 1, KEY_I),
KEY(6, 1, KEY_U),
KEY(0, 2, KEY_LEFTALT),
KEY(1, 2, KEY_TAB),
KEY(2, 2, KEY_N),
KEY(2, 3, KEY_J),
KEY(2, 4, KEY_ENTER),
KEY(2, 5, KEY_H),
KEY(2, 6, KEY_Y),
KEY(3, 0, KEY_SPACE),
KEY(3, 1, KEY_L),
KEY(3, 2, KEY_B),
KEY(3, 2, KEY_J),
KEY(4, 2, KEY_ENTER),
KEY(5, 2, KEY_H),
KEY(6, 2, KEY_Y),
KEY(0, 3, KEY_SPACE),
KEY(1, 3, KEY_L),
KEY(2, 3, KEY_B),
KEY(3, 3, KEY_V),
KEY(3, 4, KEY_BACKSPACE),
KEY(3, 5, KEY_G),
KEY(3, 6, KEY_T),
KEY(4, 0, KEY_CAPSLOCK), /* Shift */
KEY(4, 1, KEY_C),
KEY(4, 2, KEY_F),
KEY(4, 3, KEY_R),
KEY(4, 3, KEY_BACKSPACE),
KEY(5, 3, KEY_G),
KEY(6, 3, KEY_T),
KEY(0, 4, KEY_CAPSLOCK), /* Shift */
KEY(1, 4, KEY_C),
KEY(2, 4, KEY_F),
KEY(3, 4, KEY_R),
KEY(4, 4, KEY_O),
KEY(4, 5, KEY_E),
KEY(4, 6, KEY_D),
KEY(5, 0, KEY_X),
KEY(5, 1, KEY_Z),
KEY(5, 2, KEY_S),
KEY(5, 3, KEY_W),
KEY(5, 4, KEY_P),
KEY(5, 4, KEY_E),
KEY(6, 4, KEY_D),
KEY(0, 5, KEY_X),
KEY(1, 5, KEY_Z),
KEY(2, 5, KEY_S),
KEY(3, 5, KEY_W),
KEY(4, 5, KEY_P),
KEY(5, 5, KEY_Q),
KEY(5, 6, KEY_A),
KEY(6, 0, KEY_CONNECT), /* Voice button */
KEY(6, 2, KEY_CANCEL), /* End key */
KEY(6, 3, KEY_VOLUMEDOWN), /* Volume down */
KEY(6, 4, KEY_F1), /* Left bar (landscape) */
KEY(6, 5, KEY_WWW), /* OK button (portrait) */
KEY(6, 5, KEY_A),
KEY(0, 6, KEY_CONNECT), /* Voice button */
KEY(2, 6, KEY_CANCEL), /* End key */
KEY(3, 6, KEY_VOLUMEDOWN), /* Volume down */
KEY(4, 6, KEY_F1), /* Left bar (landscape) */
KEY(5, 6, KEY_WWW), /* OK button (portrait) */
KEY(6, 6, KEY_CALENDAR), /* Left bar (portrait) */
0
};
struct omap_kp_platform_data htcherald_kp_data = {
static const struct matrix_keymap_data htc_herald_keymap_data = {
.keymap = htc_herald_keymap,
.keymap_size = ARRAY_SIZE(htc_herald_keymap),
};
static struct omap_kp_platform_data htcherald_kp_data = {
.rows = 7,
.cols = 7,
.delay = 20,
.rep = 1,
.keymap = htc_herald_keymap,
.rep = true,
.keymap_data = &htc_herald_keymap_data,
};
static struct resource kp_resources[] = {
......@@ -278,7 +282,7 @@ static struct gpio_keys_button herald_gpio_keys_table[] = {
static struct gpio_keys_platform_data herald_gpio_keys_data = {
.buttons = herald_gpio_keys_table,
.nbuttons = ARRAY_SIZE(herald_gpio_keys_table),
.rep = 1,
.rep = true,
};
static struct platform_device herald_gpiokeys_device = {
......
......@@ -44,17 +44,16 @@
/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
#define INNOVATOR1610_ETHR_START 0x04000300
static int innovator_keymap[] = {
static const unsigned int innovator_keymap[] = {
KEY(0, 0, KEY_F1),