Merge branch 'for-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu
[sfrench/cifs-2.6.git] / arch / arm / mach-pxa / ezx.c
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.h>
19 #include <linux/pwm_backlight.h>
20 #include <linux/regulator/machine.h>
21 #include <linux/regulator/fixed.h>
22 #include <linux/input.h>
23 #include <linux/gpio.h>
24 #include <linux/gpio/machine.h>
25 #include <linux/gpio_keys.h>
26 #include <linux/leds-lp3944.h>
27 #include <linux/platform_data/i2c-pxa.h>
28
29 #include <asm/setup.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32
33 #include "pxa27x.h"
34 #include <linux/platform_data/video-pxafb.h>
35 #include <linux/platform_data/usb-ohci-pxa27x.h>
36 #include <mach/hardware.h>
37 #include <linux/platform_data/keypad-pxa27x.h>
38 #include <linux/platform_data/media/camera-pxa.h>
39
40 #include "devices.h"
41 #include "generic.h"
42
43 #define EZX_NR_IRQS                     (IRQ_BOARD_START + 24)
44
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
50 #define GPIO50_nCAM_EN                  50
51 #define GPIO19_GEN1_CAM_RST             19
52 #define GPIO28_GEN2_CAM_RST             28
53
54 static struct pwm_lookup ezx_pwm_lookup[] __maybe_unused = {
55         PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78700,
56                    PWM_POLARITY_NORMAL),
57 };
58
59 static struct platform_pwm_backlight_data ezx_backlight_data = {
60         .max_brightness = 1023,
61         .dft_brightness = 1023,
62         .enable_gpio    = -1,
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
87 static struct pxafb_mach_info ezx_fb_info_1 __maybe_unused = {
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
108 static struct pxafb_mach_info ezx_fb_info_2 __maybe_unused = {
109         .modes          = &mode_72r89803y01,
110         .num_modes      = 1,
111         .lcd_conn       = LCD_COLOR_TFT_18BPP,
112 };
113
114 static struct platform_device *ezx_devices[] __initdata __maybe_unused = {
115         &ezx_backlight_device,
116 };
117
118 static unsigned long ezx_pin_config[] __initdata __maybe_unused = {
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
128         /* I2C */
129         GPIO117_I2C_SCL,
130         GPIO118_I2C_SDA,
131
132         /* PCAP SSP */
133         GPIO29_SSP1_SCLK,
134         GPIO25_SSP1_TXD,
135         GPIO26_SSP1_RXD,
136         GPIO24_GPIO,                            /* pcap chip select */
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 */
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 */
170         GPIO12_GPIO | WAKEUP_ON_EDGE_BOTH,
171
172         /* bluetooth (bcm2035) */
173         GPIO14_GPIO | WAKEUP_ON_EDGE_RISE,      /* HOSTWAKE */
174         GPIO48_GPIO,                            /* RESET */
175         GPIO28_GPIO,                            /* WAKEUP */
176
177         /* Neptune handshake */
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 */
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,
210         GPIO50_GPIO | MFP_LPM_DRIVE_HIGH,       /* CAM_EN */
211         GPIO19_GPIO | MFP_LPM_DRIVE_HIGH,       /* CAM_RST */
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 */
218 };
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 */
225         GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH,
226
227         /* EOC */
228         GPIO10_GPIO | WAKEUP_ON_EDGE_RISE,
229
230         /* bluetooth (bcm2045) */
231         GPIO13_GPIO | WAKEUP_ON_EDGE_RISE,      /* HOSTWAKE */
232         GPIO37_GPIO,                            /* RESET */
233         GPIO57_GPIO,                            /* WAKEUP */
234
235         /* Neptune handshake */
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 */
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 */
253
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,
267         GPIO50_GPIO | MFP_LPM_DRIVE_HIGH,       /* CAM_EN */
268         GPIO28_GPIO | MFP_LPM_DRIVE_HIGH,       /* CAM_RST */
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
399 /* KEYPAD */
400 #ifdef CONFIG_MACH_EZX_A780
401 static const unsigned int a780_key_map[] = {
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
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
438 static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
439         .matrix_key_rows = 5,
440         .matrix_key_cols = 5,
441         .matrix_keymap_data = &a780_matrix_keymap_data,
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
451 static const unsigned int e680_key_map[] = {
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
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
473 static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
474         .matrix_key_rows = 3,
475         .matrix_key_cols = 4,
476         .matrix_keymap_data = &e680_matrix_keymap_data,
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
493 static const unsigned int a1200_key_map[] = {
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
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
535 static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
536         .matrix_key_rows = 5,
537         .matrix_key_cols = 6,
538         .matrix_keymap_data = &a1200_matrix_keymap_data,
539
540         .debounce_interval = 30,
541 };
542 #endif /* CONFIG_MACH_EZX_A1200 */
543
544 #ifdef CONFIG_MACH_EZX_E6
545 static const unsigned int e6_key_map[] = {
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
582 static struct matrix_keymap_data e6_keymap_data = {
583         .keymap                 = e6_key_map,
584         .keymap_size            = ARRAY_SIZE(e6_key_map),
585 };
586
587 static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
588         .matrix_key_rows = 5,
589         .matrix_key_cols = 6,
590         .matrix_keymap_data = &e6_keymap_data,
591
592         .debounce_interval = 30,
593 };
594 #endif /* CONFIG_MACH_EZX_E6 */
595
596 #ifdef CONFIG_MACH_EZX_A910
597 static const unsigned int a910_key_map[] = {
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),
632 };
633
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
639 static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
640         .matrix_key_rows = 5,
641         .matrix_key_cols = 6,
642         .matrix_keymap_data = &a910_matrix_keymap_data,
643
644         .debounce_interval = 30,
645 };
646 #endif /* CONFIG_MACH_EZX_A910 */
647
648 #ifdef CONFIG_MACH_EZX_E2
649 static const unsigned int e2_key_map[] = {
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
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
691 static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
692         .matrix_key_rows = 5,
693         .matrix_key_cols = 6,
694         .matrix_keymap_data = &e2_matrix_keymap_data,
695
696         .debounce_interval = 30,
697 };
698 #endif /* CONFIG_MACH_EZX_E2 */
699
700 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910)
701 /* camera */
702 static struct regulator_consumer_supply camera_regulator_supplies[] = {
703         REGULATOR_SUPPLY("vdd", "0-005d"),
704 };
705
706 static struct regulator_init_data camera_regulator_initdata = {
707         .consumer_supplies = camera_regulator_supplies,
708         .num_consumer_supplies = ARRAY_SIZE(camera_regulator_supplies),
709         .constraints = {
710                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
711         },
712 };
713
714 static struct fixed_voltage_config camera_regulator_config = {
715         .supply_name            = "camera_vdd",
716         .microvolts             = 2800000,
717         .enable_high            = 0,
718         .init_data              = &camera_regulator_initdata,
719 };
720
721 static struct platform_device camera_supply_regulator_device = {
722         .name   = "reg-fixed-voltage",
723         .id     = 1,
724         .dev    = {
725                 .platform_data = &camera_regulator_config,
726         },
727 };
728
729 static struct gpiod_lookup_table camera_supply_gpiod_table = {
730         .dev_id = "reg-fixed-voltage.1",
731         .table = {
732                 GPIO_LOOKUP("gpio-pxa", GPIO50_nCAM_EN,
733                             NULL, GPIO_ACTIVE_HIGH),
734                 { },
735         },
736 };
737 #endif
738
739 #ifdef CONFIG_MACH_EZX_A780
740 /* gpio_keys */
741 static struct gpio_keys_button a780_buttons[] = {
742         [0] = {
743                 .code       = SW_LID,
744                 .gpio       = GPIO12_A780_FLIP_LID,
745                 .active_low = 0,
746                 .desc       = "A780 flip lid",
747                 .type       = EV_SW,
748                 .wakeup     = 1,
749         },
750 };
751
752 static struct gpio_keys_platform_data a780_gpio_keys_platform_data = {
753         .buttons  = a780_buttons,
754         .nbuttons = ARRAY_SIZE(a780_buttons),
755 };
756
757 static struct platform_device a780_gpio_keys = {
758         .name = "gpio-keys",
759         .id   = -1,
760         .dev  = {
761                 .platform_data = &a780_gpio_keys_platform_data,
762         },
763 };
764
765 /* camera */
766 static int a780_camera_reset(struct device *dev)
767 {
768         gpio_set_value(GPIO19_GEN1_CAM_RST, 0);
769         msleep(10);
770         gpio_set_value(GPIO19_GEN1_CAM_RST, 1);
771
772         return 0;
773 }
774
775 static int a780_camera_init(void)
776 {
777         int err;
778
779         /*
780          * GPIO50_nCAM_EN is active low
781          * GPIO19_GEN1_CAM_RST is active on rising edge
782          */
783         err = gpio_request(GPIO19_GEN1_CAM_RST, "CAM_RST");
784         if (err) {
785                 pr_err("%s: Failed to request CAM_RST\n", __func__);
786                 return err;
787         }
788
789         gpio_direction_output(GPIO19_GEN1_CAM_RST, 0);
790         a780_camera_reset(NULL);
791
792         return 0;
793 }
794
795 struct pxacamera_platform_data a780_pxacamera_platform_data = {
796         .flags  = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
797                 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN |
798                 PXA_CAMERA_PCP,
799         .mclk_10khz = 5000,
800         .sensor_i2c_adapter_id = 0,
801         .sensor_i2c_address = 0x5d,
802 };
803
804 static struct i2c_board_info a780_i2c_board_info[] = {
805         {
806                 I2C_BOARD_INFO("mt9m111", 0x5d),
807         },
808 };
809
810 static struct platform_device *a780_devices[] __initdata = {
811         &a780_gpio_keys,
812         &camera_supply_regulator_device,
813 };
814
815 static void __init a780_init(void)
816 {
817         pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
818         pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
819         pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config));
820
821         pxa_set_ffuart_info(NULL);
822         pxa_set_btuart_info(NULL);
823         pxa_set_stuart_info(NULL);
824
825         pxa_set_i2c_info(NULL);
826         i2c_register_board_info(0, ARRAY_AND_SIZE(a780_i2c_board_info));
827
828         pxa_set_fb_info(NULL, &ezx_fb_info_1);
829
830         pxa_set_keypad_info(&a780_keypad_platform_data);
831
832         if (a780_camera_init() == 0)
833                 pxa_set_camera_info(&a780_pxacamera_platform_data);
834
835         gpiod_add_lookup_table(&camera_supply_gpiod_table);
836         pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
837         platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
838         platform_add_devices(ARRAY_AND_SIZE(a780_devices));
839         regulator_has_full_constraints();
840 }
841
842 MACHINE_START(EZX_A780, "Motorola EZX A780")
843         .atag_offset    = 0x100,
844         .map_io         = pxa27x_map_io,
845         .nr_irqs        = EZX_NR_IRQS,
846         .init_irq       = pxa27x_init_irq,
847         .handle_irq       = pxa27x_handle_irq,
848         .init_time      = pxa_timer_init,
849         .init_machine   = a780_init,
850         .restart        = pxa_restart,
851 MACHINE_END
852 #endif
853
854 #ifdef CONFIG_MACH_EZX_E680
855 /* gpio_keys */
856 static struct gpio_keys_button e680_buttons[] = {
857         [0] = {
858                 .code       = KEY_SCREENLOCK,
859                 .gpio       = GPIO12_E680_LOCK_SWITCH,
860                 .active_low = 0,
861                 .desc       = "E680 lock switch",
862                 .type       = EV_KEY,
863                 .wakeup     = 1,
864         },
865 };
866
867 static struct gpio_keys_platform_data e680_gpio_keys_platform_data = {
868         .buttons  = e680_buttons,
869         .nbuttons = ARRAY_SIZE(e680_buttons),
870 };
871
872 static struct platform_device e680_gpio_keys = {
873         .name = "gpio-keys",
874         .id   = -1,
875         .dev  = {
876                 .platform_data = &e680_gpio_keys_platform_data,
877         },
878 };
879
880 static struct i2c_board_info __initdata e680_i2c_board_info[] = {
881         { I2C_BOARD_INFO("tea5767", 0x81) },
882 };
883
884 static struct platform_device *e680_devices[] __initdata = {
885         &e680_gpio_keys,
886 };
887
888 static void __init e680_init(void)
889 {
890         pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
891         pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
892         pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config));
893
894         pxa_set_ffuart_info(NULL);
895         pxa_set_btuart_info(NULL);
896         pxa_set_stuart_info(NULL);
897
898         pxa_set_i2c_info(NULL);
899         i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info));
900
901         pxa_set_fb_info(NULL, &ezx_fb_info_1);
902
903         pxa_set_keypad_info(&e680_keypad_platform_data);
904
905         pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
906         platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
907         platform_add_devices(ARRAY_AND_SIZE(e680_devices));
908 }
909
910 MACHINE_START(EZX_E680, "Motorola EZX E680")
911         .atag_offset    = 0x100,
912         .map_io         = pxa27x_map_io,
913         .nr_irqs        = EZX_NR_IRQS,
914         .init_irq       = pxa27x_init_irq,
915         .handle_irq       = pxa27x_handle_irq,
916         .init_time      = pxa_timer_init,
917         .init_machine   = e680_init,
918         .restart        = pxa_restart,
919 MACHINE_END
920 #endif
921
922 #ifdef CONFIG_MACH_EZX_A1200
923 /* gpio_keys */
924 static struct gpio_keys_button a1200_buttons[] = {
925         [0] = {
926                 .code       = SW_LID,
927                 .gpio       = GPIO15_A1200_FLIP_LID,
928                 .active_low = 0,
929                 .desc       = "A1200 flip lid",
930                 .type       = EV_SW,
931                 .wakeup     = 1,
932         },
933 };
934
935 static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = {
936         .buttons  = a1200_buttons,
937         .nbuttons = ARRAY_SIZE(a1200_buttons),
938 };
939
940 static struct platform_device a1200_gpio_keys = {
941         .name = "gpio-keys",
942         .id   = -1,
943         .dev  = {
944                 .platform_data = &a1200_gpio_keys_platform_data,
945         },
946 };
947
948 static struct i2c_board_info __initdata a1200_i2c_board_info[] = {
949         { I2C_BOARD_INFO("tea5767", 0x81) },
950 };
951
952 static struct platform_device *a1200_devices[] __initdata = {
953         &a1200_gpio_keys,
954 };
955
956 static void __init a1200_init(void)
957 {
958         pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
959         pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
960         pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config));
961
962         pxa_set_ffuart_info(NULL);
963         pxa_set_btuart_info(NULL);
964         pxa_set_stuart_info(NULL);
965
966         pxa_set_i2c_info(NULL);
967         i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info));
968
969         pxa_set_fb_info(NULL, &ezx_fb_info_2);
970
971         pxa_set_keypad_info(&a1200_keypad_platform_data);
972
973         pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
974         platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
975         platform_add_devices(ARRAY_AND_SIZE(a1200_devices));
976 }
977
978 MACHINE_START(EZX_A1200, "Motorola EZX A1200")
979         .atag_offset    = 0x100,
980         .map_io         = pxa27x_map_io,
981         .nr_irqs        = EZX_NR_IRQS,
982         .init_irq       = pxa27x_init_irq,
983         .handle_irq       = pxa27x_handle_irq,
984         .init_time      = pxa_timer_init,
985         .init_machine   = a1200_init,
986         .restart        = pxa_restart,
987 MACHINE_END
988 #endif
989
990 #ifdef CONFIG_MACH_EZX_A910
991 /* gpio_keys */
992 static struct gpio_keys_button a910_buttons[] = {
993         [0] = {
994                 .code       = SW_LID,
995                 .gpio       = GPIO15_A910_FLIP_LID,
996                 .active_low = 0,
997                 .desc       = "A910 flip lid",
998                 .type       = EV_SW,
999                 .wakeup     = 1,
1000         },
1001 };
1002
1003 static struct gpio_keys_platform_data a910_gpio_keys_platform_data = {
1004         .buttons  = a910_buttons,
1005         .nbuttons = ARRAY_SIZE(a910_buttons),
1006 };
1007
1008 static struct platform_device a910_gpio_keys = {
1009         .name = "gpio-keys",
1010         .id   = -1,
1011         .dev  = {
1012                 .platform_data = &a910_gpio_keys_platform_data,
1013         },
1014 };
1015
1016 /* camera */
1017 static int a910_camera_reset(struct device *dev)
1018 {
1019         gpio_set_value(GPIO28_GEN2_CAM_RST, 0);
1020         msleep(10);
1021         gpio_set_value(GPIO28_GEN2_CAM_RST, 1);
1022
1023         return 0;
1024 }
1025
1026 static int a910_camera_init(void)
1027 {
1028         int err;
1029
1030         /*
1031          * GPIO50_nCAM_EN is active low
1032          * GPIO28_GEN2_CAM_RST is active on rising edge
1033          */
1034         err = gpio_request(GPIO28_GEN2_CAM_RST, "CAM_RST");
1035         if (err) {
1036                 pr_err("%s: Failed to request CAM_RST\n", __func__);
1037                 return err;
1038         }
1039
1040         gpio_direction_output(GPIO28_GEN2_CAM_RST, 0);
1041         a910_camera_reset(NULL);
1042
1043         return 0;
1044 }
1045
1046 struct pxacamera_platform_data a910_pxacamera_platform_data = {
1047         .flags  = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
1048                 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN |
1049                 PXA_CAMERA_PCP,
1050         .mclk_10khz = 5000,
1051         .sensor_i2c_adapter_id = 0,
1052         .sensor_i2c_address = 0x5d,
1053 };
1054
1055 /* leds-lp3944 */
1056 static struct lp3944_platform_data a910_lp3944_leds = {
1057         .leds_size = LP3944_LEDS_MAX,
1058         .leds = {
1059                 [0] = {
1060                         .name = "a910:red:",
1061                         .status = LP3944_LED_STATUS_OFF,
1062                         .type = LP3944_LED_TYPE_LED,
1063                 },
1064                 [1] = {
1065                         .name = "a910:green:",
1066                         .status = LP3944_LED_STATUS_OFF,
1067                         .type = LP3944_LED_TYPE_LED,
1068                 },
1069                 [2] {
1070                         .name = "a910:blue:",
1071                         .status = LP3944_LED_STATUS_OFF,
1072                         .type = LP3944_LED_TYPE_LED,
1073                 },
1074                 /* Leds 3 and 4 are used as display power switches */
1075                 [3] = {
1076                         .name = "a910::cli_display",
1077                         .status = LP3944_LED_STATUS_OFF,
1078                         .type = LP3944_LED_TYPE_LED_INVERTED
1079                 },
1080                 [4] = {
1081                         .name = "a910::main_display",
1082                         .status = LP3944_LED_STATUS_ON,
1083                         .type = LP3944_LED_TYPE_LED_INVERTED
1084                 },
1085                 [5] = { .type = LP3944_LED_TYPE_NONE },
1086                 [6] = {
1087                         .name = "a910::torch",
1088                         .status = LP3944_LED_STATUS_OFF,
1089                         .type = LP3944_LED_TYPE_LED,
1090                 },
1091                 [7] = {
1092                         .name = "a910::flash",
1093                         .status = LP3944_LED_STATUS_OFF,
1094                         .type = LP3944_LED_TYPE_LED_INVERTED,
1095                 },
1096         },
1097 };
1098
1099 static struct i2c_board_info __initdata a910_i2c_board_info[] = {
1100         {
1101                 I2C_BOARD_INFO("lp3944", 0x60),
1102                 .platform_data = &a910_lp3944_leds,
1103         },
1104         {
1105                 I2C_BOARD_INFO("mt9m111", 0x5d),
1106         },
1107 };
1108
1109 static struct platform_device *a910_devices[] __initdata = {
1110         &a910_gpio_keys,
1111         &camera_supply_regulator_device,
1112 };
1113
1114 static void __init a910_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(a910_pin_config));
1119
1120         pxa_set_ffuart_info(NULL);
1121         pxa_set_btuart_info(NULL);
1122         pxa_set_stuart_info(NULL);
1123
1124         pxa_set_i2c_info(NULL);
1125         i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info));
1126
1127         pxa_set_fb_info(NULL, &ezx_fb_info_2);
1128
1129         pxa_set_keypad_info(&a910_keypad_platform_data);
1130
1131         if (a910_camera_init() == 0)
1132                 pxa_set_camera_info(&a910_pxacamera_platform_data);
1133
1134         gpiod_add_lookup_table(&camera_supply_gpiod_table);
1135         pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1136         platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1137         platform_add_devices(ARRAY_AND_SIZE(a910_devices));
1138         regulator_has_full_constraints();
1139 }
1140
1141 MACHINE_START(EZX_A910, "Motorola EZX A910")
1142         .atag_offset    = 0x100,
1143         .map_io         = pxa27x_map_io,
1144         .nr_irqs        = EZX_NR_IRQS,
1145         .init_irq       = pxa27x_init_irq,
1146         .handle_irq       = pxa27x_handle_irq,
1147         .init_time      = pxa_timer_init,
1148         .init_machine   = a910_init,
1149         .restart        = pxa_restart,
1150 MACHINE_END
1151 #endif
1152
1153 #ifdef CONFIG_MACH_EZX_E6
1154 /* gpio_keys */
1155 static struct gpio_keys_button e6_buttons[] = {
1156         [0] = {
1157                 .code       = KEY_SCREENLOCK,
1158                 .gpio       = GPIO15_E6_LOCK_SWITCH,
1159                 .active_low = 0,
1160                 .desc       = "E6 lock switch",
1161                 .type       = EV_KEY,
1162                 .wakeup     = 1,
1163         },
1164 };
1165
1166 static struct gpio_keys_platform_data e6_gpio_keys_platform_data = {
1167         .buttons  = e6_buttons,
1168         .nbuttons = ARRAY_SIZE(e6_buttons),
1169 };
1170
1171 static struct platform_device e6_gpio_keys = {
1172         .name = "gpio-keys",
1173         .id   = -1,
1174         .dev  = {
1175                 .platform_data = &e6_gpio_keys_platform_data,
1176         },
1177 };
1178
1179 static struct i2c_board_info __initdata e6_i2c_board_info[] = {
1180         { I2C_BOARD_INFO("tea5767", 0x81) },
1181 };
1182
1183 static struct platform_device *e6_devices[] __initdata = {
1184         &e6_gpio_keys,
1185 };
1186
1187 static void __init e6_init(void)
1188 {
1189         pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1190         pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1191         pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config));
1192
1193         pxa_set_ffuart_info(NULL);
1194         pxa_set_btuart_info(NULL);
1195         pxa_set_stuart_info(NULL);
1196
1197         pxa_set_i2c_info(NULL);
1198         i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info));
1199
1200         pxa_set_fb_info(NULL, &ezx_fb_info_2);
1201
1202         pxa_set_keypad_info(&e6_keypad_platform_data);
1203
1204         pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1205         platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1206         platform_add_devices(ARRAY_AND_SIZE(e6_devices));
1207 }
1208
1209 MACHINE_START(EZX_E6, "Motorola EZX E6")
1210         .atag_offset    = 0x100,
1211         .map_io         = pxa27x_map_io,
1212         .nr_irqs        = EZX_NR_IRQS,
1213         .init_irq       = pxa27x_init_irq,
1214         .handle_irq       = pxa27x_handle_irq,
1215         .init_time      = pxa_timer_init,
1216         .init_machine   = e6_init,
1217         .restart        = pxa_restart,
1218 MACHINE_END
1219 #endif
1220
1221 #ifdef CONFIG_MACH_EZX_E2
1222 static struct i2c_board_info __initdata e2_i2c_board_info[] = {
1223         { I2C_BOARD_INFO("tea5767", 0x81) },
1224 };
1225
1226 static struct platform_device *e2_devices[] __initdata = {
1227 };
1228
1229 static void __init e2_init(void)
1230 {
1231         pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1232         pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1233         pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config));
1234
1235         pxa_set_ffuart_info(NULL);
1236         pxa_set_btuart_info(NULL);
1237         pxa_set_stuart_info(NULL);
1238
1239         pxa_set_i2c_info(NULL);
1240         i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info));
1241
1242         pxa_set_fb_info(NULL, &ezx_fb_info_2);
1243
1244         pxa_set_keypad_info(&e2_keypad_platform_data);
1245
1246         pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1247         platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1248         platform_add_devices(ARRAY_AND_SIZE(e2_devices));
1249 }
1250
1251 MACHINE_START(EZX_E2, "Motorola EZX E2")
1252         .atag_offset    = 0x100,
1253         .map_io         = pxa27x_map_io,
1254         .nr_irqs        = EZX_NR_IRQS,
1255         .init_irq       = pxa27x_init_irq,
1256         .handle_irq       = pxa27x_handle_irq,
1257         .init_time      = pxa_timer_init,
1258         .init_machine   = e2_init,
1259         .restart        = pxa_restart,
1260 MACHINE_END
1261 #endif