1 // SPDX-License-Identifier: GPL-2.0-only
3 * ezx.c - Common code for the EZX platform.
5 * Copyright (C) 2005-2006 Harald Welte <laforge@openezx.org>,
6 * 2007-2008 Daniel Ribeiro <drwyrm@gmail.com>,
7 * 2007-2008 Stefan Schmidt <stefan@datenfreihafen.org>
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/delay.h>
14 #include <linux/pwm.h>
15 #include <linux/pwm_backlight.h>
16 #include <linux/regulator/machine.h>
17 #include <linux/regulator/fixed.h>
18 #include <linux/input.h>
19 #include <linux/gpio.h>
20 #include <linux/gpio/machine.h>
21 #include <linux/gpio_keys.h>
22 #include <linux/leds-lp3944.h>
23 #include <linux/platform_data/i2c-pxa.h>
25 #include <asm/setup.h>
26 #include <asm/mach-types.h>
27 #include <asm/mach/arch.h>
30 #include <linux/platform_data/video-pxafb.h>
31 #include <linux/platform_data/usb-ohci-pxa27x.h>
32 #include <mach/hardware.h>
33 #include <linux/platform_data/keypad-pxa27x.h>
34 #include <linux/platform_data/media/camera-pxa.h>
39 #define EZX_NR_IRQS (IRQ_BOARD_START + 24)
41 #define GPIO12_A780_FLIP_LID 12
42 #define GPIO15_A1200_FLIP_LID 15
43 #define GPIO15_A910_FLIP_LID 15
44 #define GPIO12_E680_LOCK_SWITCH 12
45 #define GPIO15_E6_LOCK_SWITCH 15
46 #define GPIO50_nCAM_EN 50
47 #define GPIO19_GEN1_CAM_RST 19
48 #define GPIO28_GEN2_CAM_RST 28
50 static struct pwm_lookup ezx_pwm_lookup[] __maybe_unused = {
51 PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78700,
55 static struct platform_pwm_backlight_data ezx_backlight_data = {
56 .max_brightness = 1023,
57 .dft_brightness = 1023,
61 static struct platform_device ezx_backlight_device = {
62 .name = "pwm-backlight",
64 .parent = &pxa27x_device_pwm0.dev,
65 .platform_data = &ezx_backlight_data,
69 static struct pxafb_mode_info mode_ezx_old = {
83 static struct pxafb_mach_info ezx_fb_info_1 __maybe_unused = {
84 .modes = &mode_ezx_old,
86 .lcd_conn = LCD_COLOR_TFT_16BPP,
89 static struct pxafb_mode_info mode_72r89803y01 = {
104 static struct pxafb_mach_info ezx_fb_info_2 __maybe_unused = {
105 .modes = &mode_72r89803y01,
107 .lcd_conn = LCD_COLOR_TFT_18BPP,
110 static struct platform_device *ezx_devices[] __initdata __maybe_unused = {
111 &ezx_backlight_device,
114 static unsigned long ezx_pin_config[] __initdata __maybe_unused = {
132 GPIO24_GPIO, /* pcap chip select */
133 GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, /* pcap interrupt */
134 GPIO4_GPIO | MFP_LPM_DRIVE_HIGH, /* WDI_AP */
135 GPIO55_GPIO | MFP_LPM_DRIVE_HIGH, /* SYS_RESTART */
144 GPIO11_GPIO, /* mmc detect */
146 /* usb to external transceiver */
154 /* usb to Neptune GSM chip */
163 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680)
164 static unsigned long gen1_pin_config[] __initdata = {
165 /* flip / lockswitch */
166 GPIO12_GPIO | WAKEUP_ON_EDGE_BOTH,
168 /* bluetooth (bcm2035) */
169 GPIO14_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
170 GPIO48_GPIO, /* RESET */
171 GPIO28_GPIO, /* WAKEUP */
173 /* Neptune handshake */
174 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
175 GPIO57_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
176 GPIO13_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI */
177 GPIO3_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI2 */
178 GPIO82_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
179 GPIO99_GPIO | MFP_LPM_DRIVE_HIGH, /* TC_MM_EN */
187 /* ssp2 pins to in */
188 GPIO22_GPIO, /* SSP2_SCLK */
189 GPIO37_GPIO, /* SSP2_SFRM */
190 GPIO38_GPIO, /* SSP2_TXD */
191 GPIO88_GPIO, /* SSP2_RXD */
206 GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */
207 GPIO19_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */
210 GPIO120_GPIO, /* EMU_MUX1 */
211 GPIO119_GPIO, /* EMU_MUX2 */
212 GPIO86_GPIO, /* SNP_INT_CTL */
213 GPIO87_GPIO, /* SNP_INT_IN */
217 #if defined(CONFIG_MACH_EZX_A1200) || defined(CONFIG_MACH_EZX_A910) || \
218 defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6)
219 static unsigned long gen2_pin_config[] __initdata = {
220 /* flip / lockswitch */
221 GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH,
224 GPIO10_GPIO | WAKEUP_ON_EDGE_RISE,
226 /* bluetooth (bcm2045) */
227 GPIO13_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
228 GPIO37_GPIO, /* RESET */
229 GPIO57_GPIO, /* WAKEUP */
231 /* Neptune handshake */
232 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
233 GPIO96_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
234 GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* WDI */
235 GPIO116_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
236 GPIO41_GPIO, /* BP_FLASH */
244 /* ssp2 pins to in */
245 GPIO22_GPIO, /* SSP2_SCLK */
246 GPIO14_GPIO, /* SSP2_SFRM */
247 GPIO38_GPIO, /* SSP2_TXD */
248 GPIO88_GPIO, /* SSP2_RXD */
263 GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */
264 GPIO28_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */
265 GPIO17_GPIO, /* CAM_FLASH */
269 #ifdef CONFIG_MACH_EZX_A780
270 static unsigned long a780_pin_config[] __initdata = {
272 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
273 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
274 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
275 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
276 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
277 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
284 /* attenuate sound */
289 #ifdef CONFIG_MACH_EZX_E680
290 static unsigned long e680_pin_config[] __initdata = {
292 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
293 GPIO96_KP_DKIN_3 | WAKEUP_ON_LEVEL_HIGH,
294 GPIO97_KP_DKIN_4 | WAKEUP_ON_LEVEL_HIGH,
295 GPIO98_KP_DKIN_5 | WAKEUP_ON_LEVEL_HIGH,
296 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
297 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
298 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
305 GPIO79_GPIO, /* VA_SEL_BUL */
306 GPIO80_GPIO, /* FLT_SEL_BUL */
307 GPIO78_GPIO, /* MIDI_RESET */
308 GPIO33_GPIO, /* MIDI_CS */
309 GPIO15_GPIO, /* MIDI_IRQ */
310 GPIO49_GPIO, /* MIDI_NPWE */
311 GPIO18_GPIO, /* MIDI_RDY */
319 #ifdef CONFIG_MACH_EZX_A1200
320 static unsigned long a1200_pin_config[] __initdata = {
322 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
323 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
324 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
325 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
326 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
336 #ifdef CONFIG_MACH_EZX_A910
337 static unsigned long a910_pin_config[] __initdata = {
339 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
340 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
341 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
342 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
343 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
352 GPIO89_GPIO, /* RESET */
353 GPIO33_GPIO, /* WAKEUP */
354 GPIO94_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */
361 #ifdef CONFIG_MACH_EZX_E2
362 static unsigned long e2_pin_config[] __initdata = {
364 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
365 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
366 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
367 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
368 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
378 #ifdef CONFIG_MACH_EZX_E6
379 static unsigned long e6_pin_config[] __initdata = {
381 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
382 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
383 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
384 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
385 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
396 #ifdef CONFIG_MACH_EZX_A780
397 static const unsigned int a780_key_map[] = {
401 KEY(0, 3, KEY_PAGEUP),
404 KEY(1, 0, KEY_NUMERIC_1),
405 KEY(1, 1, KEY_NUMERIC_2),
406 KEY(1, 2, KEY_NUMERIC_3),
407 KEY(1, 3, KEY_SELECT),
408 KEY(1, 4, KEY_KPENTER),
410 KEY(2, 0, KEY_NUMERIC_4),
411 KEY(2, 1, KEY_NUMERIC_5),
412 KEY(2, 2, KEY_NUMERIC_6),
413 KEY(2, 3, KEY_RECORD),
416 KEY(3, 0, KEY_NUMERIC_7),
417 KEY(3, 1, KEY_NUMERIC_8),
418 KEY(3, 2, KEY_NUMERIC_9),
420 KEY(3, 4, KEY_RIGHT),
422 KEY(4, 0, KEY_NUMERIC_STAR),
423 KEY(4, 1, KEY_NUMERIC_0),
424 KEY(4, 2, KEY_NUMERIC_POUND),
425 KEY(4, 3, KEY_PAGEDOWN),
429 static struct matrix_keymap_data a780_matrix_keymap_data = {
430 .keymap = a780_key_map,
431 .keymap_size = ARRAY_SIZE(a780_key_map),
434 static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
435 .matrix_key_rows = 5,
436 .matrix_key_cols = 5,
437 .matrix_keymap_data = &a780_matrix_keymap_data,
439 .direct_key_map = { KEY_CAMERA },
442 .debounce_interval = 30,
444 #endif /* CONFIG_MACH_EZX_A780 */
446 #ifdef CONFIG_MACH_EZX_E680
447 static const unsigned int e680_key_map[] = {
449 KEY(0, 1, KEY_RIGHT),
450 KEY(0, 2, KEY_RESERVED),
455 KEY(1, 2, KEY_PAGEUP),
456 KEY(1, 3, KEY_PAGEDOWN),
458 KEY(2, 0, KEY_RESERVED),
459 KEY(2, 1, KEY_RESERVED),
460 KEY(2, 2, KEY_RESERVED),
461 KEY(2, 3, KEY_KPENTER),
464 static struct matrix_keymap_data e680_matrix_keymap_data = {
465 .keymap = e680_key_map,
466 .keymap_size = ARRAY_SIZE(e680_key_map),
469 static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
470 .matrix_key_rows = 3,
471 .matrix_key_cols = 4,
472 .matrix_keymap_data = &e680_matrix_keymap_data,
484 .debounce_interval = 30,
486 #endif /* CONFIG_MACH_EZX_E680 */
488 #ifdef CONFIG_MACH_EZX_A1200
489 static const unsigned int a1200_key_map[] = {
490 KEY(0, 0, KEY_RESERVED),
491 KEY(0, 1, KEY_RIGHT),
492 KEY(0, 2, KEY_PAGEDOWN),
493 KEY(0, 3, KEY_RESERVED),
494 KEY(0, 4, KEY_RESERVED),
495 KEY(0, 5, KEY_RESERVED),
497 KEY(1, 0, KEY_RESERVED),
499 KEY(1, 2, KEY_CAMERA),
500 KEY(1, 3, KEY_RESERVED),
501 KEY(1, 4, KEY_RESERVED),
502 KEY(1, 5, KEY_RESERVED),
504 KEY(2, 0, KEY_RESERVED),
505 KEY(2, 1, KEY_KPENTER),
506 KEY(2, 2, KEY_RECORD),
507 KEY(2, 3, KEY_RESERVED),
508 KEY(2, 4, KEY_RESERVED),
509 KEY(2, 5, KEY_SELECT),
511 KEY(3, 0, KEY_RESERVED),
514 KEY(3, 3, KEY_RESERVED),
515 KEY(3, 4, KEY_RESERVED),
516 KEY(3, 5, KEY_RESERVED),
518 KEY(4, 0, KEY_RESERVED),
520 KEY(4, 2, KEY_PAGEUP),
521 KEY(4, 3, KEY_RESERVED),
522 KEY(4, 4, KEY_RESERVED),
523 KEY(4, 5, KEY_RESERVED),
526 static struct matrix_keymap_data a1200_matrix_keymap_data = {
527 .keymap = a1200_key_map,
528 .keymap_size = ARRAY_SIZE(a1200_key_map),
531 static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
532 .matrix_key_rows = 5,
533 .matrix_key_cols = 6,
534 .matrix_keymap_data = &a1200_matrix_keymap_data,
536 .debounce_interval = 30,
538 #endif /* CONFIG_MACH_EZX_A1200 */
540 #ifdef CONFIG_MACH_EZX_E6
541 static const unsigned int e6_key_map[] = {
542 KEY(0, 0, KEY_RESERVED),
543 KEY(0, 1, KEY_RIGHT),
544 KEY(0, 2, KEY_PAGEDOWN),
545 KEY(0, 3, KEY_RESERVED),
546 KEY(0, 4, KEY_RESERVED),
547 KEY(0, 5, KEY_NEXTSONG),
549 KEY(1, 0, KEY_RESERVED),
551 KEY(1, 2, KEY_PROG1),
552 KEY(1, 3, KEY_RESERVED),
553 KEY(1, 4, KEY_RESERVED),
554 KEY(1, 5, KEY_RESERVED),
556 KEY(2, 0, KEY_RESERVED),
557 KEY(2, 1, KEY_ENTER),
558 KEY(2, 2, KEY_CAMERA),
559 KEY(2, 3, KEY_RESERVED),
560 KEY(2, 4, KEY_RESERVED),
563 KEY(3, 0, KEY_RESERVED),
566 KEY(3, 3, KEY_RESERVED),
567 KEY(3, 4, KEY_RESERVED),
568 KEY(3, 5, KEY_PLAYPAUSE),
570 KEY(4, 0, KEY_RESERVED),
572 KEY(4, 2, KEY_PAGEUP),
573 KEY(4, 3, KEY_RESERVED),
574 KEY(4, 4, KEY_RESERVED),
575 KEY(4, 5, KEY_PREVIOUSSONG),
578 static struct matrix_keymap_data e6_keymap_data = {
579 .keymap = e6_key_map,
580 .keymap_size = ARRAY_SIZE(e6_key_map),
583 static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
584 .matrix_key_rows = 5,
585 .matrix_key_cols = 6,
586 .matrix_keymap_data = &e6_keymap_data,
588 .debounce_interval = 30,
590 #endif /* CONFIG_MACH_EZX_E6 */
592 #ifdef CONFIG_MACH_EZX_A910
593 static const unsigned int a910_key_map[] = {
594 KEY(0, 0, KEY_NUMERIC_6),
595 KEY(0, 1, KEY_RIGHT),
596 KEY(0, 2, KEY_PAGEDOWN),
597 KEY(0, 3, KEY_KPENTER),
598 KEY(0, 4, KEY_NUMERIC_5),
599 KEY(0, 5, KEY_CAMERA),
601 KEY(1, 0, KEY_NUMERIC_8),
603 KEY(1, 2, KEY_RESERVED),
604 KEY(1, 3, KEY_F1), /* Left SoftKey */
605 KEY(1, 4, KEY_NUMERIC_STAR),
606 KEY(1, 5, KEY_RESERVED),
608 KEY(2, 0, KEY_NUMERIC_7),
609 KEY(2, 1, KEY_NUMERIC_9),
610 KEY(2, 2, KEY_RECORD),
611 KEY(2, 3, KEY_F2), /* Right SoftKey */
613 KEY(2, 5, KEY_SELECT),
615 KEY(3, 0, KEY_NUMERIC_2),
618 KEY(3, 3, KEY_NUMERIC_0),
619 KEY(3, 4, KEY_NUMERIC_1),
620 KEY(3, 5, KEY_RECORD),
622 KEY(4, 0, KEY_NUMERIC_4),
624 KEY(4, 2, KEY_PAGEUP),
625 KEY(4, 3, KEY_NUMERIC_POUND),
626 KEY(4, 4, KEY_NUMERIC_3),
627 KEY(4, 5, KEY_RESERVED),
630 static struct matrix_keymap_data a910_matrix_keymap_data = {
631 .keymap = a910_key_map,
632 .keymap_size = ARRAY_SIZE(a910_key_map),
635 static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
636 .matrix_key_rows = 5,
637 .matrix_key_cols = 6,
638 .matrix_keymap_data = &a910_matrix_keymap_data,
640 .debounce_interval = 30,
642 #endif /* CONFIG_MACH_EZX_A910 */
644 #ifdef CONFIG_MACH_EZX_E2
645 static const unsigned int e2_key_map[] = {
646 KEY(0, 0, KEY_NUMERIC_6),
647 KEY(0, 1, KEY_RIGHT),
648 KEY(0, 2, KEY_NUMERIC_9),
649 KEY(0, 3, KEY_NEXTSONG),
650 KEY(0, 4, KEY_NUMERIC_5),
651 KEY(0, 5, KEY_F1), /* Left SoftKey */
653 KEY(1, 0, KEY_NUMERIC_8),
655 KEY(1, 2, KEY_RESERVED),
656 KEY(1, 3, KEY_PAGEUP),
657 KEY(1, 4, KEY_NUMERIC_STAR),
658 KEY(1, 5, KEY_F2), /* Right SoftKey */
660 KEY(2, 0, KEY_NUMERIC_7),
661 KEY(2, 1, KEY_KPENTER),
662 KEY(2, 2, KEY_RECORD),
663 KEY(2, 3, KEY_PAGEDOWN),
665 KEY(2, 5, KEY_NUMERIC_0),
667 KEY(3, 0, KEY_NUMERIC_2),
670 KEY(3, 3, KEY_PLAYPAUSE),
671 KEY(3, 4, KEY_NUMERIC_1),
672 KEY(3, 5, KEY_SOUND), /* Music SoftKey */
674 KEY(4, 0, KEY_NUMERIC_4),
676 KEY(4, 2, KEY_NUMERIC_POUND),
677 KEY(4, 3, KEY_PREVIOUSSONG),
678 KEY(4, 4, KEY_NUMERIC_3),
679 KEY(4, 5, KEY_RESERVED),
682 static struct matrix_keymap_data e2_matrix_keymap_data = {
683 .keymap = e2_key_map,
684 .keymap_size = ARRAY_SIZE(e2_key_map),
687 static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
688 .matrix_key_rows = 5,
689 .matrix_key_cols = 6,
690 .matrix_keymap_data = &e2_matrix_keymap_data,
692 .debounce_interval = 30,
694 #endif /* CONFIG_MACH_EZX_E2 */
696 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910)
698 static struct regulator_consumer_supply camera_regulator_supplies[] = {
699 REGULATOR_SUPPLY("vdd", "0-005d"),
702 static struct regulator_init_data camera_regulator_initdata = {
703 .consumer_supplies = camera_regulator_supplies,
704 .num_consumer_supplies = ARRAY_SIZE(camera_regulator_supplies),
706 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
710 static struct fixed_voltage_config camera_regulator_config = {
711 .supply_name = "camera_vdd",
712 .microvolts = 2800000,
713 .init_data = &camera_regulator_initdata,
716 static struct platform_device camera_supply_regulator_device = {
717 .name = "reg-fixed-voltage",
720 .platform_data = &camera_regulator_config,
724 static struct gpiod_lookup_table camera_supply_gpiod_table = {
725 .dev_id = "reg-fixed-voltage.1",
727 GPIO_LOOKUP("gpio-pxa", GPIO50_nCAM_EN,
728 NULL, GPIO_ACTIVE_LOW),
734 #ifdef CONFIG_MACH_EZX_A780
736 static struct gpio_keys_button a780_buttons[] = {
739 .gpio = GPIO12_A780_FLIP_LID,
741 .desc = "A780 flip lid",
747 static struct gpio_keys_platform_data a780_gpio_keys_platform_data = {
748 .buttons = a780_buttons,
749 .nbuttons = ARRAY_SIZE(a780_buttons),
752 static struct platform_device a780_gpio_keys = {
756 .platform_data = &a780_gpio_keys_platform_data,
761 static int a780_camera_reset(struct device *dev)
763 gpio_set_value(GPIO19_GEN1_CAM_RST, 0);
765 gpio_set_value(GPIO19_GEN1_CAM_RST, 1);
770 static int a780_camera_init(void)
775 * GPIO50_nCAM_EN is active low
776 * GPIO19_GEN1_CAM_RST is active on rising edge
778 err = gpio_request(GPIO19_GEN1_CAM_RST, "CAM_RST");
780 pr_err("%s: Failed to request CAM_RST\n", __func__);
784 gpio_direction_output(GPIO19_GEN1_CAM_RST, 0);
785 a780_camera_reset(NULL);
790 struct pxacamera_platform_data a780_pxacamera_platform_data = {
791 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
792 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN |
795 .sensor_i2c_adapter_id = 0,
796 .sensor_i2c_address = 0x5d,
799 static struct i2c_board_info a780_i2c_board_info[] = {
801 I2C_BOARD_INFO("mt9m111", 0x5d),
805 static struct platform_device *a780_devices[] __initdata = {
807 &camera_supply_regulator_device,
810 static void __init a780_init(void)
812 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
813 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
814 pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config));
816 pxa_set_ffuart_info(NULL);
817 pxa_set_btuart_info(NULL);
818 pxa_set_stuart_info(NULL);
820 pxa_set_i2c_info(NULL);
821 i2c_register_board_info(0, ARRAY_AND_SIZE(a780_i2c_board_info));
823 pxa_set_fb_info(NULL, &ezx_fb_info_1);
825 pxa_set_keypad_info(&a780_keypad_platform_data);
827 if (a780_camera_init() == 0)
828 pxa_set_camera_info(&a780_pxacamera_platform_data);
830 gpiod_add_lookup_table(&camera_supply_gpiod_table);
831 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
832 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
833 platform_add_devices(ARRAY_AND_SIZE(a780_devices));
834 regulator_has_full_constraints();
837 MACHINE_START(EZX_A780, "Motorola EZX A780")
838 .atag_offset = 0x100,
839 .map_io = pxa27x_map_io,
840 .nr_irqs = EZX_NR_IRQS,
841 .init_irq = pxa27x_init_irq,
842 .handle_irq = pxa27x_handle_irq,
843 .init_time = pxa_timer_init,
844 .init_machine = a780_init,
845 .restart = pxa_restart,
849 #ifdef CONFIG_MACH_EZX_E680
851 static struct gpio_keys_button e680_buttons[] = {
853 .code = KEY_SCREENLOCK,
854 .gpio = GPIO12_E680_LOCK_SWITCH,
856 .desc = "E680 lock switch",
862 static struct gpio_keys_platform_data e680_gpio_keys_platform_data = {
863 .buttons = e680_buttons,
864 .nbuttons = ARRAY_SIZE(e680_buttons),
867 static struct platform_device e680_gpio_keys = {
871 .platform_data = &e680_gpio_keys_platform_data,
875 static struct i2c_board_info __initdata e680_i2c_board_info[] = {
876 { I2C_BOARD_INFO("tea5767", 0x81) },
879 static struct platform_device *e680_devices[] __initdata = {
883 static void __init e680_init(void)
885 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
886 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
887 pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config));
889 pxa_set_ffuart_info(NULL);
890 pxa_set_btuart_info(NULL);
891 pxa_set_stuart_info(NULL);
893 pxa_set_i2c_info(NULL);
894 i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info));
896 pxa_set_fb_info(NULL, &ezx_fb_info_1);
898 pxa_set_keypad_info(&e680_keypad_platform_data);
900 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
901 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
902 platform_add_devices(ARRAY_AND_SIZE(e680_devices));
905 MACHINE_START(EZX_E680, "Motorola EZX E680")
906 .atag_offset = 0x100,
907 .map_io = pxa27x_map_io,
908 .nr_irqs = EZX_NR_IRQS,
909 .init_irq = pxa27x_init_irq,
910 .handle_irq = pxa27x_handle_irq,
911 .init_time = pxa_timer_init,
912 .init_machine = e680_init,
913 .restart = pxa_restart,
917 #ifdef CONFIG_MACH_EZX_A1200
919 static struct gpio_keys_button a1200_buttons[] = {
922 .gpio = GPIO15_A1200_FLIP_LID,
924 .desc = "A1200 flip lid",
930 static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = {
931 .buttons = a1200_buttons,
932 .nbuttons = ARRAY_SIZE(a1200_buttons),
935 static struct platform_device a1200_gpio_keys = {
939 .platform_data = &a1200_gpio_keys_platform_data,
943 static struct i2c_board_info __initdata a1200_i2c_board_info[] = {
944 { I2C_BOARD_INFO("tea5767", 0x81) },
947 static struct platform_device *a1200_devices[] __initdata = {
951 static void __init a1200_init(void)
953 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
954 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
955 pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config));
957 pxa_set_ffuart_info(NULL);
958 pxa_set_btuart_info(NULL);
959 pxa_set_stuart_info(NULL);
961 pxa_set_i2c_info(NULL);
962 i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info));
964 pxa_set_fb_info(NULL, &ezx_fb_info_2);
966 pxa_set_keypad_info(&a1200_keypad_platform_data);
968 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
969 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
970 platform_add_devices(ARRAY_AND_SIZE(a1200_devices));
973 MACHINE_START(EZX_A1200, "Motorola EZX A1200")
974 .atag_offset = 0x100,
975 .map_io = pxa27x_map_io,
976 .nr_irqs = EZX_NR_IRQS,
977 .init_irq = pxa27x_init_irq,
978 .handle_irq = pxa27x_handle_irq,
979 .init_time = pxa_timer_init,
980 .init_machine = a1200_init,
981 .restart = pxa_restart,
985 #ifdef CONFIG_MACH_EZX_A910
987 static struct gpio_keys_button a910_buttons[] = {
990 .gpio = GPIO15_A910_FLIP_LID,
992 .desc = "A910 flip lid",
998 static struct gpio_keys_platform_data a910_gpio_keys_platform_data = {
999 .buttons = a910_buttons,
1000 .nbuttons = ARRAY_SIZE(a910_buttons),
1003 static struct platform_device a910_gpio_keys = {
1004 .name = "gpio-keys",
1007 .platform_data = &a910_gpio_keys_platform_data,
1012 static int a910_camera_reset(struct device *dev)
1014 gpio_set_value(GPIO28_GEN2_CAM_RST, 0);
1016 gpio_set_value(GPIO28_GEN2_CAM_RST, 1);
1021 static int a910_camera_init(void)
1026 * GPIO50_nCAM_EN is active low
1027 * GPIO28_GEN2_CAM_RST is active on rising edge
1029 err = gpio_request(GPIO28_GEN2_CAM_RST, "CAM_RST");
1031 pr_err("%s: Failed to request CAM_RST\n", __func__);
1035 gpio_direction_output(GPIO28_GEN2_CAM_RST, 0);
1036 a910_camera_reset(NULL);
1041 struct pxacamera_platform_data a910_pxacamera_platform_data = {
1042 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
1043 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN |
1046 .sensor_i2c_adapter_id = 0,
1047 .sensor_i2c_address = 0x5d,
1051 static struct lp3944_platform_data a910_lp3944_leds = {
1052 .leds_size = LP3944_LEDS_MAX,
1055 .name = "a910:red:",
1056 .status = LP3944_LED_STATUS_OFF,
1057 .type = LP3944_LED_TYPE_LED,
1060 .name = "a910:green:",
1061 .status = LP3944_LED_STATUS_OFF,
1062 .type = LP3944_LED_TYPE_LED,
1065 .name = "a910:blue:",
1066 .status = LP3944_LED_STATUS_OFF,
1067 .type = LP3944_LED_TYPE_LED,
1069 /* Leds 3 and 4 are used as display power switches */
1071 .name = "a910::cli_display",
1072 .status = LP3944_LED_STATUS_OFF,
1073 .type = LP3944_LED_TYPE_LED_INVERTED
1076 .name = "a910::main_display",
1077 .status = LP3944_LED_STATUS_ON,
1078 .type = LP3944_LED_TYPE_LED_INVERTED
1080 [5] = { .type = LP3944_LED_TYPE_NONE },
1082 .name = "a910::torch",
1083 .status = LP3944_LED_STATUS_OFF,
1084 .type = LP3944_LED_TYPE_LED,
1087 .name = "a910::flash",
1088 .status = LP3944_LED_STATUS_OFF,
1089 .type = LP3944_LED_TYPE_LED_INVERTED,
1094 static struct i2c_board_info __initdata a910_i2c_board_info[] = {
1096 I2C_BOARD_INFO("lp3944", 0x60),
1097 .platform_data = &a910_lp3944_leds,
1100 I2C_BOARD_INFO("mt9m111", 0x5d),
1104 static struct platform_device *a910_devices[] __initdata = {
1106 &camera_supply_regulator_device,
1109 static void __init a910_init(void)
1111 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1112 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1113 pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config));
1115 pxa_set_ffuart_info(NULL);
1116 pxa_set_btuart_info(NULL);
1117 pxa_set_stuart_info(NULL);
1119 pxa_set_i2c_info(NULL);
1120 i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info));
1122 pxa_set_fb_info(NULL, &ezx_fb_info_2);
1124 pxa_set_keypad_info(&a910_keypad_platform_data);
1126 if (a910_camera_init() == 0)
1127 pxa_set_camera_info(&a910_pxacamera_platform_data);
1129 gpiod_add_lookup_table(&camera_supply_gpiod_table);
1130 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1131 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1132 platform_add_devices(ARRAY_AND_SIZE(a910_devices));
1133 regulator_has_full_constraints();
1136 MACHINE_START(EZX_A910, "Motorola EZX A910")
1137 .atag_offset = 0x100,
1138 .map_io = pxa27x_map_io,
1139 .nr_irqs = EZX_NR_IRQS,
1140 .init_irq = pxa27x_init_irq,
1141 .handle_irq = pxa27x_handle_irq,
1142 .init_time = pxa_timer_init,
1143 .init_machine = a910_init,
1144 .restart = pxa_restart,
1148 #ifdef CONFIG_MACH_EZX_E6
1150 static struct gpio_keys_button e6_buttons[] = {
1152 .code = KEY_SCREENLOCK,
1153 .gpio = GPIO15_E6_LOCK_SWITCH,
1155 .desc = "E6 lock switch",
1161 static struct gpio_keys_platform_data e6_gpio_keys_platform_data = {
1162 .buttons = e6_buttons,
1163 .nbuttons = ARRAY_SIZE(e6_buttons),
1166 static struct platform_device e6_gpio_keys = {
1167 .name = "gpio-keys",
1170 .platform_data = &e6_gpio_keys_platform_data,
1174 static struct i2c_board_info __initdata e6_i2c_board_info[] = {
1175 { I2C_BOARD_INFO("tea5767", 0x81) },
1178 static struct platform_device *e6_devices[] __initdata = {
1182 static void __init e6_init(void)
1184 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1185 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1186 pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config));
1188 pxa_set_ffuart_info(NULL);
1189 pxa_set_btuart_info(NULL);
1190 pxa_set_stuart_info(NULL);
1192 pxa_set_i2c_info(NULL);
1193 i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info));
1195 pxa_set_fb_info(NULL, &ezx_fb_info_2);
1197 pxa_set_keypad_info(&e6_keypad_platform_data);
1199 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1200 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1201 platform_add_devices(ARRAY_AND_SIZE(e6_devices));
1204 MACHINE_START(EZX_E6, "Motorola EZX E6")
1205 .atag_offset = 0x100,
1206 .map_io = pxa27x_map_io,
1207 .nr_irqs = EZX_NR_IRQS,
1208 .init_irq = pxa27x_init_irq,
1209 .handle_irq = pxa27x_handle_irq,
1210 .init_time = pxa_timer_init,
1211 .init_machine = e6_init,
1212 .restart = pxa_restart,
1216 #ifdef CONFIG_MACH_EZX_E2
1217 static struct i2c_board_info __initdata e2_i2c_board_info[] = {
1218 { I2C_BOARD_INFO("tea5767", 0x81) },
1221 static struct platform_device *e2_devices[] __initdata = {
1224 static void __init e2_init(void)
1226 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1227 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1228 pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config));
1230 pxa_set_ffuart_info(NULL);
1231 pxa_set_btuart_info(NULL);
1232 pxa_set_stuart_info(NULL);
1234 pxa_set_i2c_info(NULL);
1235 i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info));
1237 pxa_set_fb_info(NULL, &ezx_fb_info_2);
1239 pxa_set_keypad_info(&e2_keypad_platform_data);
1241 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1242 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1243 platform_add_devices(ARRAY_AND_SIZE(e2_devices));
1246 MACHINE_START(EZX_E2, "Motorola EZX E2")
1247 .atag_offset = 0x100,
1248 .map_io = pxa27x_map_io,
1249 .nr_irqs = EZX_NR_IRQS,
1250 .init_irq = pxa27x_init_irq,
1251 .handle_irq = pxa27x_handle_irq,
1252 .init_time = pxa_timer_init,
1253 .init_machine = e2_init,
1254 .restart = pxa_restart,