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_keys.h>
25 #include <linux/leds-lp3944.h>
26 #include <linux/platform_data/i2c-pxa.h>
28 #include <asm/setup.h>
29 #include <asm/mach-types.h>
30 #include <asm/mach/arch.h>
33 #include <linux/platform_data/video-pxafb.h>
34 #include <linux/platform_data/usb-ohci-pxa27x.h>
35 #include <mach/hardware.h>
36 #include <linux/platform_data/keypad-pxa27x.h>
37 #include <linux/platform_data/media/camera-pxa.h>
42 #define EZX_NR_IRQS (IRQ_BOARD_START + 24)
44 #define GPIO12_A780_FLIP_LID 12
45 #define GPIO15_A1200_FLIP_LID 15
46 #define GPIO15_A910_FLIP_LID 15
47 #define GPIO12_E680_LOCK_SWITCH 12
48 #define GPIO15_E6_LOCK_SWITCH 15
49 #define GPIO50_nCAM_EN 50
50 #define GPIO19_GEN1_CAM_RST 19
51 #define GPIO28_GEN2_CAM_RST 28
53 static struct pwm_lookup ezx_pwm_lookup
[] __maybe_unused
= {
54 PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL
, 78700,
58 static struct platform_pwm_backlight_data ezx_backlight_data
= {
59 .max_brightness
= 1023,
60 .dft_brightness
= 1023,
64 static struct platform_device ezx_backlight_device
= {
65 .name
= "pwm-backlight",
67 .parent
= &pxa27x_device_pwm0
.dev
,
68 .platform_data
= &ezx_backlight_data
,
72 static struct pxafb_mode_info mode_ezx_old
= {
86 static struct pxafb_mach_info ezx_fb_info_1 __maybe_unused
= {
87 .modes
= &mode_ezx_old
,
89 .lcd_conn
= LCD_COLOR_TFT_16BPP
,
92 static struct pxafb_mode_info mode_72r89803y01
= {
107 static struct pxafb_mach_info ezx_fb_info_2 __maybe_unused
= {
108 .modes
= &mode_72r89803y01
,
110 .lcd_conn
= LCD_COLOR_TFT_18BPP
,
113 static struct platform_device
*ezx_devices
[] __initdata __maybe_unused
= {
114 &ezx_backlight_device
,
117 static unsigned long ezx_pin_config
[] __initdata __maybe_unused
= {
135 GPIO24_GPIO
, /* pcap chip select */
136 GPIO1_GPIO
| WAKEUP_ON_EDGE_RISE
, /* pcap interrupt */
137 GPIO4_GPIO
| MFP_LPM_DRIVE_HIGH
, /* WDI_AP */
138 GPIO55_GPIO
| MFP_LPM_DRIVE_HIGH
, /* SYS_RESTART */
147 GPIO11_GPIO
, /* mmc detect */
149 /* usb to external transceiver */
157 /* usb to Neptune GSM chip */
166 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680)
167 static unsigned long gen1_pin_config
[] __initdata
= {
168 /* flip / lockswitch */
169 GPIO12_GPIO
| WAKEUP_ON_EDGE_BOTH
,
171 /* bluetooth (bcm2035) */
172 GPIO14_GPIO
| WAKEUP_ON_EDGE_RISE
, /* HOSTWAKE */
173 GPIO48_GPIO
, /* RESET */
174 GPIO28_GPIO
, /* WAKEUP */
176 /* Neptune handshake */
177 GPIO0_GPIO
| WAKEUP_ON_EDGE_FALL
, /* BP_RDY */
178 GPIO57_GPIO
| MFP_LPM_DRIVE_HIGH
, /* AP_RDY */
179 GPIO13_GPIO
| WAKEUP_ON_EDGE_BOTH
, /* WDI */
180 GPIO3_GPIO
| WAKEUP_ON_EDGE_BOTH
, /* WDI2 */
181 GPIO82_GPIO
| MFP_LPM_DRIVE_HIGH
, /* RESET */
182 GPIO99_GPIO
| MFP_LPM_DRIVE_HIGH
, /* TC_MM_EN */
190 /* ssp2 pins to in */
191 GPIO22_GPIO
, /* SSP2_SCLK */
192 GPIO37_GPIO
, /* SSP2_SFRM */
193 GPIO38_GPIO
, /* SSP2_TXD */
194 GPIO88_GPIO
, /* SSP2_RXD */
209 GPIO50_GPIO
| MFP_LPM_DRIVE_HIGH
, /* CAM_EN */
210 GPIO19_GPIO
| MFP_LPM_DRIVE_HIGH
, /* CAM_RST */
213 GPIO120_GPIO
, /* EMU_MUX1 */
214 GPIO119_GPIO
, /* EMU_MUX2 */
215 GPIO86_GPIO
, /* SNP_INT_CTL */
216 GPIO87_GPIO
, /* SNP_INT_IN */
220 #if defined(CONFIG_MACH_EZX_A1200) || defined(CONFIG_MACH_EZX_A910) || \
221 defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6)
222 static unsigned long gen2_pin_config
[] __initdata
= {
223 /* flip / lockswitch */
224 GPIO15_GPIO
| WAKEUP_ON_EDGE_BOTH
,
227 GPIO10_GPIO
| WAKEUP_ON_EDGE_RISE
,
229 /* bluetooth (bcm2045) */
230 GPIO13_GPIO
| WAKEUP_ON_EDGE_RISE
, /* HOSTWAKE */
231 GPIO37_GPIO
, /* RESET */
232 GPIO57_GPIO
, /* WAKEUP */
234 /* Neptune handshake */
235 GPIO0_GPIO
| WAKEUP_ON_EDGE_FALL
, /* BP_RDY */
236 GPIO96_GPIO
| MFP_LPM_DRIVE_HIGH
, /* AP_RDY */
237 GPIO3_GPIO
| WAKEUP_ON_EDGE_FALL
, /* WDI */
238 GPIO116_GPIO
| MFP_LPM_DRIVE_HIGH
, /* RESET */
239 GPIO41_GPIO
, /* BP_FLASH */
247 /* ssp2 pins to in */
248 GPIO22_GPIO
, /* SSP2_SCLK */
249 GPIO14_GPIO
, /* SSP2_SFRM */
250 GPIO38_GPIO
, /* SSP2_TXD */
251 GPIO88_GPIO
, /* SSP2_RXD */
266 GPIO50_GPIO
| MFP_LPM_DRIVE_HIGH
, /* CAM_EN */
267 GPIO28_GPIO
| MFP_LPM_DRIVE_HIGH
, /* CAM_RST */
268 GPIO17_GPIO
, /* CAM_FLASH */
272 #ifdef CONFIG_MACH_EZX_A780
273 static unsigned long a780_pin_config
[] __initdata
= {
275 GPIO93_KP_DKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
276 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
277 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
278 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
279 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
280 GPIO98_KP_MKIN_4
| WAKEUP_ON_LEVEL_HIGH
,
287 /* attenuate sound */
292 #ifdef CONFIG_MACH_EZX_E680
293 static unsigned long e680_pin_config
[] __initdata
= {
295 GPIO93_KP_DKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
296 GPIO96_KP_DKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
297 GPIO97_KP_DKIN_4
| WAKEUP_ON_LEVEL_HIGH
,
298 GPIO98_KP_DKIN_5
| WAKEUP_ON_LEVEL_HIGH
,
299 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
300 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
301 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
308 GPIO79_GPIO
, /* VA_SEL_BUL */
309 GPIO80_GPIO
, /* FLT_SEL_BUL */
310 GPIO78_GPIO
, /* MIDI_RESET */
311 GPIO33_GPIO
, /* MIDI_CS */
312 GPIO15_GPIO
, /* MIDI_IRQ */
313 GPIO49_GPIO
, /* MIDI_NPWE */
314 GPIO18_GPIO
, /* MIDI_RDY */
322 #ifdef CONFIG_MACH_EZX_A1200
323 static unsigned long a1200_pin_config
[] __initdata
= {
325 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
326 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
327 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
328 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
329 GPIO98_KP_MKIN_4
| WAKEUP_ON_LEVEL_HIGH
,
339 #ifdef CONFIG_MACH_EZX_A910
340 static unsigned long a910_pin_config
[] __initdata
= {
342 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
343 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
344 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
345 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
346 GPIO98_KP_MKIN_4
| WAKEUP_ON_LEVEL_HIGH
,
355 GPIO89_GPIO
, /* RESET */
356 GPIO33_GPIO
, /* WAKEUP */
357 GPIO94_GPIO
| WAKEUP_ON_LEVEL_HIGH
, /* HOSTWAKE */
364 #ifdef CONFIG_MACH_EZX_E2
365 static unsigned long e2_pin_config
[] __initdata
= {
367 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
368 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
369 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
370 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
371 GPIO98_KP_MKIN_4
| WAKEUP_ON_LEVEL_HIGH
,
381 #ifdef CONFIG_MACH_EZX_E6
382 static unsigned long e6_pin_config
[] __initdata
= {
384 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
385 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
386 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
387 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
388 GPIO98_KP_MKIN_4
| WAKEUP_ON_LEVEL_HIGH
,
399 #ifdef CONFIG_MACH_EZX_A780
400 static const unsigned int a780_key_map
[] = {
404 KEY(0, 3, KEY_PAGEUP
),
407 KEY(1, 0, KEY_NUMERIC_1
),
408 KEY(1, 1, KEY_NUMERIC_2
),
409 KEY(1, 2, KEY_NUMERIC_3
),
410 KEY(1, 3, KEY_SELECT
),
411 KEY(1, 4, KEY_KPENTER
),
413 KEY(2, 0, KEY_NUMERIC_4
),
414 KEY(2, 1, KEY_NUMERIC_5
),
415 KEY(2, 2, KEY_NUMERIC_6
),
416 KEY(2, 3, KEY_RECORD
),
419 KEY(3, 0, KEY_NUMERIC_7
),
420 KEY(3, 1, KEY_NUMERIC_8
),
421 KEY(3, 2, KEY_NUMERIC_9
),
423 KEY(3, 4, KEY_RIGHT
),
425 KEY(4, 0, KEY_NUMERIC_STAR
),
426 KEY(4, 1, KEY_NUMERIC_0
),
427 KEY(4, 2, KEY_NUMERIC_POUND
),
428 KEY(4, 3, KEY_PAGEDOWN
),
432 static struct matrix_keymap_data a780_matrix_keymap_data
= {
433 .keymap
= a780_key_map
,
434 .keymap_size
= ARRAY_SIZE(a780_key_map
),
437 static struct pxa27x_keypad_platform_data a780_keypad_platform_data
= {
438 .matrix_key_rows
= 5,
439 .matrix_key_cols
= 5,
440 .matrix_keymap_data
= &a780_matrix_keymap_data
,
442 .direct_key_map
= { KEY_CAMERA
},
445 .debounce_interval
= 30,
447 #endif /* CONFIG_MACH_EZX_A780 */
449 #ifdef CONFIG_MACH_EZX_E680
450 static const unsigned int e680_key_map
[] = {
452 KEY(0, 1, KEY_RIGHT
),
453 KEY(0, 2, KEY_RESERVED
),
458 KEY(1, 2, KEY_PAGEUP
),
459 KEY(1, 3, KEY_PAGEDOWN
),
461 KEY(2, 0, KEY_RESERVED
),
462 KEY(2, 1, KEY_RESERVED
),
463 KEY(2, 2, KEY_RESERVED
),
464 KEY(2, 3, KEY_KPENTER
),
467 static struct matrix_keymap_data e680_matrix_keymap_data
= {
468 .keymap
= e680_key_map
,
469 .keymap_size
= ARRAY_SIZE(e680_key_map
),
472 static struct pxa27x_keypad_platform_data e680_keypad_platform_data
= {
473 .matrix_key_rows
= 3,
474 .matrix_key_cols
= 4,
475 .matrix_keymap_data
= &e680_matrix_keymap_data
,
487 .debounce_interval
= 30,
489 #endif /* CONFIG_MACH_EZX_E680 */
491 #ifdef CONFIG_MACH_EZX_A1200
492 static const unsigned int a1200_key_map
[] = {
493 KEY(0, 0, KEY_RESERVED
),
494 KEY(0, 1, KEY_RIGHT
),
495 KEY(0, 2, KEY_PAGEDOWN
),
496 KEY(0, 3, KEY_RESERVED
),
497 KEY(0, 4, KEY_RESERVED
),
498 KEY(0, 5, KEY_RESERVED
),
500 KEY(1, 0, KEY_RESERVED
),
502 KEY(1, 2, KEY_CAMERA
),
503 KEY(1, 3, KEY_RESERVED
),
504 KEY(1, 4, KEY_RESERVED
),
505 KEY(1, 5, KEY_RESERVED
),
507 KEY(2, 0, KEY_RESERVED
),
508 KEY(2, 1, KEY_KPENTER
),
509 KEY(2, 2, KEY_RECORD
),
510 KEY(2, 3, KEY_RESERVED
),
511 KEY(2, 4, KEY_RESERVED
),
512 KEY(2, 5, KEY_SELECT
),
514 KEY(3, 0, KEY_RESERVED
),
517 KEY(3, 3, KEY_RESERVED
),
518 KEY(3, 4, KEY_RESERVED
),
519 KEY(3, 5, KEY_RESERVED
),
521 KEY(4, 0, KEY_RESERVED
),
523 KEY(4, 2, KEY_PAGEUP
),
524 KEY(4, 3, KEY_RESERVED
),
525 KEY(4, 4, KEY_RESERVED
),
526 KEY(4, 5, KEY_RESERVED
),
529 static struct matrix_keymap_data a1200_matrix_keymap_data
= {
530 .keymap
= a1200_key_map
,
531 .keymap_size
= ARRAY_SIZE(a1200_key_map
),
534 static struct pxa27x_keypad_platform_data a1200_keypad_platform_data
= {
535 .matrix_key_rows
= 5,
536 .matrix_key_cols
= 6,
537 .matrix_keymap_data
= &a1200_matrix_keymap_data
,
539 .debounce_interval
= 30,
541 #endif /* CONFIG_MACH_EZX_A1200 */
543 #ifdef CONFIG_MACH_EZX_E6
544 static const unsigned int e6_key_map
[] = {
545 KEY(0, 0, KEY_RESERVED
),
546 KEY(0, 1, KEY_RIGHT
),
547 KEY(0, 2, KEY_PAGEDOWN
),
548 KEY(0, 3, KEY_RESERVED
),
549 KEY(0, 4, KEY_RESERVED
),
550 KEY(0, 5, KEY_NEXTSONG
),
552 KEY(1, 0, KEY_RESERVED
),
554 KEY(1, 2, KEY_PROG1
),
555 KEY(1, 3, KEY_RESERVED
),
556 KEY(1, 4, KEY_RESERVED
),
557 KEY(1, 5, KEY_RESERVED
),
559 KEY(2, 0, KEY_RESERVED
),
560 KEY(2, 1, KEY_ENTER
),
561 KEY(2, 2, KEY_CAMERA
),
562 KEY(2, 3, KEY_RESERVED
),
563 KEY(2, 4, KEY_RESERVED
),
566 KEY(3, 0, KEY_RESERVED
),
569 KEY(3, 3, KEY_RESERVED
),
570 KEY(3, 4, KEY_RESERVED
),
571 KEY(3, 5, KEY_PLAYPAUSE
),
573 KEY(4, 0, KEY_RESERVED
),
575 KEY(4, 2, KEY_PAGEUP
),
576 KEY(4, 3, KEY_RESERVED
),
577 KEY(4, 4, KEY_RESERVED
),
578 KEY(4, 5, KEY_PREVIOUSSONG
),
581 static struct matrix_keymap_data e6_keymap_data
= {
582 .keymap
= e6_key_map
,
583 .keymap_size
= ARRAY_SIZE(e6_key_map
),
586 static struct pxa27x_keypad_platform_data e6_keypad_platform_data
= {
587 .matrix_key_rows
= 5,
588 .matrix_key_cols
= 6,
589 .matrix_keymap_data
= &e6_keymap_data
,
591 .debounce_interval
= 30,
593 #endif /* CONFIG_MACH_EZX_E6 */
595 #ifdef CONFIG_MACH_EZX_A910
596 static const unsigned int a910_key_map
[] = {
597 KEY(0, 0, KEY_NUMERIC_6
),
598 KEY(0, 1, KEY_RIGHT
),
599 KEY(0, 2, KEY_PAGEDOWN
),
600 KEY(0, 3, KEY_KPENTER
),
601 KEY(0, 4, KEY_NUMERIC_5
),
602 KEY(0, 5, KEY_CAMERA
),
604 KEY(1, 0, KEY_NUMERIC_8
),
606 KEY(1, 2, KEY_RESERVED
),
607 KEY(1, 3, KEY_F1
), /* Left SoftKey */
608 KEY(1, 4, KEY_NUMERIC_STAR
),
609 KEY(1, 5, KEY_RESERVED
),
611 KEY(2, 0, KEY_NUMERIC_7
),
612 KEY(2, 1, KEY_NUMERIC_9
),
613 KEY(2, 2, KEY_RECORD
),
614 KEY(2, 3, KEY_F2
), /* Right SoftKey */
616 KEY(2, 5, KEY_SELECT
),
618 KEY(3, 0, KEY_NUMERIC_2
),
621 KEY(3, 3, KEY_NUMERIC_0
),
622 KEY(3, 4, KEY_NUMERIC_1
),
623 KEY(3, 5, KEY_RECORD
),
625 KEY(4, 0, KEY_NUMERIC_4
),
627 KEY(4, 2, KEY_PAGEUP
),
628 KEY(4, 3, KEY_NUMERIC_POUND
),
629 KEY(4, 4, KEY_NUMERIC_3
),
630 KEY(4, 5, KEY_RESERVED
),
633 static struct matrix_keymap_data a910_matrix_keymap_data
= {
634 .keymap
= a910_key_map
,
635 .keymap_size
= ARRAY_SIZE(a910_key_map
),
638 static struct pxa27x_keypad_platform_data a910_keypad_platform_data
= {
639 .matrix_key_rows
= 5,
640 .matrix_key_cols
= 6,
641 .matrix_keymap_data
= &a910_matrix_keymap_data
,
643 .debounce_interval
= 30,
645 #endif /* CONFIG_MACH_EZX_A910 */
647 #ifdef CONFIG_MACH_EZX_E2
648 static const unsigned int e2_key_map
[] = {
649 KEY(0, 0, KEY_NUMERIC_6
),
650 KEY(0, 1, KEY_RIGHT
),
651 KEY(0, 2, KEY_NUMERIC_9
),
652 KEY(0, 3, KEY_NEXTSONG
),
653 KEY(0, 4, KEY_NUMERIC_5
),
654 KEY(0, 5, KEY_F1
), /* Left SoftKey */
656 KEY(1, 0, KEY_NUMERIC_8
),
658 KEY(1, 2, KEY_RESERVED
),
659 KEY(1, 3, KEY_PAGEUP
),
660 KEY(1, 4, KEY_NUMERIC_STAR
),
661 KEY(1, 5, KEY_F2
), /* Right SoftKey */
663 KEY(2, 0, KEY_NUMERIC_7
),
664 KEY(2, 1, KEY_KPENTER
),
665 KEY(2, 2, KEY_RECORD
),
666 KEY(2, 3, KEY_PAGEDOWN
),
668 KEY(2, 5, KEY_NUMERIC_0
),
670 KEY(3, 0, KEY_NUMERIC_2
),
673 KEY(3, 3, KEY_PLAYPAUSE
),
674 KEY(3, 4, KEY_NUMERIC_1
),
675 KEY(3, 5, KEY_SOUND
), /* Music SoftKey */
677 KEY(4, 0, KEY_NUMERIC_4
),
679 KEY(4, 2, KEY_NUMERIC_POUND
),
680 KEY(4, 3, KEY_PREVIOUSSONG
),
681 KEY(4, 4, KEY_NUMERIC_3
),
682 KEY(4, 5, KEY_RESERVED
),
685 static struct matrix_keymap_data e2_matrix_keymap_data
= {
686 .keymap
= e2_key_map
,
687 .keymap_size
= ARRAY_SIZE(e2_key_map
),
690 static struct pxa27x_keypad_platform_data e2_keypad_platform_data
= {
691 .matrix_key_rows
= 5,
692 .matrix_key_cols
= 6,
693 .matrix_keymap_data
= &e2_matrix_keymap_data
,
695 .debounce_interval
= 30,
697 #endif /* CONFIG_MACH_EZX_E2 */
699 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910)
701 static struct regulator_consumer_supply camera_dummy_supplies
[] = {
702 REGULATOR_SUPPLY("vdd", "0-005d"),
705 static struct regulator_init_data camera_dummy_initdata
= {
706 .consumer_supplies
= camera_dummy_supplies
,
707 .num_consumer_supplies
= ARRAY_SIZE(camera_dummy_supplies
),
709 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
713 static struct fixed_voltage_config camera_dummy_config
= {
714 .supply_name
= "camera_vdd",
715 .microvolts
= 2800000,
716 .gpio
= GPIO50_nCAM_EN
,
718 .init_data
= &camera_dummy_initdata
,
721 static struct platform_device camera_supply_dummy_device
= {
722 .name
= "reg-fixed-voltage",
725 .platform_data
= &camera_dummy_config
,
730 #ifdef CONFIG_MACH_EZX_A780
732 static struct gpio_keys_button a780_buttons
[] = {
735 .gpio
= GPIO12_A780_FLIP_LID
,
737 .desc
= "A780 flip lid",
743 static struct gpio_keys_platform_data a780_gpio_keys_platform_data
= {
744 .buttons
= a780_buttons
,
745 .nbuttons
= ARRAY_SIZE(a780_buttons
),
748 static struct platform_device a780_gpio_keys
= {
752 .platform_data
= &a780_gpio_keys_platform_data
,
757 static int a780_camera_reset(struct device
*dev
)
759 gpio_set_value(GPIO19_GEN1_CAM_RST
, 0);
761 gpio_set_value(GPIO19_GEN1_CAM_RST
, 1);
766 static int a780_camera_init(void)
771 * GPIO50_nCAM_EN is active low
772 * GPIO19_GEN1_CAM_RST is active on rising edge
774 err
= gpio_request(GPIO19_GEN1_CAM_RST
, "CAM_RST");
776 pr_err("%s: Failed to request CAM_RST\n", __func__
);
780 gpio_direction_output(GPIO19_GEN1_CAM_RST
, 0);
781 a780_camera_reset(NULL
);
786 struct pxacamera_platform_data a780_pxacamera_platform_data
= {
787 .flags
= PXA_CAMERA_MASTER
| PXA_CAMERA_DATAWIDTH_8
|
788 PXA_CAMERA_PCLK_EN
| PXA_CAMERA_MCLK_EN
|
791 .sensor_i2c_adapter_id
= 0,
792 .sensor_i2c_address
= 0x5d,
795 static struct i2c_board_info a780_i2c_board_info
[] = {
797 I2C_BOARD_INFO("mt9m111", 0x5d),
801 static struct platform_device
*a780_devices
[] __initdata
= {
803 &camera_supply_dummy_device
,
806 static void __init
a780_init(void)
808 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config
));
809 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config
));
810 pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config
));
812 pxa_set_ffuart_info(NULL
);
813 pxa_set_btuart_info(NULL
);
814 pxa_set_stuart_info(NULL
);
816 pxa_set_i2c_info(NULL
);
817 i2c_register_board_info(0, ARRAY_AND_SIZE(a780_i2c_board_info
));
819 pxa_set_fb_info(NULL
, &ezx_fb_info_1
);
821 pxa_set_keypad_info(&a780_keypad_platform_data
);
823 if (a780_camera_init() == 0)
824 pxa_set_camera_info(&a780_pxacamera_platform_data
);
826 pwm_add_table(ezx_pwm_lookup
, ARRAY_SIZE(ezx_pwm_lookup
));
827 platform_add_devices(ARRAY_AND_SIZE(ezx_devices
));
828 platform_add_devices(ARRAY_AND_SIZE(a780_devices
));
829 regulator_has_full_constraints();
832 MACHINE_START(EZX_A780
, "Motorola EZX A780")
833 .atag_offset
= 0x100,
834 .map_io
= pxa27x_map_io
,
835 .nr_irqs
= EZX_NR_IRQS
,
836 .init_irq
= pxa27x_init_irq
,
837 .handle_irq
= pxa27x_handle_irq
,
838 .init_time
= pxa_timer_init
,
839 .init_machine
= a780_init
,
840 .restart
= pxa_restart
,
844 #ifdef CONFIG_MACH_EZX_E680
846 static struct gpio_keys_button e680_buttons
[] = {
848 .code
= KEY_SCREENLOCK
,
849 .gpio
= GPIO12_E680_LOCK_SWITCH
,
851 .desc
= "E680 lock switch",
857 static struct gpio_keys_platform_data e680_gpio_keys_platform_data
= {
858 .buttons
= e680_buttons
,
859 .nbuttons
= ARRAY_SIZE(e680_buttons
),
862 static struct platform_device e680_gpio_keys
= {
866 .platform_data
= &e680_gpio_keys_platform_data
,
870 static struct i2c_board_info __initdata e680_i2c_board_info
[] = {
871 { I2C_BOARD_INFO("tea5767", 0x81) },
874 static struct platform_device
*e680_devices
[] __initdata
= {
878 static void __init
e680_init(void)
880 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config
));
881 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config
));
882 pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config
));
884 pxa_set_ffuart_info(NULL
);
885 pxa_set_btuart_info(NULL
);
886 pxa_set_stuart_info(NULL
);
888 pxa_set_i2c_info(NULL
);
889 i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info
));
891 pxa_set_fb_info(NULL
, &ezx_fb_info_1
);
893 pxa_set_keypad_info(&e680_keypad_platform_data
);
895 pwm_add_table(ezx_pwm_lookup
, ARRAY_SIZE(ezx_pwm_lookup
));
896 platform_add_devices(ARRAY_AND_SIZE(ezx_devices
));
897 platform_add_devices(ARRAY_AND_SIZE(e680_devices
));
900 MACHINE_START(EZX_E680
, "Motorola EZX E680")
901 .atag_offset
= 0x100,
902 .map_io
= pxa27x_map_io
,
903 .nr_irqs
= EZX_NR_IRQS
,
904 .init_irq
= pxa27x_init_irq
,
905 .handle_irq
= pxa27x_handle_irq
,
906 .init_time
= pxa_timer_init
,
907 .init_machine
= e680_init
,
908 .restart
= pxa_restart
,
912 #ifdef CONFIG_MACH_EZX_A1200
914 static struct gpio_keys_button a1200_buttons
[] = {
917 .gpio
= GPIO15_A1200_FLIP_LID
,
919 .desc
= "A1200 flip lid",
925 static struct gpio_keys_platform_data a1200_gpio_keys_platform_data
= {
926 .buttons
= a1200_buttons
,
927 .nbuttons
= ARRAY_SIZE(a1200_buttons
),
930 static struct platform_device a1200_gpio_keys
= {
934 .platform_data
= &a1200_gpio_keys_platform_data
,
938 static struct i2c_board_info __initdata a1200_i2c_board_info
[] = {
939 { I2C_BOARD_INFO("tea5767", 0x81) },
942 static struct platform_device
*a1200_devices
[] __initdata
= {
946 static void __init
a1200_init(void)
948 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config
));
949 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config
));
950 pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config
));
952 pxa_set_ffuart_info(NULL
);
953 pxa_set_btuart_info(NULL
);
954 pxa_set_stuart_info(NULL
);
956 pxa_set_i2c_info(NULL
);
957 i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info
));
959 pxa_set_fb_info(NULL
, &ezx_fb_info_2
);
961 pxa_set_keypad_info(&a1200_keypad_platform_data
);
963 pwm_add_table(ezx_pwm_lookup
, ARRAY_SIZE(ezx_pwm_lookup
));
964 platform_add_devices(ARRAY_AND_SIZE(ezx_devices
));
965 platform_add_devices(ARRAY_AND_SIZE(a1200_devices
));
968 MACHINE_START(EZX_A1200
, "Motorola EZX A1200")
969 .atag_offset
= 0x100,
970 .map_io
= pxa27x_map_io
,
971 .nr_irqs
= EZX_NR_IRQS
,
972 .init_irq
= pxa27x_init_irq
,
973 .handle_irq
= pxa27x_handle_irq
,
974 .init_time
= pxa_timer_init
,
975 .init_machine
= a1200_init
,
976 .restart
= pxa_restart
,
980 #ifdef CONFIG_MACH_EZX_A910
982 static struct gpio_keys_button a910_buttons
[] = {
985 .gpio
= GPIO15_A910_FLIP_LID
,
987 .desc
= "A910 flip lid",
993 static struct gpio_keys_platform_data a910_gpio_keys_platform_data
= {
994 .buttons
= a910_buttons
,
995 .nbuttons
= ARRAY_SIZE(a910_buttons
),
998 static struct platform_device a910_gpio_keys
= {
1002 .platform_data
= &a910_gpio_keys_platform_data
,
1007 static int a910_camera_reset(struct device
*dev
)
1009 gpio_set_value(GPIO28_GEN2_CAM_RST
, 0);
1011 gpio_set_value(GPIO28_GEN2_CAM_RST
, 1);
1016 static int a910_camera_init(void)
1021 * GPIO50_nCAM_EN is active low
1022 * GPIO28_GEN2_CAM_RST is active on rising edge
1024 err
= gpio_request(GPIO28_GEN2_CAM_RST
, "CAM_RST");
1026 pr_err("%s: Failed to request CAM_RST\n", __func__
);
1030 gpio_direction_output(GPIO28_GEN2_CAM_RST
, 0);
1031 a910_camera_reset(NULL
);
1036 struct pxacamera_platform_data a910_pxacamera_platform_data
= {
1037 .flags
= PXA_CAMERA_MASTER
| PXA_CAMERA_DATAWIDTH_8
|
1038 PXA_CAMERA_PCLK_EN
| PXA_CAMERA_MCLK_EN
|
1041 .sensor_i2c_adapter_id
= 0,
1042 .sensor_i2c_address
= 0x5d,
1046 static struct lp3944_platform_data a910_lp3944_leds
= {
1047 .leds_size
= LP3944_LEDS_MAX
,
1050 .name
= "a910:red:",
1051 .status
= LP3944_LED_STATUS_OFF
,
1052 .type
= LP3944_LED_TYPE_LED
,
1055 .name
= "a910:green:",
1056 .status
= LP3944_LED_STATUS_OFF
,
1057 .type
= LP3944_LED_TYPE_LED
,
1060 .name
= "a910:blue:",
1061 .status
= LP3944_LED_STATUS_OFF
,
1062 .type
= LP3944_LED_TYPE_LED
,
1064 /* Leds 3 and 4 are used as display power switches */
1066 .name
= "a910::cli_display",
1067 .status
= LP3944_LED_STATUS_OFF
,
1068 .type
= LP3944_LED_TYPE_LED_INVERTED
1071 .name
= "a910::main_display",
1072 .status
= LP3944_LED_STATUS_ON
,
1073 .type
= LP3944_LED_TYPE_LED_INVERTED
1075 [5] = { .type
= LP3944_LED_TYPE_NONE
},
1077 .name
= "a910::torch",
1078 .status
= LP3944_LED_STATUS_OFF
,
1079 .type
= LP3944_LED_TYPE_LED
,
1082 .name
= "a910::flash",
1083 .status
= LP3944_LED_STATUS_OFF
,
1084 .type
= LP3944_LED_TYPE_LED_INVERTED
,
1089 static struct i2c_board_info __initdata a910_i2c_board_info
[] = {
1091 I2C_BOARD_INFO("lp3944", 0x60),
1092 .platform_data
= &a910_lp3944_leds
,
1095 I2C_BOARD_INFO("mt9m111", 0x5d),
1099 static struct platform_device
*a910_devices
[] __initdata
= {
1101 &camera_supply_dummy_device
,
1104 static void __init
a910_init(void)
1106 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config
));
1107 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config
));
1108 pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config
));
1110 pxa_set_ffuart_info(NULL
);
1111 pxa_set_btuart_info(NULL
);
1112 pxa_set_stuart_info(NULL
);
1114 pxa_set_i2c_info(NULL
);
1115 i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info
));
1117 pxa_set_fb_info(NULL
, &ezx_fb_info_2
);
1119 pxa_set_keypad_info(&a910_keypad_platform_data
);
1121 if (a910_camera_init() == 0)
1122 pxa_set_camera_info(&a910_pxacamera_platform_data
);
1124 pwm_add_table(ezx_pwm_lookup
, ARRAY_SIZE(ezx_pwm_lookup
));
1125 platform_add_devices(ARRAY_AND_SIZE(ezx_devices
));
1126 platform_add_devices(ARRAY_AND_SIZE(a910_devices
));
1127 regulator_has_full_constraints();
1130 MACHINE_START(EZX_A910
, "Motorola EZX A910")
1131 .atag_offset
= 0x100,
1132 .map_io
= pxa27x_map_io
,
1133 .nr_irqs
= EZX_NR_IRQS
,
1134 .init_irq
= pxa27x_init_irq
,
1135 .handle_irq
= pxa27x_handle_irq
,
1136 .init_time
= pxa_timer_init
,
1137 .init_machine
= a910_init
,
1138 .restart
= pxa_restart
,
1142 #ifdef CONFIG_MACH_EZX_E6
1144 static struct gpio_keys_button e6_buttons
[] = {
1146 .code
= KEY_SCREENLOCK
,
1147 .gpio
= GPIO15_E6_LOCK_SWITCH
,
1149 .desc
= "E6 lock switch",
1155 static struct gpio_keys_platform_data e6_gpio_keys_platform_data
= {
1156 .buttons
= e6_buttons
,
1157 .nbuttons
= ARRAY_SIZE(e6_buttons
),
1160 static struct platform_device e6_gpio_keys
= {
1161 .name
= "gpio-keys",
1164 .platform_data
= &e6_gpio_keys_platform_data
,
1168 static struct i2c_board_info __initdata e6_i2c_board_info
[] = {
1169 { I2C_BOARD_INFO("tea5767", 0x81) },
1172 static struct platform_device
*e6_devices
[] __initdata
= {
1176 static void __init
e6_init(void)
1178 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config
));
1179 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config
));
1180 pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config
));
1182 pxa_set_ffuart_info(NULL
);
1183 pxa_set_btuart_info(NULL
);
1184 pxa_set_stuart_info(NULL
);
1186 pxa_set_i2c_info(NULL
);
1187 i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info
));
1189 pxa_set_fb_info(NULL
, &ezx_fb_info_2
);
1191 pxa_set_keypad_info(&e6_keypad_platform_data
);
1193 pwm_add_table(ezx_pwm_lookup
, ARRAY_SIZE(ezx_pwm_lookup
));
1194 platform_add_devices(ARRAY_AND_SIZE(ezx_devices
));
1195 platform_add_devices(ARRAY_AND_SIZE(e6_devices
));
1198 MACHINE_START(EZX_E6
, "Motorola EZX E6")
1199 .atag_offset
= 0x100,
1200 .map_io
= pxa27x_map_io
,
1201 .nr_irqs
= EZX_NR_IRQS
,
1202 .init_irq
= pxa27x_init_irq
,
1203 .handle_irq
= pxa27x_handle_irq
,
1204 .init_time
= pxa_timer_init
,
1205 .init_machine
= e6_init
,
1206 .restart
= pxa_restart
,
1210 #ifdef CONFIG_MACH_EZX_E2
1211 static struct i2c_board_info __initdata e2_i2c_board_info
[] = {
1212 { I2C_BOARD_INFO("tea5767", 0x81) },
1215 static struct platform_device
*e2_devices
[] __initdata
= {
1218 static void __init
e2_init(void)
1220 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config
));
1221 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config
));
1222 pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config
));
1224 pxa_set_ffuart_info(NULL
);
1225 pxa_set_btuart_info(NULL
);
1226 pxa_set_stuart_info(NULL
);
1228 pxa_set_i2c_info(NULL
);
1229 i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info
));
1231 pxa_set_fb_info(NULL
, &ezx_fb_info_2
);
1233 pxa_set_keypad_info(&e2_keypad_platform_data
);
1235 pwm_add_table(ezx_pwm_lookup
, ARRAY_SIZE(ezx_pwm_lookup
));
1236 platform_add_devices(ARRAY_AND_SIZE(ezx_devices
));
1237 platform_add_devices(ARRAY_AND_SIZE(e2_devices
));
1240 MACHINE_START(EZX_E2
, "Motorola EZX E2")
1241 .atag_offset
= 0x100,
1242 .map_io
= pxa27x_map_io
,
1243 .nr_irqs
= EZX_NR_IRQS
,
1244 .init_irq
= pxa27x_init_irq
,
1245 .handle_irq
= pxa27x_handle_irq
,
1246 .init_time
= pxa_timer_init
,
1247 .init_machine
= e2_init
,
1248 .restart
= pxa_restart
,