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