Commit 0a085a94 authored by Chao Xie's avatar Chao Xie Committed by Dmitry Torokhov

Input: pxa27x-keypad - use matrix_keymap for matrix keys

pxa27x-keypad includes matrix keys. Make use of matrix_keymap
for the matrix keys.
Signed-off-by: default avatarChao Xie <chao.xie@marvell.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 48318028
...@@ -205,7 +205,7 @@ struct pxa168fb_mach_info aspenite_lcd_info = { ...@@ -205,7 +205,7 @@ struct pxa168fb_mach_info aspenite_lcd_info = {
.invert_pixclock = 0, .invert_pixclock = 0,
}; };
static unsigned int aspenite_matrix_key_map[] = { static const unsigned int aspenite_matrix_key_map[] = {
KEY(0, 6, KEY_UP), /* SW 4 */ KEY(0, 6, KEY_UP), /* SW 4 */
KEY(0, 7, KEY_DOWN), /* SW 5 */ KEY(0, 7, KEY_DOWN), /* SW 5 */
KEY(1, 6, KEY_LEFT), /* SW 6 */ KEY(1, 6, KEY_LEFT), /* SW 6 */
...@@ -214,11 +214,15 @@ static unsigned int aspenite_matrix_key_map[] = { ...@@ -214,11 +214,15 @@ static unsigned int aspenite_matrix_key_map[] = {
KEY(4, 7, KEY_ESC), /* SW 9 */ KEY(4, 7, KEY_ESC), /* SW 9 */
}; };
static struct matrix_keymap_data aspenite_matrix_keymap_data = {
.keymap = aspenite_matrix_key_map,
.keymap_size = ARRAY_SIZE(aspenite_matrix_key_map),
};
static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = { static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
.matrix_key_rows = 5, .matrix_key_rows = 5,
.matrix_key_cols = 8, .matrix_key_cols = 8,
.matrix_key_map = aspenite_matrix_key_map, .matrix_keymap_data = &aspenite_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(aspenite_matrix_key_map),
.debounce_interval = 30, .debounce_interval = 30,
}; };
......
...@@ -56,11 +56,15 @@ static unsigned int teton_bga_matrix_key_map[] = { ...@@ -56,11 +56,15 @@ static unsigned int teton_bga_matrix_key_map[] = {
KEY(1, 7, KEY_RIGHT), KEY(1, 7, KEY_RIGHT),
}; };
static struct matrix_keymap_data teton_bga_matrix_keymap_data = {
.keymap = teton_bga_matrix_key_map,
.keymap_size = ARRAY_SIZE(teton_bga_matrix_key_map),
};
static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = { static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = {
.matrix_key_rows = 2, .matrix_key_rows = 2,
.matrix_key_cols = 8, .matrix_key_cols = 8,
.matrix_key_map = teton_bga_matrix_key_map, .matrix_keymap_data = &teton_bga_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(teton_bga_matrix_key_map),
.debounce_interval = 30, .debounce_interval = 30,
}; };
......
...@@ -833,21 +833,25 @@ static inline void em_x270_init_ac97(void) {} ...@@ -833,21 +833,25 @@ static inline void em_x270_init_ac97(void) {}
#endif #endif
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int em_x270_module_matrix_keys[] = { static const unsigned int em_x270_module_matrix_keys[] = {
KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B), KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B),
KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT), KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT),
KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D), KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D),
}; };
static struct matrix_keymap_data em_x270_matrix_keymap_data = {
.keymap = em_x270_module_matrix_keys,
.keymap_size = ARRAY_SIZE(em_x270_module_matrix_keys),
};
struct pxa27x_keypad_platform_data em_x270_module_keypad_info = { struct pxa27x_keypad_platform_data em_x270_module_keypad_info = {
/* code map for the matrix keys */ /* code map for the matrix keys */
.matrix_key_rows = 3, .matrix_key_rows = 3,
.matrix_key_cols = 3, .matrix_key_cols = 3,
.matrix_key_map = em_x270_module_matrix_keys, .matrix_keymap_data = &em_x270_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(em_x270_module_matrix_keys),
}; };
static unsigned int em_x270_exeda_matrix_keys[] = { static const unsigned int em_x270_exeda_matrix_keys[] = {
KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL), KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL),
KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE), KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE),
KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL), KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL),
...@@ -889,12 +893,16 @@ static unsigned int em_x270_exeda_matrix_keys[] = { ...@@ -889,12 +893,16 @@ static unsigned int em_x270_exeda_matrix_keys[] = {
KEY(7, 6, 0), KEY(7, 7, 0), KEY(7, 6, 0), KEY(7, 7, 0),
}; };
static struct matrix_keymap_data em_x270_exeda_matrix_keymap_data = {
.keymap = em_x270_exeda_matrix_keys,
.keymap_size = ARRAY_SIZE(em_x270_exeda_matrix_keys),
};
struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = { struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = {
/* code map for the matrix keys */ /* code map for the matrix keys */
.matrix_key_rows = 8, .matrix_key_rows = 8,
.matrix_key_cols = 8, .matrix_key_cols = 8,
.matrix_key_map = em_x270_exeda_matrix_keys, .matrix_keymap_data = &em_x270_exeda_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(em_x270_exeda_matrix_keys),
}; };
static void __init em_x270_init_keypad(void) static void __init em_x270_init_keypad(void)
......
...@@ -392,7 +392,7 @@ static unsigned long e6_pin_config[] __initdata = { ...@@ -392,7 +392,7 @@ static unsigned long e6_pin_config[] __initdata = {
/* KEYPAD */ /* KEYPAD */
#ifdef CONFIG_MACH_EZX_A780 #ifdef CONFIG_MACH_EZX_A780
static unsigned int a780_key_map[] = { static const unsigned int a780_key_map[] = {
KEY(0, 0, KEY_SEND), KEY(0, 0, KEY_SEND),
KEY(0, 1, KEY_BACK), KEY(0, 1, KEY_BACK),
KEY(0, 2, KEY_END), KEY(0, 2, KEY_END),
...@@ -424,11 +424,15 @@ static unsigned int a780_key_map[] = { ...@@ -424,11 +424,15 @@ static unsigned int a780_key_map[] = {
KEY(4, 4, KEY_DOWN), KEY(4, 4, KEY_DOWN),
}; };
static struct matrix_keymap_data a780_matrix_keymap_data = {
.keymap = a780_key_map,
.keymap_size = ARRAY_SIZE(a780_key_map),
};
static struct pxa27x_keypad_platform_data a780_keypad_platform_data = { static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
.matrix_key_rows = 5, .matrix_key_rows = 5,
.matrix_key_cols = 5, .matrix_key_cols = 5,
.matrix_key_map = a780_key_map, .matrix_keymap_data = &a780_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(a780_key_map),
.direct_key_map = { KEY_CAMERA }, .direct_key_map = { KEY_CAMERA },
.direct_key_num = 1, .direct_key_num = 1,
...@@ -438,7 +442,7 @@ static struct pxa27x_keypad_platform_data a780_keypad_platform_data = { ...@@ -438,7 +442,7 @@ static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
#endif /* CONFIG_MACH_EZX_A780 */ #endif /* CONFIG_MACH_EZX_A780 */
#ifdef CONFIG_MACH_EZX_E680 #ifdef CONFIG_MACH_EZX_E680
static unsigned int e680_key_map[] = { static const unsigned int e680_key_map[] = {
KEY(0, 0, KEY_UP), KEY(0, 0, KEY_UP),
KEY(0, 1, KEY_RIGHT), KEY(0, 1, KEY_RIGHT),
KEY(0, 2, KEY_RESERVED), KEY(0, 2, KEY_RESERVED),
...@@ -455,11 +459,15 @@ static unsigned int e680_key_map[] = { ...@@ -455,11 +459,15 @@ static unsigned int e680_key_map[] = {
KEY(2, 3, KEY_KPENTER), KEY(2, 3, KEY_KPENTER),
}; };
static struct matrix_keymap_data e680_matrix_keymap_data = {
.keymap = e680_key_map,
.keymap_size = ARRAY_SIZE(e680_key_map),
};
static struct pxa27x_keypad_platform_data e680_keypad_platform_data = { static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
.matrix_key_rows = 3, .matrix_key_rows = 3,
.matrix_key_cols = 4, .matrix_key_cols = 4,
.matrix_key_map = e680_key_map, .matrix_keymap_data = &e680_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(e680_key_map),
.direct_key_map = { .direct_key_map = {
KEY_CAMERA, KEY_CAMERA,
...@@ -476,7 +484,7 @@ static struct pxa27x_keypad_platform_data e680_keypad_platform_data = { ...@@ -476,7 +484,7 @@ static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
#endif /* CONFIG_MACH_EZX_E680 */ #endif /* CONFIG_MACH_EZX_E680 */
#ifdef CONFIG_MACH_EZX_A1200 #ifdef CONFIG_MACH_EZX_A1200
static unsigned int a1200_key_map[] = { static const unsigned int a1200_key_map[] = {
KEY(0, 0, KEY_RESERVED), KEY(0, 0, KEY_RESERVED),
KEY(0, 1, KEY_RIGHT), KEY(0, 1, KEY_RIGHT),
KEY(0, 2, KEY_PAGEDOWN), KEY(0, 2, KEY_PAGEDOWN),
...@@ -513,18 +521,22 @@ static unsigned int a1200_key_map[] = { ...@@ -513,18 +521,22 @@ static unsigned int a1200_key_map[] = {
KEY(4, 5, KEY_RESERVED), KEY(4, 5, KEY_RESERVED),
}; };
static struct matrix_keymap_data a1200_matrix_keymap_data = {
.keymap = a1200_key_map,
.keymap_size = ARRAY_SIZE(a1200_key_map),
};
static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = { static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
.matrix_key_rows = 5, .matrix_key_rows = 5,
.matrix_key_cols = 6, .matrix_key_cols = 6,
.matrix_key_map = a1200_key_map, .matrix_keymap_data = &a1200_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(a1200_key_map),
.debounce_interval = 30, .debounce_interval = 30,
}; };
#endif /* CONFIG_MACH_EZX_A1200 */ #endif /* CONFIG_MACH_EZX_A1200 */
#ifdef CONFIG_MACH_EZX_E6 #ifdef CONFIG_MACH_EZX_E6
static unsigned int e6_key_map[] = { static const unsigned int e6_key_map[] = {
KEY(0, 0, KEY_RESERVED), KEY(0, 0, KEY_RESERVED),
KEY(0, 1, KEY_RIGHT), KEY(0, 1, KEY_RIGHT),
KEY(0, 2, KEY_PAGEDOWN), KEY(0, 2, KEY_PAGEDOWN),
...@@ -561,18 +573,22 @@ static unsigned int e6_key_map[] = { ...@@ -561,18 +573,22 @@ static unsigned int e6_key_map[] = {
KEY(4, 5, KEY_PREVIOUSSONG), KEY(4, 5, KEY_PREVIOUSSONG),
}; };
static struct matrix_keymap_data e6_keymap_data = {
.keymap = e6_key_map,
.keymap_size = ARRAY_SIZE(e6_key_map),
};
static struct pxa27x_keypad_platform_data e6_keypad_platform_data = { static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
.matrix_key_rows = 5, .matrix_key_rows = 5,
.matrix_key_cols = 6, .matrix_key_cols = 6,
.matrix_key_map = e6_key_map, .matrix_keymap_data = &e6_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(e6_key_map),
.debounce_interval = 30, .debounce_interval = 30,
}; };
#endif /* CONFIG_MACH_EZX_E6 */ #endif /* CONFIG_MACH_EZX_E6 */
#ifdef CONFIG_MACH_EZX_A910 #ifdef CONFIG_MACH_EZX_A910
static unsigned int a910_key_map[] = { static const unsigned int a910_key_map[] = {
KEY(0, 0, KEY_NUMERIC_6), KEY(0, 0, KEY_NUMERIC_6),
KEY(0, 1, KEY_RIGHT), KEY(0, 1, KEY_RIGHT),
KEY(0, 2, KEY_PAGEDOWN), KEY(0, 2, KEY_PAGEDOWN),
...@@ -609,18 +625,22 @@ static unsigned int a910_key_map[] = { ...@@ -609,18 +625,22 @@ static unsigned int a910_key_map[] = {
KEY(4, 5, KEY_RESERVED), KEY(4, 5, KEY_RESERVED),
}; };
static struct matrix_keymap_data a910_matrix_keymap_data = {
.keymap = a910_key_map,
.keymap_size = ARRAY_SIZE(a910_key_map),
};
static struct pxa27x_keypad_platform_data a910_keypad_platform_data = { static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
.matrix_key_rows = 5, .matrix_key_rows = 5,
.matrix_key_cols = 6, .matrix_key_cols = 6,
.matrix_key_map = a910_key_map, .matrix_keymap_data = &a910_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(a910_key_map),
.debounce_interval = 30, .debounce_interval = 30,
}; };
#endif /* CONFIG_MACH_EZX_A910 */ #endif /* CONFIG_MACH_EZX_A910 */
#ifdef CONFIG_MACH_EZX_E2 #ifdef CONFIG_MACH_EZX_E2
static unsigned int e2_key_map[] = { static const unsigned int e2_key_map[] = {
KEY(0, 0, KEY_NUMERIC_6), KEY(0, 0, KEY_NUMERIC_6),
KEY(0, 1, KEY_RIGHT), KEY(0, 1, KEY_RIGHT),
KEY(0, 2, KEY_NUMERIC_9), KEY(0, 2, KEY_NUMERIC_9),
...@@ -657,11 +677,15 @@ static unsigned int e2_key_map[] = { ...@@ -657,11 +677,15 @@ static unsigned int e2_key_map[] = {
KEY(4, 5, KEY_RESERVED), KEY(4, 5, KEY_RESERVED),
}; };
static struct matrix_keymap_data e2_matrix_keymap_data = {
.keymap = e2_key_map,
.keymap_size = ARRAY_SIZE(e2_key_map),
};
static struct pxa27x_keypad_platform_data e2_keypad_platform_data = { static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
.matrix_key_rows = 5, .matrix_key_rows = 5,
.matrix_key_cols = 6, .matrix_key_cols = 6,
.matrix_key_map = e2_key_map, .matrix_keymap_data = &e2_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(e2_key_map),
.debounce_interval = 30, .debounce_interval = 30,
}; };
......
...@@ -222,7 +222,7 @@ static inline void littleton_init_spi(void) {} ...@@ -222,7 +222,7 @@ static inline void littleton_init_spi(void) {}
#endif #endif
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int littleton_matrix_key_map[] = { static const unsigned int littleton_matrix_key_map[] = {
/* KEY(row, col, key_code) */ /* KEY(row, col, key_code) */
KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3), KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7), KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7),
...@@ -249,11 +249,15 @@ static unsigned int littleton_matrix_key_map[] = { ...@@ -249,11 +249,15 @@ static unsigned int littleton_matrix_key_map[] = {
KEY(3, 1, KEY_F23), /* soft2 */ KEY(3, 1, KEY_F23), /* soft2 */
}; };
static struct matrix_keymap_data littleton_matrix_keymap_data = {
.keymap = littleton_matrix_key_map,
.keymap_size = ARRAY_SIZE(littleton_matrix_key_map),
};
static struct pxa27x_keypad_platform_data littleton_keypad_info = { static struct pxa27x_keypad_platform_data littleton_keypad_info = {
.matrix_key_rows = 6, .matrix_key_rows = 6,
.matrix_key_cols = 5, .matrix_key_cols = 5,
.matrix_key_map = littleton_matrix_key_map, .matrix_keymap_data = &littleton_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(littleton_matrix_key_map),
.enable_rotary0 = 1, .enable_rotary0 = 1,
.rotary0_up_key = KEY_UP, .rotary0_up_key = KEY_UP,
......
...@@ -498,7 +498,7 @@ static struct pxaohci_platform_data mainstone_ohci_platform_data = { ...@@ -498,7 +498,7 @@ static struct pxaohci_platform_data mainstone_ohci_platform_data = {
}; };
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int mainstone_matrix_keys[] = { static const unsigned int mainstone_matrix_keys[] = {
KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C), 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(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(0, 1, KEY_G), KEY(1, 1, KEY_H), KEY(2, 1, KEY_I),
...@@ -527,11 +527,15 @@ static unsigned int mainstone_matrix_keys[] = { ...@@ -527,11 +527,15 @@ static unsigned int mainstone_matrix_keys[] = {
KEY(4, 6, KEY_SELECT), KEY(4, 6, KEY_SELECT),
}; };
static struct matrix_keymap_data mainstone_matrix_keymap_data = {
.keymap = mainstone_matrix_keys,
.keymap_size = ARRAY_SIZE(mainstone_matrix_keys),
};
struct pxa27x_keypad_platform_data mainstone_keypad_info = { struct pxa27x_keypad_platform_data mainstone_keypad_info = {
.matrix_key_rows = 6, .matrix_key_rows = 6,
.matrix_key_cols = 7, .matrix_key_cols = 7,
.matrix_key_map = mainstone_matrix_keys, .matrix_keymap_data = &mainstone_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(mainstone_matrix_keys),
.enable_rotary0 = 1, .enable_rotary0 = 1,
.rotary0_up_key = KEY_UP, .rotary0_up_key = KEY_UP,
......
...@@ -222,7 +222,7 @@ static struct pxafb_mach_info mioa701_pxafb_info = { ...@@ -222,7 +222,7 @@ static struct pxafb_mach_info mioa701_pxafb_info = {
/* /*
* Keyboard configuration * Keyboard configuration
*/ */
static unsigned int mioa701_matrix_keys[] = { static const unsigned int mioa701_matrix_keys[] = {
KEY(0, 0, KEY_UP), KEY(0, 0, KEY_UP),
KEY(0, 1, KEY_RIGHT), KEY(0, 1, KEY_RIGHT),
KEY(0, 2, KEY_MEDIA), KEY(0, 2, KEY_MEDIA),
...@@ -233,11 +233,16 @@ static unsigned int mioa701_matrix_keys[] = { ...@@ -233,11 +233,16 @@ static unsigned int mioa701_matrix_keys[] = {
KEY(2, 1, KEY_PHONE), /* Phone Green key */ KEY(2, 1, KEY_PHONE), /* Phone Green key */
KEY(2, 2, KEY_CAMERA) /* Camera key */ KEY(2, 2, KEY_CAMERA) /* Camera key */
}; };
static struct matrix_keymap_data mioa701_matrix_keymap_data = {
.keymap = mioa701_matrix_keys,
.keymap_size = ARRAY_SIZE(mioa701_matrix_keys),
};
static struct pxa27x_keypad_platform_data mioa701_keypad_info = { static struct pxa27x_keypad_platform_data mioa701_keypad_info = {
.matrix_key_rows = 3, .matrix_key_rows = 3,
.matrix_key_cols = 3, .matrix_key_cols = 3,
.matrix_key_map = mioa701_matrix_keys, .matrix_keymap_data = &mioa701_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(mioa701_matrix_keys),
}; };
/* /*
......
...@@ -173,7 +173,7 @@ static inline void palmld_nor_init(void) {} ...@@ -173,7 +173,7 @@ static inline void palmld_nor_init(void) {}
* GPIO keyboard * GPIO keyboard
******************************************************************************/ ******************************************************************************/
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int palmld_matrix_keys[] = { static const unsigned int palmld_matrix_keys[] = {
KEY(0, 1, KEY_F2), KEY(0, 1, KEY_F2),
KEY(0, 2, KEY_UP), KEY(0, 2, KEY_UP),
...@@ -190,11 +190,15 @@ static unsigned int palmld_matrix_keys[] = { ...@@ -190,11 +190,15 @@ static unsigned int palmld_matrix_keys[] = {
KEY(3, 2, KEY_LEFT), KEY(3, 2, KEY_LEFT),
}; };
static struct matrix_keymap_data palmld_matrix_keymap_data = {
.keymap = palmld_matrix_keys,
.keymap_size = ARRAY_SIZE(palmld_matrix_keys),
};
static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = { static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
.matrix_key_rows = 4, .matrix_key_rows = 4,
.matrix_key_cols = 3, .matrix_key_cols = 3,
.matrix_key_map = palmld_matrix_keys, .matrix_keymap_data = &palmld_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(palmld_matrix_keys),
.debounce_interval = 30, .debounce_interval = 30,
}; };
......
...@@ -108,7 +108,7 @@ static unsigned long palmt5_pin_config[] __initdata = { ...@@ -108,7 +108,7 @@ static unsigned long palmt5_pin_config[] __initdata = {
* GPIO keyboard * GPIO keyboard
******************************************************************************/ ******************************************************************************/
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int palmt5_matrix_keys[] = { static const unsigned int palmt5_matrix_keys[] = {
KEY(0, 0, KEY_POWER), KEY(0, 0, KEY_POWER),
KEY(0, 1, KEY_F1), KEY(0, 1, KEY_F1),
KEY(0, 2, KEY_ENTER), KEY(0, 2, KEY_ENTER),
...@@ -124,11 +124,15 @@ static unsigned int palmt5_matrix_keys[] = { ...@@ -124,11 +124,15 @@ static unsigned int palmt5_matrix_keys[] = {
KEY(3, 2, KEY_LEFT), KEY(3, 2, KEY_LEFT),
}; };
static struct matrix_keymap_data palmt5_matrix_keymap_data = {
.keymap = palmt5_matrix_keys,
.keymap_size = ARRAY_SIZE(palmt5_matrix_keys),
};
static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = { static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
.matrix_key_rows = 4, .matrix_key_rows = 4,
.matrix_key_cols = 3, .matrix_key_cols = 3,
.matrix_key_map = palmt5_matrix_keys, .matrix_keymap_data = &palmt5_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(palmt5_matrix_keys),
.debounce_interval = 30, .debounce_interval = 30,
}; };
......
...@@ -168,7 +168,7 @@ static unsigned long centro685_pin_config[] __initdata = { ...@@ -168,7 +168,7 @@ static unsigned long centro685_pin_config[] __initdata = {
* GPIO keyboard * GPIO keyboard
******************************************************************************/ ******************************************************************************/
#if IS_ENABLED(CONFIG_KEYBOARD_PXA27x) #if IS_ENABLED(CONFIG_KEYBOARD_PXA27x)
static unsigned int treo680_matrix_keys[] = { static const unsigned int treo680_matrix_keys[] = {
KEY(0, 0, KEY_F8), /* Red/Off/Power */ KEY(0, 0, KEY_F8), /* Red/Off/Power */
KEY(0, 1, KEY_LEFT), KEY(0, 1, KEY_LEFT),
KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ KEY(0, 2, KEY_LEFTCTRL), /* Alternate */
...@@ -227,7 +227,7 @@ static unsigned int treo680_matrix_keys[] = { ...@@ -227,7 +227,7 @@ static unsigned int treo680_matrix_keys[] = {
KEY(7, 5, KEY_I), KEY(7, 5, KEY_I),
}; };
static unsigned int centro_matrix_keys[] = { static const unsigned int centro_matrix_keys[] = {
KEY(0, 0, KEY_F9), /* Home */ KEY(0, 0, KEY_F9), /* Home */
KEY(0, 1, KEY_LEFT), KEY(0, 1, KEY_LEFT),
KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ KEY(0, 2, KEY_LEFTCTRL), /* Alternate */
...@@ -286,11 +286,20 @@ static unsigned int centro_matrix_keys[] = { ...@@ -286,11 +286,20 @@ static unsigned int centro_matrix_keys[] = {
KEY(7, 5, KEY_I), KEY(7, 5, KEY_I),
}; };
static struct matrix_keymap_data treo680_matrix_keymap_data = {
.keymap = treo680_matrix_keys,
.keymap_size = ARRAY_SIZE(treo680_matrix_keys),
};
static struct matrix_keymap_data centro_matrix_keymap_data = {
.keymap = centro_matrix_keys,
.keymap_size = ARRAY_SIZE(centro_matrix_keys),
};
static struct pxa27x_keypad_platform_data treo680_keypad_pdata = { static struct pxa27x_keypad_platform_data treo680_keypad_pdata = {
.matrix_key_rows = 8, .matrix_key_rows = 8,
.matrix_key_cols = 7, .matrix_key_cols = 7,
.matrix_key_map = treo680_matrix_keys, .matrix_keymap_data = &treo680_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys),
.direct_key_map = { KEY_CONNECT }, .direct_key_map = { KEY_CONNECT },
.direct_key_num = 1, .direct_key_num = 1,
...@@ -301,10 +310,8 @@ static void __init palmtreo_kpc_init(void) ...@@ -301,10 +310,8 @@ static void __init palmtreo_kpc_init(void)
{ {
static struct pxa27x_keypad_platform_data *data = &treo680_keypad_pdata; static struct pxa27x_keypad_platform_data *data = &treo680_keypad_pdata;
if (machine_is_centro()) { if (machine_is_centro())
data->matrix_key_map = centro_matrix_keys; data->matrix_keymap_data = &centro_matrix_keymap_data;
data->matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys);
}
pxa_set_keypad_info(&treo680_keypad_pdata); pxa_set_keypad_info(&treo680_keypad_pdata);
} }
......
...@@ -176,7 +176,7 @@ static inline void palmtx_nor_init(void) {} ...@@ -176,7 +176,7 @@ static inline void palmtx_nor_init(void) {}
* GPIO keyboard * GPIO keyboard
******************************************************************************/ ******************************************************************************/
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int palmtx_matrix_keys[] = { static const unsigned int palmtx_matrix_keys[] = {
KEY(0, 0, KEY_POWER), KEY(0, 0, KEY_POWER),
KEY(0, 1, KEY_F1), KEY(0, 1, KEY_F1),
KEY(0, 2, KEY_ENTER), KEY(0, 2, KEY_ENTER),
...@@ -192,11 +192,15 @@ static unsigned int palmtx_matrix_keys[] = { ...@@ -192,11 +192,15 @@ static unsigned int palmtx_matrix_keys[] = {
KEY(3, 2, KEY_LEFT), KEY(3, 2, KEY_LEFT),
}; };
static struct matrix_keymap_data palmtx_matrix_keymap_data = {
.keymap = palmtx_matrix_keys,
.keymap_size = ARRAY_SIZE(palmtx_matrix_keys),
};
static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = { static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = {
.matrix_key_rows = 4, .matrix_key_rows = 4,
.matrix_key_cols = 3, .matrix_key_cols = 3,
.matrix_key_map = palmtx_matrix_keys, .matrix_keymap_data = &palmtx_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(palmtx_matrix_keys),
.debounce_interval = 30, .debounce_interval = 30,
}; };
......
...@@ -140,7 +140,7 @@ static unsigned long palmz72_pin_config[] __initdata = { ...@@ -140,7 +140,7 @@ static unsigned long palmz72_pin_config[] __initdata = {
* GPIO keyboard * GPIO keyboard
******************************************************************************/ ******************************************************************************/
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int palmz72_matrix_keys[] = { static const unsigned int palmz72_matrix_keys[] = {
KEY(0, 0, KEY_POWER), KEY(0, 0, KEY_POWER),
KEY(0, 1, KEY_F1), KEY(0, 1, KEY_F1),
KEY(0, 2, KEY_ENTER), KEY(0, 2, KEY_ENTER),
...@@ -156,11 +156,15 @@ static unsigned int palmz72_matrix_keys[] = { ...@@ -156,11 +156,15 @@ static unsigned int palmz72_matrix_keys[] = {
KEY(3, 2, KEY_LEFT), KEY(3, 2, KEY_LEFT),
}; };
static struct matrix_keymap_data almz72_matrix_keymap_data = {
.keymap = palmz72_matrix_keys,
.keymap_size = ARRAY_SIZE(palmz72_matrix_keys),
};
static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = { static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = {
.matrix_key_rows = 4, .matrix_key_rows = 4,
.matrix_key_cols = 3, .matrix_key_cols = 3,
.matrix_key_map = palmz72_matrix_keys, .matrix_keymap_data = &almz72_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(palmz72_matrix_keys),
.debounce_interval = 30, .debounce_interval = 30,
}; };
......
...@@ -106,7 +106,7 @@ static struct platform_device smc91x_device = { ...@@ -106,7 +106,7 @@ static struct platform_device smc91x_device = {
}; };
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int tavorevb_matrix_key_map[] = { static const unsigned int tavorevb_matrix_key_map[] = {
/* KEY(row, col, key_code) */ /* KEY(row, col, key_code) */
KEY(0, 4, KEY_A), KEY(0, 5, KEY_B), KEY(0, 6, KEY_C), KEY(0, 4, KEY_A), KEY(0, 5, KEY_B), KEY(0, 6, KEY_C),
KEY(1, 4, KEY_E), KEY(1, 5, KEY_F), KEY(1, 6, KEY_G), KEY(1, 4, KEY_E), KEY(1, 5, KEY_F), KEY(1, 6, KEY_G),
...@@ -147,11 +147,15 @@ static unsigned int tavorevb_matrix_key_map[] = { ...@@ -147,11 +147,15 @@ static unsigned int tavorevb_matrix_key_map[] = {
KEY(3, 3, KEY_F23), /* soft2 */ KEY(3, 3, KEY_F23), /* soft2 */
}; };
static struct matrix_keymap_data tavorevb_matrix_keymap_data = {
.keymap = tavorevb_matrix_key_map,
.keymap_size = ARRAY_SIZE(tavorevb_matrix_key_map),
};
static struct pxa27x_keypad_platform_data tavorevb_keypad_info = { static struct pxa27x_keypad_platform_data tavorevb_keypad_info = {
.matrix_key_rows = 7, .matrix_key_rows = 7,
.matrix_key_cols = 7, .matrix_key_cols = 7,
.matrix_key_map = tavorevb_matrix_key_map, .matrix_keymap_data = &tavorevb_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(tavorevb_matrix_key_map),
.debounce_interval = 30, .debounce_interval = 30,
}; };
......
...@@ -345,7 +345,7 @@ static inline void z2_leds_init(void) {} ...@@ -345,7 +345,7 @@ static inline void z2_leds_init(void) {}
* GPIO keyboard * GPIO keyboard
******************************************************************************/ ******************************************************************************/
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int z2_matrix_keys[] = { static const unsigned int z2_matrix_keys[] = {
KEY(0, 0, KEY_OPTION), KEY(0, 0, KEY_OPTION),
KEY(1, 0, KEY_UP), KEY(1, 0, KEY_UP),
KEY(2, 0, KEY_DOWN), KEY(2, 0, KEY_DOWN),
...@@ -405,11 +405,15 @@ static unsigned int z2_matrix_keys[] = { ...@@ -405,11 +405,15 @@ static unsigned int z2_matrix_keys[] = {
KEY(5, 7, KEY_DOT), KEY(5, 7, KEY_DOT),
}; };
static struct matrix_keymap_data z2_matrix_keymap_data = {
.keymap = z2_matrix_keys,
.keymap_size = ARRAY_SIZE(z2_matrix_keys),
};
static struct pxa27x_keypad_platform_data z2_keypad_platform_data = { static struct pxa27x_keypad_platform_data z2_keypad_platform_data = {
.matrix_key_rows = 7, .matrix_key_rows = 7,
.matrix_key_cols = 8, .matrix_key_cols = 8,
.matrix_key_map = z2_matrix_keys, .matrix_keymap_data = &z2_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(z2_matrix_keys),
.debounce_interval = 30, .debounce_interval = 30,
}; };
......
...@@ -263,7 +263,7 @@ static inline void zylonite_init_mmc(void) {} ...@@ -263,7 +263,7 @@ static inline void zylonite_init_mmc(void) {}
#endif #endif
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int zylonite_matrix_key_map[] = { static const unsigned int zylonite_matrix_key_map[] = {
/* KEY(row, col, key_code) */ /* KEY(row, col, key_code) */
KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D), KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H), KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H),
...@@ -306,11 +306,15 @@ static unsigned int zylonite_matrix_key_map[] = { ...@@ -306,11 +306,15 @@ static unsigned int zylonite_matrix_key_map[] = {
KEY(0, 3, KEY_AUX), /* contact */ KEY(0, 3, KEY_AUX), /* contact */
}; };
static struct matrix_keymap_data zylonite_matrix_keymap_data = {
.keymap = zylonite_matrix_key_map,
.keymap_size = ARRAY_SIZE(zylonite_matrix_key_map),
};
static struct pxa27x_keypad_platform_data zylonite_keypad_info = { static struct pxa27x_keypad_platform_data zylonite_keypad_info = {
.matrix_key_rows = 8, .matrix_key_rows = 8,
.matrix_key_cols = 8, .matrix_key_cols = 8,
.matrix_key_map = zylonite_matrix_key_map, .matrix_keymap_data = &zylonite_matrix_keymap_data,
.matrix_key_map_size = ARRAY_SIZE(zylonite_matrix_key_map),
.enable_rotary0 = 1, .enable_rotary0 = 1,
.rotary0_up_key = KEY_UP, .rotary0_up_key = KEY_UP,
......
...@@ -451,6 +451,7 @@ config KEYBOARD_OPENCORES ...@@ -451,6 +451,7 @@ config KEYBOARD_OPENCORES
config KEYBOARD_PXA27x config KEYBOARD_PXA27x
tristate "PXA27x/PXA3xx keypad support" tristate "PXA27x/PXA3xx keypad support"
depends on PXA27x || PXA3xx || ARCH_MMP depends on PXA27x || PXA3xx || ARCH_MMP
select INPUT_MATRIXKMAP
help help
Enable support for PXA27x/PXA3xx keypad controller. Enable support for PXA27x/PXA3xx keypad controller.
......
...@@ -118,25 +118,30 @@ struct pxa27x_keypad { ...@@ -118,25 +118,30 @@ struct pxa27x_keypad {
unsigned int direct_key_mask; unsigned int direct_key_mask;
}; };
static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) static int pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
{ {
struct pxa27x_keypad_platform_data *pdata = keypad->pdata; struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
struct input_dev *input_dev = keypad->input_dev; struct input_dev *input_dev = keypad->input_dev;
const struct matrix_keymap_data *keymap_data =
pdata ? pdata->matrix_keymap_data : NULL;
unsigned short keycode; unsigned short keycode;
int i; int i;
int error;
for (i = 0; i < pdata->matrix_key_map_size; i++) { error = matrix_keypad_build_keymap(keymap_data, NULL,
unsigned int key = pdata->matrix_key_map[i]; pdata->matrix_key_rows,
unsigned int row = KEY_ROW(key); pdata->matrix_key_cols,
unsigned int col = KEY_COL(key); keypad->keycodes, input_dev);
unsigned int scancode = MATRIX_SCAN_CODE(row, col, if (error)
MATRIX_ROW_SHIFT); return error;
keycode = KEY_VAL(key); /*
keypad->keycodes[scancode] = keycode; * The keycodes may not only include matrix keys but also the direct
__set_bit(keycode, input_dev->keybit); * or rotary keys.
} */
input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes);
/* For direct keys. */
for (i = 0; i < pdata->direct_key_num; i++) { for (i = 0; i < pdata->direct_key_num; i++) {
keycode = pdata->direct_key_map[i]; keycode = pdata->direct_key_map[i];
keypad->keycodes[MAX_MATRIX_KEY_NUM + i] = keycode; keypad->keycodes[MAX_MATRIX_KEY_NUM + i] = keycode;
...@@ -178,6 +183,8 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) ...@@ -178,6 +183,8 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
} }
__clear_bit(KEY_RESERVED, input_dev->keybit); __clear_bit(KEY_RESERVED, input_dev->keybit);
return 0;
} }
static void pxa27x_keypad_scan_matrix(struct pxa27x_keypad *keypad) static void pxa27x_keypad_scan_matrix(struct pxa27x_keypad *keypad)
...@@ -555,7 +562,11 @@ static int pxa27x_keypad_probe(struct platform_device *pdev) ...@@ -555,7 +562,11 @@ static int pxa27x_keypad_probe(struct platform_device *pdev)
input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
input_set_capability(input_dev, EV_MSC, MSC_SCAN); input_set_capability(input_dev, EV_MSC, MSC_SCAN);
pxa27x_keypad_build_keycode(keypad); error = pxa27x_keypad_build_keycode(keypad);
if (error) {
dev_err(&pdev->dev, "failed to build keycode\n");
goto failed_put_clk;
}
if ((pdata->enable_rotary0 && keypad->rotary_rel_code[0] != -1) || if ((pdata->enable_rotary0 && keypad->rotary_rel_code[0] != -1) ||
(pdata->enable_rotary1 && keypad->rotary_rel_code[1] != -1)) { (pdata->enable_rotary1 && keypad->rotary_rel_code[1] != -1)) {
......
...@@ -36,10 +36,9 @@ ...@@ -36,10 +36,9 @@
struct pxa27x_keypad_platform_data { struct pxa27x_keypad_platform_data {
/* code map for the matrix keys */ /* code map for the matrix keys */
const struct matrix_keymap_data *matrix_keymap_data;
unsigned int matrix_key_rows; unsigned int matrix_key_rows;
unsigned int matrix_key_cols; unsigned int matrix_key_cols;
unsigned int *matrix_key_map;
int matrix_key_map_size;
/* direct keys */ /* direct keys */
int direct_key_num; int direct_key_num;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment