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,
60 static struct platform_device ezx_backlight_device
= {
61 .name
= "pwm-backlight",
63 .parent
= &pxa27x_device_pwm0
.dev
,
64 .platform_data
= &ezx_backlight_data
,
68 static struct pxafb_mode_info mode_ezx_old
= {
82 static struct pxafb_mach_info ezx_fb_info_1 __maybe_unused
= {
83 .modes
= &mode_ezx_old
,
85 .lcd_conn
= LCD_COLOR_TFT_16BPP
,
88 static struct pxafb_mode_info mode_72r89803y01
= {
103 static struct pxafb_mach_info ezx_fb_info_2 __maybe_unused
= {
104 .modes
= &mode_72r89803y01
,
106 .lcd_conn
= LCD_COLOR_TFT_18BPP
,
109 static struct platform_device
*ezx_devices
[] __initdata __maybe_unused
= {
110 &ezx_backlight_device
,
113 static unsigned long ezx_pin_config
[] __initdata __maybe_unused
= {
131 GPIO24_GPIO
, /* pcap chip select */
132 GPIO1_GPIO
| WAKEUP_ON_EDGE_RISE
, /* pcap interrupt */
133 GPIO4_GPIO
| MFP_LPM_DRIVE_HIGH
, /* WDI_AP */
134 GPIO55_GPIO
| MFP_LPM_DRIVE_HIGH
, /* SYS_RESTART */
143 GPIO11_GPIO
, /* mmc detect */
145 /* usb to external transceiver */
153 /* usb to Neptune GSM chip */
162 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680)
163 static unsigned long gen1_pin_config
[] __initdata
= {
164 /* flip / lockswitch */
165 GPIO12_GPIO
| WAKEUP_ON_EDGE_BOTH
,
167 /* bluetooth (bcm2035) */
168 GPIO14_GPIO
| WAKEUP_ON_EDGE_RISE
, /* HOSTWAKE */
169 GPIO48_GPIO
, /* RESET */
170 GPIO28_GPIO
, /* WAKEUP */
172 /* Neptune handshake */
173 GPIO0_GPIO
| WAKEUP_ON_EDGE_FALL
, /* BP_RDY */
174 GPIO57_GPIO
| MFP_LPM_DRIVE_HIGH
, /* AP_RDY */
175 GPIO13_GPIO
| WAKEUP_ON_EDGE_BOTH
, /* WDI */
176 GPIO3_GPIO
| WAKEUP_ON_EDGE_BOTH
, /* WDI2 */
177 GPIO82_GPIO
| MFP_LPM_DRIVE_HIGH
, /* RESET */
178 GPIO99_GPIO
| MFP_LPM_DRIVE_HIGH
, /* TC_MM_EN */
186 /* ssp2 pins to in */
187 GPIO22_GPIO
, /* SSP2_SCLK */
188 GPIO37_GPIO
, /* SSP2_SFRM */
189 GPIO38_GPIO
, /* SSP2_TXD */
190 GPIO88_GPIO
, /* SSP2_RXD */
205 GPIO50_GPIO
| MFP_LPM_DRIVE_HIGH
, /* CAM_EN */
206 GPIO19_GPIO
| MFP_LPM_DRIVE_HIGH
, /* CAM_RST */
209 GPIO120_GPIO
, /* EMU_MUX1 */
210 GPIO119_GPIO
, /* EMU_MUX2 */
211 GPIO86_GPIO
, /* SNP_INT_CTL */
212 GPIO87_GPIO
, /* SNP_INT_IN */
216 #if defined(CONFIG_MACH_EZX_A1200) || defined(CONFIG_MACH_EZX_A910) || \
217 defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6)
218 static unsigned long gen2_pin_config
[] __initdata
= {
219 /* flip / lockswitch */
220 GPIO15_GPIO
| WAKEUP_ON_EDGE_BOTH
,
223 GPIO10_GPIO
| WAKEUP_ON_EDGE_RISE
,
225 /* bluetooth (bcm2045) */
226 GPIO13_GPIO
| WAKEUP_ON_EDGE_RISE
, /* HOSTWAKE */
227 GPIO37_GPIO
, /* RESET */
228 GPIO57_GPIO
, /* WAKEUP */
230 /* Neptune handshake */
231 GPIO0_GPIO
| WAKEUP_ON_EDGE_FALL
, /* BP_RDY */
232 GPIO96_GPIO
| MFP_LPM_DRIVE_HIGH
, /* AP_RDY */
233 GPIO3_GPIO
| WAKEUP_ON_EDGE_FALL
, /* WDI */
234 GPIO116_GPIO
| MFP_LPM_DRIVE_HIGH
, /* RESET */
235 GPIO41_GPIO
, /* BP_FLASH */
243 /* ssp2 pins to in */
244 GPIO22_GPIO
, /* SSP2_SCLK */
245 GPIO14_GPIO
, /* SSP2_SFRM */
246 GPIO38_GPIO
, /* SSP2_TXD */
247 GPIO88_GPIO
, /* SSP2_RXD */
262 GPIO50_GPIO
| MFP_LPM_DRIVE_HIGH
, /* CAM_EN */
263 GPIO28_GPIO
| MFP_LPM_DRIVE_HIGH
, /* CAM_RST */
264 GPIO17_GPIO
, /* CAM_FLASH */
268 #ifdef CONFIG_MACH_EZX_A780
269 static unsigned long a780_pin_config
[] __initdata
= {
271 GPIO93_KP_DKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
272 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
273 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
274 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
275 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
276 GPIO98_KP_MKIN_4
| WAKEUP_ON_LEVEL_HIGH
,
283 /* attenuate sound */
288 #ifdef CONFIG_MACH_EZX_E680
289 static unsigned long e680_pin_config
[] __initdata
= {
291 GPIO93_KP_DKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
292 GPIO96_KP_DKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
293 GPIO97_KP_DKIN_4
| WAKEUP_ON_LEVEL_HIGH
,
294 GPIO98_KP_DKIN_5
| WAKEUP_ON_LEVEL_HIGH
,
295 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
296 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
297 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
304 GPIO79_GPIO
, /* VA_SEL_BUL */
305 GPIO80_GPIO
, /* FLT_SEL_BUL */
306 GPIO78_GPIO
, /* MIDI_RESET */
307 GPIO33_GPIO
, /* MIDI_CS */
308 GPIO15_GPIO
, /* MIDI_IRQ */
309 GPIO49_GPIO
, /* MIDI_NPWE */
310 GPIO18_GPIO
, /* MIDI_RDY */
318 #ifdef CONFIG_MACH_EZX_A1200
319 static unsigned long a1200_pin_config
[] __initdata
= {
321 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
322 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
323 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
324 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
325 GPIO98_KP_MKIN_4
| WAKEUP_ON_LEVEL_HIGH
,
335 #ifdef CONFIG_MACH_EZX_A910
336 static unsigned long a910_pin_config
[] __initdata
= {
338 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
339 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
340 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
341 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
342 GPIO98_KP_MKIN_4
| WAKEUP_ON_LEVEL_HIGH
,
351 GPIO89_GPIO
, /* RESET */
352 GPIO33_GPIO
, /* WAKEUP */
353 GPIO94_GPIO
| WAKEUP_ON_LEVEL_HIGH
, /* HOSTWAKE */
360 #ifdef CONFIG_MACH_EZX_E2
361 static unsigned long e2_pin_config
[] __initdata
= {
363 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
364 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
365 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
366 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
367 GPIO98_KP_MKIN_4
| WAKEUP_ON_LEVEL_HIGH
,
377 #ifdef CONFIG_MACH_EZX_E6
378 static unsigned long e6_pin_config
[] __initdata
= {
380 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
381 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
382 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
383 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
384 GPIO98_KP_MKIN_4
| WAKEUP_ON_LEVEL_HIGH
,
395 #ifdef CONFIG_MACH_EZX_A780
396 static const unsigned int a780_key_map
[] = {
400 KEY(0, 3, KEY_PAGEUP
),
403 KEY(1, 0, KEY_NUMERIC_1
),
404 KEY(1, 1, KEY_NUMERIC_2
),
405 KEY(1, 2, KEY_NUMERIC_3
),
406 KEY(1, 3, KEY_SELECT
),
407 KEY(1, 4, KEY_KPENTER
),
409 KEY(2, 0, KEY_NUMERIC_4
),
410 KEY(2, 1, KEY_NUMERIC_5
),
411 KEY(2, 2, KEY_NUMERIC_6
),
412 KEY(2, 3, KEY_RECORD
),
415 KEY(3, 0, KEY_NUMERIC_7
),
416 KEY(3, 1, KEY_NUMERIC_8
),
417 KEY(3, 2, KEY_NUMERIC_9
),
419 KEY(3, 4, KEY_RIGHT
),
421 KEY(4, 0, KEY_NUMERIC_STAR
),
422 KEY(4, 1, KEY_NUMERIC_0
),
423 KEY(4, 2, KEY_NUMERIC_POUND
),
424 KEY(4, 3, KEY_PAGEDOWN
),
428 static struct matrix_keymap_data a780_matrix_keymap_data
= {
429 .keymap
= a780_key_map
,
430 .keymap_size
= ARRAY_SIZE(a780_key_map
),
433 static struct pxa27x_keypad_platform_data a780_keypad_platform_data
= {
434 .matrix_key_rows
= 5,
435 .matrix_key_cols
= 5,
436 .matrix_keymap_data
= &a780_matrix_keymap_data
,
438 .direct_key_map
= { KEY_CAMERA
},
441 .debounce_interval
= 30,
443 #endif /* CONFIG_MACH_EZX_A780 */
445 #ifdef CONFIG_MACH_EZX_E680
446 static const unsigned int e680_key_map
[] = {
448 KEY(0, 1, KEY_RIGHT
),
449 KEY(0, 2, KEY_RESERVED
),
454 KEY(1, 2, KEY_PAGEUP
),
455 KEY(1, 3, KEY_PAGEDOWN
),
457 KEY(2, 0, KEY_RESERVED
),
458 KEY(2, 1, KEY_RESERVED
),
459 KEY(2, 2, KEY_RESERVED
),
460 KEY(2, 3, KEY_KPENTER
),
463 static struct matrix_keymap_data e680_matrix_keymap_data
= {
464 .keymap
= e680_key_map
,
465 .keymap_size
= ARRAY_SIZE(e680_key_map
),
468 static struct pxa27x_keypad_platform_data e680_keypad_platform_data
= {
469 .matrix_key_rows
= 3,
470 .matrix_key_cols
= 4,
471 .matrix_keymap_data
= &e680_matrix_keymap_data
,
483 .debounce_interval
= 30,
485 #endif /* CONFIG_MACH_EZX_E680 */
487 #ifdef CONFIG_MACH_EZX_A1200
488 static const unsigned int a1200_key_map
[] = {
489 KEY(0, 0, KEY_RESERVED
),
490 KEY(0, 1, KEY_RIGHT
),
491 KEY(0, 2, KEY_PAGEDOWN
),
492 KEY(0, 3, KEY_RESERVED
),
493 KEY(0, 4, KEY_RESERVED
),
494 KEY(0, 5, KEY_RESERVED
),
496 KEY(1, 0, KEY_RESERVED
),
498 KEY(1, 2, KEY_CAMERA
),
499 KEY(1, 3, KEY_RESERVED
),
500 KEY(1, 4, KEY_RESERVED
),
501 KEY(1, 5, KEY_RESERVED
),
503 KEY(2, 0, KEY_RESERVED
),
504 KEY(2, 1, KEY_KPENTER
),
505 KEY(2, 2, KEY_RECORD
),
506 KEY(2, 3, KEY_RESERVED
),
507 KEY(2, 4, KEY_RESERVED
),
508 KEY(2, 5, KEY_SELECT
),
510 KEY(3, 0, KEY_RESERVED
),
513 KEY(3, 3, KEY_RESERVED
),
514 KEY(3, 4, KEY_RESERVED
),
515 KEY(3, 5, KEY_RESERVED
),
517 KEY(4, 0, KEY_RESERVED
),
519 KEY(4, 2, KEY_PAGEUP
),
520 KEY(4, 3, KEY_RESERVED
),
521 KEY(4, 4, KEY_RESERVED
),
522 KEY(4, 5, KEY_RESERVED
),
525 static struct matrix_keymap_data a1200_matrix_keymap_data
= {
526 .keymap
= a1200_key_map
,
527 .keymap_size
= ARRAY_SIZE(a1200_key_map
),
530 static struct pxa27x_keypad_platform_data a1200_keypad_platform_data
= {
531 .matrix_key_rows
= 5,
532 .matrix_key_cols
= 6,
533 .matrix_keymap_data
= &a1200_matrix_keymap_data
,
535 .debounce_interval
= 30,
537 #endif /* CONFIG_MACH_EZX_A1200 */
539 #ifdef CONFIG_MACH_EZX_E6
540 static const unsigned int e6_key_map
[] = {
541 KEY(0, 0, KEY_RESERVED
),
542 KEY(0, 1, KEY_RIGHT
),
543 KEY(0, 2, KEY_PAGEDOWN
),
544 KEY(0, 3, KEY_RESERVED
),
545 KEY(0, 4, KEY_RESERVED
),
546 KEY(0, 5, KEY_NEXTSONG
),
548 KEY(1, 0, KEY_RESERVED
),
550 KEY(1, 2, KEY_PROG1
),
551 KEY(1, 3, KEY_RESERVED
),
552 KEY(1, 4, KEY_RESERVED
),
553 KEY(1, 5, KEY_RESERVED
),
555 KEY(2, 0, KEY_RESERVED
),
556 KEY(2, 1, KEY_ENTER
),
557 KEY(2, 2, KEY_CAMERA
),
558 KEY(2, 3, KEY_RESERVED
),
559 KEY(2, 4, KEY_RESERVED
),
562 KEY(3, 0, KEY_RESERVED
),
565 KEY(3, 3, KEY_RESERVED
),
566 KEY(3, 4, KEY_RESERVED
),
567 KEY(3, 5, KEY_PLAYPAUSE
),
569 KEY(4, 0, KEY_RESERVED
),
571 KEY(4, 2, KEY_PAGEUP
),
572 KEY(4, 3, KEY_RESERVED
),
573 KEY(4, 4, KEY_RESERVED
),
574 KEY(4, 5, KEY_PREVIOUSSONG
),
577 static struct matrix_keymap_data e6_keymap_data
= {
578 .keymap
= e6_key_map
,
579 .keymap_size
= ARRAY_SIZE(e6_key_map
),
582 static struct pxa27x_keypad_platform_data e6_keypad_platform_data
= {
583 .matrix_key_rows
= 5,
584 .matrix_key_cols
= 6,
585 .matrix_keymap_data
= &e6_keymap_data
,
587 .debounce_interval
= 30,
589 #endif /* CONFIG_MACH_EZX_E6 */
591 #ifdef CONFIG_MACH_EZX_A910
592 static const unsigned int a910_key_map
[] = {
593 KEY(0, 0, KEY_NUMERIC_6
),
594 KEY(0, 1, KEY_RIGHT
),
595 KEY(0, 2, KEY_PAGEDOWN
),
596 KEY(0, 3, KEY_KPENTER
),
597 KEY(0, 4, KEY_NUMERIC_5
),
598 KEY(0, 5, KEY_CAMERA
),
600 KEY(1, 0, KEY_NUMERIC_8
),
602 KEY(1, 2, KEY_RESERVED
),
603 KEY(1, 3, KEY_F1
), /* Left SoftKey */
604 KEY(1, 4, KEY_NUMERIC_STAR
),
605 KEY(1, 5, KEY_RESERVED
),
607 KEY(2, 0, KEY_NUMERIC_7
),
608 KEY(2, 1, KEY_NUMERIC_9
),
609 KEY(2, 2, KEY_RECORD
),
610 KEY(2, 3, KEY_F2
), /* Right SoftKey */
612 KEY(2, 5, KEY_SELECT
),
614 KEY(3, 0, KEY_NUMERIC_2
),
617 KEY(3, 3, KEY_NUMERIC_0
),
618 KEY(3, 4, KEY_NUMERIC_1
),
619 KEY(3, 5, KEY_RECORD
),
621 KEY(4, 0, KEY_NUMERIC_4
),
623 KEY(4, 2, KEY_PAGEUP
),
624 KEY(4, 3, KEY_NUMERIC_POUND
),
625 KEY(4, 4, KEY_NUMERIC_3
),
626 KEY(4, 5, KEY_RESERVED
),
629 static struct matrix_keymap_data a910_matrix_keymap_data
= {
630 .keymap
= a910_key_map
,
631 .keymap_size
= ARRAY_SIZE(a910_key_map
),
634 static struct pxa27x_keypad_platform_data a910_keypad_platform_data
= {
635 .matrix_key_rows
= 5,
636 .matrix_key_cols
= 6,
637 .matrix_keymap_data
= &a910_matrix_keymap_data
,
639 .debounce_interval
= 30,
641 #endif /* CONFIG_MACH_EZX_A910 */
643 #ifdef CONFIG_MACH_EZX_E2
644 static const unsigned int e2_key_map
[] = {
645 KEY(0, 0, KEY_NUMERIC_6
),
646 KEY(0, 1, KEY_RIGHT
),
647 KEY(0, 2, KEY_NUMERIC_9
),
648 KEY(0, 3, KEY_NEXTSONG
),
649 KEY(0, 4, KEY_NUMERIC_5
),
650 KEY(0, 5, KEY_F1
), /* Left SoftKey */
652 KEY(1, 0, KEY_NUMERIC_8
),
654 KEY(1, 2, KEY_RESERVED
),
655 KEY(1, 3, KEY_PAGEUP
),
656 KEY(1, 4, KEY_NUMERIC_STAR
),
657 KEY(1, 5, KEY_F2
), /* Right SoftKey */
659 KEY(2, 0, KEY_NUMERIC_7
),
660 KEY(2, 1, KEY_KPENTER
),
661 KEY(2, 2, KEY_RECORD
),
662 KEY(2, 3, KEY_PAGEDOWN
),
664 KEY(2, 5, KEY_NUMERIC_0
),
666 KEY(3, 0, KEY_NUMERIC_2
),
669 KEY(3, 3, KEY_PLAYPAUSE
),
670 KEY(3, 4, KEY_NUMERIC_1
),
671 KEY(3, 5, KEY_SOUND
), /* Music SoftKey */
673 KEY(4, 0, KEY_NUMERIC_4
),
675 KEY(4, 2, KEY_NUMERIC_POUND
),
676 KEY(4, 3, KEY_PREVIOUSSONG
),
677 KEY(4, 4, KEY_NUMERIC_3
),
678 KEY(4, 5, KEY_RESERVED
),
681 static struct matrix_keymap_data e2_matrix_keymap_data
= {
682 .keymap
= e2_key_map
,
683 .keymap_size
= ARRAY_SIZE(e2_key_map
),
686 static struct pxa27x_keypad_platform_data e2_keypad_platform_data
= {
687 .matrix_key_rows
= 5,
688 .matrix_key_cols
= 6,
689 .matrix_keymap_data
= &e2_matrix_keymap_data
,
691 .debounce_interval
= 30,
693 #endif /* CONFIG_MACH_EZX_E2 */
695 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910)
697 static struct regulator_consumer_supply camera_regulator_supplies
[] = {
698 REGULATOR_SUPPLY("vdd", "0-005d"),
701 static struct regulator_init_data camera_regulator_initdata
= {
702 .consumer_supplies
= camera_regulator_supplies
,
703 .num_consumer_supplies
= ARRAY_SIZE(camera_regulator_supplies
),
705 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
709 static struct fixed_voltage_config camera_regulator_config
= {
710 .supply_name
= "camera_vdd",
711 .microvolts
= 2800000,
712 .init_data
= &camera_regulator_initdata
,
715 static struct platform_device camera_supply_regulator_device
= {
716 .name
= "reg-fixed-voltage",
719 .platform_data
= &camera_regulator_config
,
723 static struct gpiod_lookup_table camera_supply_gpiod_table
= {
724 .dev_id
= "reg-fixed-voltage.1",
726 GPIO_LOOKUP("gpio-pxa", GPIO50_nCAM_EN
,
727 NULL
, GPIO_ACTIVE_LOW
),
733 #ifdef CONFIG_MACH_EZX_A780
735 static struct gpio_keys_button a780_buttons
[] = {
738 .gpio
= GPIO12_A780_FLIP_LID
,
740 .desc
= "A780 flip lid",
746 static struct gpio_keys_platform_data a780_gpio_keys_platform_data
= {
747 .buttons
= a780_buttons
,
748 .nbuttons
= ARRAY_SIZE(a780_buttons
),
751 static struct platform_device a780_gpio_keys
= {
755 .platform_data
= &a780_gpio_keys_platform_data
,
760 static int a780_camera_reset(struct device
*dev
)
762 gpio_set_value(GPIO19_GEN1_CAM_RST
, 0);
764 gpio_set_value(GPIO19_GEN1_CAM_RST
, 1);
769 static int a780_camera_init(void)
774 * GPIO50_nCAM_EN is active low
775 * GPIO19_GEN1_CAM_RST is active on rising edge
777 err
= gpio_request(GPIO19_GEN1_CAM_RST
, "CAM_RST");
779 pr_err("%s: Failed to request CAM_RST\n", __func__
);
783 gpio_direction_output(GPIO19_GEN1_CAM_RST
, 0);
784 a780_camera_reset(NULL
);
789 struct pxacamera_platform_data a780_pxacamera_platform_data
= {
790 .flags
= PXA_CAMERA_MASTER
| PXA_CAMERA_DATAWIDTH_8
|
791 PXA_CAMERA_PCLK_EN
| PXA_CAMERA_MCLK_EN
|
794 .sensor_i2c_adapter_id
= 0,
795 .sensor_i2c_address
= 0x5d,
798 static struct i2c_board_info a780_i2c_board_info
[] = {
800 I2C_BOARD_INFO("mt9m111", 0x5d),
804 static struct platform_device
*a780_devices
[] __initdata
= {
806 &camera_supply_regulator_device
,
809 static void __init
a780_init(void)
811 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config
));
812 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config
));
813 pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config
));
815 pxa_set_ffuart_info(NULL
);
816 pxa_set_btuart_info(NULL
);
817 pxa_set_stuart_info(NULL
);
819 pxa_set_i2c_info(NULL
);
820 i2c_register_board_info(0, ARRAY_AND_SIZE(a780_i2c_board_info
));
822 pxa_set_fb_info(NULL
, &ezx_fb_info_1
);
824 pxa_set_keypad_info(&a780_keypad_platform_data
);
826 if (a780_camera_init() == 0)
827 pxa_set_camera_info(&a780_pxacamera_platform_data
);
829 gpiod_add_lookup_table(&camera_supply_gpiod_table
);
830 pwm_add_table(ezx_pwm_lookup
, ARRAY_SIZE(ezx_pwm_lookup
));
831 platform_add_devices(ARRAY_AND_SIZE(ezx_devices
));
832 platform_add_devices(ARRAY_AND_SIZE(a780_devices
));
833 regulator_has_full_constraints();
836 MACHINE_START(EZX_A780
, "Motorola EZX A780")
837 .atag_offset
= 0x100,
838 .map_io
= pxa27x_map_io
,
839 .nr_irqs
= EZX_NR_IRQS
,
840 .init_irq
= pxa27x_init_irq
,
841 .handle_irq
= pxa27x_handle_irq
,
842 .init_time
= pxa_timer_init
,
843 .init_machine
= a780_init
,
844 .restart
= pxa_restart
,
848 #ifdef CONFIG_MACH_EZX_E680
850 static struct gpio_keys_button e680_buttons
[] = {
852 .code
= KEY_SCREENLOCK
,
853 .gpio
= GPIO12_E680_LOCK_SWITCH
,
855 .desc
= "E680 lock switch",
861 static struct gpio_keys_platform_data e680_gpio_keys_platform_data
= {
862 .buttons
= e680_buttons
,
863 .nbuttons
= ARRAY_SIZE(e680_buttons
),
866 static struct platform_device e680_gpio_keys
= {
870 .platform_data
= &e680_gpio_keys_platform_data
,
874 static struct i2c_board_info __initdata e680_i2c_board_info
[] = {
875 { I2C_BOARD_INFO("tea5767", 0x81) },
878 static struct platform_device
*e680_devices
[] __initdata
= {
882 static void __init
e680_init(void)
884 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config
));
885 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config
));
886 pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config
));
888 pxa_set_ffuart_info(NULL
);
889 pxa_set_btuart_info(NULL
);
890 pxa_set_stuart_info(NULL
);
892 pxa_set_i2c_info(NULL
);
893 i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info
));
895 pxa_set_fb_info(NULL
, &ezx_fb_info_1
);
897 pxa_set_keypad_info(&e680_keypad_platform_data
);
899 pwm_add_table(ezx_pwm_lookup
, ARRAY_SIZE(ezx_pwm_lookup
));
900 platform_add_devices(ARRAY_AND_SIZE(ezx_devices
));
901 platform_add_devices(ARRAY_AND_SIZE(e680_devices
));
904 MACHINE_START(EZX_E680
, "Motorola EZX E680")
905 .atag_offset
= 0x100,
906 .map_io
= pxa27x_map_io
,
907 .nr_irqs
= EZX_NR_IRQS
,
908 .init_irq
= pxa27x_init_irq
,
909 .handle_irq
= pxa27x_handle_irq
,
910 .init_time
= pxa_timer_init
,
911 .init_machine
= e680_init
,
912 .restart
= pxa_restart
,
916 #ifdef CONFIG_MACH_EZX_A1200
918 static struct gpio_keys_button a1200_buttons
[] = {
921 .gpio
= GPIO15_A1200_FLIP_LID
,
923 .desc
= "A1200 flip lid",
929 static struct gpio_keys_platform_data a1200_gpio_keys_platform_data
= {
930 .buttons
= a1200_buttons
,
931 .nbuttons
= ARRAY_SIZE(a1200_buttons
),
934 static struct platform_device a1200_gpio_keys
= {
938 .platform_data
= &a1200_gpio_keys_platform_data
,
942 static struct i2c_board_info __initdata a1200_i2c_board_info
[] = {
943 { I2C_BOARD_INFO("tea5767", 0x81) },
946 static struct platform_device
*a1200_devices
[] __initdata
= {
950 static void __init
a1200_init(void)
952 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config
));
953 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config
));
954 pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config
));
956 pxa_set_ffuart_info(NULL
);
957 pxa_set_btuart_info(NULL
);
958 pxa_set_stuart_info(NULL
);
960 pxa_set_i2c_info(NULL
);
961 i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info
));
963 pxa_set_fb_info(NULL
, &ezx_fb_info_2
);
965 pxa_set_keypad_info(&a1200_keypad_platform_data
);
967 pwm_add_table(ezx_pwm_lookup
, ARRAY_SIZE(ezx_pwm_lookup
));
968 platform_add_devices(ARRAY_AND_SIZE(ezx_devices
));
969 platform_add_devices(ARRAY_AND_SIZE(a1200_devices
));
972 MACHINE_START(EZX_A1200
, "Motorola EZX A1200")
973 .atag_offset
= 0x100,
974 .map_io
= pxa27x_map_io
,
975 .nr_irqs
= EZX_NR_IRQS
,
976 .init_irq
= pxa27x_init_irq
,
977 .handle_irq
= pxa27x_handle_irq
,
978 .init_time
= pxa_timer_init
,
979 .init_machine
= a1200_init
,
980 .restart
= pxa_restart
,
984 #ifdef CONFIG_MACH_EZX_A910
986 static struct gpio_keys_button a910_buttons
[] = {
989 .gpio
= GPIO15_A910_FLIP_LID
,
991 .desc
= "A910 flip lid",
997 static struct gpio_keys_platform_data a910_gpio_keys_platform_data
= {
998 .buttons
= a910_buttons
,
999 .nbuttons
= ARRAY_SIZE(a910_buttons
),
1002 static struct platform_device a910_gpio_keys
= {
1003 .name
= "gpio-keys",
1006 .platform_data
= &a910_gpio_keys_platform_data
,
1011 static int a910_camera_reset(struct device
*dev
)
1013 gpio_set_value(GPIO28_GEN2_CAM_RST
, 0);
1015 gpio_set_value(GPIO28_GEN2_CAM_RST
, 1);
1020 static int a910_camera_init(void)
1025 * GPIO50_nCAM_EN is active low
1026 * GPIO28_GEN2_CAM_RST is active on rising edge
1028 err
= gpio_request(GPIO28_GEN2_CAM_RST
, "CAM_RST");
1030 pr_err("%s: Failed to request CAM_RST\n", __func__
);
1034 gpio_direction_output(GPIO28_GEN2_CAM_RST
, 0);
1035 a910_camera_reset(NULL
);
1040 struct pxacamera_platform_data a910_pxacamera_platform_data
= {
1041 .flags
= PXA_CAMERA_MASTER
| PXA_CAMERA_DATAWIDTH_8
|
1042 PXA_CAMERA_PCLK_EN
| PXA_CAMERA_MCLK_EN
|
1045 .sensor_i2c_adapter_id
= 0,
1046 .sensor_i2c_address
= 0x5d,
1050 static struct lp3944_platform_data a910_lp3944_leds
= {
1051 .leds_size
= LP3944_LEDS_MAX
,
1054 .name
= "a910:red:",
1055 .status
= LP3944_LED_STATUS_OFF
,
1056 .type
= LP3944_LED_TYPE_LED
,
1059 .name
= "a910:green:",
1060 .status
= LP3944_LED_STATUS_OFF
,
1061 .type
= LP3944_LED_TYPE_LED
,
1064 .name
= "a910:blue:",
1065 .status
= LP3944_LED_STATUS_OFF
,
1066 .type
= LP3944_LED_TYPE_LED
,
1068 /* Leds 3 and 4 are used as display power switches */
1070 .name
= "a910::cli_display",
1071 .status
= LP3944_LED_STATUS_OFF
,
1072 .type
= LP3944_LED_TYPE_LED_INVERTED
1075 .name
= "a910::main_display",
1076 .status
= LP3944_LED_STATUS_ON
,
1077 .type
= LP3944_LED_TYPE_LED_INVERTED
1079 [5] = { .type
= LP3944_LED_TYPE_NONE
},
1081 .name
= "a910::torch",
1082 .status
= LP3944_LED_STATUS_OFF
,
1083 .type
= LP3944_LED_TYPE_LED
,
1086 .name
= "a910::flash",
1087 .status
= LP3944_LED_STATUS_OFF
,
1088 .type
= LP3944_LED_TYPE_LED_INVERTED
,
1093 static struct i2c_board_info __initdata a910_i2c_board_info
[] = {
1095 I2C_BOARD_INFO("lp3944", 0x60),
1096 .platform_data
= &a910_lp3944_leds
,
1099 I2C_BOARD_INFO("mt9m111", 0x5d),
1103 static struct platform_device
*a910_devices
[] __initdata
= {
1105 &camera_supply_regulator_device
,
1108 static void __init
a910_init(void)
1110 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config
));
1111 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config
));
1112 pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config
));
1114 pxa_set_ffuart_info(NULL
);
1115 pxa_set_btuart_info(NULL
);
1116 pxa_set_stuart_info(NULL
);
1118 pxa_set_i2c_info(NULL
);
1119 i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info
));
1121 pxa_set_fb_info(NULL
, &ezx_fb_info_2
);
1123 pxa_set_keypad_info(&a910_keypad_platform_data
);
1125 if (a910_camera_init() == 0)
1126 pxa_set_camera_info(&a910_pxacamera_platform_data
);
1128 gpiod_add_lookup_table(&camera_supply_gpiod_table
);
1129 pwm_add_table(ezx_pwm_lookup
, ARRAY_SIZE(ezx_pwm_lookup
));
1130 platform_add_devices(ARRAY_AND_SIZE(ezx_devices
));
1131 platform_add_devices(ARRAY_AND_SIZE(a910_devices
));
1132 regulator_has_full_constraints();
1135 MACHINE_START(EZX_A910
, "Motorola EZX A910")
1136 .atag_offset
= 0x100,
1137 .map_io
= pxa27x_map_io
,
1138 .nr_irqs
= EZX_NR_IRQS
,
1139 .init_irq
= pxa27x_init_irq
,
1140 .handle_irq
= pxa27x_handle_irq
,
1141 .init_time
= pxa_timer_init
,
1142 .init_machine
= a910_init
,
1143 .restart
= pxa_restart
,
1147 #ifdef CONFIG_MACH_EZX_E6
1149 static struct gpio_keys_button e6_buttons
[] = {
1151 .code
= KEY_SCREENLOCK
,
1152 .gpio
= GPIO15_E6_LOCK_SWITCH
,
1154 .desc
= "E6 lock switch",
1160 static struct gpio_keys_platform_data e6_gpio_keys_platform_data
= {
1161 .buttons
= e6_buttons
,
1162 .nbuttons
= ARRAY_SIZE(e6_buttons
),
1165 static struct platform_device e6_gpio_keys
= {
1166 .name
= "gpio-keys",
1169 .platform_data
= &e6_gpio_keys_platform_data
,
1173 static struct i2c_board_info __initdata e6_i2c_board_info
[] = {
1174 { I2C_BOARD_INFO("tea5767", 0x81) },
1177 static struct platform_device
*e6_devices
[] __initdata
= {
1181 static void __init
e6_init(void)
1183 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config
));
1184 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config
));
1185 pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config
));
1187 pxa_set_ffuart_info(NULL
);
1188 pxa_set_btuart_info(NULL
);
1189 pxa_set_stuart_info(NULL
);
1191 pxa_set_i2c_info(NULL
);
1192 i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info
));
1194 pxa_set_fb_info(NULL
, &ezx_fb_info_2
);
1196 pxa_set_keypad_info(&e6_keypad_platform_data
);
1198 pwm_add_table(ezx_pwm_lookup
, ARRAY_SIZE(ezx_pwm_lookup
));
1199 platform_add_devices(ARRAY_AND_SIZE(ezx_devices
));
1200 platform_add_devices(ARRAY_AND_SIZE(e6_devices
));
1203 MACHINE_START(EZX_E6
, "Motorola EZX E6")
1204 .atag_offset
= 0x100,
1205 .map_io
= pxa27x_map_io
,
1206 .nr_irqs
= EZX_NR_IRQS
,
1207 .init_irq
= pxa27x_init_irq
,
1208 .handle_irq
= pxa27x_handle_irq
,
1209 .init_time
= pxa_timer_init
,
1210 .init_machine
= e6_init
,
1211 .restart
= pxa_restart
,
1215 #ifdef CONFIG_MACH_EZX_E2
1216 static struct i2c_board_info __initdata e2_i2c_board_info
[] = {
1217 { I2C_BOARD_INFO("tea5767", 0x81) },
1220 static struct platform_device
*e2_devices
[] __initdata
= {
1223 static void __init
e2_init(void)
1225 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config
));
1226 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config
));
1227 pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config
));
1229 pxa_set_ffuart_info(NULL
);
1230 pxa_set_btuart_info(NULL
);
1231 pxa_set_stuart_info(NULL
);
1233 pxa_set_i2c_info(NULL
);
1234 i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info
));
1236 pxa_set_fb_info(NULL
, &ezx_fb_info_2
);
1238 pxa_set_keypad_info(&e2_keypad_platform_data
);
1240 pwm_add_table(ezx_pwm_lookup
, ARRAY_SIZE(ezx_pwm_lookup
));
1241 platform_add_devices(ARRAY_AND_SIZE(ezx_devices
));
1242 platform_add_devices(ARRAY_AND_SIZE(e2_devices
));
1245 MACHINE_START(EZX_E2
, "Motorola EZX E2")
1246 .atag_offset
= 0x100,
1247 .map_io
= pxa27x_map_io
,
1248 .nr_irqs
= EZX_NR_IRQS
,
1249 .init_irq
= pxa27x_init_irq
,
1250 .handle_irq
= pxa27x_handle_irq
,
1251 .init_time
= pxa_timer_init
,
1252 .init_machine
= e2_init
,
1253 .restart
= pxa_restart
,