Commit | Line | Data |
---|---|---|
9ab24e4e SS |
1 | /* |
2 | * ezx.c - Common code for the EZX platform. | |
3 | * | |
4 | * Copyright (C) 2005-2006 Harald Welte <laforge@openezx.org>, | |
5 | * 2007-2008 Daniel Ribeiro <drwyrm@gmail.com>, | |
6 | * 2007-2008 Stefan Schmidt <stefan@datenfreihafen.org> | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License version 2 as | |
10 | * published by the Free Software Foundation. | |
11 | * | |
12 | */ | |
13 | ||
14 | #include <linux/kernel.h> | |
15 | #include <linux/init.h> | |
16 | #include <linux/platform_device.h> | |
17 | #include <linux/delay.h> | |
18 | #include <linux/pwm_backlight.h> | |
fe9490c6 | 19 | #include <linux/input.h> |
405ac401 | 20 | #include <linux/gpio.h> |
1ce2c51e | 21 | #include <linux/gpio_keys.h> |
9ab24e4e | 22 | |
405ac401 AO |
23 | #include <media/soc_camera.h> |
24 | ||
9ab24e4e | 25 | #include <asm/setup.h> |
51c62982 EM |
26 | #include <asm/mach-types.h> |
27 | #include <asm/mach/arch.h> | |
28 | ||
29 | #include <mach/pxa27x.h> | |
a09e64fb RK |
30 | #include <mach/pxafb.h> |
31 | #include <mach/ohci.h> | |
f0a83701 | 32 | #include <plat/i2c.h> |
05678a96 | 33 | #include <mach/hardware.h> |
fe9490c6 | 34 | #include <mach/pxa27x_keypad.h> |
405ac401 | 35 | #include <mach/camera.h> |
9ab24e4e | 36 | |
9ab24e4e SS |
37 | #include "devices.h" |
38 | #include "generic.h" | |
39 | ||
1ce2c51e AO |
40 | #define GPIO12_A780_FLIP_LID 12 |
41 | #define GPIO15_A1200_FLIP_LID 15 | |
42 | #define GPIO15_A910_FLIP_LID 15 | |
43 | #define GPIO12_E680_LOCK_SWITCH 12 | |
44 | #define GPIO15_E6_LOCK_SWITCH 15 | |
405ac401 AO |
45 | #define GPIO50_nCAM_EN 50 |
46 | #define GPIO19_GEN1_CAM_RST 19 | |
47 | #define GPIO28_GEN2_CAM_RST 28 | |
1ce2c51e | 48 | |
9ab24e4e SS |
49 | static struct platform_pwm_backlight_data ezx_backlight_data = { |
50 | .pwm_id = 0, | |
51 | .max_brightness = 1023, | |
52 | .dft_brightness = 1023, | |
53 | .pwm_period_ns = 78770, | |
54 | }; | |
55 | ||
56 | static struct platform_device ezx_backlight_device = { | |
57 | .name = "pwm-backlight", | |
58 | .dev = { | |
59 | .parent = &pxa27x_device_pwm0.dev, | |
60 | .platform_data = &ezx_backlight_data, | |
61 | }, | |
62 | }; | |
63 | ||
64 | static struct pxafb_mode_info mode_ezx_old = { | |
65 | .pixclock = 150000, | |
66 | .xres = 240, | |
67 | .yres = 320, | |
68 | .bpp = 16, | |
69 | .hsync_len = 10, | |
70 | .left_margin = 20, | |
71 | .right_margin = 10, | |
72 | .vsync_len = 2, | |
73 | .upper_margin = 3, | |
74 | .lower_margin = 2, | |
75 | .sync = 0, | |
76 | }; | |
77 | ||
78 | static struct pxafb_mach_info ezx_fb_info_1 = { | |
79 | .modes = &mode_ezx_old, | |
80 | .num_modes = 1, | |
81 | .lcd_conn = LCD_COLOR_TFT_16BPP, | |
82 | }; | |
83 | ||
84 | static struct pxafb_mode_info mode_72r89803y01 = { | |
85 | .pixclock = 192308, | |
86 | .xres = 240, | |
87 | .yres = 320, | |
88 | .bpp = 32, | |
89 | .depth = 18, | |
90 | .hsync_len = 10, | |
91 | .left_margin = 20, | |
92 | .right_margin = 10, | |
93 | .vsync_len = 2, | |
94 | .upper_margin = 3, | |
95 | .lower_margin = 2, | |
96 | .sync = 0, | |
97 | }; | |
98 | ||
99 | static struct pxafb_mach_info ezx_fb_info_2 = { | |
100 | .modes = &mode_72r89803y01, | |
101 | .num_modes = 1, | |
102 | .lcd_conn = LCD_COLOR_TFT_18BPP, | |
103 | }; | |
104 | ||
1ce2c51e | 105 | static struct platform_device *ezx_devices[] __initdata = { |
9ab24e4e SS |
106 | &ezx_backlight_device, |
107 | }; | |
108 | ||
109 | static unsigned long ezx_pin_config[] __initdata = { | |
110 | /* PWM backlight */ | |
111 | GPIO16_PWM0_OUT, | |
112 | ||
113 | /* BTUART */ | |
114 | GPIO42_BTUART_RXD, | |
115 | GPIO43_BTUART_TXD, | |
116 | GPIO44_BTUART_CTS, | |
117 | GPIO45_BTUART_RTS, | |
118 | ||
6f584cfa EM |
119 | /* I2C */ |
120 | GPIO117_I2C_SCL, | |
121 | GPIO118_I2C_SDA, | |
9078ac21 SS |
122 | |
123 | /* PCAP SSP */ | |
124 | GPIO29_SSP1_SCLK, | |
125 | GPIO25_SSP1_TXD, | |
126 | GPIO26_SSP1_RXD, | |
127 | GPIO24_GPIO, /* pcap chip select */ | |
ff71338e DR |
128 | GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, /* pcap interrupt */ |
129 | GPIO4_GPIO | MFP_LPM_DRIVE_HIGH, /* WDI_AP */ | |
130 | GPIO55_GPIO | MFP_LPM_DRIVE_HIGH, /* SYS_RESTART */ | |
9078ac21 SS |
131 | |
132 | /* MMC */ | |
133 | GPIO32_MMC_CLK, | |
134 | GPIO92_MMC_DAT_0, | |
135 | GPIO109_MMC_DAT_1, | |
136 | GPIO110_MMC_DAT_2, | |
137 | GPIO111_MMC_DAT_3, | |
138 | GPIO112_MMC_CMD, | |
139 | GPIO11_GPIO, /* mmc detect */ | |
140 | ||
141 | /* usb to external transceiver */ | |
142 | GPIO34_USB_P2_2, | |
143 | GPIO35_USB_P2_1, | |
144 | GPIO36_USB_P2_4, | |
145 | GPIO39_USB_P2_6, | |
146 | GPIO40_USB_P2_5, | |
147 | GPIO53_USB_P2_3, | |
148 | ||
149 | /* usb to Neptune GSM chip */ | |
150 | GPIO30_USB_P3_2, | |
151 | GPIO31_USB_P3_6, | |
152 | GPIO90_USB_P3_5, | |
153 | GPIO91_USB_P3_1, | |
154 | GPIO56_USB_P3_4, | |
155 | GPIO113_USB_P3_3, | |
156 | }; | |
157 | ||
158 | #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680) | |
159 | static unsigned long gen1_pin_config[] __initdata = { | |
160 | /* flip / lockswitch */ | |
ff71338e | 161 | GPIO12_GPIO | WAKEUP_ON_EDGE_BOTH, |
9078ac21 SS |
162 | |
163 | /* bluetooth (bcm2035) */ | |
ff71338e | 164 | GPIO14_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */ |
9078ac21 SS |
165 | GPIO48_GPIO, /* RESET */ |
166 | GPIO28_GPIO, /* WAKEUP */ | |
167 | ||
168 | /* Neptune handshake */ | |
ff71338e DR |
169 | GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */ |
170 | GPIO57_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */ | |
171 | GPIO13_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI */ | |
172 | GPIO3_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI2 */ | |
173 | GPIO82_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */ | |
174 | GPIO99_GPIO | MFP_LPM_DRIVE_HIGH, /* TC_MM_EN */ | |
9078ac21 SS |
175 | |
176 | /* sound */ | |
177 | GPIO52_SSP3_SCLK, | |
178 | GPIO83_SSP3_SFRM, | |
179 | GPIO81_SSP3_TXD, | |
180 | GPIO89_SSP3_RXD, | |
181 | ||
182 | /* ssp2 pins to in */ | |
183 | GPIO22_GPIO, /* SSP2_SCLK */ | |
184 | GPIO37_GPIO, /* SSP2_SFRM */ | |
185 | GPIO38_GPIO, /* SSP2_TXD */ | |
186 | GPIO88_GPIO, /* SSP2_RXD */ | |
187 | ||
188 | /* camera */ | |
189 | GPIO23_CIF_MCLK, | |
190 | GPIO54_CIF_PCLK, | |
191 | GPIO85_CIF_LV, | |
192 | GPIO84_CIF_FV, | |
193 | GPIO27_CIF_DD_0, | |
194 | GPIO114_CIF_DD_1, | |
195 | GPIO51_CIF_DD_2, | |
196 | GPIO115_CIF_DD_3, | |
197 | GPIO95_CIF_DD_4, | |
198 | GPIO94_CIF_DD_5, | |
199 | GPIO17_CIF_DD_6, | |
200 | GPIO108_CIF_DD_7, | |
405ac401 AO |
201 | GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */ |
202 | GPIO19_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */ | |
9078ac21 SS |
203 | |
204 | /* EMU */ | |
205 | GPIO120_GPIO, /* EMU_MUX1 */ | |
206 | GPIO119_GPIO, /* EMU_MUX2 */ | |
207 | GPIO86_GPIO, /* SNP_INT_CTL */ | |
208 | GPIO87_GPIO, /* SNP_INT_IN */ | |
9ab24e4e | 209 | }; |
9078ac21 SS |
210 | #endif |
211 | ||
212 | #if defined(CONFIG_MACH_EZX_A1200) || defined(CONFIG_MACH_EZX_A910) || \ | |
213 | defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6) | |
214 | static unsigned long gen2_pin_config[] __initdata = { | |
215 | /* flip / lockswitch */ | |
ff71338e | 216 | GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH, |
9078ac21 SS |
217 | |
218 | /* EOC */ | |
ff71338e | 219 | GPIO10_GPIO | WAKEUP_ON_EDGE_RISE, |
9078ac21 SS |
220 | |
221 | /* bluetooth (bcm2045) */ | |
ff71338e | 222 | GPIO13_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */ |
9078ac21 SS |
223 | GPIO37_GPIO, /* RESET */ |
224 | GPIO57_GPIO, /* WAKEUP */ | |
225 | ||
226 | /* Neptune handshake */ | |
ff71338e DR |
227 | GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */ |
228 | GPIO96_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */ | |
229 | GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* WDI */ | |
230 | GPIO116_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */ | |
9078ac21 SS |
231 | GPIO41_GPIO, /* BP_FLASH */ |
232 | ||
233 | /* sound */ | |
234 | GPIO52_SSP3_SCLK, | |
235 | GPIO83_SSP3_SFRM, | |
236 | GPIO81_SSP3_TXD, | |
237 | GPIO82_SSP3_RXD, | |
238 | ||
239 | /* ssp2 pins to in */ | |
240 | GPIO22_GPIO, /* SSP2_SCLK */ | |
241 | GPIO14_GPIO, /* SSP2_SFRM */ | |
242 | GPIO38_GPIO, /* SSP2_TXD */ | |
243 | GPIO88_GPIO, /* SSP2_RXD */ | |
9ab24e4e | 244 | |
9078ac21 SS |
245 | /* camera */ |
246 | GPIO23_CIF_MCLK, | |
247 | GPIO54_CIF_PCLK, | |
248 | GPIO85_CIF_LV, | |
249 | GPIO84_CIF_FV, | |
250 | GPIO27_CIF_DD_0, | |
251 | GPIO114_CIF_DD_1, | |
252 | GPIO51_CIF_DD_2, | |
253 | GPIO115_CIF_DD_3, | |
254 | GPIO95_CIF_DD_4, | |
255 | GPIO48_CIF_DD_5, | |
256 | GPIO93_CIF_DD_6, | |
257 | GPIO12_CIF_DD_7, | |
405ac401 AO |
258 | GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */ |
259 | GPIO28_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */ | |
9078ac21 SS |
260 | GPIO17_GPIO, /* CAM_FLASH */ |
261 | }; | |
262 | #endif | |
263 | ||
264 | #ifdef CONFIG_MACH_EZX_A780 | |
265 | static unsigned long a780_pin_config[] __initdata = { | |
266 | /* keypad */ | |
267 | GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, | |
268 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | |
269 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, | |
270 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, | |
271 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, | |
272 | GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH, | |
273 | GPIO103_KP_MKOUT_0, | |
274 | GPIO104_KP_MKOUT_1, | |
275 | GPIO105_KP_MKOUT_2, | |
276 | GPIO106_KP_MKOUT_3, | |
277 | GPIO107_KP_MKOUT_4, | |
278 | ||
279 | /* attenuate sound */ | |
280 | GPIO96_GPIO, | |
281 | }; | |
282 | #endif | |
283 | ||
284 | #ifdef CONFIG_MACH_EZX_E680 | |
285 | static unsigned long e680_pin_config[] __initdata = { | |
286 | /* keypad */ | |
287 | GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, | |
288 | GPIO96_KP_DKIN_3 | WAKEUP_ON_LEVEL_HIGH, | |
289 | GPIO97_KP_DKIN_4 | WAKEUP_ON_LEVEL_HIGH, | |
290 | GPIO98_KP_DKIN_5 | WAKEUP_ON_LEVEL_HIGH, | |
291 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | |
292 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, | |
293 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, | |
294 | GPIO103_KP_MKOUT_0, | |
295 | GPIO104_KP_MKOUT_1, | |
296 | GPIO105_KP_MKOUT_2, | |
297 | GPIO106_KP_MKOUT_3, | |
298 | ||
299 | /* MIDI */ | |
300 | GPIO79_GPIO, /* VA_SEL_BUL */ | |
301 | GPIO80_GPIO, /* FLT_SEL_BUL */ | |
302 | GPIO78_GPIO, /* MIDI_RESET */ | |
303 | GPIO33_GPIO, /* MIDI_CS */ | |
304 | GPIO15_GPIO, /* MIDI_IRQ */ | |
305 | GPIO49_GPIO, /* MIDI_NPWE */ | |
306 | GPIO18_GPIO, /* MIDI_RDY */ | |
307 | ||
308 | /* leds */ | |
309 | GPIO46_GPIO, | |
310 | GPIO47_GPIO, | |
311 | }; | |
312 | #endif | |
313 | ||
314 | #ifdef CONFIG_MACH_EZX_A1200 | |
315 | static unsigned long a1200_pin_config[] __initdata = { | |
316 | /* keypad */ | |
317 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | |
318 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, | |
319 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, | |
320 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, | |
321 | GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH, | |
322 | GPIO103_KP_MKOUT_0, | |
323 | GPIO104_KP_MKOUT_1, | |
324 | GPIO105_KP_MKOUT_2, | |
325 | GPIO106_KP_MKOUT_3, | |
326 | GPIO107_KP_MKOUT_4, | |
327 | GPIO108_KP_MKOUT_5, | |
328 | }; | |
329 | #endif | |
330 | ||
331 | #ifdef CONFIG_MACH_EZX_A910 | |
332 | static unsigned long a910_pin_config[] __initdata = { | |
333 | /* keypad */ | |
334 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | |
335 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, | |
336 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, | |
337 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, | |
338 | GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH, | |
339 | GPIO103_KP_MKOUT_0, | |
340 | GPIO104_KP_MKOUT_1, | |
341 | GPIO105_KP_MKOUT_2, | |
342 | GPIO106_KP_MKOUT_3, | |
343 | GPIO107_KP_MKOUT_4, | |
344 | GPIO108_KP_MKOUT_5, | |
345 | ||
346 | /* WLAN */ | |
347 | GPIO89_GPIO, /* RESET */ | |
348 | GPIO33_GPIO, /* WAKEUP */ | |
349 | GPIO94_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */ | |
350 | ||
351 | /* MMC CS */ | |
352 | GPIO20_GPIO, | |
353 | }; | |
354 | #endif | |
355 | ||
356 | #ifdef CONFIG_MACH_EZX_E2 | |
357 | static unsigned long e2_pin_config[] __initdata = { | |
358 | /* keypad */ | |
359 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | |
360 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, | |
361 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, | |
362 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, | |
363 | GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH, | |
364 | GPIO103_KP_MKOUT_0, | |
365 | GPIO104_KP_MKOUT_1, | |
366 | GPIO105_KP_MKOUT_2, | |
367 | GPIO106_KP_MKOUT_3, | |
368 | GPIO107_KP_MKOUT_4, | |
369 | GPIO108_KP_MKOUT_5, | |
370 | }; | |
371 | #endif | |
372 | ||
373 | #ifdef CONFIG_MACH_EZX_E6 | |
374 | static unsigned long e6_pin_config[] __initdata = { | |
375 | /* keypad */ | |
376 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | |
377 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, | |
378 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, | |
379 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, | |
380 | GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH, | |
381 | GPIO103_KP_MKOUT_0, | |
382 | GPIO104_KP_MKOUT_1, | |
383 | GPIO105_KP_MKOUT_2, | |
384 | GPIO106_KP_MKOUT_3, | |
385 | GPIO107_KP_MKOUT_4, | |
386 | GPIO108_KP_MKOUT_5, | |
387 | }; | |
388 | #endif | |
389 | ||
fe9490c6 SS |
390 | /* KEYPAD */ |
391 | #ifdef CONFIG_MACH_EZX_A780 | |
392 | static unsigned int a780_key_map[] = { | |
393 | KEY(0, 0, KEY_SEND), | |
394 | KEY(0, 1, KEY_BACK), | |
395 | KEY(0, 2, KEY_END), | |
396 | KEY(0, 3, KEY_PAGEUP), | |
397 | KEY(0, 4, KEY_UP), | |
398 | ||
399 | KEY(1, 0, KEY_NUMERIC_1), | |
400 | KEY(1, 1, KEY_NUMERIC_2), | |
401 | KEY(1, 2, KEY_NUMERIC_3), | |
402 | KEY(1, 3, KEY_SELECT), | |
403 | KEY(1, 4, KEY_KPENTER), | |
404 | ||
405 | KEY(2, 0, KEY_NUMERIC_4), | |
406 | KEY(2, 1, KEY_NUMERIC_5), | |
407 | KEY(2, 2, KEY_NUMERIC_6), | |
408 | KEY(2, 3, KEY_RECORD), | |
409 | KEY(2, 4, KEY_LEFT), | |
410 | ||
411 | KEY(3, 0, KEY_NUMERIC_7), | |
412 | KEY(3, 1, KEY_NUMERIC_8), | |
413 | KEY(3, 2, KEY_NUMERIC_9), | |
414 | KEY(3, 3, KEY_HOME), | |
415 | KEY(3, 4, KEY_RIGHT), | |
416 | ||
417 | KEY(4, 0, KEY_NUMERIC_STAR), | |
418 | KEY(4, 1, KEY_NUMERIC_0), | |
419 | KEY(4, 2, KEY_NUMERIC_POUND), | |
420 | KEY(4, 3, KEY_PAGEDOWN), | |
421 | KEY(4, 4, KEY_DOWN), | |
422 | }; | |
423 | ||
424 | static struct pxa27x_keypad_platform_data a780_keypad_platform_data = { | |
425 | .matrix_key_rows = 5, | |
426 | .matrix_key_cols = 5, | |
427 | .matrix_key_map = a780_key_map, | |
428 | .matrix_key_map_size = ARRAY_SIZE(a780_key_map), | |
429 | ||
430 | .direct_key_map = { KEY_CAMERA }, | |
431 | .direct_key_num = 1, | |
432 | ||
433 | .debounce_interval = 30, | |
434 | }; | |
435 | #endif /* CONFIG_MACH_EZX_A780 */ | |
436 | ||
437 | #ifdef CONFIG_MACH_EZX_E680 | |
438 | static unsigned int e680_key_map[] = { | |
439 | KEY(0, 0, KEY_UP), | |
440 | KEY(0, 1, KEY_RIGHT), | |
441 | KEY(0, 2, KEY_RESERVED), | |
442 | KEY(0, 3, KEY_SEND), | |
443 | ||
444 | KEY(1, 0, KEY_DOWN), | |
445 | KEY(1, 1, KEY_LEFT), | |
446 | KEY(1, 2, KEY_PAGEUP), | |
447 | KEY(1, 3, KEY_PAGEDOWN), | |
448 | ||
449 | KEY(2, 0, KEY_RESERVED), | |
450 | KEY(2, 1, KEY_RESERVED), | |
451 | KEY(2, 2, KEY_RESERVED), | |
452 | KEY(2, 3, KEY_KPENTER), | |
453 | }; | |
454 | ||
455 | static struct pxa27x_keypad_platform_data e680_keypad_platform_data = { | |
456 | .matrix_key_rows = 3, | |
457 | .matrix_key_cols = 4, | |
458 | .matrix_key_map = e680_key_map, | |
459 | .matrix_key_map_size = ARRAY_SIZE(e680_key_map), | |
460 | ||
461 | .direct_key_map = { | |
462 | KEY_CAMERA, | |
463 | KEY_RESERVED, | |
464 | KEY_RESERVED, | |
465 | KEY_F1, | |
466 | KEY_CANCEL, | |
467 | KEY_F2, | |
468 | }, | |
469 | .direct_key_num = 6, | |
470 | ||
471 | .debounce_interval = 30, | |
472 | }; | |
473 | #endif /* CONFIG_MACH_EZX_E680 */ | |
474 | ||
475 | #ifdef CONFIG_MACH_EZX_A1200 | |
476 | static unsigned int a1200_key_map[] = { | |
477 | KEY(0, 0, KEY_RESERVED), | |
478 | KEY(0, 1, KEY_RIGHT), | |
479 | KEY(0, 2, KEY_PAGEDOWN), | |
480 | KEY(0, 3, KEY_RESERVED), | |
481 | KEY(0, 4, KEY_RESERVED), | |
482 | KEY(0, 5, KEY_RESERVED), | |
483 | ||
484 | KEY(1, 0, KEY_RESERVED), | |
485 | KEY(1, 1, KEY_DOWN), | |
486 | KEY(1, 2, KEY_CAMERA), | |
487 | KEY(1, 3, KEY_RESERVED), | |
488 | KEY(1, 4, KEY_RESERVED), | |
489 | KEY(1, 5, KEY_RESERVED), | |
490 | ||
491 | KEY(2, 0, KEY_RESERVED), | |
492 | KEY(2, 1, KEY_KPENTER), | |
493 | KEY(2, 2, KEY_RECORD), | |
494 | KEY(2, 3, KEY_RESERVED), | |
495 | KEY(2, 4, KEY_RESERVED), | |
496 | KEY(2, 5, KEY_SELECT), | |
497 | ||
498 | KEY(3, 0, KEY_RESERVED), | |
499 | KEY(3, 1, KEY_UP), | |
500 | KEY(3, 2, KEY_SEND), | |
501 | KEY(3, 3, KEY_RESERVED), | |
502 | KEY(3, 4, KEY_RESERVED), | |
503 | KEY(3, 5, KEY_RESERVED), | |
504 | ||
505 | KEY(4, 0, KEY_RESERVED), | |
506 | KEY(4, 1, KEY_LEFT), | |
507 | KEY(4, 2, KEY_PAGEUP), | |
508 | KEY(4, 3, KEY_RESERVED), | |
509 | KEY(4, 4, KEY_RESERVED), | |
510 | KEY(4, 5, KEY_RESERVED), | |
511 | }; | |
512 | ||
513 | static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = { | |
514 | .matrix_key_rows = 5, | |
515 | .matrix_key_cols = 6, | |
516 | .matrix_key_map = a1200_key_map, | |
517 | .matrix_key_map_size = ARRAY_SIZE(a1200_key_map), | |
518 | ||
519 | .debounce_interval = 30, | |
520 | }; | |
521 | #endif /* CONFIG_MACH_EZX_A1200 */ | |
522 | ||
523 | #ifdef CONFIG_MACH_EZX_E6 | |
524 | static unsigned int e6_key_map[] = { | |
525 | KEY(0, 0, KEY_RESERVED), | |
526 | KEY(0, 1, KEY_RIGHT), | |
527 | KEY(0, 2, KEY_PAGEDOWN), | |
528 | KEY(0, 3, KEY_RESERVED), | |
529 | KEY(0, 4, KEY_RESERVED), | |
530 | KEY(0, 5, KEY_NEXTSONG), | |
531 | ||
532 | KEY(1, 0, KEY_RESERVED), | |
533 | KEY(1, 1, KEY_DOWN), | |
534 | KEY(1, 2, KEY_PROG1), | |
535 | KEY(1, 3, KEY_RESERVED), | |
536 | KEY(1, 4, KEY_RESERVED), | |
537 | KEY(1, 5, KEY_RESERVED), | |
538 | ||
539 | KEY(2, 0, KEY_RESERVED), | |
540 | KEY(2, 1, KEY_ENTER), | |
541 | KEY(2, 2, KEY_CAMERA), | |
542 | KEY(2, 3, KEY_RESERVED), | |
543 | KEY(2, 4, KEY_RESERVED), | |
544 | KEY(2, 5, KEY_WWW), | |
545 | ||
546 | KEY(3, 0, KEY_RESERVED), | |
547 | KEY(3, 1, KEY_UP), | |
548 | KEY(3, 2, KEY_SEND), | |
549 | KEY(3, 3, KEY_RESERVED), | |
550 | KEY(3, 4, KEY_RESERVED), | |
551 | KEY(3, 5, KEY_PLAYPAUSE), | |
552 | ||
553 | KEY(4, 0, KEY_RESERVED), | |
554 | KEY(4, 1, KEY_LEFT), | |
555 | KEY(4, 2, KEY_PAGEUP), | |
556 | KEY(4, 3, KEY_RESERVED), | |
557 | KEY(4, 4, KEY_RESERVED), | |
558 | KEY(4, 5, KEY_PREVIOUSSONG), | |
559 | }; | |
560 | ||
561 | static struct pxa27x_keypad_platform_data e6_keypad_platform_data = { | |
562 | .matrix_key_rows = 5, | |
563 | .matrix_key_cols = 6, | |
564 | .matrix_key_map = e6_key_map, | |
565 | .matrix_key_map_size = ARRAY_SIZE(e6_key_map), | |
566 | ||
567 | .debounce_interval = 30, | |
568 | }; | |
569 | #endif /* CONFIG_MACH_EZX_E6 */ | |
570 | ||
571 | #ifdef CONFIG_MACH_EZX_A910 | |
572 | static unsigned int a910_key_map[] = { | |
573 | KEY(0, 0, KEY_NUMERIC_6), | |
574 | KEY(0, 1, KEY_RIGHT), | |
575 | KEY(0, 2, KEY_PAGEDOWN), | |
576 | KEY(0, 3, KEY_KPENTER), | |
577 | KEY(0, 4, KEY_NUMERIC_5), | |
578 | KEY(0, 5, KEY_CAMERA), | |
579 | ||
580 | KEY(1, 0, KEY_NUMERIC_8), | |
581 | KEY(1, 1, KEY_DOWN), | |
582 | KEY(1, 2, KEY_RESERVED), | |
583 | KEY(1, 3, KEY_F1), /* Left SoftKey */ | |
584 | KEY(1, 4, KEY_NUMERIC_STAR), | |
585 | KEY(1, 5, KEY_RESERVED), | |
586 | ||
587 | KEY(2, 0, KEY_NUMERIC_7), | |
588 | KEY(2, 1, KEY_NUMERIC_9), | |
589 | KEY(2, 2, KEY_RECORD), | |
590 | KEY(2, 3, KEY_F2), /* Right SoftKey */ | |
591 | KEY(2, 4, KEY_BACK), | |
592 | KEY(2, 5, KEY_SELECT), | |
593 | ||
594 | KEY(3, 0, KEY_NUMERIC_2), | |
595 | KEY(3, 1, KEY_UP), | |
596 | KEY(3, 2, KEY_SEND), | |
597 | KEY(3, 3, KEY_NUMERIC_0), | |
598 | KEY(3, 4, KEY_NUMERIC_1), | |
599 | KEY(3, 5, KEY_RECORD), | |
600 | ||
601 | KEY(4, 0, KEY_NUMERIC_4), | |
602 | KEY(4, 1, KEY_LEFT), | |
603 | KEY(4, 2, KEY_PAGEUP), | |
604 | KEY(4, 3, KEY_NUMERIC_POUND), | |
605 | KEY(4, 4, KEY_NUMERIC_3), | |
606 | KEY(4, 5, KEY_RESERVED), | |
9ab24e4e SS |
607 | }; |
608 | ||
fe9490c6 SS |
609 | static struct pxa27x_keypad_platform_data a910_keypad_platform_data = { |
610 | .matrix_key_rows = 5, | |
611 | .matrix_key_cols = 6, | |
612 | .matrix_key_map = a910_key_map, | |
613 | .matrix_key_map_size = ARRAY_SIZE(a910_key_map), | |
614 | ||
615 | .debounce_interval = 30, | |
616 | }; | |
617 | #endif /* CONFIG_MACH_EZX_A910 */ | |
618 | ||
619 | #ifdef CONFIG_MACH_EZX_E2 | |
620 | static unsigned int e2_key_map[] = { | |
621 | KEY(0, 0, KEY_NUMERIC_6), | |
622 | KEY(0, 1, KEY_RIGHT), | |
623 | KEY(0, 2, KEY_NUMERIC_9), | |
624 | KEY(0, 3, KEY_NEXTSONG), | |
625 | KEY(0, 4, KEY_NUMERIC_5), | |
626 | KEY(0, 5, KEY_F1), /* Left SoftKey */ | |
627 | ||
628 | KEY(1, 0, KEY_NUMERIC_8), | |
629 | KEY(1, 1, KEY_DOWN), | |
630 | KEY(1, 2, KEY_RESERVED), | |
631 | KEY(1, 3, KEY_PAGEUP), | |
632 | KEY(1, 4, KEY_NUMERIC_STAR), | |
633 | KEY(1, 5, KEY_F2), /* Right SoftKey */ | |
634 | ||
635 | KEY(2, 0, KEY_NUMERIC_7), | |
636 | KEY(2, 1, KEY_KPENTER), | |
637 | KEY(2, 2, KEY_RECORD), | |
638 | KEY(2, 3, KEY_PAGEDOWN), | |
639 | KEY(2, 4, KEY_BACK), | |
640 | KEY(2, 5, KEY_NUMERIC_0), | |
641 | ||
642 | KEY(3, 0, KEY_NUMERIC_2), | |
643 | KEY(3, 1, KEY_UP), | |
644 | KEY(3, 2, KEY_SEND), | |
645 | KEY(3, 3, KEY_PLAYPAUSE), | |
646 | KEY(3, 4, KEY_NUMERIC_1), | |
647 | KEY(3, 5, KEY_SOUND), /* Music SoftKey */ | |
648 | ||
649 | KEY(4, 0, KEY_NUMERIC_4), | |
650 | KEY(4, 1, KEY_LEFT), | |
651 | KEY(4, 2, KEY_NUMERIC_POUND), | |
652 | KEY(4, 3, KEY_PREVIOUSSONG), | |
653 | KEY(4, 4, KEY_NUMERIC_3), | |
654 | KEY(4, 5, KEY_RESERVED), | |
655 | }; | |
656 | ||
657 | static struct pxa27x_keypad_platform_data e2_keypad_platform_data = { | |
658 | .matrix_key_rows = 5, | |
659 | .matrix_key_cols = 6, | |
660 | .matrix_key_map = e2_key_map, | |
661 | .matrix_key_map_size = ARRAY_SIZE(e2_key_map), | |
662 | ||
663 | .debounce_interval = 30, | |
664 | }; | |
665 | #endif /* CONFIG_MACH_EZX_E2 */ | |
666 | ||
9078ac21 | 667 | #ifdef CONFIG_MACH_EZX_A780 |
1ce2c51e AO |
668 | /* gpio_keys */ |
669 | static struct gpio_keys_button a780_buttons[] = { | |
670 | [0] = { | |
671 | .code = SW_LID, | |
672 | .gpio = GPIO12_A780_FLIP_LID, | |
673 | .active_low = 0, | |
674 | .desc = "A780 flip lid", | |
675 | .type = EV_SW, | |
676 | .wakeup = 1, | |
677 | }, | |
678 | }; | |
679 | ||
680 | static struct gpio_keys_platform_data a780_gpio_keys_platform_data = { | |
681 | .buttons = a780_buttons, | |
682 | .nbuttons = ARRAY_SIZE(a780_buttons), | |
683 | }; | |
684 | ||
685 | static struct platform_device a780_gpio_keys = { | |
686 | .name = "gpio-keys", | |
687 | .id = -1, | |
688 | .dev = { | |
689 | .platform_data = &a780_gpio_keys_platform_data, | |
690 | }, | |
691 | }; | |
692 | ||
405ac401 AO |
693 | /* camera */ |
694 | static int a780_camera_init(void) | |
695 | { | |
696 | int err; | |
697 | ||
698 | /* | |
699 | * GPIO50_nCAM_EN is active low | |
700 | * GPIO19_GEN1_CAM_RST is active on rising edge | |
701 | */ | |
702 | err = gpio_request(GPIO50_nCAM_EN, "nCAM_EN"); | |
703 | if (err) { | |
704 | pr_err("%s: Failed to request nCAM_EN\n", __func__); | |
705 | goto fail; | |
706 | } | |
707 | ||
708 | err = gpio_request(GPIO19_GEN1_CAM_RST, "CAM_RST"); | |
709 | if (err) { | |
710 | pr_err("%s: Failed to request CAM_RST\n", __func__); | |
711 | goto fail_gpio_cam_rst; | |
712 | } | |
713 | ||
714 | gpio_direction_output(GPIO50_nCAM_EN, 1); | |
715 | gpio_direction_output(GPIO19_GEN1_CAM_RST, 0); | |
716 | ||
717 | return 0; | |
718 | ||
719 | fail_gpio_cam_rst: | |
720 | gpio_free(GPIO50_nCAM_EN); | |
721 | fail: | |
722 | return err; | |
723 | } | |
724 | ||
725 | static int a780_camera_power(struct device *dev, int on) | |
726 | { | |
727 | gpio_set_value(GPIO50_nCAM_EN, !on); | |
728 | return 0; | |
729 | } | |
730 | ||
731 | static int a780_camera_reset(struct device *dev) | |
732 | { | |
733 | gpio_set_value(GPIO19_GEN1_CAM_RST, 0); | |
734 | msleep(10); | |
735 | gpio_set_value(GPIO19_GEN1_CAM_RST, 1); | |
736 | ||
737 | return 0; | |
738 | } | |
739 | ||
740 | struct pxacamera_platform_data a780_pxacamera_platform_data = { | |
741 | .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | | |
742 | PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, | |
743 | .mclk_10khz = 5000, | |
744 | }; | |
745 | ||
746 | static struct i2c_board_info a780_camera_i2c_board_info = { | |
747 | I2C_BOARD_INFO("mt9m111", 0x5d), | |
748 | }; | |
749 | ||
750 | static struct soc_camera_link a780_iclink = { | |
751 | .bus_id = 0, | |
752 | .flags = SOCAM_SENSOR_INVERT_PCLK, | |
753 | .i2c_adapter_id = 0, | |
754 | .board_info = &a780_camera_i2c_board_info, | |
755 | .module_name = "mt9m111", | |
756 | .power = a780_camera_power, | |
757 | .reset = a780_camera_reset, | |
758 | }; | |
759 | ||
760 | static struct platform_device a780_camera = { | |
761 | .name = "soc-camera-pdrv", | |
762 | .id = 0, | |
763 | .dev = { | |
764 | .platform_data = &a780_iclink, | |
765 | }, | |
766 | }; | |
767 | ||
1ce2c51e AO |
768 | static struct platform_device *a780_devices[] __initdata = { |
769 | &a780_gpio_keys, | |
770 | }; | |
771 | ||
9078ac21 | 772 | static void __init a780_init(void) |
9ab24e4e SS |
773 | { |
774 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | |
9078ac21 SS |
775 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config)); |
776 | pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config)); | |
777 | ||
cc155c6f RK |
778 | pxa_set_ffuart_info(NULL); |
779 | pxa_set_btuart_info(NULL); | |
780 | pxa_set_stuart_info(NULL); | |
781 | ||
9ab24e4e | 782 | pxa_set_i2c_info(NULL); |
9ab24e4e | 783 | |
9078ac21 | 784 | set_pxa_fb_info(&ezx_fb_info_1); |
9ab24e4e | 785 | |
fe9490c6 SS |
786 | pxa_set_keypad_info(&a780_keypad_platform_data); |
787 | ||
405ac401 AO |
788 | if (a780_camera_init() == 0) { |
789 | pxa_set_camera_info(&a780_pxacamera_platform_data); | |
790 | platform_device_register(&a780_camera); | |
791 | } | |
792 | ||
1ce2c51e AO |
793 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
794 | platform_add_devices(ARRAY_AND_SIZE(a780_devices)); | |
9ab24e4e SS |
795 | } |
796 | ||
9ab24e4e SS |
797 | MACHINE_START(EZX_A780, "Motorola EZX A780") |
798 | .phys_io = 0x40000000, | |
799 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
9ab24e4e SS |
800 | .boot_params = 0xa0000100, |
801 | .map_io = pxa_map_io, | |
802 | .init_irq = pxa27x_init_irq, | |
803 | .timer = &pxa_timer, | |
9078ac21 | 804 | .init_machine = a780_init, |
9ab24e4e SS |
805 | MACHINE_END |
806 | #endif | |
807 | ||
808 | #ifdef CONFIG_MACH_EZX_E680 | |
1ce2c51e AO |
809 | /* gpio_keys */ |
810 | static struct gpio_keys_button e680_buttons[] = { | |
811 | [0] = { | |
812 | .code = KEY_SCREENLOCK, | |
813 | .gpio = GPIO12_E680_LOCK_SWITCH, | |
814 | .active_low = 0, | |
815 | .desc = "E680 lock switch", | |
816 | .type = EV_KEY, | |
817 | .wakeup = 1, | |
818 | }, | |
819 | }; | |
820 | ||
821 | static struct gpio_keys_platform_data e680_gpio_keys_platform_data = { | |
822 | .buttons = e680_buttons, | |
823 | .nbuttons = ARRAY_SIZE(e680_buttons), | |
824 | }; | |
825 | ||
826 | static struct platform_device e680_gpio_keys = { | |
827 | .name = "gpio-keys", | |
828 | .id = -1, | |
829 | .dev = { | |
830 | .platform_data = &e680_gpio_keys_platform_data, | |
831 | }, | |
832 | }; | |
833 | ||
bc09cf6d SS |
834 | static struct i2c_board_info __initdata e680_i2c_board_info[] = { |
835 | { I2C_BOARD_INFO("tea5767", 0x81) }, | |
836 | }; | |
837 | ||
1ce2c51e AO |
838 | static struct platform_device *e680_devices[] __initdata = { |
839 | &e680_gpio_keys, | |
840 | }; | |
841 | ||
9078ac21 SS |
842 | static void __init e680_init(void) |
843 | { | |
844 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | |
845 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config)); | |
846 | pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config)); | |
847 | ||
cc155c6f RK |
848 | pxa_set_ffuart_info(NULL); |
849 | pxa_set_btuart_info(NULL); | |
850 | pxa_set_stuart_info(NULL); | |
851 | ||
9078ac21 | 852 | pxa_set_i2c_info(NULL); |
bc09cf6d | 853 | i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info)); |
9078ac21 SS |
854 | |
855 | set_pxa_fb_info(&ezx_fb_info_1); | |
856 | ||
fe9490c6 SS |
857 | pxa_set_keypad_info(&e680_keypad_platform_data); |
858 | ||
1ce2c51e AO |
859 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
860 | platform_add_devices(ARRAY_AND_SIZE(e680_devices)); | |
9078ac21 SS |
861 | } |
862 | ||
9ab24e4e SS |
863 | MACHINE_START(EZX_E680, "Motorola EZX E680") |
864 | .phys_io = 0x40000000, | |
865 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
9ab24e4e SS |
866 | .boot_params = 0xa0000100, |
867 | .map_io = pxa_map_io, | |
868 | .init_irq = pxa27x_init_irq, | |
869 | .timer = &pxa_timer, | |
9078ac21 | 870 | .init_machine = e680_init, |
9ab24e4e SS |
871 | MACHINE_END |
872 | #endif | |
873 | ||
874 | #ifdef CONFIG_MACH_EZX_A1200 | |
1ce2c51e AO |
875 | /* gpio_keys */ |
876 | static struct gpio_keys_button a1200_buttons[] = { | |
877 | [0] = { | |
878 | .code = SW_LID, | |
879 | .gpio = GPIO15_A1200_FLIP_LID, | |
880 | .active_low = 0, | |
881 | .desc = "A1200 flip lid", | |
882 | .type = EV_SW, | |
883 | .wakeup = 1, | |
884 | }, | |
885 | }; | |
886 | ||
887 | static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = { | |
888 | .buttons = a1200_buttons, | |
889 | .nbuttons = ARRAY_SIZE(a1200_buttons), | |
890 | }; | |
891 | ||
892 | static struct platform_device a1200_gpio_keys = { | |
893 | .name = "gpio-keys", | |
894 | .id = -1, | |
895 | .dev = { | |
896 | .platform_data = &a1200_gpio_keys_platform_data, | |
897 | }, | |
898 | }; | |
899 | ||
bc09cf6d SS |
900 | static struct i2c_board_info __initdata a1200_i2c_board_info[] = { |
901 | { I2C_BOARD_INFO("tea5767", 0x81) }, | |
902 | }; | |
903 | ||
1ce2c51e AO |
904 | static struct platform_device *a1200_devices[] __initdata = { |
905 | &a1200_gpio_keys, | |
906 | }; | |
907 | ||
9078ac21 SS |
908 | static void __init a1200_init(void) |
909 | { | |
910 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | |
911 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config)); | |
912 | pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config)); | |
913 | ||
cc155c6f RK |
914 | pxa_set_ffuart_info(NULL); |
915 | pxa_set_btuart_info(NULL); | |
916 | pxa_set_stuart_info(NULL); | |
917 | ||
9078ac21 | 918 | pxa_set_i2c_info(NULL); |
bc09cf6d | 919 | i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info)); |
9078ac21 SS |
920 | |
921 | set_pxa_fb_info(&ezx_fb_info_2); | |
922 | ||
fe9490c6 SS |
923 | pxa_set_keypad_info(&a1200_keypad_platform_data); |
924 | ||
1ce2c51e AO |
925 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
926 | platform_add_devices(ARRAY_AND_SIZE(a1200_devices)); | |
9078ac21 SS |
927 | } |
928 | ||
9ab24e4e SS |
929 | MACHINE_START(EZX_A1200, "Motorola EZX A1200") |
930 | .phys_io = 0x40000000, | |
931 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
9ab24e4e SS |
932 | .boot_params = 0xa0000100, |
933 | .map_io = pxa_map_io, | |
934 | .init_irq = pxa27x_init_irq, | |
935 | .timer = &pxa_timer, | |
9078ac21 | 936 | .init_machine = a1200_init, |
9ab24e4e SS |
937 | MACHINE_END |
938 | #endif | |
939 | ||
940 | #ifdef CONFIG_MACH_EZX_A910 | |
1ce2c51e AO |
941 | /* gpio_keys */ |
942 | static struct gpio_keys_button a910_buttons[] = { | |
943 | [0] = { | |
944 | .code = SW_LID, | |
945 | .gpio = GPIO15_A910_FLIP_LID, | |
946 | .active_low = 0, | |
947 | .desc = "A910 flip lid", | |
948 | .type = EV_SW, | |
949 | .wakeup = 1, | |
950 | }, | |
951 | }; | |
952 | ||
953 | static struct gpio_keys_platform_data a910_gpio_keys_platform_data = { | |
954 | .buttons = a910_buttons, | |
955 | .nbuttons = ARRAY_SIZE(a910_buttons), | |
956 | }; | |
957 | ||
958 | static struct platform_device a910_gpio_keys = { | |
959 | .name = "gpio-keys", | |
960 | .id = -1, | |
961 | .dev = { | |
962 | .platform_data = &a910_gpio_keys_platform_data, | |
963 | }, | |
964 | }; | |
965 | ||
405ac401 AO |
966 | /* camera */ |
967 | static int a910_camera_init(void) | |
968 | { | |
969 | int err; | |
970 | ||
971 | /* | |
972 | * GPIO50_nCAM_EN is active low | |
973 | * GPIO28_GEN2_CAM_RST is active on rising edge | |
974 | */ | |
975 | err = gpio_request(GPIO50_nCAM_EN, "nCAM_EN"); | |
976 | if (err) { | |
977 | pr_err("%s: Failed to request nCAM_EN\n", __func__); | |
978 | goto fail; | |
979 | } | |
980 | ||
981 | err = gpio_request(GPIO28_GEN2_CAM_RST, "CAM_RST"); | |
982 | if (err) { | |
983 | pr_err("%s: Failed to request CAM_RST\n", __func__); | |
984 | goto fail_gpio_cam_rst; | |
985 | } | |
986 | ||
987 | gpio_direction_output(GPIO50_nCAM_EN, 1); | |
988 | gpio_direction_output(GPIO28_GEN2_CAM_RST, 0); | |
989 | ||
990 | return 0; | |
991 | ||
992 | fail_gpio_cam_rst: | |
993 | gpio_free(GPIO50_nCAM_EN); | |
994 | fail: | |
995 | return err; | |
996 | } | |
997 | ||
998 | static int a910_camera_power(struct device *dev, int on) | |
999 | { | |
1000 | gpio_set_value(GPIO50_nCAM_EN, !on); | |
1001 | return 0; | |
1002 | } | |
1003 | ||
1004 | static int a910_camera_reset(struct device *dev) | |
1005 | { | |
1006 | gpio_set_value(GPIO28_GEN2_CAM_RST, 0); | |
1007 | msleep(10); | |
1008 | gpio_set_value(GPIO28_GEN2_CAM_RST, 1); | |
1009 | ||
1010 | return 0; | |
1011 | } | |
1012 | ||
1013 | struct pxacamera_platform_data a910_pxacamera_platform_data = { | |
1014 | .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | | |
1015 | PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, | |
1016 | .mclk_10khz = 5000, | |
1017 | }; | |
1018 | ||
1019 | static struct i2c_board_info a910_camera_i2c_board_info = { | |
1020 | I2C_BOARD_INFO("mt9m111", 0x5d), | |
1021 | }; | |
1022 | ||
1023 | static struct soc_camera_link a910_iclink = { | |
1024 | .bus_id = 0, | |
1025 | .i2c_adapter_id = 0, | |
1026 | .board_info = &a910_camera_i2c_board_info, | |
1027 | .module_name = "mt9m111", | |
1028 | .power = a910_camera_power, | |
1029 | .reset = a910_camera_reset, | |
1030 | }; | |
1031 | ||
1032 | static struct platform_device a910_camera = { | |
1033 | .name = "soc-camera-pdrv", | |
1034 | .id = 0, | |
1035 | .dev = { | |
1036 | .platform_data = &a910_iclink, | |
1037 | }, | |
1038 | }; | |
1039 | ||
1ce2c51e AO |
1040 | static struct platform_device *a910_devices[] __initdata = { |
1041 | &a910_gpio_keys, | |
1042 | }; | |
1043 | ||
9078ac21 SS |
1044 | static void __init a910_init(void) |
1045 | { | |
1046 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | |
1047 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config)); | |
1048 | pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config)); | |
1049 | ||
cc155c6f RK |
1050 | pxa_set_ffuart_info(NULL); |
1051 | pxa_set_btuart_info(NULL); | |
1052 | pxa_set_stuart_info(NULL); | |
1053 | ||
9078ac21 SS |
1054 | pxa_set_i2c_info(NULL); |
1055 | ||
1056 | set_pxa_fb_info(&ezx_fb_info_2); | |
1057 | ||
fe9490c6 SS |
1058 | pxa_set_keypad_info(&a910_keypad_platform_data); |
1059 | ||
405ac401 AO |
1060 | if (a910_camera_init() == 0) { |
1061 | pxa_set_camera_info(&a910_pxacamera_platform_data); | |
1062 | platform_device_register(&a910_camera); | |
1063 | } | |
1064 | ||
1ce2c51e AO |
1065 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
1066 | platform_add_devices(ARRAY_AND_SIZE(a910_devices)); | |
9078ac21 SS |
1067 | } |
1068 | ||
9ab24e4e SS |
1069 | MACHINE_START(EZX_A910, "Motorola EZX A910") |
1070 | .phys_io = 0x40000000, | |
1071 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
9ab24e4e SS |
1072 | .boot_params = 0xa0000100, |
1073 | .map_io = pxa_map_io, | |
1074 | .init_irq = pxa27x_init_irq, | |
1075 | .timer = &pxa_timer, | |
9078ac21 | 1076 | .init_machine = a910_init, |
9ab24e4e SS |
1077 | MACHINE_END |
1078 | #endif | |
1079 | ||
1080 | #ifdef CONFIG_MACH_EZX_E6 | |
1ce2c51e AO |
1081 | /* gpio_keys */ |
1082 | static struct gpio_keys_button e6_buttons[] = { | |
1083 | [0] = { | |
1084 | .code = KEY_SCREENLOCK, | |
1085 | .gpio = GPIO15_E6_LOCK_SWITCH, | |
1086 | .active_low = 0, | |
1087 | .desc = "E6 lock switch", | |
1088 | .type = EV_KEY, | |
1089 | .wakeup = 1, | |
1090 | }, | |
1091 | }; | |
1092 | ||
1093 | static struct gpio_keys_platform_data e6_gpio_keys_platform_data = { | |
1094 | .buttons = e6_buttons, | |
1095 | .nbuttons = ARRAY_SIZE(e6_buttons), | |
1096 | }; | |
1097 | ||
1098 | static struct platform_device e6_gpio_keys = { | |
1099 | .name = "gpio-keys", | |
1100 | .id = -1, | |
1101 | .dev = { | |
1102 | .platform_data = &e6_gpio_keys_platform_data, | |
1103 | }, | |
1104 | }; | |
1105 | ||
bc09cf6d SS |
1106 | static struct i2c_board_info __initdata e6_i2c_board_info[] = { |
1107 | { I2C_BOARD_INFO("tea5767", 0x81) }, | |
1108 | }; | |
1109 | ||
1ce2c51e AO |
1110 | static struct platform_device *e6_devices[] __initdata = { |
1111 | &e6_gpio_keys, | |
1112 | }; | |
1113 | ||
9078ac21 SS |
1114 | static void __init e6_init(void) |
1115 | { | |
1116 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | |
1117 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config)); | |
1118 | pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config)); | |
1119 | ||
cc155c6f RK |
1120 | pxa_set_ffuart_info(NULL); |
1121 | pxa_set_btuart_info(NULL); | |
1122 | pxa_set_stuart_info(NULL); | |
1123 | ||
9078ac21 | 1124 | pxa_set_i2c_info(NULL); |
bc09cf6d | 1125 | i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info)); |
9078ac21 SS |
1126 | |
1127 | set_pxa_fb_info(&ezx_fb_info_2); | |
1128 | ||
fe9490c6 SS |
1129 | pxa_set_keypad_info(&e6_keypad_platform_data); |
1130 | ||
1ce2c51e AO |
1131 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
1132 | platform_add_devices(ARRAY_AND_SIZE(e6_devices)); | |
9078ac21 SS |
1133 | } |
1134 | ||
9ab24e4e SS |
1135 | MACHINE_START(EZX_E6, "Motorola EZX E6") |
1136 | .phys_io = 0x40000000, | |
1137 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
9ab24e4e SS |
1138 | .boot_params = 0xa0000100, |
1139 | .map_io = pxa_map_io, | |
1140 | .init_irq = pxa27x_init_irq, | |
1141 | .timer = &pxa_timer, | |
9078ac21 | 1142 | .init_machine = e6_init, |
9ab24e4e SS |
1143 | MACHINE_END |
1144 | #endif | |
1145 | ||
1146 | #ifdef CONFIG_MACH_EZX_E2 | |
bc09cf6d SS |
1147 | static struct i2c_board_info __initdata e2_i2c_board_info[] = { |
1148 | { I2C_BOARD_INFO("tea5767", 0x81) }, | |
1149 | }; | |
1150 | ||
1ce2c51e AO |
1151 | static struct platform_device *e2_devices[] __initdata = { |
1152 | }; | |
1153 | ||
9078ac21 SS |
1154 | static void __init e2_init(void) |
1155 | { | |
1156 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | |
1157 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config)); | |
1158 | pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config)); | |
1159 | ||
cc155c6f RK |
1160 | pxa_set_ffuart_info(NULL); |
1161 | pxa_set_btuart_info(NULL); | |
1162 | pxa_set_stuart_info(NULL); | |
1163 | ||
9078ac21 | 1164 | pxa_set_i2c_info(NULL); |
bc09cf6d | 1165 | i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info)); |
9078ac21 SS |
1166 | |
1167 | set_pxa_fb_info(&ezx_fb_info_2); | |
1168 | ||
fe9490c6 SS |
1169 | pxa_set_keypad_info(&e2_keypad_platform_data); |
1170 | ||
1ce2c51e AO |
1171 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
1172 | platform_add_devices(ARRAY_AND_SIZE(e2_devices)); | |
9078ac21 SS |
1173 | } |
1174 | ||
9ab24e4e SS |
1175 | MACHINE_START(EZX_E2, "Motorola EZX E2") |
1176 | .phys_io = 0x40000000, | |
1177 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
9ab24e4e SS |
1178 | .boot_params = 0xa0000100, |
1179 | .map_io = pxa_map_io, | |
1180 | .init_irq = pxa27x_init_irq, | |
1181 | .timer = &pxa_timer, | |
9078ac21 | 1182 | .init_machine = e2_init, |
9ab24e4e SS |
1183 | MACHINE_END |
1184 | #endif |