diff options
author | Tony Lindgren <tony@atomide.com> | 2011-10-06 18:43:00 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-11-04 21:07:21 -0400 |
commit | 41eb2d813f558900884e240c2f723e36c7bd151f (patch) | |
tree | 9b40261999588d6fc274d296f8eb6a644bc46da0 /arch/arm | |
parent | 98e541ffaadf01fc4d202ad2bd187a14b671f1a4 (diff) |
ARM: OMAP2: Fix H4 matrix keyboard warning
Convert to use matrix keyboard to remove the warning
"Please update the board to use matrix-keypad driver".
Based on similar setup in palmtc.c. Note that this
patch is compile tested only because of lack of working
hardware.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/board-h4.c | 122 |
1 files changed, 69 insertions, 53 deletions
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index c12666ee7017..8b351d92a1cc 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/input/matrix_keypad.h> | ||
28 | 29 | ||
29 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
30 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
@@ -34,7 +35,6 @@ | |||
34 | #include <plat/usb.h> | 35 | #include <plat/usb.h> |
35 | #include <plat/board.h> | 36 | #include <plat/board.h> |
36 | #include <plat/common.h> | 37 | #include <plat/common.h> |
37 | #include <plat/keypad.h> | ||
38 | #include <plat/menelaus.h> | 38 | #include <plat/menelaus.h> |
39 | #include <plat/dma.h> | 39 | #include <plat/dma.h> |
40 | #include <plat/gpmc.h> | 40 | #include <plat/gpmc.h> |
@@ -50,10 +50,8 @@ | |||
50 | 50 | ||
51 | #define H4_ETHR_GPIO_IRQ 92 | 51 | #define H4_ETHR_GPIO_IRQ 92 |
52 | 52 | ||
53 | static unsigned int row_gpios[6] = { 88, 89, 124, 11, 6, 96 }; | 53 | #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) |
54 | static unsigned int col_gpios[7] = { 90, 91, 100, 36, 12, 97, 98 }; | 54 | static const uint32_t board_matrix_keys[] = { |
55 | |||
56 | static const unsigned int h4_keymap[] = { | ||
57 | KEY(0, 0, KEY_LEFT), | 55 | KEY(0, 0, KEY_LEFT), |
58 | KEY(1, 0, KEY_RIGHT), | 56 | KEY(1, 0, KEY_RIGHT), |
59 | KEY(2, 0, KEY_A), | 57 | KEY(2, 0, KEY_A), |
@@ -86,6 +84,71 @@ static const unsigned int h4_keymap[] = { | |||
86 | KEY(4, 5, KEY_ENTER), | 84 | KEY(4, 5, KEY_ENTER), |
87 | }; | 85 | }; |
88 | 86 | ||
87 | static const struct matrix_keymap_data board_keymap_data = { | ||
88 | .keymap = board_matrix_keys, | ||
89 | .keymap_size = ARRAY_SIZE(board_matrix_keys), | ||
90 | }; | ||
91 | |||
92 | static unsigned int board_keypad_row_gpios[] = { | ||
93 | 88, 89, 124, 11, 6, 96 | ||
94 | }; | ||
95 | |||
96 | static unsigned int board_keypad_col_gpios[] = { | ||
97 | 90, 91, 100, 36, 12, 97, 98 | ||
98 | }; | ||
99 | |||
100 | static struct matrix_keypad_platform_data board_keypad_platform_data = { | ||
101 | .keymap_data = &board_keymap_data, | ||
102 | .row_gpios = board_keypad_row_gpios, | ||
103 | .num_row_gpios = ARRAY_SIZE(board_keypad_row_gpios), | ||
104 | .col_gpios = board_keypad_col_gpios, | ||
105 | .num_col_gpios = ARRAY_SIZE(board_keypad_col_gpios), | ||
106 | .active_low = 1, | ||
107 | |||
108 | .debounce_ms = 20, | ||
109 | .col_scan_delay_us = 5, | ||
110 | }; | ||
111 | |||
112 | static struct platform_device board_keyboard = { | ||
113 | .name = "matrix-keypad", | ||
114 | .id = -1, | ||
115 | .dev = { | ||
116 | .platform_data = &board_keypad_platform_data, | ||
117 | }, | ||
118 | }; | ||
119 | static void __init board_mkp_init(void) | ||
120 | { | ||
121 | omap_mux_init_gpio(88, OMAP_PULL_ENA | OMAP_PULL_UP); | ||
122 | omap_mux_init_gpio(89, OMAP_PULL_ENA | OMAP_PULL_UP); | ||
123 | omap_mux_init_gpio(124, OMAP_PULL_ENA | OMAP_PULL_UP); | ||
124 | omap_mux_init_signal("mcbsp2_dr.gpio_11", OMAP_PULL_ENA | OMAP_PULL_UP); | ||
125 | if (omap_has_menelaus()) { | ||
126 | omap_mux_init_signal("sdrc_a14.gpio0", | ||
127 | OMAP_PULL_ENA | OMAP_PULL_UP); | ||
128 | omap_mux_init_signal("vlynq_rx0.gpio_15", 0); | ||
129 | omap_mux_init_signal("gpio_98", 0); | ||
130 | board_keypad_row_gpios[5] = 0; | ||
131 | board_keypad_col_gpios[2] = 15; | ||
132 | board_keypad_col_gpios[6] = 18; | ||
133 | } else { | ||
134 | omap_mux_init_signal("gpio_96", OMAP_PULL_ENA | OMAP_PULL_UP); | ||
135 | omap_mux_init_signal("gpio_100", 0); | ||
136 | omap_mux_init_signal("gpio_98", 0); | ||
137 | } | ||
138 | omap_mux_init_signal("gpio_90", 0); | ||
139 | omap_mux_init_signal("gpio_91", 0); | ||
140 | omap_mux_init_signal("gpio_36", 0); | ||
141 | omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0); | ||
142 | omap_mux_init_signal("gpio_97", 0); | ||
143 | |||
144 | platform_device_register(&board_keyboard); | ||
145 | } | ||
146 | #else | ||
147 | static inline void board_mkp_init(void) | ||
148 | { | ||
149 | } | ||
150 | #endif | ||
151 | |||
89 | static struct mtd_partition h4_partitions[] = { | 152 | static struct mtd_partition h4_partitions[] = { |
90 | /* bootloader (U-Boot, etc) in first sector */ | 153 | /* bootloader (U-Boot, etc) in first sector */ |
91 | { | 154 | { |
@@ -137,31 +200,8 @@ static struct platform_device h4_flash_device = { | |||
137 | .resource = &h4_flash_resource, | 200 | .resource = &h4_flash_resource, |
138 | }; | 201 | }; |
139 | 202 | ||
140 | static const struct matrix_keymap_data h4_keymap_data = { | ||
141 | .keymap = h4_keymap, | ||
142 | .keymap_size = ARRAY_SIZE(h4_keymap), | ||
143 | }; | ||
144 | |||
145 | static struct omap_kp_platform_data h4_kp_data = { | ||
146 | .rows = 6, | ||
147 | .cols = 7, | ||
148 | .keymap_data = &h4_keymap_data, | ||
149 | .rep = true, | ||
150 | .row_gpios = row_gpios, | ||
151 | .col_gpios = col_gpios, | ||
152 | }; | ||
153 | |||
154 | static struct platform_device h4_kp_device = { | ||
155 | .name = "omap-keypad", | ||
156 | .id = -1, | ||
157 | .dev = { | ||
158 | .platform_data = &h4_kp_data, | ||
159 | }, | ||
160 | }; | ||
161 | |||
162 | static struct platform_device *h4_devices[] __initdata = { | 203 | static struct platform_device *h4_devices[] __initdata = { |
163 | &h4_flash_device, | 204 | &h4_flash_device, |
164 | &h4_kp_device, | ||
165 | }; | 205 | }; |
166 | 206 | ||
167 | static struct panel_generic_dpi_data h4_panel_data = { | 207 | static struct panel_generic_dpi_data h4_panel_data = { |
@@ -336,31 +376,7 @@ static void __init omap_h4_init(void) | |||
336 | * if not needed. | 376 | * if not needed. |
337 | */ | 377 | */ |
338 | 378 | ||
339 | #if defined(CONFIG_KEYBOARD_OMAP) || defined(CONFIG_KEYBOARD_OMAP_MODULE) | 379 | board_mkp_init(); |
340 | omap_mux_init_gpio(88, OMAP_PULL_ENA | OMAP_PULL_UP); | ||
341 | omap_mux_init_gpio(89, OMAP_PULL_ENA | OMAP_PULL_UP); | ||
342 | omap_mux_init_gpio(124, OMAP_PULL_ENA | OMAP_PULL_UP); | ||
343 | omap_mux_init_signal("mcbsp2_dr.gpio_11", OMAP_PULL_ENA | OMAP_PULL_UP); | ||
344 | if (omap_has_menelaus()) { | ||
345 | omap_mux_init_signal("sdrc_a14.gpio0", | ||
346 | OMAP_PULL_ENA | OMAP_PULL_UP); | ||
347 | omap_mux_init_signal("vlynq_rx0.gpio_15", 0); | ||
348 | omap_mux_init_signal("gpio_98", 0); | ||
349 | row_gpios[5] = 0; | ||
350 | col_gpios[2] = 15; | ||
351 | col_gpios[6] = 18; | ||
352 | } else { | ||
353 | omap_mux_init_signal("gpio_96", OMAP_PULL_ENA | OMAP_PULL_UP); | ||
354 | omap_mux_init_signal("gpio_100", 0); | ||
355 | omap_mux_init_signal("gpio_98", 0); | ||
356 | } | ||
357 | omap_mux_init_signal("gpio_90", 0); | ||
358 | omap_mux_init_signal("gpio_91", 0); | ||
359 | omap_mux_init_signal("gpio_36", 0); | ||
360 | omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0); | ||
361 | omap_mux_init_signal("gpio_97", 0); | ||
362 | #endif | ||
363 | |||
364 | i2c_register_board_info(1, h4_i2c_board_info, | 380 | i2c_register_board_info(1, h4_i2c_board_info, |
365 | ARRAY_SIZE(h4_i2c_board_info)); | 381 | ARRAY_SIZE(h4_i2c_board_info)); |
366 | 382 | ||