2 * linux/arch/arm/mach-s5pv310/mach-p8_c210.c
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/platform_device.h>
12 #include <linux/serial_core.h>
13 #include <linux/input.h>
14 #include <linux/gpio.h>
15 #include <linux/gpio_keys.h>
16 #include <linux/delay.h>
17 #include <linux/cma.h>
18 #include <linux/lcd.h>
19 #include <linux/spi/spi.h>
20 #include <linux/spi/spi_gpio.h>
21 #include <linux/i2c.h>
22 #include <linux/i2c-gpio.h>
23 #include <linux/i2c/cypress_touchkey.h>
24 #include <linux/i2c/atmel_mxt_ts.h>
25 #include <linux/clk.h>
26 #include <linux/ntc.h>
27 #include <linux/regulator/machine.h>
28 #include <linux/regulator/fixed.h>
29 #include <linux/power_supply.h>
30 #include <linux/mfd/max8997.h>
31 #include <linux/mfd/max8997-private.h>
32 #include <linux/mfd/mc1n2_pdata.h>
33 #include <linux/power/max17042_battery.h>
34 #include <linux/power/max8903_charger.h>
35 #include <linux/ramoops.h>
36 #include <linux/mmcoops.h>
37 #include <linux/uart_select.h>
38 #include <linux/memblock.h>
39 #include <linux/rtc/rtc-s3c.h>
40 #include <linux/swi.h>
41 #include <linux/jack.h>
42 #include <linux/k3g.h>
43 #include <linux/kr3dh.h>
44 #include <linux/tmd27711.h>
45 #include <linux/ak8975.h>
46 #include <linux/micro_usb_switch.h>
47 #include <linux/switch.h>
48 #include <linux/cm3623.h>
49 #include <linux/host_notify.h>
50 #include <linux/utsname.h>
52 #include <linux/cpufreq.h>
53 #include <linux/modem/xmm6260.h>
54 #include <linux/power/charger-manager.h>
55 #include <video/platform_lcd.h>
57 #include <asm/mach-types.h>
58 #include <asm/mach/arch.h>
59 #include <asm/setup.h>
60 #include <asm/cacheflush.h>
63 #include <mach/gpio.h>
64 #include <mach/regs-clock.h>
65 #include <mach/regs-pmu.h>
66 #include <mach/pm-core.h>
67 #include <mach/nt39411.h>
68 #include <mach/universal.h>
71 #include <plat/clock.h>
72 #include <plat/devs.h>
73 #include <plat/gpio-cfg.h>
74 #include <plat/gpio-core.h>
76 #include <plat/fimg2d.h>
77 #include <plat/mali.h>
80 #include <plat/regs-otg.h>
81 #include <plat/regs-serial.h>
82 #include <plat/s5pv310.h>
84 #include <plat/fimd_drm.h>
85 #include <plat/tvout.h>
87 #include <plat/s5p_fimd_lite.h>
88 #include <plat/usb_ehci.h>
89 #include <plat/sysmmu.h>
90 #include <plat/s5p-otghost.h>
91 #include <plat/udc-hs.h>
92 #include <plat/mipi_dsim.h>
94 #include "gpio-mobile.h"
96 #include "board-mobile.h"
97 #include "../../../drivers/usb/gadget/s3c_udc.h"
99 #ifdef CONFIG_TOUCHSCREEN_MELFAS
100 #include <linux/melfas_ts.h>
103 #ifdef CONFIG_INPUT_SECBRIDGE
104 #include <linux/input/sec-input-bridge.h>
107 #if defined(CONFIG_DEV_THERMAL)
108 #include <plat/s5p-tmu.h>
109 #include <mach/regs-tmu.h>
112 #ifdef CONFIG_INPUT_GP2A
113 #include <linux/input/gp2a.h>
116 /* Following are default values for UCON, ULCON and UFCON UART registers */
117 #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
118 S3C2410_UCON_RXILEVEL | \
119 S3C2410_UCON_TXIRQMODE | \
120 S3C2410_UCON_RXIRQMODE | \
121 S3C2410_UCON_RXFIFO_TOI | \
122 S3C2443_UCON_RXERR_IRQEN)
124 #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
126 #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
127 S5PV210_UFCON_TXTRIG128 | \
128 S5PV210_UFCON_RXTRIG128)
130 extern void p8_config_sleep_gpio_table(void);
132 enum fixed_regulator_id {
133 FIXED_REG_ID_MMC = 0,
142 FIXED_REG_ID_MLCD_ON,
144 FIXED_REG_ID_MAX8903,
147 static struct s3c2410_uartcfg p8_uartcfgs[] __initdata = {
150 .ucon = UNIVERSAL_UCON_DEFAULT,
151 .ulcon = UNIVERSAL_ULCON_DEFAULT,
152 .ufcon = UNIVERSAL_UFCON_DEFAULT,
156 .ucon = UNIVERSAL_UCON_DEFAULT,
157 .ulcon = UNIVERSAL_ULCON_DEFAULT,
158 .ufcon = UNIVERSAL_UFCON_DEFAULT,
162 .ucon = UNIVERSAL_UCON_DEFAULT,
163 .ulcon = UNIVERSAL_ULCON_DEFAULT,
164 .ufcon = UNIVERSAL_UFCON_DEFAULT,
168 .ucon = UNIVERSAL_UCON_DEFAULT,
169 .ulcon = UNIVERSAL_ULCON_DEFAULT,
170 .ufcon = UNIVERSAL_UFCON_DEFAULT,
174 static struct s3c2410_platform_i2c p8_i2c0_platdata __initdata = {
175 .frequency = 300 * 1000,
179 static struct k3g_platform_data p8_k3g_data = {
181 .powerdown = K3G_POWERDOWN_NORMAL,
185 .block_data_update = K3G_BLOCK_DATA_UPDATE,
186 .fullscale = K3G_FULL_SCALE_500DPS,
187 .fifo_mode = K3G_FIFO_FIFO_MODE,
188 .int2_src = K3G_INT2_OVERRUN,
189 .fifo_threshold = 16,
190 .int1_z_high_enable = K3G_Z_HIGH_INT_EN,
191 .int1_y_high_enable = K3G_Y_HIGH_INT_EN,
192 .int1_x_high_enable = K3G_X_HIGH_INT_EN,
193 .int1_latch = K3G_INTERRUPT_LATCHED,
194 .int1_z_threshold = 0x12,
195 .int1_y_threshold = 0x25,
196 .int1_x_threshold = 0x25,
197 .int1_wait_enable = K3G_INT1_WAIT_EN,
198 .int1_wait_duration = 0x10,
201 static struct kr3dh_platform_data p8_kr3dh_data = {
202 .power_mode = KR3DH_LOW_POWER_ONE_HALF_HZ,
203 .data_rate = KR3DH_ODR_50HZ,
208 .int1_cfg = KR3DH_INT_SOURCE,
209 .block_data_update = 1,
210 .fullscale = KR3DH_RANGE_2G,
211 .int1_combination = KR3DH_OR_COMBINATION,
213 .int1_z_high_enable = 1,
214 .int1_z_low_enable = 1,
215 .int1_y_high_enable = 1,
216 .int1_y_low_enable = 1,
217 .int1_x_high_enable = 1,
218 .int1_x_low_enable = 1,
219 .int1_threshold = 0x25,
220 .int1_duration = 0x01,
227 #ifdef CONFIG_CPU_FREQ_TICKLE
228 static void user_input_response_work(struct work_struct *work)
230 /* core 0's cpufreq controls both cores */
231 #ifdef CONFIG_S5PV310_ENABLE_1200MHZ
232 cpufreq_tickle_cpu(80, 0); /* 1000MHz is enough */
234 cpufreq_tickle_cpu(100, 0);
238 static DECLARE_WORK(uir_work, user_input_response_work);
242 static struct i2c_board_info i2c1_devs[] __initdata = {
245 I2C_BOARD_INFO("K3G_1", 0x69),
246 .platform_data = &p8_k3g_data,
250 I2C_BOARD_INFO("KR3DH", 0x19),
251 .platform_data = &p8_kr3dh_data,
256 /* TODO: should be modify for U1 */
257 extern struct max8997_platform_data p8_max8997_pdata;
258 extern void __init p8_pmic_init(void);
260 static void haptic_control_power(struct device *dev, int on)
262 static struct regulator *regulator;
263 static DEFINE_MUTEX(lock);
272 if (regulator == NULL)
273 regulator = regulator_get(dev, "inmotor");
274 if (IS_ERR_OR_NULL(regulator)) {
280 ret = regulator_enable(regulator);
282 ret = regulator_disable(regulator);
290 struct max8997_haptic_platform_data p8_haptic_pdata = {
293 .control_power = haptic_control_power,
296 /* GPIO I2C 5 (PMIC) */
297 enum { I2C5_MAX8997 };
298 static struct i2c_board_info i2c5_devs[] __initdata = {
300 I2C_BOARD_INFO("max8997", 0xCC >> 1),
301 .platform_data = &p8_max8997_pdata,
305 static void sec_set_sub_mic_bias(bool on)
308 gpio = MOBILE_GPIO(SUB_MICBIAS_EN);
309 gpio_set_value(gpio, on);
310 pr_err(KERN_ERR "SUB_MIC_BIAS_EN GPIO set [%d] !\n", on);
313 static void sec_set_main_mic_bias(bool on)
316 gpio = MOBILE_GPIO(MICBIAS_EN);
317 gpio_set_value(gpio, on);
318 pr_err(KERN_ERR "MAIN_MIC_BIAS_EN GPIO set [%d] !\n", on);
321 static struct mc1n2_platform_data mc1n2_pdata = {
322 .set_main_mic_bias = sec_set_main_mic_bias,
323 .set_sub_mic_bias = sec_set_sub_mic_bias,
327 static struct i2c_board_info i2c6_devs[] __initdata = {
330 I2C_BOARD_INFO("mc1n2", 0x3a),
331 .platform_data = &mc1n2_pdata,
335 static void __init p8_sound_init(void)
341 /* Set PMU register to set CLK_OUT to use XUSBXTI
342 * as codec source clock */
344 __raw_writel(val, S5P_PMREG(0xA00));
346 gpio = MOBILE_GPIO(MICBIAS_EN);
347 err = gpio_request(gpio, "MICBIAS_EN");
349 pr_err(KERN_ERR "MIC_BIAS_EN GPIO set error!\n");
352 gpio_direction_output(gpio, 1);
353 gpio_set_value(gpio, 0);
355 gpio = MOBILE_GPIO(EAR_MICBIAS_EN);
356 err = gpio_request(gpio, "EAR_MICBIAS_EN");
358 pr_err(KERN_ERR "EAR_MIC_BIAS_EN GPIO set error!\n");
361 gpio_direction_output(gpio, 1);
362 gpio_set_value(gpio, 0);
364 gpio = MOBILE_GPIO(SUB_MICBIAS_EN);
365 err = gpio_request(gpio, "submic_bias");
367 pr_err(KERN_ERR "SUB_MIC_BIAS_EN GPIO set error!\n");
370 gpio_direction_output(gpio, 0);
373 static struct ak8975_platform_data universal_ak8975_data = {
374 .poll_interval = 100,
378 static struct i2c_board_info i2c7_devs[] __initdata = {
381 I2C_BOARD_INFO("ak8975", 0x0c),
382 .platform_data = &universal_ak8975_data,
389 static struct i2c_gpio_platform_data i2c9_gpio_data = {
390 .sda_pin = S5PV310_GPY4(0), /* XM0ADDR_8 */
391 .scl_pin = S5PV310_GPY4(1), /* XM0ADDR_9 */
394 static struct platform_device i2c9_gpio = {
398 .platform_data = &i2c9_gpio_data,
402 static struct max17042_reg_data max17042_init_data[] = {
403 { MAX17042_CGAIN, 0x0000 },
404 { MAX17042_MiscCFG, 0x0003 },
405 { MAX17042_LearnCFG, 0x0007 },
406 /* RCOMP: 0x0050 2011.02.29 from MAXIM */
407 { MAX17042_RCOMP0, 0x0050 },
409 /* Alert only when the battery is removed or inserted */
410 static struct max17042_reg_data max17042_alert_init_data[] = {
411 /* SALRT Threshold setting (disable) unsigned MAX/MIN */
412 { MAX17042_SALRT_Th, 0xFF00 },
413 /* VALRT Threshold setting (disable) unsigned MAX/MIN */
414 { MAX17042_VALRT_Th, 0xFF00 },
415 /* TALRT Threshold setting (disable) signed MAX/MIN */
416 { MAX17042_TALRT_Th, 0x7F80 },
418 static struct max17042_platform_data p8_battery_platform_data = {
419 .init_data = max17042_init_data,
420 .num_init_data = ARRAY_SIZE(max17042_init_data),
421 .alrt_data = max17042_alert_init_data,
422 .num_alrt_data = ARRAY_SIZE(max17042_alert_init_data),
423 .irq_base = IRQ_FUEL_BASE,
424 .enable_alert = true,
426 .r_sns = 10000, /* 10m Ohm */
429 enum { I2C9_MAX17042};
430 static struct i2c_board_info i2c9_devs[] __initdata = {
432 I2C_BOARD_INFO("max17042", 0x36),
433 .platform_data = &p8_battery_platform_data,
438 /* GPIO I2C 12 (3 Touchkey) */
439 #define TOUCHKEY_INT S5PV310_GPL0(5)
440 #define TOUCHKEY_SCL S5PV310_GPK1(0)
441 #define TOUCHKEY_SDA S5PV310_GPK1(2)
443 static struct i2c_gpio_platform_data i2c12_gpio_data = {
444 .sda_pin = S5PV310_GPK1(2), /* XMDMDATA_8 */
445 .scl_pin = S5PV310_GPK1(0), /* XMDMDATA_9 */
448 static struct platform_device i2c12_gpio = {
452 .platform_data = &i2c12_gpio_data,
456 /*===============================*/
457 /*= CYPRESS TOUCH KEY =*/
458 /*===============================*/
459 static struct cypress_pin cypress_tk_pin = {
461 .gpio_int = TOUCHKEY_INT,
462 .gpio_sda = TOUCHKEY_SDA,
463 .gpio_scl = TOUCHKEY_SCL,
466 static void cypress_tk_cfg_pin(void)
468 s3c_gpio_setpull(cypress_tk_pin.gpio_sda, S3C_GPIO_PULL_NONE);
469 s3c_gpio_setpull(cypress_tk_pin.gpio_scl, S3C_GPIO_PULL_NONE);
471 s3c_gpio_cfgpin(cypress_tk_pin.gpio_sda, S3C_GPIO_SFN(2));
472 s3c_gpio_cfgpin(cypress_tk_pin.gpio_scl, S3C_GPIO_SFN(2));
474 s3c_gpio_cfgpin(cypress_tk_pin.gpio_int, S3C_GPIO_SFN(0xf));
475 if (gpio_is_valid(cypress_tk_pin.gpio_en))
476 s3c_gpio_cfgpin(cypress_tk_pin.gpio_en, S3C_GPIO_OUTPUT);
479 static int cypress_touchkey_power(int onoff)
481 static struct regulator *regulator;
482 static DEFINE_MUTEX(lock);
488 if (enabled == !!onoff)
491 if (regulator == NULL)
492 regulator = regulator_get(NULL, "touch_2.8v");
493 if (IS_ERR_OR_NULL(regulator)) {
495 pr_err("[TK][ERROR] regulator_get fail\n");
501 ret = regulator_enable(regulator);
503 ret = regulator_disable(regulator);
514 static int cypress_touchled_power(int onoff)
516 static struct regulator *regulator;
517 static DEFINE_MUTEX(lock);
523 if (enabled == !!onoff)
526 if (regulator == NULL)
527 regulator = regulator_get(NULL, "touch_led_3.3v");
528 if (IS_ERR_OR_NULL(regulator)) {
530 pr_err("[TK][ERROR] regulator_get fail\n");
536 ret = regulator_enable(regulator);
538 ret = regulator_disable(regulator);
549 static unsigned int p8_cypress_touch_keycode[] = {
550 KEY_PHONE, /* not use this value 0x00 */
551 KEY_PHONE, /* KEY_SEND 0x01 */
552 KEY_BACK, /* KEY_END 0x02 */
555 static unsigned char p8_cypress_keycode_setbit[] = {
561 static struct cypress_platform_data cypress_tk_data = {
562 .cfg_pin = cypress_tk_cfg_pin,
563 .power_pin = cypress_touchkey_power,
564 .led_pin = cypress_touchled_power,
565 .pin = &cypress_tk_pin,
566 .keycode = p8_cypress_touch_keycode,
567 .keycode_size = ARRAY_SIZE(p8_cypress_touch_keycode),
568 .keycode_setbit = p8_cypress_keycode_setbit,
572 static struct i2c_board_info i2c12_devs_cypress[] __initdata = {
574 I2C_BOARD_INFO("cypress_tk", 0x20),
575 .platform_data = &cypress_tk_data,
579 static void __init universal_touchkey_init(void)
584 gpio = TOUCHKEY_INT; /* XMDMDATA_7 */
585 gpio_request(gpio, "3_TOUCH_INT");
586 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
587 irq = gpio_to_irq(gpio);
588 i2c12_devs_cypress[0].irq = irq;
591 static struct regulator_consumer_supply supplies_ps_on_led_a[] = {
592 REGULATOR_SUPPLY("led_a_2.8v", NULL),
594 static struct regulator_init_data ps_on_led_a_data = {
596 .name = "LED_A_2.8V",
597 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
604 .num_consumer_supplies = ARRAY_SIZE(supplies_ps_on_led_a),
605 .consumer_supplies = supplies_ps_on_led_a,
607 static struct fixed_voltage_config ps_on_led_a_pdata = {
608 .supply_name = "LED_A_2.8V",
609 .microvolts = 2800000,
610 .gpio = S5PV310_GPE2(3), /* PS_ON */
612 .enabled_at_boot = 0,
613 .init_data = &ps_on_led_a_data,
615 static struct platform_device ps_on_led_a_fixed_reg_dev = {
616 .name = "reg-fixed-voltage",
617 .id = FIXED_REG_ID_LED_A,
618 .dev = { .platform_data = &ps_on_led_a_pdata },
622 static struct i2c_gpio_platform_data i2c14_gpio_data = {
623 .sda_pin = S5PV310_GPK2(2), /* XMMC2CDn */
624 .scl_pin = S5PV310_GPK3(2), /* XMMC3CDn */
625 .udelay = 1, /* 500kHz */
628 static struct platform_device i2c14_gpio = {
632 .platform_data = &i2c14_gpio_data,
636 #ifdef CONFIG_INPUT_GP2A
637 static int gp2a_led_control(bool enable)
639 static struct regulator *regulator;
640 static DEFINE_MUTEX(lock);
646 if (!enabled && !enable)
649 if (regulator == NULL)
650 regulator = regulator_get_exclusive(NULL, "led_a_2.8v");
651 WARN(IS_ERR_OR_NULL(regulator), "%s cannot get regulator\n", __func__);
652 if (IS_ERR_OR_NULL(regulator)) {
660 regulator_disable(regulator);
663 regulator_enable(regulator);
666 regulator_disable(regulator);
674 static struct gp2a_platform_data p8_gp2a_pdata = {
675 .gp2a_led_on = gp2a_led_control,
676 .p_out = S5PV310_GPX0(2),
679 static struct platform_device opt_gp2a = {
683 .platform_data = &p8_gp2a_pdata,
687 static struct i2c_board_info i2c14_devs[] __initdata = {
689 I2C_BOARD_INFO("gp2a", 0x72 >> 1),
694 static void __init p8_sensor_init(void)
698 gpio = S5PV310_GPX2(2); /* XEINT_18 */
699 gpio_request(gpio, "MSENSE_INT");
700 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
701 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
702 i2c7_devs[0].irq = gpio_to_irq(gpio);
704 gpio = S5PV310_GPX0(0); /* XEINT_0 */
705 gpio_request(gpio, "GYRO_INT");
706 gpio_direction_input(gpio);
707 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
709 gpio = S5PV310_GPX0(1); /* XEINT_1 */
710 gpio_request(gpio, "GYRO_INT1");
711 gpio_direction_input(gpio);
712 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
715 gpio = S5PV310_GPX3(0); /* XEINT_24 */
716 gpio_request(gpio, "ACC_INT");
717 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
718 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
720 /* added for gp2a light sensor*/
721 platform_device_register_simple("light_gp2a", 0, NULL, 0);
725 static struct i2c_gpio_platform_data i2c15_gpio_data = {
726 .sda_pin = S5PV310_GPY3(0), /* XM0ADDR_0 */
727 .scl_pin = S5PV310_GPY3(2), /* XM0ADDR_2 */
731 static struct platform_device i2c15_gpio = {
735 .platform_data = &i2c15_gpio_data,
739 static struct i2c_board_info i2c15_devs[] __initdata = {
746 #define GPIO_NFC_SCL_1_8V S5PV310_GPY0(0)
747 #define GPIO_NFC_SDA_1_8V S5PV310_GPY0(1)
748 #define GPIO_NFC_IRQ S5PV310_GPX1(7)
749 #define GPIO_NFC_EN S5PV310_GPL2(6)
750 #define GPIO_NFC_FIRMWARE S5PV310_GPL2(7)
752 static struct i2c_gpio_platform_data i2c16_gpio_data = {
753 .sda_pin = GPIO_NFC_SDA_1_8V,
754 .scl_pin = GPIO_NFC_SCL_1_8V,
758 static struct platform_device i2c16_gpio = {
762 .platform_data = &i2c16_gpio_data,
767 #if defined(CONFIG_VIDEO_S5K5BAFX)
768 #define VT_CAM_SDA_18V S5PV310_GPC1(0)
769 #define VT_CAM_SCL_18V S5PV310_GPC1(2)
771 static struct i2c_gpio_platform_data i2c17_platdata = {
772 .sda_pin = VT_CAM_SDA_18V,
773 .scl_pin = VT_CAM_SCL_18V,
775 .sda_is_open_drain = 0,
776 .scl_is_open_drain = 0,
777 .scl_is_output_only = 0,
780 static struct platform_device s3c_device_i2c17 = {
783 .dev.platform_data = &i2c17_platdata,
786 static struct i2c_board_info i2c17_devs[] __initdata = {
788 I2C_BOARD_INFO("s5k5bafx", (0x5A >> 1)),
795 #define GPIO_FM_SDA_28V S5PV310_GPB(2)
796 #define GPIO_FM_SCL_28V S5PV310_GPB(3)
798 static struct i2c_gpio_platform_data i2c18_gpio_data = {
799 .sda_pin = GPIO_FM_SDA_28V,
800 .scl_pin = GPIO_FM_SCL_28V,
803 static struct platform_device i2c18_gpio = {
807 .platform_data = &i2c18_gpio_data,
811 static struct i2c_board_info i2c18_devs[] __initdata = {
813 I2C_BOARD_INFO("si470x", (0x20 >> 1)),
819 static struct s5p_usb_ehci_platdata p8_usb_ehci_pdata;
821 static void __init p8_usb_ehci_init(void)
823 struct s5p_usb_ehci_platdata *pdata = &p8_usb_ehci_pdata;
825 /* The gpios is initialized from modem_init */
826 pdata->gpio_active = MOBILE_GPIO(ACTIVE_STATE_HSIC);
828 s5p_usb_ehci_set_platdata(pdata);
832 /* we don't use OTGDRVVBUS pin for powering up otg charging pump */
833 static void p8_otg_power_cb(int enable)
836 u8 on = (u8)!!enable;
837 gpio = MOBILE_GPIO(USB_OTG_EN);
838 gpio_request(gpio, "USB_OTG_EN");
839 gpio_direction_output(gpio, on);
841 pr_info("%s: otg power = %d\n", __func__, on);
844 static void __init p8_usb_otg_init(void)
846 struct host_notify_dev *p8_otg_ndev =
847 dev_get_platdata(&s3c_device_usbgadget.dev);
848 struct sec_otghost_data *p8_otg_host_data =
849 dev_get_platdata(&s3c_device_usb_otghcd.dev);
851 p8_otg_ndev->set_booster = p8_otg_power_cb;
852 p8_otg_host_data->set_pwr_cb = p8_otg_power_cb;
856 static struct platform_device p8_modem_net = {
861 /* XMM6260 control */
862 static struct xmm6260_gpios p8_xmm6260_gpios;
864 static struct xmm6260_platform_data p8_xmm6260_pdata = {
865 .gpios = &p8_xmm6260_gpios,
870 * SLP uses standardized device name of modemctl
871 * and this is same to Android.
873 static struct platform_device p8_xmm6260 = {
877 .platform_data = &p8_xmm6260_pdata,
881 static void __init p8_modem_init(void)
883 struct xmm6260_gpios *gpios = &p8_xmm6260_gpios;
886 gpio = MOBILE_GPIO(CP_ON);
887 gpio_request(gpio, "CP_ON");
888 gpio_direction_output(gpio, 0);
891 gpio = MOBILE_GPIO(PHONE_ACTIVE);
892 gpio_request(gpio, "PHONE_ACTIVE");
893 gpios->phone_active = gpio;
895 gpio = MOBILE_GPIO(PDA_ACTIVE);
896 gpio_request(gpio, "PDA_ACTIVE");
897 gpio_direction_output(gpio, 0);
898 gpios->pda_active = gpio;
900 gpio = MOBILE_GPIO(CP_DUMP_INT);
901 gpio_request(gpio, "CP_DUMP_INT");
902 gpios->cp_dump_int = gpio;
904 gpio = MOBILE_GPIO(CP_PMU_RST);
905 gpio_request(gpio, "CP_PMU_RST");
906 gpio_direction_output(gpio, 0);
907 gpios->cp_pmu_rst = gpio;
909 gpio = MOBILE_GPIO(RESET_REQ_N);
910 gpio_request(gpio, "RESET_REQ_N");
911 gpio_direction_output(gpio, 0);
912 gpios->reset_req_n = gpio;
914 gpio = MOBILE_GPIO(IPC_SLAVE_WAKEUP);
915 gpio_request(gpio, "IPC_SLAVE_WAKEUP");
916 gpio_direction_output(gpio, 0);
917 gpios->ipc_slave_wakeup = gpio;
919 gpio = MOBILE_GPIO(IPC_HOST_WAKEUP);
920 gpio_request(gpio, "IPC_HOST_WAKEUP");
921 gpios->ipc_host_wakeup = gpio;
923 gpio = MOBILE_GPIO(SUSPEND_REQUEST_HSIC);
924 gpio_request(gpio, "SUSPEND_REQUEST_HSIC");
925 gpios->suspend_request_hsic = gpio;
927 gpio = MOBILE_GPIO(ACTIVE_STATE_HSIC);
928 gpio_request(gpio, "ACTIVE_STATE_HSIC");
929 gpio_direction_output(gpio, 0);
930 gpios->active_state_hsic = gpio;
934 static void p8_set_uart_switch(int path)
938 gpio = MOBILE_GPIO(UART_SEL);
939 gpio_request(gpio, "UART_SEL");
941 /* p8 target is gpio_high == AP */
942 if (path == UART_SW_PATH_AP)
943 gpio_set_value(gpio, GPIO_LEVEL_HIGH);
944 else if (path == UART_SW_PATH_CP)
945 gpio_set_value(gpio, GPIO_LEVEL_LOW);
951 static int p8_get_uart_switch(void)
956 gpio = MOBILE_GPIO(UART_SEL);
957 gpio_request(gpio, "UART_SEL");
958 val = gpio_get_value(gpio);
961 /* p8 target is gpio_high == AP */
962 if (val == GPIO_LEVEL_HIGH)
963 return UART_SW_PATH_AP;
964 else if (val == GPIO_LEVEL_LOW)
965 return UART_SW_PATH_CP;
967 return UART_SW_PATH_NA;
970 static struct uart_select_platform_data p8_uart_select_data = {
971 .set_uart_switch = p8_set_uart_switch,
972 .get_uart_switch = p8_get_uart_switch,
975 static struct platform_device p8_uart_select = {
976 .name = "uart-select",
979 .platform_data = &p8_uart_select_data,
983 static struct regulator_consumer_supply emmc_supplies[] = {
984 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
985 REGULATOR_SUPPLY("vmmc", "dw_mmc"),
988 static struct regulator_init_data emmc_fixed_voltage_init_data = {
990 .name = "VMEM_VDD_2.8V",
991 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
993 .num_consumer_supplies = ARRAY_SIZE(emmc_supplies),
994 .consumer_supplies = emmc_supplies,
997 static struct fixed_voltage_config emmc_fixed_voltage_config = {
998 .supply_name = "eMMC_EN",
999 .microvolts = 2800000,
1000 .gpio = S5PV310_GPK0(2),
1001 .enable_high = true,
1002 .init_data = &emmc_fixed_voltage_init_data,
1005 static struct platform_device emmc_fixed_voltage = {
1006 .name = "reg-fixed-voltage",
1007 .id = FIXED_REG_ID_MMC,
1009 .platform_data = &emmc_fixed_voltage_config,
1016 /* GSD4T GPS module */
1017 static struct gsd4t_platform_data p8_gsd4t_data = {
1018 .onoff = S5PV310_GPE0(3),
1019 .nrst = S5PV310_GPE0(4),
1020 .tsync = S5PV310_GPE0(1),
1021 .uart_rxd = S5PV310_GPA0(4),
1022 .uart_txd = S5PV310_GPA0(5),
1023 .uart_cts = S5PV310_GPA0(6),
1024 .uart_rts = S5PV310_GPA0(7),
1027 static struct platform_device p8_gsd4t = {
1031 .platform_data = &p8_gsd4t_data,
1037 #ifdef CONFIG_DRM_MALI
1038 static struct platform_device s5p_device_mali_drm = {
1045 #ifdef CONFIG_DRM_FIMD
1046 static struct resource fimd_drm_resource[] = {
1048 .start = S5P_PA_LCD0,
1049 .end = S5P_PA_LCD0 + S5P_SZ_LCD0 - 1,
1050 .flags = IORESOURCE_MEM,
1053 .start = S5P_PA_LCD1,
1054 .end = S5P_PA_LCD1 + S5P_SZ_LCD1 - 1,
1055 .flags = IORESOURCE_MEM,
1060 .flags = IORESOURCE_IRQ,
1065 .flags = IORESOURCE_IRQ,
1069 static struct fimd_drm_platform_data fimd_drm_pd = {
1073 static struct platform_device s5p_device_fimd_drm = {
1076 .num_resources = ARRAY_SIZE(fimd_drm_resource),
1077 .resource = fimd_drm_resource,
1079 .platform_data = &fimd_drm_pd,
1085 static struct s3c_adc_platform_data s3c_adc_pdata __initdata = {
1089 .max_adc_voltage_uV = 3300000,
1092 static void __init p8_adc_init(void)
1094 s3c_adc_set_platdata(&s3c_adc_pdata);
1097 static void ramoops_enable(int enable)
1101 clk = clk_get(NULL, "modem");
1109 static struct ramoops_platform_data p8_ramoops_data = {
1110 .mem_address = 0x13A00000, /* MODEM I/F */
1112 .enable = ramoops_enable,
1115 static struct platform_device p8_ramoops = {
1118 .platform_data = &p8_ramoops_data,
1123 static struct platform_device p8_tzpc = {
1128 #ifdef CONFIG_ANDROID_RAM_CONSOLE
1129 static struct resource ram_console_resource[] = {
1131 .flags = IORESOURCE_MEM,
1135 static struct platform_device ram_console_device = {
1136 .name = "ram_console",
1138 .num_resources = ARRAY_SIZE(ram_console_resource),
1139 .resource = ram_console_resource,
1143 static void __init p8_map_io(void)
1145 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
1146 s5p_xtal_set_parent(CLK_XUSBXTI);
1147 s3c24xx_init_clocks(24000000);
1148 s3c24xx_init_uarts(p8_uartcfgs, ARRAY_SIZE(p8_uartcfgs));
1151 static unsigned long fbmem_start, fbmem_size;
1152 static int __init early_fbmem(char *p)
1159 fbmem_size = memparse(p, &endp);
1161 fbmem_start = memparse(endp + 1, &endp);
1163 return endp > p ? 0 : -EINVAL;
1165 early_param("fbmem", early_fbmem);
1167 static struct cma_region regions[] = {
1168 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD0
1171 .size = (CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD0
1172 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD1
1173 + CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD1
1178 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC0
1181 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC0 * SZ_1K,
1185 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1
1188 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1 * SZ_1K,
1192 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC2
1195 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC2 * SZ_1K,
1199 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3
1202 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3 * SZ_1K,
1206 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG
1209 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG * SZ_1K,
1212 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC
1215 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC * SZ_1K,
1218 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0
1221 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0 * SZ_1K,
1223 .alignment = 1 << 17,
1227 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1
1230 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1 * SZ_1K,
1232 .alignment = 1 << 17,
1236 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_MFC
1240 { .alignment = 128 << 10 },
1241 .start = 0x42000000,
1246 .start = 0x43000000,
1251 .start = 0x51000000,
1254 #ifdef CONFIG_SEC_DEBUG
1258 .start = 0x40003000,
1264 static void __init s5pv310_reserve(void)
1266 static const char map[] __initconst =
1268 #ifdef CONFIG_VIDEO_FIMC
1275 #ifdef CONFIG_SEC_DEBUG
1276 "s3c-getlog=getlog;"
1278 #if !defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
1279 "s5p-mfc=mfc,mfc0,mfc1;"
1281 "mfc=mfc,mfc0,mfc1;"
1282 "s5p-mfc/f=fw;s5p-mfc/a=b1;s5p-mfc/b=b2;"
1288 #ifdef CONFIG_ANDROID_RAM_CONSOLE
1291 /* FIXME: ram console MUST be reserved at first time */
1292 addr = memblock_alloc_base(SZ_1M, SZ_4K, 0x60000000);
1293 ram_console_resource[0].start = addr;
1294 ram_console_resource[0].end = addr + SZ_1M - 1;
1295 pr_info("ram_console: 0x%08x ~ 0x%08x (1MB)\n",
1296 addr, addr + SZ_1M);
1300 regions[0].start = (dma_addr_t)fbmem_start;
1302 regions[0].size = (size_t)fbmem_size;
1304 cma_set_defaults(regions, map);
1305 cma_early_regions_reserve(NULL);
1307 for (; i < ARRAY_SIZE(regions) - 1 /* terminator */; ++i) {
1308 pr_info("cma: region: %-8s: 0x%08x ~ 0x%08x (%dMB)\n",
1309 regions[i].name, regions[i].start,
1310 regions[i].start + regions[i].size,
1311 regions[i].size / SZ_1M);
1315 #ifdef CONFIG_HIBERNATION
1316 static int __init p8_set_nosave_regions(void)
1320 for ( i = ARRAY_SIZE(regions) - 2; i >= 0 /* terminator */; i--) {
1321 /* MFC firmware SHOULD BE saved.
1322 * If the region is fw, don't register to nosave regions */
1323 if (strcmp(regions[i].name, "fw"))
1324 register_nosave_region_late(
1325 __phys_to_pfn(regions[i].start),
1326 __phys_to_pfn(regions[i].start +
1331 late_initcall(p8_set_nosave_regions);
1335 * GPX are saved and restored at plat-samsung/pm.c:s5c_pm_enter.
1336 * However, they are inside of pm_prepare and pm_finish, so it
1337 * does not save ours against universal_pm_prepare:2.
1339 static struct sleep_save s5pc210_gpx[] = {
1340 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C00),
1341 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C04),
1342 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C08),
1343 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C0C),
1344 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C20),
1345 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C24),
1346 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C28),
1347 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C2C),
1348 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C40),
1349 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C44),
1350 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C48),
1351 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C4C),
1352 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C60),
1353 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C64),
1354 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C68),
1355 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C6C),
1359 static struct gpio_keys_button p8_gpio_keys_tables[] = {
1361 .code = KEY_VOLUMEUP,
1362 .gpio = S5PV310_GPX2(0), /* XEINT16 */
1363 .desc = "gpio-keys: KEY_VOLUMEUP",
1366 .debounce_interval = 1,
1367 /* YUBAEK 20110905 RAMDUMP_DEBUG : Android forceable ramdump ++ */
1368 #ifdef CONFIG_INPUT_FORCE_PANIC_KEY
1369 .isr_hook = sec_debug_check_crash_key , /* VOL UP */
1371 /* YUBAEK 20110905 RAMDUMP_DEBUG : Android forceable ramdump -- */
1374 .code = KEY_VOLUMEDOWN,
1375 .gpio = S5PV310_GPX2(1), /* XEINT17 */
1376 .desc = "gpio-keys: KEY_VOLUMEDOWN",
1379 .debounce_interval = 1,
1380 /* YUBAEK 20110905 RAMDUMP_DEBUG : Android forceable ramdump ++ */
1381 #ifdef CONFIG_INPUT_FORCE_PANIC_KEY
1382 .isr_hook = sec_debug_check_crash_key , /*VOL DOWN */
1384 /* YUBAEK 20110905 RAMDUMP_DEBUG : Android forceable ramdump -- */
1388 .gpio = S5PV310_GPX2(7), /* XEINT23 */
1389 .desc = "gpio-keys: KEY_POWER",
1393 .debounce_interval = 1,
1395 /* KEY_MENU will be used */
1396 .code = KEY_MENU, /* KEY_OK */
1397 .gpio = S5PV310_GPX3(5), /* XEINT29 */
1398 .desc = "gpio-keys: KEY_MENU",
1402 .debounce_interval = 1,
1403 /* YUBAEK 20110905 RAMDUMP_DEBUG : Android forceable ramdump ++ */
1404 #ifdef CONFIG_INPUT_FORCE_PANIC_KEY
1405 .isr_hook = sec_debug_check_crash_key , /* HOME */
1407 /* YUBAEK 20110905 RAMDUMP_DEBUG : Android forceable ramdump -- */
1412 static struct gpio_keys_platform_data p8_gpio_keys_data = {
1413 .buttons = p8_gpio_keys_tables,
1414 .nbuttons = ARRAY_SIZE(p8_gpio_keys_tables),
1417 static struct platform_device p8_gpio_keys = {
1418 .name = "gpio-keys",
1420 .platform_data = &p8_gpio_keys_data,
1423 /* s6e8aa0 panel. */
1424 static struct s3cfb_lcd s6e8aa0 = {
1441 .cmd_allow_len = 0xf,
1452 static struct fixed_voltage_config lcd_fixreg_cfg[] = {
1454 .supply_name = "MLCD_ON",
1455 .microvolts = 2800000,
1456 .gpio = S5PV310_GPE2(1),
1458 .init_data = &cam_fixreg_init_data[0],
1461 .supply_name = "LCD_EN",
1462 .microvolts = 1500000,
1463 .gpio = S5PV310_GPE2(2),
1465 .init_data = &cam_fixreg_init_data[1],
1469 static struct platform_device lcd_fixed_reg_dev[] = {
1471 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_MLCD_ON,
1472 .dev = { .platform_data = &cam_fixreg_cfg[0] },
1474 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_LCD_EN,
1475 .dev = { .platform_data = &cam_fixreg_cfg[1] },
1479 static int lcd_power_on(struct lcd_device *ld, int enable)
1482 static struct regulator *r_28, *r_33;
1483 static DEFINE_MUTEX(lock);
1484 static bool enabled;
1487 gpio1 = S5PV310_GPK1(1);
1488 gpio_request(gpio1, "MLCD_ON");
1489 gpio2 = S5PV310_GPL0(7);
1490 gpio_request(gpio2, "LCD_EN");
1492 dev_info(&ld->dev, "enable=%d\n", enable);
1496 if (enabled == !!enable)
1500 r_33 = regulator_get(&ld->dev, "vadc");
1501 if (IS_ERR_OR_NULL(r_33)) {
1508 r_28 = regulator_get(&ld->dev, "vcc_2.8v_pda");
1509 if (IS_ERR_OR_NULL(r_28)) {
1516 ret = regulator_enable(r_28);
1520 ret = regulator_enable(r_33);
1526 gpio_direction_output(gpio1, 1);
1529 gpio_direction_output(gpio2, 1);
1531 mutex_unlock(&lock);
1536 static int reset_lcd(struct lcd_device *ld)
1538 static unsigned int first = 1;
1539 int reset_gpio = -1;
1541 reset_gpio = S5PV310_GPF0(1);
1544 gpio_request(reset_gpio, "MLCD_RST");
1548 gpio_direction_output(reset_gpio, 0);
1550 gpio_direction_output(reset_gpio, 1);
1555 static int s5p_mipi_dphy_power(struct platform_device *pdev, unsigned int enable)
1557 static struct regulator *p_mipi_1_1v, *p_mipi_1_8v;
1558 static DEFINE_MUTEX(lock);
1559 static bool enabled;
1562 dev_info(&pdev->dev, "enable = %d\n", enable);
1566 if (enabled == !!enable)
1569 if (p_mipi_1_1v == NULL)
1570 p_mipi_1_1v = regulator_get(&pdev->dev, "mipi_1.1v_c210");
1571 if (IS_ERR_OR_NULL(p_mipi_1_1v)) {
1574 dev_err(&pdev->dev, "failed to get regulator.\n");
1578 if (p_mipi_1_8v == NULL)
1579 p_mipi_1_8v = regulator_get(&pdev->dev, "vmipi_1.8v");
1580 if (IS_ERR_OR_NULL(p_mipi_1_8v)) {
1583 dev_err(&pdev->dev, "failed to get regulator.\n");
1588 ret = regulator_enable(p_mipi_1_1v);
1591 ret = regulator_enable(p_mipi_1_8v);
1595 ret = regulator_disable(p_mipi_1_1v);
1598 ret = regulator_disable(p_mipi_1_8v);
1605 mutex_unlock(&lock);
1609 static struct mipi_dsim_config dsim_config = {
1610 .e_interface = DSIM_VIDEO,
1611 .e_virtual_ch = DSIM_VIRTUAL_CH_0,
1612 .e_pixel_format = DSIM_24BPP_888,
1613 .e_burst_mode = DSIM_BURST_SYNC_EVENT,
1614 .e_no_data_lane = DSIM_DATA_LANE_4,
1615 .e_byte_clk = DSIM_PLL_OUT_DIV8,
1618 * ===========================================
1619 * | P | M | S | MHz |
1620 * -------------------------------------------
1621 * | 3 | 100 | 3 | 100 |
1622 * | 3 | 100 | 2 | 200 |
1623 * | 3 | 63 | 1 | 252 |
1624 * | 4 | 100 | 1 | 300 |
1625 * | 4 | 110 | 1 | 330 |
1626 * | 12 | 350 | 1 | 350 |
1627 * | 3 | 100 | 1 | 400 |
1628 * | 4 | 150 | 1 | 450 |
1629 * | 3 | 120 | 1 | 480 |
1630 * | 12 | 250 | 0 | 500 |
1631 * | 4 | 100 | 0 | 600 |
1632 * | 3 | 81 | 0 | 648 |
1633 * | 3 | 88 | 0 | 704 |
1634 * | 3 | 90 | 0 | 720 |
1635 * | 3 | 100 | 0 | 800 |
1636 * | 12 | 425 | 0 | 850 |
1637 * | 4 | 150 | 0 | 900 |
1638 * | 12 | 475 | 0 | 950 |
1639 * | 6 | 250 | 0 | 1000 |
1640 * -------------------------------------------
1647 /* D-PHY PLL stable time spec :min = 200usec ~ max 400usec */
1648 .pll_stable_time = 500,
1650 /* escape clk : 10MHz */
1651 .esc_clk = 10 * 1000000,
1653 /* stop state holding counter after bta change count 0 ~ 0xfff */
1654 .stop_holding_cnt = 0x7ff,
1655 /* bta timeout 0 ~ 0xff */
1656 .bta_timeout = 0xff,
1657 /* lp rx timeout 0 ~ 0xffff */
1658 .rx_timeout = 0xffff,
1661 static struct s5p_platform_mipi_dsim dsim_platform_data = {
1664 .phy_enable = s5p_dsim_phy_enable,
1665 .dsim_config = &dsim_config,
1668 static struct lcd_platform_data s6e8aa0_pd = {
1670 .power_on = lcd_power_on,
1672 .power_off_delay = 120,
1673 .power_on_delay = 120,
1676 static struct mipi_dsim_lcd_device mipi_lcd_device = {
1678 .panel_id = "ams767kc01", /* p8 */
1682 .platform_data = (void *)&s6e8aa0_pd,
1685 #ifdef CONFIG_VIDEO_FIMG2D
1686 static struct fimg2d_platdata fimg2d_data __initdata = {
1688 .parent_clkname = "mout_g2d0",
1689 .clkname = "sclk_fimg2d",
1690 .gate_clkname = "fimg2d",
1691 .smmu_gate_clkname = "smmu_fimg2d",
1692 .clkrate = 250 * 1000000,
1696 static struct s3c_platform_fb fb_platform_data __initdata = {
1699 #ifdef CONFIG_FB_S3C_DEFAULT_WINDOW
1700 .default_win = CONFIG_FB_S3C_DEFAULT_WINDOW,
1704 .swap = FB_SWAP_HWORD | FB_SWAP_WORD,
1707 #ifdef CONFIG_FB_S3C_HIBERNATION_LOADING
1708 #include <linux/hib_ani.h>
1710 static struct s3cfb_hib_ani hib_ani_set __initdata = {
1732 .hib_animation = hib_anis,
1738 static void __init p8_fb_init(void)
1740 struct device *dev = s3c_device_fb.dev.parent;
1741 struct samsung_pd_info *pdinfo;
1742 struct s5p_platform_mipi_dsim *dsim_pd;
1745 pdinfo = (struct samsung_pd_info *)dev->platform_data;
1746 /* fimd driver have to know LCD domain power status. */
1748 fb_platform_data.boot_on = pdinfo->boot_on;
1752 fb_platform_data.logo_on = 1;
1754 s5p_device_mipi_dsim0.dev.platform_data = (void *)&dsim_platform_data;
1755 dsim_pd = (struct s5p_platform_mipi_dsim *)&dsim_platform_data;
1757 strcpy(dsim_pd->lcd_panel_name, "s6e8aa0");
1758 dsim_pd->mipi_power = s5p_mipi_dphy_power;
1759 dsim_pd->lcd_panel_info = &s6e8aa0;
1760 s5p_mipi_dsi_register_lcd_device(&mipi_lcd_device);
1761 platform_device_register(&s5p_device_mipi_dsim0);
1763 #ifdef CONFIG_FB_S3C_HIBERNATION_LOADING
1764 fb_platform_data.hib_ani = (void *)&hib_ani_set;
1766 fb_platform_data.lcd_data = (struct s3cfb_lcd *)&s6e8aa0;
1767 s3cfb_set_platdata(&fb_platform_data);
1769 s3cfb_cfg_gpio(NULL);
1772 /* YUBAEK 20110905 RAMDUMP_DEBUG : GPIO Dump ++ */
1773 #ifdef CONFIG_SEC_DEBUG_PERIPHERAL_DUMP_GPIO
1774 void __iomem *s5pv310_gpio_class_a_addr;
1775 void __iomem *s5pv310_gpio_class_b_addr;
1776 static void s5pv310_gpio_io_map(void)
1778 s5pv310_gpio_class_a_addr = ioremap(S5PV310_PA_GPIO1, SZ_4K);
1779 s5pv310_gpio_class_b_addr = ioremap(S5PV310_PA_GPIO2, SZ_4K);
1781 #endif /* CONFIG_SEC_DEBUG_PERIPHERAL_DUMP_GPIO */
1782 /* YUBAEK 20110905 RAMDUMP_DEBUG : GPIO Dump -- */
1784 static struct regulator_consumer_supply supplies_cam_io_en[] = {
1785 REGULATOR_SUPPLY("vdda", "17-002d"),
1786 REGULATOR_SUPPLY("a_sensor", "0-001f"),
1789 static struct regulator_consumer_supply supplies_vt_cam_15v_en[] = {
1790 REGULATOR_SUPPLY("vt_core", "17-002d"),
1793 static struct regulator_consumer_supply supplies_cam_af_28v[] = {
1794 REGULATOR_SUPPLY("af_28", "0-001f"),
1797 static struct regulator_consumer_supply supplies_cam_sensor_core_12v_en[] = {
1798 REGULATOR_SUPPLY("dig_12", "0-001f"),
1799 REGULATOR_SUPPLY("dig_12", "17-002d"),
1802 static struct regulator_init_data cam_fixreg_init_data[] = {
1804 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1805 .num_consumer_supplies = ARRAY_SIZE(supplies_cam_io_en),
1806 .consumer_supplies = supplies_cam_io_en,
1809 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1810 .num_consumer_supplies = ARRAY_SIZE(supplies_vt_cam_15v_en),
1811 .consumer_supplies = supplies_vt_cam_15v_en,
1814 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1815 .num_consumer_supplies = ARRAY_SIZE(supplies_cam_sensor_core_12v_en),
1816 .consumer_supplies = supplies_cam_sensor_core_12v_en,
1819 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1820 .num_consumer_supplies = ARRAY_SIZE(supplies_cam_af_28v),
1821 .consumer_supplies = supplies_cam_af_28v,
1825 static struct fixed_voltage_config cam_fixreg_cfg[] = {
1827 .supply_name = "CAM_IO_EN",
1828 .microvolts = 2800000,
1829 .gpio = S5PV310_GPE2(1),
1831 .init_data = &cam_fixreg_init_data[0],
1834 .supply_name = "VT_CAM_1.5V_EN",
1835 .microvolts = 1500000,
1836 .gpio = S5PV310_GPE2(2),
1838 .init_data = &cam_fixreg_init_data[1],
1841 .supply_name = "CAM_SENSOR_CORE_1.2V_EN",
1842 .microvolts = 1200000,
1843 .gpio = S5PV310_GPE2(5),
1845 .init_data = &cam_fixreg_init_data[2],
1848 .supply_name = "CAM_AF_2.8V",
1849 .microvolts = 2800000,
1850 .gpio = S5PV310_GPK1(1),
1852 .init_data = &cam_fixreg_init_data[3],
1857 static struct platform_device camera_fixed_reg_dev[] = {
1859 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM0,
1860 .dev = { .platform_data = &cam_fixreg_cfg[0] },
1862 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM1,
1863 .dev = { .platform_data = &cam_fixreg_cfg[1] },
1865 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM2,
1866 .dev = { .platform_data = &cam_fixreg_cfg[2] },
1868 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM3,
1869 .dev = { .platform_data = &cam_fixreg_cfg[3] },
1873 static struct jack_platform_data p8_jack_data = {
1875 .charger_online = 0,
1877 .earjack_online = 0,
1884 static struct platform_device p8_jack = {
1888 .platform_data = &p8_jack_data,
1892 //device dependent regulator feature
1894 //============================================================
1896 //============================================================
1897 static struct regulator_consumer_supply fmradio_supplies[] = {
1903 static struct regulator_init_data fmradio_fixed_voltage_init_data = {
1905 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
1907 .num_consumer_supplies = ARRAY_SIZE(fmradio_supplies),
1908 .consumer_supplies = fmradio_supplies,
1910 #define GPIO_FM_RST S5PV310_GPB(0)
1911 static struct fixed_voltage_config fmradio_fixed_voltage_config = {
1912 .supply_name = "FM_RST",
1913 .microvolts = 2800000,
1914 .gpio = GPIO_FM_RST,
1915 .enable_high = true,
1916 .init_data = &fmradio_fixed_voltage_init_data,
1919 static struct platform_device fmradio_fixed_voltage = {
1920 .name = "reg-fixed-voltage",
1921 .id = FIXED_REG_ID_RADIO,
1923 .platform_data = &fmradio_fixed_voltage_config,
1927 static void p8_sec_switch_init(void)
1929 sec_class = class_create(THIS_MODULE, "sec");
1931 if (IS_ERR(sec_class))
1932 pr_err("Failed to create class(sec)!\n");
1934 switch_dev = device_create(sec_class, NULL, 0, NULL, "switch");
1936 if (IS_ERR(switch_dev))
1937 pr_err("Failed to create device(switch)!\n");
1939 // ret = device_create_file(switch_dev, &dev_attr_disable_vbus);
1941 // pr_err("Failed to create device file(disable_vbus)!\n");
1943 #ifdef CONFIG_TARGET_LOCALE_KOR
1944 usb_lock = device_create(sec_class, switch_dev,
1945 MKDEV(0, 0), NULL, ".usb_lock");
1947 if (IS_ERR(usb_lock)) {
1948 pr_err("Failed to create device (usb_lock)!\n");
1952 if (device_create_file(usb_lock, &dev_attr_enable) < 0)
1953 pr_err("Failed to create device file(.usblock/enable)!\n");
1957 static struct p8_charging_status_callbacks {
1958 void (*tsp_set_charging_cable) (int type);
1961 static bool is_cable_attached;
1963 static int p8_charger_cb(cable_type_t cable_type)
1965 union power_supply_propval value;
1968 switch(cable_type) {
1969 case CABLE_TYPE_NONE:
1970 case CABLE_TYPE_OTG:
1971 case CABLE_TYPE_JIG_UART_OFF:
1972 value.intval = POWER_SUPPLY_TYPE_BATTERY;
1973 is_cable_attached = false;
1975 case CABLE_TYPE_USB:
1976 case CABLE_TYPE_JIG_USB_OFF:
1977 case CABLE_TYPE_JIG_USB_ON:
1978 value.intval = POWER_SUPPLY_TYPE_USB;
1979 is_cable_attached = true;
1981 case CABLE_TYPE_DESKDOCK:
1982 case CABLE_TYPE_CARDOCK:
1983 value.intval = POWER_SUPPLY_TYPE_DOCK;
1984 is_cable_attached = true;
1987 case CABLE_TYPE_JIG_UART_OFF_VB:
1988 value.intval = POWER_SUPPLY_TYPE_MAINS;
1989 is_cable_attached = true;
1992 pr_err("%s: invalid type:%d\n", __func__, cable_type);
1997 pr_err("%s: regulator_set failed. %d\n", __func__, ret);
2001 if (charging_cbs.tsp_set_charging_cable)
2002 charging_cbs.tsp_set_charging_cable(value.intval);
2004 #ifdef CONFIG_CHARGER_DETECT_BOOT
2005 jack_event_handler("charger", is_cable_attached);
2011 static struct regulator *regulator_vbus_ap;
2012 static bool ap_enabled;
2013 static DEFINE_MUTEX(usb_ap_lock);
2015 static void p8_usb_cb(u8 usb_mode)
2018 struct s3c_udc *udc = platform_get_drvdata(&s3c_device_usbgadget);
2019 struct sec_otghost_data *otg_data =
2020 dev_get_platdata(&s3c_device_usb_otghcd.dev);
2022 unsigned long inform6 = __raw_readl(S5P_INFORM6);
2024 pr_info("%s: usb mode=%d, inform6=0x%08lx\n", __func__, usb_mode, inform6);
2026 if (inform6 & RST_FLAG_CHARGE_REBOOT_CHECK ) {
2027 pr_info("%s: lpcharging: disable USB\n", __func__);
2028 ret = udc->change_usb_mode(USB_CABLE_DETACHED);
2030 pr_warn("%s: fail to change mode!!!\n", __func__);
2032 mutex_lock(&usb_ap_lock);
2034 if (regulator_vbus_ap == NULL)
2036 regulator_get_exclusive(NULL, "usb_vbus_ap_5v");
2037 if (IS_ERR_OR_NULL(regulator_vbus_ap)) {
2038 pr_err("%s: fail to get regulator\n", __func__);
2039 regulator_vbus_ap = NULL;
2044 ret = regulator_disable(regulator_vbus_ap);
2050 mutex_unlock(&usb_ap_lock);
2055 if (usb_mode == USB_OTGHOST_ATTACHED) {
2056 otg_data->set_pwr_cb(1);
2057 p8_charger_cb(CABLE_TYPE_OTG);
2060 pr_info("%s: prev_usb_mode=%d\n", __func__, udc->get_usb_mode());
2062 ret = udc->change_usb_mode(usb_mode);
2064 pr_err("%s: fail to change mode!!!\n", __func__);
2066 if (usb_mode == USB_OTGHOST_DETACHED)
2067 otg_data->set_pwr_cb(0);
2069 #ifdef CONFIG_JACK_MON
2070 if (usb_mode == USB_OTGHOST_ATTACHED)
2071 jack_event_handler("host", USB_CABLE_ATTACHED);
2072 else if (usb_mode == USB_OTGHOST_DETACHED)
2073 jack_event_handler("host", USB_CABLE_DETACHED);
2074 else if ((usb_mode == USB_CABLE_ATTACHED)
2075 || (usb_mode == USB_CABLE_DETACHED))
2076 jack_event_handler("usb", usb_mode);
2084 #if defined(CONFIG_TOUCHSCREEN_MELFAS)
2085 static int melfas_power(int on)
2090 gpio = MOBILE_GPIO(TSP_LDO_ON);
2091 gpio_request(gpio, "TSP_LDO_ON");
2092 s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);
2093 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2094 gpio_set_value(gpio, GPIO_LEVEL_HIGH);
2097 gpio = MOBILE_GPIO(TSP_INT);
2098 gpio_request(gpio, "TSP_INT");
2099 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2100 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
2102 regulator = regulator_get(NULL, "touch");
2103 if (IS_ERR(regulator))
2105 regulator_enable(regulator);
2106 regulator_put(regulator);
2108 printk(KERN_INFO "[TSP]melfas power on\n");
2111 gpio = MOBILE_GPIO(TSP_INT);
2112 gpio_request(gpio, "TSP_INT");
2113 s3c_gpio_cfgpin(gpio, S3C_GPIO_INPUT);
2114 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
2116 gpio = MOBILE_GPIO(TSP_LDO_ON);
2117 gpio_request(gpio, "TSP_LDO_ON");
2118 s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);
2119 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2120 gpio_set_value(gpio, GPIO_LEVEL_LOW);
2122 regulator = regulator_get(NULL, "touch");
2123 if (IS_ERR(regulator))
2125 if (regulator_is_enabled(regulator))
2126 regulator_force_disable(regulator);
2127 regulator_put(regulator);
2133 static struct melfas_tsi_platform_data melfas_pdata = {
2136 .power = melfas_power,
2140 static struct i2c_board_info i2c3_devs[] __initdata = {
2142 #ifdef CONFIG_TOUCHSCREEN_MELFAS
2143 I2C_BOARD_INFO(MELFAS_TS_NAME, 0x48),
2144 .platform_data = &melfas_pdata,
2150 static void p8_power_off(void)
2152 char rst_mode = 'r';
2153 char *str_ptr = "reset\n";
2154 int poweroff_try = 0;
2157 printk(KERN_INFO "%s: p8 power off\n", __func__);
2159 /* Check reboot charging */
2160 if (is_cable_attached || (poweroff_try >= 5)) {
2162 "%s: charger connected(%d) or power off failed(%d), reboot!\n",
2163 __func__, is_cable_attached, poweroff_try);
2167 arm_machine_restart(rst_mode, str_ptr);
2168 // arch_reset(0, 0);
2170 printk(KERN_INFO "%s: waiting for reboot.\n", __func__);
2174 /* wait for power button release */
2175 gpio = MOBILE_GPIO(nPOWER);
2176 gpio_request(gpio, "nPOWER");
2177 if (gpio_get_value(gpio)) {
2178 printk(KERN_INFO "%s: set PS_HOLD low.\n", __func__);
2180 * PS_HOLD Out/High -->
2181 * Low PS_HOLD_CONTROL, R/W, 0x1002_330C
2183 writel(readl(S5P_PS_HOLD_CONTROL) & 0xFFFFFEFF,
2184 S5P_PS_HOLD_CONTROL);
2188 /* when connected zig cable with power, we can't make PS_HOLD_CONTROL low.
2189 * we try power_off 5 times. then if it failed, do restart.
2192 "%s: Should not reach here! (poweroff_try:%d)\n",
2193 __func__, poweroff_try);
2196 /* if power button is not released, wait and check TA again */
2197 printk(KERN_INFO "%s: PowerButton is not released!.\n",
2203 static void __init p8_tsp_init(void)
2208 /* TSP_LDO_ON: XGNSS_QSIGN */
2209 gpio = MOBILE_GPIO(TSP_LDO_ON);
2210 gpio_request(gpio, "TSP_LDO_ON");
2211 gpio_direction_output(gpio, 1);
2212 gpio_export(gpio, 0);
2214 /* TSP_INT: XEINT[4] */
2215 gpio = MOBILE_GPIO(TSP_INT);
2216 gpio_request(gpio, "TSP_INT");
2217 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
2221 * Note that because TSP_LDO provides an external pull-up to TSP_INT,
2222 * the pull-up setting at GPE1(7) is useless and may be omitted in
2223 * order to reduce idle current. However, it probably needs some
2224 * sleep/delay from TSP_LDO_ON = true event because there could be
2225 * "ramp-up" delay. Before knowing this, let's just use PULL_UP here.
2227 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
2228 i2c3_devs[0].irq = gpio_to_irq(gpio);
2233 #if 0 /* TODO : need to check */
2234 extern void MHL_On(bool on);
2236 static void p8_mhl_cb(int attached)
2238 pr_info("%s(%d) NOT work\n", __func__, attached);
2240 if (attached == MAX8997_MUIC_ATTACHED) {
2247 static int p8_set_safeout(int path)
2249 static struct regulator *regulator_vbus_cp;
2250 static bool cp_enabled;
2253 mutex_lock(&usb_ap_lock);
2255 if (regulator_vbus_ap == NULL)
2257 regulator_get_exclusive(NULL, "usb_vbus_ap_5v");
2258 if (IS_ERR_OR_NULL(regulator_vbus_ap)) {
2260 regulator_vbus_ap = NULL;
2264 if (regulator_vbus_cp == NULL)
2266 regulator_get_exclusive(NULL, "usb_vbus_cp_5v");
2267 if (IS_ERR_OR_NULL(regulator_vbus_cp)) {
2269 regulator_vbus_cp = NULL;
2273 if (path == CP_USB_MODE) {
2275 ret = regulator_disable(regulator_vbus_ap);
2282 ret = regulator_enable(regulator_vbus_cp);
2288 /* AP_USB_MODE || AUDIO_MODE */
2290 ret = regulator_enable(regulator_vbus_ap);
2297 ret = regulator_disable(regulator_vbus_cp);
2304 mutex_unlock(&usb_ap_lock);
2308 static struct switch_dev switch_dock = {
2312 static void p8_deskdock_cb(bool attached)
2315 switch_set_state(&switch_dock, 1);
2317 switch_set_state(&switch_dock, 0);
2320 static void p8_cardock_cb(bool attached)
2323 switch_set_state(&switch_dock, 2);
2325 switch_set_state(&switch_dock, 0);
2328 static void p8_muic_init_cb(void)
2332 /* for CarDock, DeskDock */
2333 ret = switch_dev_register(&switch_dock);
2335 pr_err("Failed to register dock switch. %d\n", ret);
2338 static int p8_host_notify_cb(int enable)
2340 struct host_notify_dev * ndev = NULL;
2342 if (s3c_device_usbgadget.dev.platform_data)
2343 ndev = s3c_device_usbgadget.dev.platform_data;
2345 pr_err("%s: ndev is null.\n", __func__);
2349 ndev->booster = enable ? NOTIFY_POWER_ON : NOTIFY_POWER_OFF;
2350 pr_info("%s: mode %d, enable %d\n", __func__, ndev->mode, enable);
2354 struct max8997_muic_platform_data p8_muic_pdata = {
2355 .usb_cb = p8_usb_cb,
2356 .charger_cb = p8_charger_cb, /* done */
2357 .mhl_cb = p8_mhl_cb, /* done */
2358 .set_safeout = p8_set_safeout, /* done */
2359 .init_cb = p8_muic_init_cb, /* done */
2360 .deskdock_cb = p8_deskdock_cb, /* done */
2361 .cardock_cb = p8_cardock_cb, /* done */
2362 .host_notify_cb = p8_host_notify_cb, /* done */
2363 .gpio_usb_sel = S5PV310_GPL0(6), /* done */
2364 .uart_path = -1, /* muic does not control uart path*/
2367 static void p8_set_usb_switch(int path)
2369 printk(KERN_INFO "set_usb_switch = [%d]\n",path);
2370 p8_muic_pdata.sw_path = path;
2373 static int p8_get_usb_switch(void)
2375 printk(KERN_INFO "get_usb_switch = [%d]\n",p8_muic_pdata.sw_path);
2376 return p8_muic_pdata.sw_path;
2379 /* Micro USB Switch */
2380 static struct micro_usb_switch_platform_data p8_usb_switch_data = {
2381 .set_usb_switch = p8_set_usb_switch,
2382 .get_usb_switch = p8_get_usb_switch,
2385 static struct platform_device p8_micro_usb_switch = {
2386 .name = "usb-switch",
2389 .platform_data = &p8_usb_switch_data,
2393 static void p8_pm_finish(void)
2395 /* Restore GPX conf */
2396 s3c_pm_do_restore(s5pc210_gpx, ARRAY_SIZE(s5pc210_gpx));
2399 static void p8_pm_prepare(void)
2401 /* 1. Save GPX conf */
2402 s3c_pm_do_save(s5pc210_gpx, ARRAY_SIZE(s5pc210_gpx));
2404 /* 2. Set GPX as Power Save Mode */
2406 /* 3. Debug: Look at the diff */
2407 mobile_gpios_groupx_difference();
2411 int p8_common_setup_clock(const char *sclk_name, const char *pclk_name,
2412 unsigned long rate, unsigned int rate_set)
2414 struct clk *sclk = NULL;
2415 struct clk *pclk = NULL;
2417 sclk = clk_get(NULL, sclk_name);
2419 printk(KERN_ERR "failed to get %s clock.\n", sclk_name);
2423 pclk = clk_get(NULL, pclk_name);
2425 printk(KERN_ERR "failed to get %s clock.\n", pclk_name);
2429 clk_set_parent(sclk, pclk);
2431 printk(KERN_INFO "set parent clock of %s to %s\n", sclk_name,
2439 clk_set_rate(sclk, rate);
2440 printk(KERN_INFO "set %s rate to %lu\n", sclk_name, rate);
2456 #ifdef CONFIG_S5PV310_DEV_PD
2457 static inline void powerdomain_boot_on(int pd)
2459 struct samsung_pd_info *pdinfo = (struct samsung_pd_info *)
2460 s5pv310_device_pd[pd].dev.platform_data;
2461 pdinfo->boot_on = true;
2465 #ifdef CONFIG_CHARGERCTRL_MAX8903
2466 static struct regulator_consumer_supply supplies_max8903[] = {
2467 REGULATOR_SUPPLY("vinchg2", "charger-manager.0"),
2470 static struct regulator_init_data max8903_charger_en_data = {
2472 .name = "VOUT_CHARGER",
2473 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
2476 .num_consumer_supplies = ARRAY_SIZE(supplies_max8903),
2477 .consumer_supplies = supplies_max8903,
2480 static struct fixed_voltage_config max8903_charger_en = {
2481 .supply_name = "VOUT_CHARGER",
2482 .microvolts = 5000000, /* Assume 5VDC */
2483 .gpio = S5PV310_GPY6(6), /* TA_EN negaged */
2484 .enable_high = 0, /* Enable = Low */
2485 .enabled_at_boot = 1,
2486 .init_data = &max8903_charger_en_data,
2489 static struct platform_device max8903_fixed_reg_dev = {
2490 .name = "reg-fixed-voltage",
2491 .id = FIXED_REG_ID_MAX8903,
2492 .dev = { .platform_data = &max8903_charger_en },
2495 static struct max8903_pdata p8_max8903 = {
2497 * cen: don't control with the driver, let it be
2498 * controlled by regulator above
2500 .dok = S5PV310_GPX3(5), /* TA_nCONNECTED */
2501 /* uok, usus: not connected */
2502 .chg = S5PV310_GPX0(4), /* TA_nCHG */
2503 /* flt: vcc_1.8V_pda */
2504 .dcm = S5PV310_GPY5(7), /* CURR_ADJ */
2507 .usb_valid = false, /* USB is not wired to MAX8903 */
2510 static struct platform_device p8_max8903_device = {
2511 .name = "max8903-charger",
2513 .platform_data = &p8_max8903,
2517 static void max8903_init(void)
2522 gpio = p8_max8903.dok;
2523 gpio_request(gpio, "TA_nCONNECTED");
2524 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
2525 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2526 ta_en = gpio_get_value(gpio) ? 0 : 1;
2528 gpio = p8_max8903.chg;
2529 gpio_request(gpio, "TA_nCHG");
2530 gpio_direction_input(gpio);
2532 gpio = p8_max8903.dcm;
2533 gpio_request(gpio, "CURR_ADJ");
2534 gpio_direction_output(gpio, ta_en);
2538 #ifdef CONFIG_INPUT_SECBRIDGE
2539 //============================================================
2540 /* sec-input-bridge */
2541 //============================================================
2542 static const struct sec_input_bridge_mkey p8_rbdump_mkey_map[] = {
2543 { .type = EV_KEY , .code = KEY_VOLUMEUP },
2544 { .type = EV_KEY , .code = KEY_VOLUMEDOWN },
2545 { .type = EV_KEY , .code = KEY_MENU },
2546 { .type = EV_KEY , .code = KEY_MENU },
2547 { .type = EV_KEY , .code = KEY_VOLUMEUP },
2548 { .type = EV_KEY , .code = KEY_VOLUMEDOWN },
2549 { .type = EV_KEY , .code = KEY_VOLUMEUP },
2550 { .type = EV_KEY , .code = KEY_MENU },
2553 static const struct sec_input_bridge_mkey p8_default_mkey_map[] = {
2554 { .type = EV_KEY , .code = KEY_VOLUMEUP },
2555 { .type = EV_KEY , .code = KEY_VOLUMEDOWN },
2556 { .type = EV_KEY , .code = KEY_MENU },
2557 { .type = EV_KEY , .code = KEY_MENU },
2558 { .type = EV_KEY , .code = KEY_VOLUMEUP },
2559 { .type = EV_KEY , .code = KEY_VOLUMEUP },
2560 { .type = EV_KEY , .code = KEY_VOLUMEUP },
2561 { .type = EV_KEY , .code = KEY_MENU },
2564 static const struct sec_input_bridge_mkey p8_uart_mkey_map[] = {
2565 { .type = EV_KEY , .code = KEY_VOLUMEUP },
2566 { .type = EV_KEY , .code = KEY_VOLUMEDOWN },
2567 { .type = EV_KEY , .code = KEY_MENU },
2568 { .type = EV_KEY , .code = KEY_MENU },
2569 { .type = EV_KEY , .code = KEY_VOLUMEUP },
2570 { .type = EV_KEY , .code = KEY_MENU },
2571 { .type = EV_KEY , .code = KEY_VOLUMEDOWN },
2572 { .type = EV_KEY , .code = KEY_MENU },
2575 static void mkey_uart_path_change (void *event_data)
2577 if (p8_get_uart_switch() == UART_SW_PATH_CP)
2578 p8_set_uart_switch(UART_SW_PATH_AP);
2580 p8_set_uart_switch(UART_SW_PATH_CP);
2583 static const struct sec_input_bridge_mmap p8_mmap[] = {
2585 .mkey_map = p8_rbdump_mkey_map,
2586 .num_mkey = ARRAY_SIZE(p8_rbdump_mkey_map),
2587 .uevent_env_str = "RB_DUMP",
2589 .uevent_action = KOBJ_CHANGE,
2590 .uevent_env_str = "RB_DUMP",
2591 .uevent_env_value = "ON",
2594 .mkey_map = p8_default_mkey_map,
2595 .num_mkey = ARRAY_SIZE(p8_default_mkey_map),
2596 .uevent_env_str = "DEFAULT",
2598 .uevent_action = KOBJ_CHANGE,
2599 .uevent_env_str = "DEFAULT",
2600 .uevent_env_value = "ON",
2603 .mkey_map = p8_uart_mkey_map,
2604 .num_mkey = ARRAY_SIZE(p8_uart_mkey_map),
2605 .uevent_env_str = "UART_SW",
2607 .uevent_action = KOBJ_CHANGE,
2608 .uevent_env_str = "DEFAULT",
2609 .uevent_env_value = "ON",
2610 .pre_event_func = mkey_uart_path_change,
2614 static struct sec_input_bridge_platform_data p8_input_bridge_data = {
2616 .num_map = ARRAY_SIZE(p8_mmap),
2619 static struct platform_device p8_input_bridge = {
2620 .name = "samsung_input_bridge",
2623 .platform_data = &p8_input_bridge_data,
2628 #ifdef CONFIG_CHARGER_MANAGER
2629 extern struct platform_device p8_charger_manager;
2630 extern struct platform_device p8_ncp15wb473_thermistor;
2631 extern struct charger_global_desc p8_charger_g_desc;
2633 static struct platform_device *p8_devices[] __initdata = {
2634 /* Samsung Platform Devices */
2635 #ifdef CONFIG_S5PV310_DEV_PD
2636 &s5pv310_device_pd[PD_MFC],
2637 &s5pv310_device_pd[PD_G3D],
2638 &s5pv310_device_pd[PD_LCD0],
2639 &s5pv310_device_pd[PD_LCD1],
2640 &s5pv310_device_pd[PD_TV],
2641 &s5pv310_device_pd[PD_CAM],
2642 &s5pv310_device_pd[PD_GPS],
2644 #ifdef CONFIG_DRM_MALI
2645 &s5p_device_mali_drm,
2647 #ifdef CONFIG_DRM_FIMD
2648 &s5p_device_fimd_drm,
2662 &s3c_device_timer[0],
2663 &s3c_device_timer[1],
2665 #ifdef CONFIG_S3C_DEV_RTC
2668 &ps_on_led_a_fixed_reg_dev,
2670 &camera_fixed_reg_dev[0],
2671 &camera_fixed_reg_dev[1],
2672 &camera_fixed_reg_dev[2],
2673 &camera_fixed_reg_dev[3],
2674 #ifdef CONFIG_VIDEO_FIMC_MIPI
2678 #ifdef CONFIG_VIDEO_FIMC
2685 #ifdef CONFIG_VIDEO_JPEG
2691 #ifdef CONFIG_USB_GADGET
2692 &s3c_device_usbgadget,
2694 #ifdef CONFIG_USB_ANDROID_RNDIS
2697 #ifdef CONFIG_USB_ANDROID_ECM
2700 #ifdef CONFIG_USB_ANDROID
2701 &s3c_device_android_usb,
2702 &s3c_device_usb_mass_storage,
2704 #ifdef CONFIG_USB_S3C_OTG_HOST
2705 &s3c_device_usb_otghcd,
2707 #ifdef CONFIG_S3C_DEV_HSMMC4
2712 &emmc_fixed_voltage,
2719 #ifdef CONFIG_SND_S3C64XX_SOC_I2S_V4
2720 &s5pv310_device_iis0,
2722 #ifdef CONFIG_SND_S3C_SOC_PCM
2723 &s5pv310_device_pcm1,
2725 #ifdef CONFIG_SND_SOC_SMDK_WM9713
2726 &s5pv310_device_ac97,
2728 #ifdef CONFIG_SND_SAMSUNG_SOC_SPDIF
2729 &s5pv310_device_spdif,
2732 &fmradio_fixed_voltage,
2738 &p8_micro_usb_switch,
2740 #ifdef CONFIG_S3C2410_WATCHDOG
2744 #ifdef CONFIG_S5P_SYSMMU
2745 &s5p_device_sysmmu[SYSMMU_G2D],
2746 &s5p_device_sysmmu[SYSMMU_MFC_L],
2747 &s5p_device_sysmmu[SYSMMU_MFC_R],
2748 &s5p_device_sysmmu[SYSMMU_FIMC0],
2749 &s5p_device_sysmmu[SYSMMU_FIMC1],
2750 &s5p_device_sysmmu[SYSMMU_FIMC2],
2751 &s5p_device_sysmmu[SYSMMU_FIMC3],
2753 #ifdef CONFIG_VIDEO_FIMG2D
2756 #if defined(CONFIG_VIDEO_MFC5X) || defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
2759 #ifdef CONFIG_FB_S3C
2762 #ifdef CONFIG_ANDROID_RAM_CONSOLE
2763 &ram_console_device,
2765 #ifdef CONFIG_CHARGERCTRL_MAX8903
2767 &max8903_fixed_reg_dev,
2770 #ifdef CONFIG_CHARGER_MANAGER
2771 /* Should be placed after fuel gauge, charger control chips, pmics */
2772 #ifdef CONFIG_SENSORS_NTC_THERMISTOR
2773 &p8_ncp15wb473_thermistor,
2775 &p8_charger_manager,
2778 #ifdef CONFIG_INPUT_SECBRIDGE
2781 #ifdef CONFIG_SAMSUNG_BOOT_MODE
2782 &s3c_device_samsung_boot_mode,
2784 #ifdef CONFIG_SEC_DEBUG
2787 #ifdef CONFIG_S5PV310_STOPWATCH
2788 &s5pv310_device_stopwatch,
2790 #ifdef CONFIG_DEV_THERMAL
2795 &s5p_device_usb_ehci,
2796 #ifdef CONFIG_INPUT_GP2A
2801 extern void (*s5p_inform6_set)(char mode);
2802 extern void s5pv310_inform6_set(char mode);
2803 extern struct machine_desc *lookup_machine_type(unsigned int);
2805 static void __init p8_machine_init(void)
2808 struct machine_desc *list;
2809 list = lookup_machine_type(machine_arch_type);
2810 strcpy(utsname()->nodename, list->name);
2812 /* to support system shut down */
2813 pm_power_off = p8_power_off;
2815 /* to support inform6 set */
2816 s5p_inform6_set = s5pv310_inform6_set;
2818 /* Initialize GPIO default setting */
2819 mobile_gpios_init();
2820 s3c_config_sleep_gpio_table = p8_config_sleep_gpio_table;
2822 s3c_i2c0_set_platdata(&p8_i2c0_platdata);
2825 s3c_i2c1_set_platdata(NULL);
2827 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
2829 #ifdef CONFIG_S5PV310_DEV_PD
2830 #ifdef CONFIG_FB_S3C
2831 s3c_device_fb.dev.parent = &s5pv310_device_pd[PD_LCD0].dev;
2832 powerdomain_boot_on(PD_LCD0);
2837 /* YUBAEK 20110905 RAMDUMP_DEBUG : GPIO Dump ++ */
2838 #ifdef CONFIG_SEC_DEBUG_PERIPHERAL_DUMP_GPIO
2839 s5pv310_gpio_io_map();
2841 /* YUBAEK 20110905 RAMDUMP_DEBUG : GPIO Dump ++ */
2843 #ifdef CONFIG_S5PV310_DEV_PD
2844 #if defined(CONFIG_VIDEO_MFC5X) || defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
2845 s5p_device_mfc.dev.parent = &s5pv310_device_pd[PD_MFC].dev;
2846 p8_common_setup_clock("mout_mfc0", "mout_mpll", 0, 0);
2847 p8_common_setup_clock("sclk_mfc", "mout_mfc0", 200 * MHZ, 1);
2851 #ifdef CONFIG_CHARGERCTRL_MAX8903
2854 p8_pmic_init(); /* TODO: should be modify for U1 */
2855 s3c_i2c5_set_platdata(NULL);
2856 i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(S5PV310_GPX0(7)),
2857 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
2860 s3c_i2c6_set_platdata(NULL);
2861 i2c_register_board_info(6, i2c6_devs, ARRAY_SIZE(i2c6_devs));
2863 s3c_i2c7_set_platdata(NULL);
2864 i2c_register_board_info(7, i2c7_devs, ARRAY_SIZE(i2c7_devs));
2866 gpio = S5PV310_GPX2(3);
2867 gpio_request(gpio, "FUEL_ALERT");
2868 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
2869 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2870 i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(gpio);
2871 i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
2873 universal_touchkey_init();
2874 i2c_register_board_info(12, i2c12_devs_cypress, ARRAY_SIZE(i2c12_devs_cypress));
2876 i2c_register_board_info(14, i2c14_devs, ARRAY_SIZE(i2c14_devs));
2878 i2c_register_board_info(15, i2c15_devs, ARRAY_SIZE(i2c15_devs));
2881 #if defined(CONFIG_VIDEO_S5K5BAFX)
2882 i2c_register_board_info(17, i2c17_devs, ARRAY_SIZE(i2c17_devs));
2885 i2c_register_board_info(18, i2c18_devs, ARRAY_SIZE(i2c18_devs));
2891 s3c_usb_set_serial();
2895 #ifdef CONFIG_VIDEO_FIMG2D
2896 s5p_fimg2d_set_platdata(&fimg2d_data);
2897 #ifdef CONFIG_S5PV310_DEV_PD
2898 s5p_device_fimg2d.dev.parent = &s5pv310_device_pd[PD_LCD0].dev;
2903 pm_cpu_prepare = p8_pm_prepare;
2904 pm_cpu_finish = p8_pm_finish;
2907 s3c_irq_wake(IRQ_RTC_ALARM, 1);
2910 #if defined(CONFIG_S5PV310_DEV_PD) && !defined(CONFIG_PM_RUNTIME)
2912 * These power domains should be always on
2913 * without runtime pm support.
2915 s5pv310_pd_enable(&s5pv310_device_pd[PD_MFC].dev);
2916 s5pv310_pd_enable(&s5pv310_device_pd[PD_G3D].dev);
2917 s5pv310_pd_enable(&s5pv310_device_pd[PD_LCD0].dev);
2918 s5pv310_pd_enable(&s5pv310_device_pd[PD_LCD1].dev);
2919 s5pv310_pd_enable(&s5pv310_device_pd[PD_CAM].dev);
2920 s5pv310_pd_enable(&s5pv310_device_pd[PD_TV].dev);
2921 s5pv310_pd_enable(&s5pv310_device_pd[PD_GPS].dev);
2924 #ifdef CONFIG_VIDEO_FIMG2D
2925 /* setup fimg2d parent clock. */
2926 universal_fimg2d_setup_clock("mout_g2d0", "mout_mpll");
2929 s5pv310_sdhci_init();
2930 #ifdef CONFIG_S5P_ADC
2934 #ifdef CONFIG_DEV_THERMAL
2935 s5p_tmu_set_platdata(NULL);
2938 s5pv310_camera_init();
2941 platform_add_devices(p8_devices, ARRAY_SIZE(p8_devices));
2943 regulator_has_full_constraints();
2944 /* Temp. commented */
2946 if (s5pv310_subrev() != 0) {
2947 pr_emerg("\n\n This kernel does NOT support subrevision %d of S5PC210.\n\n\n",
2949 panic("Not supported subrevision");
2954 MACHINE_START(P8_C210, "P8")
2955 /* Maintainer: mhban <mhban@samsung.com> */
2956 .phys_io = S3C_PA_UART & 0xfff00000,
2957 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
2958 .boot_params = S5P_PA_SDRAM + 0x100,
2959 .init_irq = s5pv310_init_irq,
2960 .map_io = p8_map_io,
2961 .init_machine = p8_machine_init,
2962 .timer = &s5pv310_timer,
2963 .reserve = &s5pv310_reserve,