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.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>
29 #include <asm/setup.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.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>
43 #define EZX_NR_IRQS (IRQ_BOARD_START + 24)
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
54 static struct pwm_lookup ezx_pwm_lookup[] __maybe_unused = {
55 PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78700,
59 static struct platform_pwm_backlight_data ezx_backlight_data = {
60 .max_brightness = 1023,
61 .dft_brightness = 1023,
65 static struct platform_device ezx_backlight_device = {
66 .name = "pwm-backlight",
68 .parent = &pxa27x_device_pwm0.dev,
69 .platform_data = &ezx_backlight_data,
73 static struct pxafb_mode_info mode_ezx_old = {
87 static struct pxafb_mach_info ezx_fb_info_1 __maybe_unused = {
88 .modes = &mode_ezx_old,
90 .lcd_conn = LCD_COLOR_TFT_16BPP,
93 static struct pxafb_mode_info mode_72r89803y01 = {
108 static struct pxafb_mach_info ezx_fb_info_2 __maybe_unused = {
109 .modes = &mode_72r89803y01,
111 .lcd_conn = LCD_COLOR_TFT_18BPP,
114 static struct platform_device *ezx_devices[] __initdata __maybe_unused = {
115 &ezx_backlight_device,
118 static unsigned long ezx_pin_config[] __initdata __maybe_unused = {
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 */
148 GPIO11_GPIO, /* mmc detect */
150 /* usb to external transceiver */
158 /* usb to Neptune GSM chip */
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,
172 /* bluetooth (bcm2035) */
173 GPIO14_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
174 GPIO48_GPIO, /* RESET */
175 GPIO28_GPIO, /* WAKEUP */
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 */
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 */
210 GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */
211 GPIO19_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */
214 GPIO120_GPIO, /* EMU_MUX1 */
215 GPIO119_GPIO, /* EMU_MUX2 */
216 GPIO86_GPIO, /* SNP_INT_CTL */
217 GPIO87_GPIO, /* SNP_INT_IN */
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,
228 GPIO10_GPIO | WAKEUP_ON_EDGE_RISE,
230 /* bluetooth (bcm2045) */
231 GPIO13_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
232 GPIO37_GPIO, /* RESET */
233 GPIO57_GPIO, /* WAKEUP */
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 */
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 */
267 GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */
268 GPIO28_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */
269 GPIO17_GPIO, /* CAM_FLASH */
273 #ifdef CONFIG_MACH_EZX_A780
274 static unsigned long a780_pin_config[] __initdata = {
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,
288 /* attenuate sound */
293 #ifdef CONFIG_MACH_EZX_E680
294 static unsigned long e680_pin_config[] __initdata = {
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,
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 */
323 #ifdef CONFIG_MACH_EZX_A1200
324 static unsigned long a1200_pin_config[] __initdata = {
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,
340 #ifdef CONFIG_MACH_EZX_A910
341 static unsigned long a910_pin_config[] __initdata = {
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,
356 GPIO89_GPIO, /* RESET */
357 GPIO33_GPIO, /* WAKEUP */
358 GPIO94_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */
365 #ifdef CONFIG_MACH_EZX_E2
366 static unsigned long e2_pin_config[] __initdata = {
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,
382 #ifdef CONFIG_MACH_EZX_E6
383 static unsigned long e6_pin_config[] __initdata = {
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,
400 #ifdef CONFIG_MACH_EZX_A780
401 static const unsigned int a780_key_map[] = {
405 KEY(0, 3, KEY_PAGEUP),
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),
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),
420 KEY(3, 0, KEY_NUMERIC_7),
421 KEY(3, 1, KEY_NUMERIC_8),
422 KEY(3, 2, KEY_NUMERIC_9),
424 KEY(3, 4, KEY_RIGHT),
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),
433 static struct matrix_keymap_data a780_matrix_keymap_data = {
434 .keymap = a780_key_map,
435 .keymap_size = ARRAY_SIZE(a780_key_map),
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,
443 .direct_key_map = { KEY_CAMERA },
446 .debounce_interval = 30,
448 #endif /* CONFIG_MACH_EZX_A780 */
450 #ifdef CONFIG_MACH_EZX_E680
451 static const unsigned int e680_key_map[] = {
453 KEY(0, 1, KEY_RIGHT),
454 KEY(0, 2, KEY_RESERVED),
459 KEY(1, 2, KEY_PAGEUP),
460 KEY(1, 3, KEY_PAGEDOWN),
462 KEY(2, 0, KEY_RESERVED),
463 KEY(2, 1, KEY_RESERVED),
464 KEY(2, 2, KEY_RESERVED),
465 KEY(2, 3, KEY_KPENTER),
468 static struct matrix_keymap_data e680_matrix_keymap_data = {
469 .keymap = e680_key_map,
470 .keymap_size = ARRAY_SIZE(e680_key_map),
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,
488 .debounce_interval = 30,
490 #endif /* CONFIG_MACH_EZX_E680 */
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),
501 KEY(1, 0, KEY_RESERVED),
503 KEY(1, 2, KEY_CAMERA),
504 KEY(1, 3, KEY_RESERVED),
505 KEY(1, 4, KEY_RESERVED),
506 KEY(1, 5, KEY_RESERVED),
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),
515 KEY(3, 0, KEY_RESERVED),
518 KEY(3, 3, KEY_RESERVED),
519 KEY(3, 4, KEY_RESERVED),
520 KEY(3, 5, KEY_RESERVED),
522 KEY(4, 0, KEY_RESERVED),
524 KEY(4, 2, KEY_PAGEUP),
525 KEY(4, 3, KEY_RESERVED),
526 KEY(4, 4, KEY_RESERVED),
527 KEY(4, 5, KEY_RESERVED),
530 static struct matrix_keymap_data a1200_matrix_keymap_data = {
531 .keymap = a1200_key_map,
532 .keymap_size = ARRAY_SIZE(a1200_key_map),
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,
540 .debounce_interval = 30,
542 #endif /* CONFIG_MACH_EZX_A1200 */
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),
553 KEY(1, 0, KEY_RESERVED),
555 KEY(1, 2, KEY_PROG1),
556 KEY(1, 3, KEY_RESERVED),
557 KEY(1, 4, KEY_RESERVED),
558 KEY(1, 5, KEY_RESERVED),
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),
567 KEY(3, 0, KEY_RESERVED),
570 KEY(3, 3, KEY_RESERVED),
571 KEY(3, 4, KEY_RESERVED),
572 KEY(3, 5, KEY_PLAYPAUSE),
574 KEY(4, 0, KEY_RESERVED),
576 KEY(4, 2, KEY_PAGEUP),
577 KEY(4, 3, KEY_RESERVED),
578 KEY(4, 4, KEY_RESERVED),
579 KEY(4, 5, KEY_PREVIOUSSONG),
582 static struct matrix_keymap_data e6_keymap_data = {
583 .keymap = e6_key_map,
584 .keymap_size = ARRAY_SIZE(e6_key_map),
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,
592 .debounce_interval = 30,
594 #endif /* CONFIG_MACH_EZX_E6 */
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),
605 KEY(1, 0, KEY_NUMERIC_8),
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),
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 */
617 KEY(2, 5, KEY_SELECT),
619 KEY(3, 0, KEY_NUMERIC_2),
622 KEY(3, 3, KEY_NUMERIC_0),
623 KEY(3, 4, KEY_NUMERIC_1),
624 KEY(3, 5, KEY_RECORD),
626 KEY(4, 0, KEY_NUMERIC_4),
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),
634 static struct matrix_keymap_data a910_matrix_keymap_data = {
635 .keymap = a910_key_map,
636 .keymap_size = ARRAY_SIZE(a910_key_map),
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,
644 .debounce_interval = 30,
646 #endif /* CONFIG_MACH_EZX_A910 */
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 */
657 KEY(1, 0, KEY_NUMERIC_8),
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 */
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),
669 KEY(2, 5, KEY_NUMERIC_0),
671 KEY(3, 0, KEY_NUMERIC_2),
674 KEY(3, 3, KEY_PLAYPAUSE),
675 KEY(3, 4, KEY_NUMERIC_1),
676 KEY(3, 5, KEY_SOUND), /* Music SoftKey */
678 KEY(4, 0, KEY_NUMERIC_4),
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),
686 static struct matrix_keymap_data e2_matrix_keymap_data = {
687 .keymap = e2_key_map,
688 .keymap_size = ARRAY_SIZE(e2_key_map),
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,
696 .debounce_interval = 30,
698 #endif /* CONFIG_MACH_EZX_E2 */
700 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910)
702 static struct regulator_consumer_supply camera_regulator_supplies[] = {
703 REGULATOR_SUPPLY("vdd", "0-005d"),
706 static struct regulator_init_data camera_regulator_initdata = {
707 .consumer_supplies = camera_regulator_supplies,
708 .num_consumer_supplies = ARRAY_SIZE(camera_regulator_supplies),
710 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
714 static struct fixed_voltage_config camera_regulator_config = {
715 .supply_name = "camera_vdd",
716 .microvolts = 2800000,
717 .init_data = &camera_regulator_initdata,
720 static struct platform_device camera_supply_regulator_device = {
721 .name = "reg-fixed-voltage",
724 .platform_data = &camera_regulator_config,
728 static struct gpiod_lookup_table camera_supply_gpiod_table = {
729 .dev_id = "reg-fixed-voltage.1",
731 GPIO_LOOKUP("gpio-pxa", GPIO50_nCAM_EN,
732 NULL, GPIO_ACTIVE_LOW),
738 #ifdef CONFIG_MACH_EZX_A780
740 static struct gpio_keys_button a780_buttons[] = {
743 .gpio = GPIO12_A780_FLIP_LID,
745 .desc = "A780 flip lid",
751 static struct gpio_keys_platform_data a780_gpio_keys_platform_data = {
752 .buttons = a780_buttons,
753 .nbuttons = ARRAY_SIZE(a780_buttons),
756 static struct platform_device a780_gpio_keys = {
760 .platform_data = &a780_gpio_keys_platform_data,
765 static int a780_camera_reset(struct device *dev)
767 gpio_set_value(GPIO19_GEN1_CAM_RST, 0);
769 gpio_set_value(GPIO19_GEN1_CAM_RST, 1);
774 static int a780_camera_init(void)
779 * GPIO50_nCAM_EN is active low
780 * GPIO19_GEN1_CAM_RST is active on rising edge
782 err = gpio_request(GPIO19_GEN1_CAM_RST, "CAM_RST");
784 pr_err("%s: Failed to request CAM_RST\n", __func__);
788 gpio_direction_output(GPIO19_GEN1_CAM_RST, 0);
789 a780_camera_reset(NULL);
794 struct pxacamera_platform_data a780_pxacamera_platform_data = {
795 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
796 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN |
799 .sensor_i2c_adapter_id = 0,
800 .sensor_i2c_address = 0x5d,
803 static struct i2c_board_info a780_i2c_board_info[] = {
805 I2C_BOARD_INFO("mt9m111", 0x5d),
809 static struct platform_device *a780_devices[] __initdata = {
811 &camera_supply_regulator_device,
814 static void __init a780_init(void)
816 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
817 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
818 pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config));
820 pxa_set_ffuart_info(NULL);
821 pxa_set_btuart_info(NULL);
822 pxa_set_stuart_info(NULL);
824 pxa_set_i2c_info(NULL);
825 i2c_register_board_info(0, ARRAY_AND_SIZE(a780_i2c_board_info));
827 pxa_set_fb_info(NULL, &ezx_fb_info_1);
829 pxa_set_keypad_info(&a780_keypad_platform_data);
831 if (a780_camera_init() == 0)
832 pxa_set_camera_info(&a780_pxacamera_platform_data);
834 gpiod_add_lookup_table(&camera_supply_gpiod_table);
835 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
836 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
837 platform_add_devices(ARRAY_AND_SIZE(a780_devices));
838 regulator_has_full_constraints();
841 MACHINE_START(EZX_A780, "Motorola EZX A780")
842 .atag_offset = 0x100,
843 .map_io = pxa27x_map_io,
844 .nr_irqs = EZX_NR_IRQS,
845 .init_irq = pxa27x_init_irq,
846 .handle_irq = pxa27x_handle_irq,
847 .init_time = pxa_timer_init,
848 .init_machine = a780_init,
849 .restart = pxa_restart,
853 #ifdef CONFIG_MACH_EZX_E680
855 static struct gpio_keys_button e680_buttons[] = {
857 .code = KEY_SCREENLOCK,
858 .gpio = GPIO12_E680_LOCK_SWITCH,
860 .desc = "E680 lock switch",
866 static struct gpio_keys_platform_data e680_gpio_keys_platform_data = {
867 .buttons = e680_buttons,
868 .nbuttons = ARRAY_SIZE(e680_buttons),
871 static struct platform_device e680_gpio_keys = {
875 .platform_data = &e680_gpio_keys_platform_data,
879 static struct i2c_board_info __initdata e680_i2c_board_info[] = {
880 { I2C_BOARD_INFO("tea5767", 0x81) },
883 static struct platform_device *e680_devices[] __initdata = {
887 static void __init e680_init(void)
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));
893 pxa_set_ffuart_info(NULL);
894 pxa_set_btuart_info(NULL);
895 pxa_set_stuart_info(NULL);
897 pxa_set_i2c_info(NULL);
898 i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info));
900 pxa_set_fb_info(NULL, &ezx_fb_info_1);
902 pxa_set_keypad_info(&e680_keypad_platform_data);
904 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
905 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
906 platform_add_devices(ARRAY_AND_SIZE(e680_devices));
909 MACHINE_START(EZX_E680, "Motorola EZX E680")
910 .atag_offset = 0x100,
911 .map_io = pxa27x_map_io,
912 .nr_irqs = EZX_NR_IRQS,
913 .init_irq = pxa27x_init_irq,
914 .handle_irq = pxa27x_handle_irq,
915 .init_time = pxa_timer_init,
916 .init_machine = e680_init,
917 .restart = pxa_restart,
921 #ifdef CONFIG_MACH_EZX_A1200
923 static struct gpio_keys_button a1200_buttons[] = {
926 .gpio = GPIO15_A1200_FLIP_LID,
928 .desc = "A1200 flip lid",
934 static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = {
935 .buttons = a1200_buttons,
936 .nbuttons = ARRAY_SIZE(a1200_buttons),
939 static struct platform_device a1200_gpio_keys = {
943 .platform_data = &a1200_gpio_keys_platform_data,
947 static struct i2c_board_info __initdata a1200_i2c_board_info[] = {
948 { I2C_BOARD_INFO("tea5767", 0x81) },
951 static struct platform_device *a1200_devices[] __initdata = {
955 static void __init a1200_init(void)
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));
961 pxa_set_ffuart_info(NULL);
962 pxa_set_btuart_info(NULL);
963 pxa_set_stuart_info(NULL);
965 pxa_set_i2c_info(NULL);
966 i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info));
968 pxa_set_fb_info(NULL, &ezx_fb_info_2);
970 pxa_set_keypad_info(&a1200_keypad_platform_data);
972 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
973 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
974 platform_add_devices(ARRAY_AND_SIZE(a1200_devices));
977 MACHINE_START(EZX_A1200, "Motorola EZX A1200")
978 .atag_offset = 0x100,
979 .map_io = pxa27x_map_io,
980 .nr_irqs = EZX_NR_IRQS,
981 .init_irq = pxa27x_init_irq,
982 .handle_irq = pxa27x_handle_irq,
983 .init_time = pxa_timer_init,
984 .init_machine = a1200_init,
985 .restart = pxa_restart,
989 #ifdef CONFIG_MACH_EZX_A910
991 static struct gpio_keys_button a910_buttons[] = {
994 .gpio = GPIO15_A910_FLIP_LID,
996 .desc = "A910 flip lid",
1002 static struct gpio_keys_platform_data a910_gpio_keys_platform_data = {
1003 .buttons = a910_buttons,
1004 .nbuttons = ARRAY_SIZE(a910_buttons),
1007 static struct platform_device a910_gpio_keys = {
1008 .name = "gpio-keys",
1011 .platform_data = &a910_gpio_keys_platform_data,
1016 static int a910_camera_reset(struct device *dev)
1018 gpio_set_value(GPIO28_GEN2_CAM_RST, 0);
1020 gpio_set_value(GPIO28_GEN2_CAM_RST, 1);
1025 static int a910_camera_init(void)
1030 * GPIO50_nCAM_EN is active low
1031 * GPIO28_GEN2_CAM_RST is active on rising edge
1033 err = gpio_request(GPIO28_GEN2_CAM_RST, "CAM_RST");
1035 pr_err("%s: Failed to request CAM_RST\n", __func__);
1039 gpio_direction_output(GPIO28_GEN2_CAM_RST, 0);
1040 a910_camera_reset(NULL);
1045 struct pxacamera_platform_data a910_pxacamera_platform_data = {
1046 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
1047 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN |
1050 .sensor_i2c_adapter_id = 0,
1051 .sensor_i2c_address = 0x5d,
1055 static struct lp3944_platform_data a910_lp3944_leds = {
1056 .leds_size = LP3944_LEDS_MAX,
1059 .name = "a910:red:",
1060 .status = LP3944_LED_STATUS_OFF,
1061 .type = LP3944_LED_TYPE_LED,
1064 .name = "a910:green:",
1065 .status = LP3944_LED_STATUS_OFF,
1066 .type = LP3944_LED_TYPE_LED,
1069 .name = "a910:blue:",
1070 .status = LP3944_LED_STATUS_OFF,
1071 .type = LP3944_LED_TYPE_LED,
1073 /* Leds 3 and 4 are used as display power switches */
1075 .name = "a910::cli_display",
1076 .status = LP3944_LED_STATUS_OFF,
1077 .type = LP3944_LED_TYPE_LED_INVERTED
1080 .name = "a910::main_display",
1081 .status = LP3944_LED_STATUS_ON,
1082 .type = LP3944_LED_TYPE_LED_INVERTED
1084 [5] = { .type = LP3944_LED_TYPE_NONE },
1086 .name = "a910::torch",
1087 .status = LP3944_LED_STATUS_OFF,
1088 .type = LP3944_LED_TYPE_LED,
1091 .name = "a910::flash",
1092 .status = LP3944_LED_STATUS_OFF,
1093 .type = LP3944_LED_TYPE_LED_INVERTED,
1098 static struct i2c_board_info __initdata a910_i2c_board_info[] = {
1100 I2C_BOARD_INFO("lp3944", 0x60),
1101 .platform_data = &a910_lp3944_leds,
1104 I2C_BOARD_INFO("mt9m111", 0x5d),
1108 static struct platform_device *a910_devices[] __initdata = {
1110 &camera_supply_regulator_device,
1113 static void __init a910_init(void)
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));
1119 pxa_set_ffuart_info(NULL);
1120 pxa_set_btuart_info(NULL);
1121 pxa_set_stuart_info(NULL);
1123 pxa_set_i2c_info(NULL);
1124 i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info));
1126 pxa_set_fb_info(NULL, &ezx_fb_info_2);
1128 pxa_set_keypad_info(&a910_keypad_platform_data);
1130 if (a910_camera_init() == 0)
1131 pxa_set_camera_info(&a910_pxacamera_platform_data);
1133 gpiod_add_lookup_table(&camera_supply_gpiod_table);
1134 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1135 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1136 platform_add_devices(ARRAY_AND_SIZE(a910_devices));
1137 regulator_has_full_constraints();
1140 MACHINE_START(EZX_A910, "Motorola EZX A910")
1141 .atag_offset = 0x100,
1142 .map_io = pxa27x_map_io,
1143 .nr_irqs = EZX_NR_IRQS,
1144 .init_irq = pxa27x_init_irq,
1145 .handle_irq = pxa27x_handle_irq,
1146 .init_time = pxa_timer_init,
1147 .init_machine = a910_init,
1148 .restart = pxa_restart,
1152 #ifdef CONFIG_MACH_EZX_E6
1154 static struct gpio_keys_button e6_buttons[] = {
1156 .code = KEY_SCREENLOCK,
1157 .gpio = GPIO15_E6_LOCK_SWITCH,
1159 .desc = "E6 lock switch",
1165 static struct gpio_keys_platform_data e6_gpio_keys_platform_data = {
1166 .buttons = e6_buttons,
1167 .nbuttons = ARRAY_SIZE(e6_buttons),
1170 static struct platform_device e6_gpio_keys = {
1171 .name = "gpio-keys",
1174 .platform_data = &e6_gpio_keys_platform_data,
1178 static struct i2c_board_info __initdata e6_i2c_board_info[] = {
1179 { I2C_BOARD_INFO("tea5767", 0x81) },
1182 static struct platform_device *e6_devices[] __initdata = {
1186 static void __init e6_init(void)
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));
1192 pxa_set_ffuart_info(NULL);
1193 pxa_set_btuart_info(NULL);
1194 pxa_set_stuart_info(NULL);
1196 pxa_set_i2c_info(NULL);
1197 i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info));
1199 pxa_set_fb_info(NULL, &ezx_fb_info_2);
1201 pxa_set_keypad_info(&e6_keypad_platform_data);
1203 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1204 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1205 platform_add_devices(ARRAY_AND_SIZE(e6_devices));
1208 MACHINE_START(EZX_E6, "Motorola EZX E6")
1209 .atag_offset = 0x100,
1210 .map_io = pxa27x_map_io,
1211 .nr_irqs = EZX_NR_IRQS,
1212 .init_irq = pxa27x_init_irq,
1213 .handle_irq = pxa27x_handle_irq,
1214 .init_time = pxa_timer_init,
1215 .init_machine = e6_init,
1216 .restart = pxa_restart,
1220 #ifdef CONFIG_MACH_EZX_E2
1221 static struct i2c_board_info __initdata e2_i2c_board_info[] = {
1222 { I2C_BOARD_INFO("tea5767", 0x81) },
1225 static struct platform_device *e2_devices[] __initdata = {
1228 static void __init e2_init(void)
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));
1234 pxa_set_ffuart_info(NULL);
1235 pxa_set_btuart_info(NULL);
1236 pxa_set_stuart_info(NULL);
1238 pxa_set_i2c_info(NULL);
1239 i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info));
1241 pxa_set_fb_info(NULL, &ezx_fb_info_2);
1243 pxa_set_keypad_info(&e2_keypad_platform_data);
1245 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1246 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1247 platform_add_devices(ARRAY_AND_SIZE(e2_devices));
1250 MACHINE_START(EZX_E2, "Motorola EZX E2")
1251 .atag_offset = 0x100,
1252 .map_io = pxa27x_map_io,
1253 .nr_irqs = EZX_NR_IRQS,
1254 .init_irq = pxa27x_init_irq,
1255 .handle_irq = pxa27x_handle_irq,
1256 .init_time = pxa_timer_init,
1257 .init_machine = e2_init,
1258 .restart = pxa_restart,