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