2 * ezx.c - Common code for the EZX platform.
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>
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.
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>
19 #include <linux/input.h>
20 #include <linux/gpio.h>
21 #include <linux/gpio_keys.h>
22 #include <linux/leds-lp3944.h>
23 #include <linux/i2c/pxa-i2c.h>
25 #include <media/soc_camera.h>
27 #include <asm/setup.h>
28 #include <asm/mach-types.h>
29 #include <asm/mach/arch.h>
31 #include <mach/pxa27x.h>
32 #include <linux/platform_data/video-pxafb.h>
33 #include <linux/platform_data/usb-ohci-pxa27x.h>
34 #include <mach/hardware.h>
35 #include <linux/platform_data/keypad-pxa27x.h>
36 #include <linux/platform_data/camera-pxa.h>
41 #define EZX_NR_IRQS (IRQ_BOARD_START + 24)
43 #define GPIO12_A780_FLIP_LID 12
44 #define GPIO15_A1200_FLIP_LID 15
45 #define GPIO15_A910_FLIP_LID 15
46 #define GPIO12_E680_LOCK_SWITCH 12
47 #define GPIO15_E6_LOCK_SWITCH 15
48 #define GPIO50_nCAM_EN 50
49 #define GPIO19_GEN1_CAM_RST 19
50 #define GPIO28_GEN2_CAM_RST 28
52 static struct platform_pwm_backlight_data ezx_backlight_data = {
54 .max_brightness = 1023,
55 .dft_brightness = 1023,
56 .pwm_period_ns = 78770,
59 static struct platform_device ezx_backlight_device = {
60 .name = "pwm-backlight",
62 .parent = &pxa27x_device_pwm0.dev,
63 .platform_data = &ezx_backlight_data,
67 static struct pxafb_mode_info mode_ezx_old = {
81 static struct pxafb_mach_info ezx_fb_info_1 = {
82 .modes = &mode_ezx_old,
84 .lcd_conn = LCD_COLOR_TFT_16BPP,
87 static struct pxafb_mode_info mode_72r89803y01 = {
102 static struct pxafb_mach_info ezx_fb_info_2 = {
103 .modes = &mode_72r89803y01,
105 .lcd_conn = LCD_COLOR_TFT_18BPP,
108 static struct platform_device *ezx_devices[] __initdata = {
109 &ezx_backlight_device,
112 static unsigned long ezx_pin_config[] __initdata = {
130 GPIO24_GPIO, /* pcap chip select */
131 GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, /* pcap interrupt */
132 GPIO4_GPIO | MFP_LPM_DRIVE_HIGH, /* WDI_AP */
133 GPIO55_GPIO | MFP_LPM_DRIVE_HIGH, /* SYS_RESTART */
142 GPIO11_GPIO, /* mmc detect */
144 /* usb to external transceiver */
152 /* usb to Neptune GSM chip */
161 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680)
162 static unsigned long gen1_pin_config[] __initdata = {
163 /* flip / lockswitch */
164 GPIO12_GPIO | WAKEUP_ON_EDGE_BOTH,
166 /* bluetooth (bcm2035) */
167 GPIO14_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
168 GPIO48_GPIO, /* RESET */
169 GPIO28_GPIO, /* WAKEUP */
171 /* Neptune handshake */
172 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
173 GPIO57_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
174 GPIO13_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI */
175 GPIO3_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI2 */
176 GPIO82_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
177 GPIO99_GPIO | MFP_LPM_DRIVE_HIGH, /* TC_MM_EN */
185 /* ssp2 pins to in */
186 GPIO22_GPIO, /* SSP2_SCLK */
187 GPIO37_GPIO, /* SSP2_SFRM */
188 GPIO38_GPIO, /* SSP2_TXD */
189 GPIO88_GPIO, /* SSP2_RXD */
204 GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */
205 GPIO19_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */
208 GPIO120_GPIO, /* EMU_MUX1 */
209 GPIO119_GPIO, /* EMU_MUX2 */
210 GPIO86_GPIO, /* SNP_INT_CTL */
211 GPIO87_GPIO, /* SNP_INT_IN */
215 #if defined(CONFIG_MACH_EZX_A1200) || defined(CONFIG_MACH_EZX_A910) || \
216 defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6)
217 static unsigned long gen2_pin_config[] __initdata = {
218 /* flip / lockswitch */
219 GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH,
222 GPIO10_GPIO | WAKEUP_ON_EDGE_RISE,
224 /* bluetooth (bcm2045) */
225 GPIO13_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
226 GPIO37_GPIO, /* RESET */
227 GPIO57_GPIO, /* WAKEUP */
229 /* Neptune handshake */
230 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
231 GPIO96_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
232 GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* WDI */
233 GPIO116_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
234 GPIO41_GPIO, /* BP_FLASH */
242 /* ssp2 pins to in */
243 GPIO22_GPIO, /* SSP2_SCLK */
244 GPIO14_GPIO, /* SSP2_SFRM */
245 GPIO38_GPIO, /* SSP2_TXD */
246 GPIO88_GPIO, /* SSP2_RXD */
261 GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */
262 GPIO28_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */
263 GPIO17_GPIO, /* CAM_FLASH */
267 #ifdef CONFIG_MACH_EZX_A780
268 static unsigned long a780_pin_config[] __initdata = {
270 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
271 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
272 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
273 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
274 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
275 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
282 /* attenuate sound */
287 #ifdef CONFIG_MACH_EZX_E680
288 static unsigned long e680_pin_config[] __initdata = {
290 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
291 GPIO96_KP_DKIN_3 | WAKEUP_ON_LEVEL_HIGH,
292 GPIO97_KP_DKIN_4 | WAKEUP_ON_LEVEL_HIGH,
293 GPIO98_KP_DKIN_5 | WAKEUP_ON_LEVEL_HIGH,
294 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
295 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
296 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
303 GPIO79_GPIO, /* VA_SEL_BUL */
304 GPIO80_GPIO, /* FLT_SEL_BUL */
305 GPIO78_GPIO, /* MIDI_RESET */
306 GPIO33_GPIO, /* MIDI_CS */
307 GPIO15_GPIO, /* MIDI_IRQ */
308 GPIO49_GPIO, /* MIDI_NPWE */
309 GPIO18_GPIO, /* MIDI_RDY */
317 #ifdef CONFIG_MACH_EZX_A1200
318 static unsigned long a1200_pin_config[] __initdata = {
320 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
321 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
322 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
323 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
324 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
334 #ifdef CONFIG_MACH_EZX_A910
335 static unsigned long a910_pin_config[] __initdata = {
337 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
338 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
339 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
340 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
341 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
350 GPIO89_GPIO, /* RESET */
351 GPIO33_GPIO, /* WAKEUP */
352 GPIO94_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */
359 #ifdef CONFIG_MACH_EZX_E2
360 static unsigned long e2_pin_config[] __initdata = {
362 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
363 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
364 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
365 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
366 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
376 #ifdef CONFIG_MACH_EZX_E6
377 static unsigned long e6_pin_config[] __initdata = {
379 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
380 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
381 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
382 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
383 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
394 #ifdef CONFIG_MACH_EZX_A780
395 static unsigned int a780_key_map[] = {
399 KEY(0, 3, KEY_PAGEUP),
402 KEY(1, 0, KEY_NUMERIC_1),
403 KEY(1, 1, KEY_NUMERIC_2),
404 KEY(1, 2, KEY_NUMERIC_3),
405 KEY(1, 3, KEY_SELECT),
406 KEY(1, 4, KEY_KPENTER),
408 KEY(2, 0, KEY_NUMERIC_4),
409 KEY(2, 1, KEY_NUMERIC_5),
410 KEY(2, 2, KEY_NUMERIC_6),
411 KEY(2, 3, KEY_RECORD),
414 KEY(3, 0, KEY_NUMERIC_7),
415 KEY(3, 1, KEY_NUMERIC_8),
416 KEY(3, 2, KEY_NUMERIC_9),
418 KEY(3, 4, KEY_RIGHT),
420 KEY(4, 0, KEY_NUMERIC_STAR),
421 KEY(4, 1, KEY_NUMERIC_0),
422 KEY(4, 2, KEY_NUMERIC_POUND),
423 KEY(4, 3, KEY_PAGEDOWN),
427 static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
428 .matrix_key_rows = 5,
429 .matrix_key_cols = 5,
430 .matrix_key_map = a780_key_map,
431 .matrix_key_map_size = ARRAY_SIZE(a780_key_map),
433 .direct_key_map = { KEY_CAMERA },
436 .debounce_interval = 30,
438 #endif /* CONFIG_MACH_EZX_A780 */
440 #ifdef CONFIG_MACH_EZX_E680
441 static unsigned int e680_key_map[] = {
443 KEY(0, 1, KEY_RIGHT),
444 KEY(0, 2, KEY_RESERVED),
449 KEY(1, 2, KEY_PAGEUP),
450 KEY(1, 3, KEY_PAGEDOWN),
452 KEY(2, 0, KEY_RESERVED),
453 KEY(2, 1, KEY_RESERVED),
454 KEY(2, 2, KEY_RESERVED),
455 KEY(2, 3, KEY_KPENTER),
458 static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
459 .matrix_key_rows = 3,
460 .matrix_key_cols = 4,
461 .matrix_key_map = e680_key_map,
462 .matrix_key_map_size = ARRAY_SIZE(e680_key_map),
474 .debounce_interval = 30,
476 #endif /* CONFIG_MACH_EZX_E680 */
478 #ifdef CONFIG_MACH_EZX_A1200
479 static unsigned int a1200_key_map[] = {
480 KEY(0, 0, KEY_RESERVED),
481 KEY(0, 1, KEY_RIGHT),
482 KEY(0, 2, KEY_PAGEDOWN),
483 KEY(0, 3, KEY_RESERVED),
484 KEY(0, 4, KEY_RESERVED),
485 KEY(0, 5, KEY_RESERVED),
487 KEY(1, 0, KEY_RESERVED),
489 KEY(1, 2, KEY_CAMERA),
490 KEY(1, 3, KEY_RESERVED),
491 KEY(1, 4, KEY_RESERVED),
492 KEY(1, 5, KEY_RESERVED),
494 KEY(2, 0, KEY_RESERVED),
495 KEY(2, 1, KEY_KPENTER),
496 KEY(2, 2, KEY_RECORD),
497 KEY(2, 3, KEY_RESERVED),
498 KEY(2, 4, KEY_RESERVED),
499 KEY(2, 5, KEY_SELECT),
501 KEY(3, 0, KEY_RESERVED),
504 KEY(3, 3, KEY_RESERVED),
505 KEY(3, 4, KEY_RESERVED),
506 KEY(3, 5, KEY_RESERVED),
508 KEY(4, 0, KEY_RESERVED),
510 KEY(4, 2, KEY_PAGEUP),
511 KEY(4, 3, KEY_RESERVED),
512 KEY(4, 4, KEY_RESERVED),
513 KEY(4, 5, KEY_RESERVED),
516 static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
517 .matrix_key_rows = 5,
518 .matrix_key_cols = 6,
519 .matrix_key_map = a1200_key_map,
520 .matrix_key_map_size = ARRAY_SIZE(a1200_key_map),
522 .debounce_interval = 30,
524 #endif /* CONFIG_MACH_EZX_A1200 */
526 #ifdef CONFIG_MACH_EZX_E6
527 static unsigned int e6_key_map[] = {
528 KEY(0, 0, KEY_RESERVED),
529 KEY(0, 1, KEY_RIGHT),
530 KEY(0, 2, KEY_PAGEDOWN),
531 KEY(0, 3, KEY_RESERVED),
532 KEY(0, 4, KEY_RESERVED),
533 KEY(0, 5, KEY_NEXTSONG),
535 KEY(1, 0, KEY_RESERVED),
537 KEY(1, 2, KEY_PROG1),
538 KEY(1, 3, KEY_RESERVED),
539 KEY(1, 4, KEY_RESERVED),
540 KEY(1, 5, KEY_RESERVED),
542 KEY(2, 0, KEY_RESERVED),
543 KEY(2, 1, KEY_ENTER),
544 KEY(2, 2, KEY_CAMERA),
545 KEY(2, 3, KEY_RESERVED),
546 KEY(2, 4, KEY_RESERVED),
549 KEY(3, 0, KEY_RESERVED),
552 KEY(3, 3, KEY_RESERVED),
553 KEY(3, 4, KEY_RESERVED),
554 KEY(3, 5, KEY_PLAYPAUSE),
556 KEY(4, 0, KEY_RESERVED),
558 KEY(4, 2, KEY_PAGEUP),
559 KEY(4, 3, KEY_RESERVED),
560 KEY(4, 4, KEY_RESERVED),
561 KEY(4, 5, KEY_PREVIOUSSONG),
564 static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
565 .matrix_key_rows = 5,
566 .matrix_key_cols = 6,
567 .matrix_key_map = e6_key_map,
568 .matrix_key_map_size = ARRAY_SIZE(e6_key_map),
570 .debounce_interval = 30,
572 #endif /* CONFIG_MACH_EZX_E6 */
574 #ifdef CONFIG_MACH_EZX_A910
575 static unsigned int a910_key_map[] = {
576 KEY(0, 0, KEY_NUMERIC_6),
577 KEY(0, 1, KEY_RIGHT),
578 KEY(0, 2, KEY_PAGEDOWN),
579 KEY(0, 3, KEY_KPENTER),
580 KEY(0, 4, KEY_NUMERIC_5),
581 KEY(0, 5, KEY_CAMERA),
583 KEY(1, 0, KEY_NUMERIC_8),
585 KEY(1, 2, KEY_RESERVED),
586 KEY(1, 3, KEY_F1), /* Left SoftKey */
587 KEY(1, 4, KEY_NUMERIC_STAR),
588 KEY(1, 5, KEY_RESERVED),
590 KEY(2, 0, KEY_NUMERIC_7),
591 KEY(2, 1, KEY_NUMERIC_9),
592 KEY(2, 2, KEY_RECORD),
593 KEY(2, 3, KEY_F2), /* Right SoftKey */
595 KEY(2, 5, KEY_SELECT),
597 KEY(3, 0, KEY_NUMERIC_2),
600 KEY(3, 3, KEY_NUMERIC_0),
601 KEY(3, 4, KEY_NUMERIC_1),
602 KEY(3, 5, KEY_RECORD),
604 KEY(4, 0, KEY_NUMERIC_4),
606 KEY(4, 2, KEY_PAGEUP),
607 KEY(4, 3, KEY_NUMERIC_POUND),
608 KEY(4, 4, KEY_NUMERIC_3),
609 KEY(4, 5, KEY_RESERVED),
612 static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
613 .matrix_key_rows = 5,
614 .matrix_key_cols = 6,
615 .matrix_key_map = a910_key_map,
616 .matrix_key_map_size = ARRAY_SIZE(a910_key_map),
618 .debounce_interval = 30,
620 #endif /* CONFIG_MACH_EZX_A910 */
622 #ifdef CONFIG_MACH_EZX_E2
623 static unsigned int e2_key_map[] = {
624 KEY(0, 0, KEY_NUMERIC_6),
625 KEY(0, 1, KEY_RIGHT),
626 KEY(0, 2, KEY_NUMERIC_9),
627 KEY(0, 3, KEY_NEXTSONG),
628 KEY(0, 4, KEY_NUMERIC_5),
629 KEY(0, 5, KEY_F1), /* Left SoftKey */
631 KEY(1, 0, KEY_NUMERIC_8),
633 KEY(1, 2, KEY_RESERVED),
634 KEY(1, 3, KEY_PAGEUP),
635 KEY(1, 4, KEY_NUMERIC_STAR),
636 KEY(1, 5, KEY_F2), /* Right SoftKey */
638 KEY(2, 0, KEY_NUMERIC_7),
639 KEY(2, 1, KEY_KPENTER),
640 KEY(2, 2, KEY_RECORD),
641 KEY(2, 3, KEY_PAGEDOWN),
643 KEY(2, 5, KEY_NUMERIC_0),
645 KEY(3, 0, KEY_NUMERIC_2),
648 KEY(3, 3, KEY_PLAYPAUSE),
649 KEY(3, 4, KEY_NUMERIC_1),
650 KEY(3, 5, KEY_SOUND), /* Music SoftKey */
652 KEY(4, 0, KEY_NUMERIC_4),
654 KEY(4, 2, KEY_NUMERIC_POUND),
655 KEY(4, 3, KEY_PREVIOUSSONG),
656 KEY(4, 4, KEY_NUMERIC_3),
657 KEY(4, 5, KEY_RESERVED),
660 static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
661 .matrix_key_rows = 5,
662 .matrix_key_cols = 6,
663 .matrix_key_map = e2_key_map,
664 .matrix_key_map_size = ARRAY_SIZE(e2_key_map),
666 .debounce_interval = 30,
668 #endif /* CONFIG_MACH_EZX_E2 */
670 #ifdef CONFIG_MACH_EZX_A780
672 static struct gpio_keys_button a780_buttons[] = {
675 .gpio = GPIO12_A780_FLIP_LID,
677 .desc = "A780 flip lid",
683 static struct gpio_keys_platform_data a780_gpio_keys_platform_data = {
684 .buttons = a780_buttons,
685 .nbuttons = ARRAY_SIZE(a780_buttons),
688 static struct platform_device a780_gpio_keys = {
692 .platform_data = &a780_gpio_keys_platform_data,
697 static int a780_camera_init(void)
702 * GPIO50_nCAM_EN is active low
703 * GPIO19_GEN1_CAM_RST is active on rising edge
705 err = gpio_request(GPIO50_nCAM_EN, "nCAM_EN");
707 pr_err("%s: Failed to request nCAM_EN\n", __func__);
711 err = gpio_request(GPIO19_GEN1_CAM_RST, "CAM_RST");
713 pr_err("%s: Failed to request CAM_RST\n", __func__);
714 goto fail_gpio_cam_rst;
717 gpio_direction_output(GPIO50_nCAM_EN, 1);
718 gpio_direction_output(GPIO19_GEN1_CAM_RST, 0);
723 gpio_free(GPIO50_nCAM_EN);
728 static int a780_camera_power(struct device *dev, int on)
730 gpio_set_value(GPIO50_nCAM_EN, !on);
734 static int a780_camera_reset(struct device *dev)
736 gpio_set_value(GPIO19_GEN1_CAM_RST, 0);
738 gpio_set_value(GPIO19_GEN1_CAM_RST, 1);
743 struct pxacamera_platform_data a780_pxacamera_platform_data = {
744 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
745 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
749 static struct i2c_board_info a780_camera_i2c_board_info = {
750 I2C_BOARD_INFO("mt9m111", 0x5d),
753 static struct soc_camera_link a780_iclink = {
755 .flags = SOCAM_SENSOR_INVERT_PCLK,
757 .board_info = &a780_camera_i2c_board_info,
758 .power = a780_camera_power,
759 .reset = a780_camera_reset,
762 static struct platform_device a780_camera = {
763 .name = "soc-camera-pdrv",
766 .platform_data = &a780_iclink,
770 static struct platform_device *a780_devices[] __initdata = {
774 static void __init a780_init(void)
776 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
777 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
778 pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config));
780 pxa_set_ffuart_info(NULL);
781 pxa_set_btuart_info(NULL);
782 pxa_set_stuart_info(NULL);
784 pxa_set_i2c_info(NULL);
786 pxa_set_fb_info(NULL, &ezx_fb_info_1);
788 pxa_set_keypad_info(&a780_keypad_platform_data);
790 if (a780_camera_init() == 0) {
791 pxa_set_camera_info(&a780_pxacamera_platform_data);
792 platform_device_register(&a780_camera);
795 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
796 platform_add_devices(ARRAY_AND_SIZE(a780_devices));
799 MACHINE_START(EZX_A780, "Motorola EZX A780")
800 .atag_offset = 0x100,
801 .map_io = pxa27x_map_io,
802 .nr_irqs = EZX_NR_IRQS,
803 .init_irq = pxa27x_init_irq,
804 .handle_irq = pxa27x_handle_irq,
806 .init_machine = a780_init,
807 .restart = pxa_restart,
811 #ifdef CONFIG_MACH_EZX_E680
813 static struct gpio_keys_button e680_buttons[] = {
815 .code = KEY_SCREENLOCK,
816 .gpio = GPIO12_E680_LOCK_SWITCH,
818 .desc = "E680 lock switch",
824 static struct gpio_keys_platform_data e680_gpio_keys_platform_data = {
825 .buttons = e680_buttons,
826 .nbuttons = ARRAY_SIZE(e680_buttons),
829 static struct platform_device e680_gpio_keys = {
833 .platform_data = &e680_gpio_keys_platform_data,
837 static struct i2c_board_info __initdata e680_i2c_board_info[] = {
838 { I2C_BOARD_INFO("tea5767", 0x81) },
841 static struct platform_device *e680_devices[] __initdata = {
845 static void __init e680_init(void)
847 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
848 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
849 pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config));
851 pxa_set_ffuart_info(NULL);
852 pxa_set_btuart_info(NULL);
853 pxa_set_stuart_info(NULL);
855 pxa_set_i2c_info(NULL);
856 i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info));
858 pxa_set_fb_info(NULL, &ezx_fb_info_1);
860 pxa_set_keypad_info(&e680_keypad_platform_data);
862 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
863 platform_add_devices(ARRAY_AND_SIZE(e680_devices));
866 MACHINE_START(EZX_E680, "Motorola EZX E680")
867 .atag_offset = 0x100,
868 .map_io = pxa27x_map_io,
869 .nr_irqs = EZX_NR_IRQS,
870 .init_irq = pxa27x_init_irq,
871 .handle_irq = pxa27x_handle_irq,
873 .init_machine = e680_init,
874 .restart = pxa_restart,
878 #ifdef CONFIG_MACH_EZX_A1200
880 static struct gpio_keys_button a1200_buttons[] = {
883 .gpio = GPIO15_A1200_FLIP_LID,
885 .desc = "A1200 flip lid",
891 static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = {
892 .buttons = a1200_buttons,
893 .nbuttons = ARRAY_SIZE(a1200_buttons),
896 static struct platform_device a1200_gpio_keys = {
900 .platform_data = &a1200_gpio_keys_platform_data,
904 static struct i2c_board_info __initdata a1200_i2c_board_info[] = {
905 { I2C_BOARD_INFO("tea5767", 0x81) },
908 static struct platform_device *a1200_devices[] __initdata = {
912 static void __init a1200_init(void)
914 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
915 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
916 pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config));
918 pxa_set_ffuart_info(NULL);
919 pxa_set_btuart_info(NULL);
920 pxa_set_stuart_info(NULL);
922 pxa_set_i2c_info(NULL);
923 i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info));
925 pxa_set_fb_info(NULL, &ezx_fb_info_2);
927 pxa_set_keypad_info(&a1200_keypad_platform_data);
929 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
930 platform_add_devices(ARRAY_AND_SIZE(a1200_devices));
933 MACHINE_START(EZX_A1200, "Motorola EZX A1200")
934 .atag_offset = 0x100,
935 .map_io = pxa27x_map_io,
936 .nr_irqs = EZX_NR_IRQS,
937 .init_irq = pxa27x_init_irq,
938 .handle_irq = pxa27x_handle_irq,
940 .init_machine = a1200_init,
941 .restart = pxa_restart,
945 #ifdef CONFIG_MACH_EZX_A910
947 static struct gpio_keys_button a910_buttons[] = {
950 .gpio = GPIO15_A910_FLIP_LID,
952 .desc = "A910 flip lid",
958 static struct gpio_keys_platform_data a910_gpio_keys_platform_data = {
959 .buttons = a910_buttons,
960 .nbuttons = ARRAY_SIZE(a910_buttons),
963 static struct platform_device a910_gpio_keys = {
967 .platform_data = &a910_gpio_keys_platform_data,
972 static int a910_camera_init(void)
977 * GPIO50_nCAM_EN is active low
978 * GPIO28_GEN2_CAM_RST is active on rising edge
980 err = gpio_request(GPIO50_nCAM_EN, "nCAM_EN");
982 pr_err("%s: Failed to request nCAM_EN\n", __func__);
986 err = gpio_request(GPIO28_GEN2_CAM_RST, "CAM_RST");
988 pr_err("%s: Failed to request CAM_RST\n", __func__);
989 goto fail_gpio_cam_rst;
992 gpio_direction_output(GPIO50_nCAM_EN, 1);
993 gpio_direction_output(GPIO28_GEN2_CAM_RST, 0);
998 gpio_free(GPIO50_nCAM_EN);
1003 static int a910_camera_power(struct device *dev, int on)
1005 gpio_set_value(GPIO50_nCAM_EN, !on);
1009 static int a910_camera_reset(struct device *dev)
1011 gpio_set_value(GPIO28_GEN2_CAM_RST, 0);
1013 gpio_set_value(GPIO28_GEN2_CAM_RST, 1);
1018 struct pxacamera_platform_data a910_pxacamera_platform_data = {
1019 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
1020 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
1024 static struct i2c_board_info a910_camera_i2c_board_info = {
1025 I2C_BOARD_INFO("mt9m111", 0x5d),
1028 static struct soc_camera_link a910_iclink = {
1030 .i2c_adapter_id = 0,
1031 .board_info = &a910_camera_i2c_board_info,
1032 .power = a910_camera_power,
1033 .reset = a910_camera_reset,
1036 static struct platform_device a910_camera = {
1037 .name = "soc-camera-pdrv",
1040 .platform_data = &a910_iclink,
1045 static struct lp3944_platform_data a910_lp3944_leds = {
1046 .leds_size = LP3944_LEDS_MAX,
1049 .name = "a910:red:",
1050 .status = LP3944_LED_STATUS_OFF,
1051 .type = LP3944_LED_TYPE_LED,
1054 .name = "a910:green:",
1055 .status = LP3944_LED_STATUS_OFF,
1056 .type = LP3944_LED_TYPE_LED,
1059 .name = "a910:blue:",
1060 .status = LP3944_LED_STATUS_OFF,
1061 .type = LP3944_LED_TYPE_LED,
1063 /* Leds 3 and 4 are used as display power switches */
1065 .name = "a910::cli_display",
1066 .status = LP3944_LED_STATUS_OFF,
1067 .type = LP3944_LED_TYPE_LED_INVERTED
1070 .name = "a910::main_display",
1071 .status = LP3944_LED_STATUS_ON,
1072 .type = LP3944_LED_TYPE_LED_INVERTED
1074 [5] = { .type = LP3944_LED_TYPE_NONE },
1076 .name = "a910::torch",
1077 .status = LP3944_LED_STATUS_OFF,
1078 .type = LP3944_LED_TYPE_LED,
1081 .name = "a910::flash",
1082 .status = LP3944_LED_STATUS_OFF,
1083 .type = LP3944_LED_TYPE_LED_INVERTED,
1088 static struct i2c_board_info __initdata a910_i2c_board_info[] = {
1090 I2C_BOARD_INFO("lp3944", 0x60),
1091 .platform_data = &a910_lp3944_leds,
1095 static struct platform_device *a910_devices[] __initdata = {
1099 static void __init a910_init(void)
1101 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1102 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1103 pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config));
1105 pxa_set_ffuart_info(NULL);
1106 pxa_set_btuart_info(NULL);
1107 pxa_set_stuart_info(NULL);
1109 pxa_set_i2c_info(NULL);
1110 i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info));
1112 pxa_set_fb_info(NULL, &ezx_fb_info_2);
1114 pxa_set_keypad_info(&a910_keypad_platform_data);
1116 if (a910_camera_init() == 0) {
1117 pxa_set_camera_info(&a910_pxacamera_platform_data);
1118 platform_device_register(&a910_camera);
1121 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1122 platform_add_devices(ARRAY_AND_SIZE(a910_devices));
1125 MACHINE_START(EZX_A910, "Motorola EZX A910")
1126 .atag_offset = 0x100,
1127 .map_io = pxa27x_map_io,
1128 .nr_irqs = EZX_NR_IRQS,
1129 .init_irq = pxa27x_init_irq,
1130 .handle_irq = pxa27x_handle_irq,
1131 .timer = &pxa_timer,
1132 .init_machine = a910_init,
1133 .restart = pxa_restart,
1137 #ifdef CONFIG_MACH_EZX_E6
1139 static struct gpio_keys_button e6_buttons[] = {
1141 .code = KEY_SCREENLOCK,
1142 .gpio = GPIO15_E6_LOCK_SWITCH,
1144 .desc = "E6 lock switch",
1150 static struct gpio_keys_platform_data e6_gpio_keys_platform_data = {
1151 .buttons = e6_buttons,
1152 .nbuttons = ARRAY_SIZE(e6_buttons),
1155 static struct platform_device e6_gpio_keys = {
1156 .name = "gpio-keys",
1159 .platform_data = &e6_gpio_keys_platform_data,
1163 static struct i2c_board_info __initdata e6_i2c_board_info[] = {
1164 { I2C_BOARD_INFO("tea5767", 0x81) },
1167 static struct platform_device *e6_devices[] __initdata = {
1171 static void __init e6_init(void)
1173 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1174 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1175 pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config));
1177 pxa_set_ffuart_info(NULL);
1178 pxa_set_btuart_info(NULL);
1179 pxa_set_stuart_info(NULL);
1181 pxa_set_i2c_info(NULL);
1182 i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info));
1184 pxa_set_fb_info(NULL, &ezx_fb_info_2);
1186 pxa_set_keypad_info(&e6_keypad_platform_data);
1188 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1189 platform_add_devices(ARRAY_AND_SIZE(e6_devices));
1192 MACHINE_START(EZX_E6, "Motorola EZX E6")
1193 .atag_offset = 0x100,
1194 .map_io = pxa27x_map_io,
1195 .nr_irqs = EZX_NR_IRQS,
1196 .init_irq = pxa27x_init_irq,
1197 .handle_irq = pxa27x_handle_irq,
1198 .timer = &pxa_timer,
1199 .init_machine = e6_init,
1200 .restart = pxa_restart,
1204 #ifdef CONFIG_MACH_EZX_E2
1205 static struct i2c_board_info __initdata e2_i2c_board_info[] = {
1206 { I2C_BOARD_INFO("tea5767", 0x81) },
1209 static struct platform_device *e2_devices[] __initdata = {
1212 static void __init e2_init(void)
1214 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1215 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1216 pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config));
1218 pxa_set_ffuart_info(NULL);
1219 pxa_set_btuart_info(NULL);
1220 pxa_set_stuart_info(NULL);
1222 pxa_set_i2c_info(NULL);
1223 i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info));
1225 pxa_set_fb_info(NULL, &ezx_fb_info_2);
1227 pxa_set_keypad_info(&e2_keypad_platform_data);
1229 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1230 platform_add_devices(ARRAY_AND_SIZE(e2_devices));
1233 MACHINE_START(EZX_E2, "Motorola EZX E2")
1234 .atag_offset = 0x100,
1235 .map_io = pxa27x_map_io,
1236 .nr_irqs = EZX_NR_IRQS,
1237 .init_irq = pxa27x_init_irq,
1238 .handle_irq = pxa27x_handle_irq,
1239 .timer = &pxa_timer,
1240 .init_machine = e2_init,
1241 .restart = pxa_restart,