upload tizen1.0 source
[kernel/linux-2.6.36.git] / arch / arm / mach-s5pv310 / mach-q1_c210.c
1 /*
2  * linux/arch/arm/mach-s5pv310/mach-q1_c210.c
3  *
4  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5  *
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.
9  */
10
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/atmel_mxt_ts.h>
24 #include <linux/i2c/cypress_touchkey.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/mfd/max8997.h>
30 #include <linux/mfd/max8997-private.h>
31 #include <linux/mfd/mc1n2_pdata.h>
32 #include <linux/power/max17042_battery.h>
33 #include <linux/power/max8903_charger.h>
34 #include <linux/ramoops.h>
35 #include <linux/mmcoops.h>
36 #include <linux/uart_select.h>
37 #include <linux/memblock.h>
38 #include <linux/rtc/rtc-s3c.h>
39 #include <linux/jack.h>
40 #include <linux/k3g.h>
41 #include <linux/kr3dh.h>
42 #include <linux/micro_usb_switch.h>
43 #include <linux/bh1721.h>
44 #include <linux/sii9234_platform.h>
45 #include <linux/cpufreq.h>
46 #include <linux/modem/xmm6260.h>
47 #include <linux/power/charger-manager.h>
48 #include <linux/host_notify.h>
49 #include <linux/switch.h>
50
51 #include <asm/mach-types.h>
52 #include <asm/mach/arch.h>
53 #include <asm/setup.h>
54
55 #include <mach/map.h>
56 #include <mach/gpio.h>
57 #include <mach/regs-clock.h>
58 #include <mach/regs-pmu.h>
59 #include <mach/pm-core.h>
60 #include <mach/universal.h>
61
62 #include <plat/cpu.h>
63 #include <plat/clock.h>
64 #include <plat/devs.h>
65 #include <plat/gpio-cfg.h>
66 #include <plat/gpio-core.h>
67 #include <plat/fb.h>
68 #ifdef CONFIG_VIDEO_FIMC
69 #include <plat/fimc.h>
70 #endif
71 #include <plat/fimg2d.h>
72 #include <plat/mali.h>
73 #include <plat/iic.h>
74 #include <plat/pm.h>
75 #include <plat/regs-otg.h>
76 #include <plat/regs-serial.h>
77 #include <plat/s5pv310.h>
78 #include <plat/adc.h>
79 #include <plat/fimd_drm.h>
80 #include <plat/tvout.h>
81 #include <plat/pd.h>
82 #include <plat/s5p_fimd_ext.h>
83 #include <plat/s5p_fimd_lite.h>
84 #include <plat/mdnie.h>
85 #include <plat/mipi_dsim.h>
86 #include <plat/usb_ehci.h>
87 #include <plat/sysmmu.h>
88 #include <plat/s5p-otghost.h>
89 #include <plat/udc-hs.h>
90
91 #include <media/s5p_fimc.h>
92 #include <media/m5mols.h>
93 #include <media/s5k6aafx.h>
94
95 #include "gpio-mobile.h"
96 #include "gpio-q1.h"
97 #include "board-mobile.h"
98 #include "../../../drivers/usb/gadget/s3c_udc.h"
99
100 #ifdef CONFIG_EPEN_WACOM_G5SP
101 #include <linux/wacom_i2c.h>
102 static struct wacom_g5_callbacks *wacom_callbacks;
103 #endif /* CONFIG_EPEN_WACOM_G5SP */
104
105 #ifdef CONFIG_SMB328_CHARGER
106 #include <linux/power/smb328_charger.h>
107 #endif
108
109 /* Following are default values for UCON, ULCON and UFCON UART registers */
110 #define UNIVERSAL_UCON_DEFAULT  (S3C2410_UCON_TXILEVEL |        \
111                                  S3C2410_UCON_RXILEVEL |        \
112                                  S3C2410_UCON_TXIRQMODE |       \
113                                  S3C2410_UCON_RXIRQMODE |       \
114                                  S3C2410_UCON_RXFIFO_TOI |      \
115                                  S3C2443_UCON_RXERR_IRQEN)
116
117 #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
118
119 #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE |       \
120                                  S5PV210_UFCON_TXTRIG256 |      \
121                                  S5PV210_UFCON_RXTRIG256)
122
123 enum fixed_regulator_id {
124         FIXED_REG_ID_MMC = 0,
125         FIXED_REG_ID_CAM0,
126         FIXED_REG_ID_CAM1,
127         FIXED_REG_ID_CAM2,
128         FIXED_REG_ID_CAM3,
129         FIXED_REG_ID_HAPTIC,
130 };
131
132 static struct s3c2410_uartcfg q1_uartcfgs[] __initdata = {
133         {
134                 .hwport         = 0,
135                 .ucon           = UNIVERSAL_UCON_DEFAULT,
136                 .ulcon          = UNIVERSAL_ULCON_DEFAULT,
137                 .ufcon          = UNIVERSAL_UFCON_DEFAULT,
138         },
139         {
140                 .hwport         = 1,
141                 .ucon           = UNIVERSAL_UCON_DEFAULT,
142                 .ulcon          = UNIVERSAL_ULCON_DEFAULT,
143                 .ufcon          = UNIVERSAL_UFCON_DEFAULT,
144         },
145         {
146                 .hwport         = 2,
147                 .ucon           = UNIVERSAL_UCON_DEFAULT,
148                 .ulcon          = UNIVERSAL_ULCON_DEFAULT,
149                 .ufcon          = UNIVERSAL_UFCON_DEFAULT,
150         },
151         {
152                 .hwport         = 3,
153                 .ucon           = UNIVERSAL_UCON_DEFAULT,
154                 .ulcon          = UNIVERSAL_ULCON_DEFAULT,
155                 .ufcon          = UNIVERSAL_UFCON_DEFAULT,
156         },
157 };
158
159 static struct s3c2410_platform_i2c q1_i2c0_platdata __initdata = {
160         .frequency      = 300 * 1000,
161         .sda_delay      = 200,
162 };
163
164 static struct k3g_platform_data q1_k3g_data = {
165         .irq2                   = IRQ_EINT(1),
166         .powerdown              = K3G_POWERDOWN_NORMAL,
167         .zen                    = K3G_Z_EN,
168         .yen                    = K3G_Y_EN,
169         .xen                    = K3G_X_EN,
170         .block_data_update      = K3G_BLOCK_DATA_UPDATE,
171         .fullscale              = K3G_FULL_SCALE_2000DPS,
172         .fifo_mode              = K3G_FIFO_FIFO_MODE,
173         .int2_src               = K3G_INT2_OVERRUN,
174         .fifo_threshold         = 16,
175         .int1_enable            = K3G_INT1_EN,
176         .int1_z_high_enable     = K3G_Z_HIGH_INT_EN,
177         .int1_y_high_enable     = K3G_Y_HIGH_INT_EN,
178         .int1_x_high_enable     = K3G_X_HIGH_INT_EN,
179         .int1_latch             = K3G_INTERRUPT_LATCHED,
180         .int1_z_threshold       = 0x12,
181         .int1_y_threshold       = 0x25,
182         .int1_x_threshold       = 0x25,
183         .int1_wait_enable       = K3G_INT1_WAIT_EN,
184         .int1_wait_duration     = 0x10,
185 };
186
187 static struct kr3dh_platform_data q1_kr3dh_data = {
188         .power_mode             = KR3DH_LOW_POWER_10HZ,
189         .data_rate              = KR3DH_ODR_50HZ,
190         .zen                    = 1,
191         .yen                    = 1,
192         .xen                    = 1,
193         .int1_latch             = 1,
194         .int1_cfg               = KR3DH_INT_SOURCE,
195         .block_data_update      = 1,
196         .fullscale              = KR3DH_RANGE_2G,
197         .int1_combination       = KR3DH_OR_COMBINATION,
198         .int1_6d_enable         = 1,
199         .int1_z_high_enable     = 1,
200         .int1_z_low_enable      = 1,
201         .int1_y_high_enable     = 1,
202         .int1_y_low_enable      = 1,
203         .int1_x_high_enable     = 1,
204         .int1_x_low_enable      = 1,
205         .int1_threshold         = 0x25,
206         .int1_duration          = 0x01,
207         .negate_x               = 0,
208         .negate_y               = 1,
209         .negate_z               = 0,
210         .change_xy              = 1,
211 };
212
213 /* I2C1 */
214 static struct i2c_board_info i2c1_devs[] __initdata = {
215         {
216                 /* Gyro sensor */
217                 I2C_BOARD_INFO("K3G", 0x69),
218                 .platform_data  = &q1_k3g_data,
219                 .irq            = IRQ_EINT(0),
220         }, {
221                 /* Accelerometer */
222                 I2C_BOARD_INFO("KR3DH", 0x19),
223                 .platform_data  = &q1_kr3dh_data,
224                 .irq            = IRQ_EINT(24),
225         }
226 };
227
228 #ifdef CONFIG_CPU_FREQ_TICKLE
229 static void user_input_response_work(struct work_struct *work)
230 {
231         /* core 0's cpufreq controls both cores */
232         cpufreq_tickle_cpu(100, 0);
233
234         /* turn the core 1 on */
235         s5pv310_pm_hotplug_tickle();
236 }
237
238 static DECLARE_WORK(uir_work, user_input_response_work);
239
240 static void user_input_response(void *data)
241 {
242         if (!work_pending(&uir_work))
243                 schedule_work_on(0, &uir_work);
244 }
245 #endif
246
247 /* I2C3: TSP */
248
249 /* FIXME: Only use for tuning */
250 static u8 mxt_init_vals_ver_22[] __initdata = {
251         /* MXT_(5) */
252         /* MXT_GEN_COMMAND(6) */
253         0, 0, 0, 0, 0, 0,
254         /* MXT_GEN_POWER(7) */
255         48, 255, 50,
256         /* MXT_GEN_ACQUIRE(8) */
257         68, 0, 5, 1, 0, 0, 4, 30, 8, 180,
258         /* MXT_TOUCH_MULTI(9) */
259         0, 0, 0, 0, 0, 0, 0, 0, 2, 6,
260         10, 10, 1, 47, 10, 20, 40, 20, 0, 0,
261         0, 0, 253, 3, 254, 2, 136, 60, 136, 40,
262         18, 12, 0, 0, 2,
263         /* MXT_TOUCH_KEYARRAY(15) */
264         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
265         /* MXT_SPT_COMMSCONFIG(18) */
266         0, 0,
267         /* MXT_SPT_GPIOPWM(19) */
268         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
269         0, 0, 0, 0, 0, 0,
270         /* MXT_PROCI_ONETOUCH(24) */
271         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
272         0, 0, 0, 0, 0, 0, 0, 0, 0,
273         /* MXT_SPT_SELFTEST(25) */
274         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
275         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
276         0, 0, 0, 0, 0, 0,
277         /* MXT_PROCI_TWOTOUCH(27) */
278         0, 0, 0, 0, 0, 0, 0,
279         /* MXT_MXT_DEBUG_DIAGNOSTIC(37) */
280         /* MXT_SPT_USERDATA(38) */
281         /* MXT_PROCI_GRIPSUPPRESSION(40) */
282         0, 0, 0, 0, 0,
283         /* MXT_PROCI_TOUCHSUPPRESSION(42) */
284         0, 0, 0, 0, 0, 0, 0, 0,
285         /* MXT_SPT_DIGITIZER(43) */
286         0, 0, 0, 0, 0, 0, 0,
287         /* MXT_(44) */
288         /* MXT_SPT_CTECONFIG(46) */
289         0, 0, 24, 36, 0, 0, 1, 0, 0,
290         /* MXT_PROCI_STYLUS(47) */
291         0, 30, 60, 15, 2, 20, 20, 150, 0, 32,
292         /* MXT_PROCG_NOISESUPPRESSION(48) */
293         3, 132, 96, 0, 0, 0, 0, 0, 10, 20,
294         0, 0, 0, 6, 6, 0, 0, 64, 4, 64,
295         10, 0, 20, 6, 0, 46, 0, 1, 0, 0,
296         0, 0, 0, 0, 160, 40, 2, 10, 1, 47,
297         10, 5, 20, 253, 3, 254, 2, 136, 60, 136,
298         40, 18, 12, 0, 0, 0, 0, 0, 0, 0,
299         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
300         0, 0, 0, 0,
301         /* MXT_TOUCH_PROXKEY(52) */
302         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
303         0, 0, 0, 0, 0,
304         /* MXT_(53) */
305 };
306
307 static struct mxt_platform_data mxt_platform_data __refconst = {
308         .config                 = mxt_init_vals_ver_22,
309         .config_length          = ARRAY_SIZE(mxt_init_vals_ver_22),
310
311         .x_line                 = 16,
312         .y_line                 = 26,
313         .x_size                 = 800,
314         .y_size                 = 1280,
315         .blen                   = 176,
316         .threshold              = 0x28,
317         .orient                 = MXT_ROTATED_180,
318         .irqflags               = IRQF_TRIGGER_FALLING,
319
320 #ifdef CONFIG_CPU_FREQ_TICKLE
321         /* For the faster user response */
322         .input_event            = user_input_response,
323 #endif
324 };
325
326 #ifdef CONFIG_EPEN_WACOM_G5SP
327 static int q1_wacom_init_hw(void);
328 static int q1_wacom_exit_hw(void);
329 static int q1_wacom_suspend_hw(void);
330 static int q1_wacom_resume_hw(void);
331 static int q1_wacom_reset_hw(void);
332 static void q1_wacom_register_callbacks(struct wacom_g5_callbacks *cb);
333
334 static struct wacom_g5_platform_data q1_wacom_platform_data = {
335         .x_invert = 1,
336         .y_invert = 0,
337         .xy_switch = 1,
338         .init_platform_hw = q1_wacom_init_hw,
339 /*      .exit_platform_hw =,    */
340         .suspend_platform_hw = q1_wacom_suspend_hw,
341         .resume_platform_hw = q1_wacom_resume_hw,
342         .register_cb = q1_wacom_register_callbacks,
343 };
344
345 static int q1_wacom_suspend_hw(void)
346 {
347         gpio_set_value(S5PV310_GPE0(2), 0);
348         return 0;
349 }
350
351 static int q1_wacom_resume_hw(void)
352 {
353         gpio_set_value(S5PV310_GPE0(2), 1);
354         return 0;
355 }
356
357 static void q1_wacom_register_callbacks(struct wacom_g5_callbacks *cb)
358 {
359         wacom_callbacks = cb;
360 };
361 #endif
362
363 static struct i2c_board_info i2c3_devs[] __initdata = {
364         {
365                 I2C_BOARD_INFO("atmel_mxt_ts", 0x4c),
366                 .platform_data  = &mxt_platform_data,
367                 .irq            = IRQ_EINT(4),
368         },
369 };
370
371 static void __init q1_tsp_init(void)
372 {
373         int gpio;
374
375         /* TSP_LDO_ON: XGNSS_QSIGN */
376         gpio = S5PV310_GPL0(3);
377         gpio_request(gpio, "TSP_LDO_ON");
378         gpio_direction_output(gpio, 1);
379         gpio_export(gpio, 0);
380
381         /* TSP_INT: XEINT[4] */
382         gpio = S5PV310_GPX0(4);
383         gpio_request(gpio, "TSP_INT");
384         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
385
386         /*
387          * Note that because TSP_LDO provides an external pull-up to TSP_INT,
388          * the pull-up setting at GPE1(7) is useless and may be omitted in
389          * order to reduce idle current. However, it probably needs some
390          * sleep/delay from TSP_LDO_ON = true event because there could be
391          * "ramp-up" delay. Before knowing this, let's just use PULL_UP here.
392          */
393         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
394
395 }
396
397 extern struct max8997_platform_data q1_max8997_pdata;
398 extern void __init q1_pmic_init(void);
399
400 static struct regulator_consumer_supply haptic_inmotor_supplies[] = {
401         REGULATOR_SUPPLY("in_motor", "max8997-haptic"),
402 };
403
404 static struct regulator_init_data haptic_inmotor_init_data = {
405         .constraints            = {
406                 .name           = "VCC_3.0V_MOTOR",
407                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
408         },
409         .num_consumer_supplies  = ARRAY_SIZE(haptic_inmotor_supplies),
410         .consumer_supplies      = haptic_inmotor_supplies,
411 };
412
413 static struct fixed_voltage_config haptic_inmotor_config = {
414         .supply_name            = "MOTOR_EN",
415         .microvolts             = 3000000,
416         .gpio                   = S5PV310_GPL2(4),
417         .enable_high            = true,
418         .init_data              = &haptic_inmotor_init_data,
419 };
420
421 static struct platform_device haptic_inmotor_fixed_voltage = {
422         .name                   = "reg-fixed-voltage",
423         .id                     = FIXED_REG_ID_HAPTIC,
424         .dev                    = {
425                 .platform_data  = &haptic_inmotor_config,
426         },
427 };
428
429 struct max8997_haptic_platform_data q1_haptic_pdata = {
430         .name           = "vibtone",
431         .pwm_timer      = 1,
432 };
433
434 /* I2C 4 */
435 static struct i2c_board_info i2c4_devs[] __initdata = {
436         {
437                 I2C_BOARD_INFO("si470x", 0x10),
438         },
439 };
440
441 static void __init q1_radio_init(void)
442 {
443         int gpio;
444
445         gpio = S5PV310_GPX2(4);                 /* XEINT_20 */
446         gpio_request(gpio, "FM_INT");
447         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
448         i2c4_devs[0].irq = gpio_to_irq(gpio);
449
450         gpio = S5PV310_GPB(0);                  /* XSPICLK_0 */
451         gpio_request(gpio, "FM_RST");
452         gpio_direction_output(gpio, 1);
453 }
454
455 /* GPIO I2C 5 (PMIC) */
456 enum { I2C5_MAX8997 };
457 static struct i2c_board_info i2c5_devs[] __initdata = {
458         [I2C5_MAX8997] = {
459                 I2C_BOARD_INFO("max8997", 0xCC >> 1),
460                 .platform_data  = &q1_max8997_pdata,
461         },
462 };
463
464 static void sec_set_sub_mic_bias(bool on)
465 {
466         int gpio;
467         gpio = MOBILE_GPIO(SUB_MICBIAS_EN);
468         gpio_set_value(gpio, on);
469         pr_err(KERN_ERR "SUB_MIC_BIAS_EN GPIO set [%d] !\n", on);
470 }
471
472 static void sec_set_main_mic_bias(bool on)
473 {
474         int gpio;
475         gpio = MOBILE_GPIO(MICBIAS_EN);
476         gpio_set_value(gpio, on);
477         pr_err(KERN_ERR "MAIN_MIC_BIAS_EN GPIO set [%d] !\n", on);
478 }
479
480 static struct mc1n2_platform_data mc1n2_pdata = {
481         .set_main_mic_bias = sec_set_main_mic_bias,
482         .set_sub_mic_bias = sec_set_sub_mic_bias,
483 };
484
485 /* GPIO I2C 6 */
486 static struct i2c_board_info i2c6_devs[] __initdata = {
487         {
488                 /* Audio Codec */
489                 I2C_BOARD_INFO("mc1n2", 0x3a),
490                 .platform_data = &mc1n2_pdata,
491         },
492 #ifdef CONFIG_EPEN_WACOM_G5SP
493         {
494                 I2C_BOARD_INFO("wacom_g5sp_i2c", 0x56),
495                 .platform_data = &q1_wacom_platform_data,
496         },
497 #endif
498 };
499
500 /* I2C7 */
501 static struct i2c_board_info i2c7_devs[] __initdata = {
502         {
503                 /* Compass */
504                 I2C_BOARD_INFO("ak8975", 0x0c),
505         },
506 };
507
508 static void __init q1_sensor_init(void)
509 {
510         int gpio;
511
512         gpio = S5PV310_GPX2(2); /* XEINT_18 */
513         gpio_request(gpio, "MSENSE_INT");
514         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
515         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
516         i2c7_devs[0].irq = gpio_to_irq(gpio);
517
518         gpio = S5PV310_GPX0(0); /* XEINT_0 */
519         gpio_request(gpio, "GYRO_INT");
520         gpio_direction_input(gpio);
521         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
522
523         gpio = S5PV310_GPX0(1); /* XEINT_1 */
524         gpio_request(gpio, "GYRO_INT1");
525         gpio_direction_input(gpio);
526         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
527
528         gpio = S5PV310_GPX3(0); /* XEINT_24 */
529         gpio_request(gpio, "ACC_INT");
530         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
531         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
532
533         gpio = S5PV310_GPX0(2); /* XEINT_2 */
534         gpio_request(gpio, "PS_INT");
535         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
536         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
537 }
538
539 /* I2C 9 */
540 static struct i2c_gpio_platform_data i2c9_gpio_data = {
541         .sda_pin                = S5PV310_GPY4(0),      /* XM0ADDR_8 */
542         .scl_pin                = S5PV310_GPY4(1),      /* XM0ADDR_9 */
543 };
544 static struct platform_device i2c9_gpio = {
545         .name                   = "i2c-gpio",
546         .id                     = 9,
547         .dev                    = {
548                 .platform_data  = &i2c9_gpio_data,
549         },
550 };
551 static struct max17042_reg_data max17042_init_data[] = {
552         { MAX17042_CGAIN,               0x0000 },
553         { MAX17042_COFF,                0x0000 },
554         { MAX17042_MiscCFG,             0x0003 },
555         { MAX17042_LearnCFG,            0x0007 },
556 };
557 /* Alert only when the battery is removed or inserted */
558 static struct max17042_reg_data max17042_alert_init_data[] = {
559         /* SALRT Threshold setting (disable) unsigned MAX/MIN */
560         { MAX17042_SALRT_Th,    0xFF00 },
561         /* VALRT Threshold setting (disable) unsigned MAX/MIN */
562         { MAX17042_VALRT_Th,    0xFF00 },
563         /* TALRT Threshold setting (disable) signed MAX/MIN */
564         { MAX17042_TALRT_Th,    0x7F80 },
565 };
566 static struct max17042_platform_data q1_battery_platform_data = {
567         .init_data = max17042_init_data,
568         .num_init_data = ARRAY_SIZE(max17042_init_data),
569         .alrt_data = max17042_alert_init_data,
570         .num_alrt_data = ARRAY_SIZE(max17042_alert_init_data),
571         .irq_base = IRQ_FUEL_BASE,
572         .enable_alert = true,
573         .wakeup = true,
574         .r_sns = 10000, /* 10m Ohm */
575 };
576 static struct i2c_board_info i2c9_devs[] __initdata = {
577         {
578                 I2C_BOARD_INFO("max17042", 0x36),
579                 .platform_data = &q1_battery_platform_data,
580         },
581 };
582
583 /* I2C 12 */
584 static struct cypress_pin cypress_tk_pin = {
585         .gpio_int       = S5PV310_GPL0(5),
586         .gpio_sda       = S5PV310_GPK1(2),
587         .gpio_scl       = S5PV310_GPK1(0),
588 };
589
590 static void cypress_tk_cfg_pin(void)
591 {
592         s3c_gpio_setpull(cypress_tk_pin.gpio_sda, S3C_GPIO_PULL_NONE);
593         s3c_gpio_setpull(cypress_tk_pin.gpio_scl, S3C_GPIO_PULL_NONE);
594
595         s3c_gpio_cfgpin(cypress_tk_pin.gpio_sda, S3C_GPIO_SFN(2));
596         s3c_gpio_cfgpin(cypress_tk_pin.gpio_scl, S3C_GPIO_SFN(2));
597
598         s3c_gpio_cfgpin(cypress_tk_pin.gpio_int, S3C_GPIO_SFN(0xf));
599 };
600
601 static int cypress_touchkey_power(int onoff)
602 {
603         struct regulator *regulator;
604
605         regulator = regulator_get(NULL, "touch_2.8v");
606         if (IS_ERR(regulator)) {
607                 printk(KERN_ERR "[TK][ERROR] regulator_get fail\n");
608                 return -1;
609         }
610
611         if (onoff) {
612                 regulator_enable(regulator);
613         } else {
614                 if (regulator_is_enabled(regulator))
615                         regulator_force_disable(regulator);
616         }
617         regulator_put(regulator);
618
619         msleep(100);
620         return 0;
621 }
622
623 static int cypress_touchled_power(int onoff)
624 {
625         struct regulator *regulator;
626
627         regulator = regulator_get(NULL, "touch_led_3.3v");
628         if (IS_ERR(regulator)) {
629                 printk(KERN_ERR "[TK][ERROR] regulator_get fail\n");
630                 return -1;
631         }
632
633         if (onoff) {
634                 regulator_enable(regulator);
635         } else {
636                 if (regulator_is_enabled(regulator))
637                         regulator_force_disable(regulator);
638         }
639         regulator_put(regulator);
640
641         msleep(100);
642         return 0;
643 }
644
645 static unsigned int q1_cypress_touch_keycode[] = {
646         KEY_PHONE,      /* not use this value 0x00 */
647         KEY_PHONE,      /* KEY_SEND 0x01 */
648         KEY_BACK,       /* KEY_END 0x02 */
649 };
650
651 static unsigned char q1_cypress_keycode_setbit[] = {
652         0,
653         1,
654         1,
655 };
656
657 static struct cypress_platform_data cypress_tk_data = {
658         .cfg_pin        = cypress_tk_cfg_pin,
659         .power_pin      = cypress_touchkey_power,
660         .led_pin        = cypress_touchled_power,
661         .pin            = &cypress_tk_pin,
662         .keycode        = q1_cypress_touch_keycode,
663         .keycode_size   = ARRAY_SIZE(q1_cypress_touch_keycode),
664         .keycode_setbit = q1_cypress_keycode_setbit,
665         .gpio_control   = 0,
666 };
667
668 static struct i2c_gpio_platform_data i2c12_gpio_data = {
669         .sda_pin                = S5PV310_GPK1(2),      /* XMMC1CDN */
670         .scl_pin                = S5PV310_GPK1(0),      /* XMMC1CLK */
671 };
672
673 static struct platform_device i2c12_gpio = {
674         .name                   = "i2c-gpio",
675         .id                     = 12,
676         .dev                    = {
677                 .platform_data  = &i2c12_gpio_data,
678         },
679 };
680
681 static struct i2c_board_info i2c12_devs[] __initdata = {
682         {
683                 I2C_BOARD_INFO("cypress_tk", 0x20),
684                 .platform_data  = &cypress_tk_data,
685         },
686 };
687
688 static struct i2c_gpio_platform_data i2c14_gpio_data = {
689         .sda_pin                = S5PV310_GPK2(2),      /* XMMC2CDn */
690         .scl_pin                = S5PV310_GPK3(2),      /* XMMC3CDn */
691         .udelay                 = 1,                    /* 500kHz   */
692 };
693
694 static struct platform_device i2c14_gpio = {
695         .name                   = "i2c-gpio",
696         .id                     = 14,
697         .dev                    = {
698                 .platform_data  = &i2c14_gpio_data,
699         },
700 };
701
702 static void __init q1_sound_init(void)
703 {
704         int val;
705         int err;
706         int gpio;
707
708         /* Set PMU register to set CLK_OUT to use XUSBXTI
709          * as codec source clock */
710         val = 0x900;
711         __raw_writel(val, S5P_PMREG(0xA00));
712
713         gpio = MOBILE_GPIO(MICBIAS_EN);
714         err = gpio_request(gpio, "MICBIAS_EN");
715         if (err) {
716                 pr_err(KERN_ERR "MIC_BIAS_EN GPIO set error!\n");
717                 return;
718         }
719         gpio_direction_output(gpio, 1);
720         gpio_set_value(gpio, 0);
721
722         gpio = MOBILE_GPIO(EAR_MICBIAS_EN);
723         err = gpio_request(gpio, "EAR_MICBIAS_EN");
724         if (err) {
725                 pr_err(KERN_ERR "EAR_MIC_BIAS_EN GPIO set error!\n");
726                 return;
727         }
728         gpio_direction_output(gpio, 1);
729         gpio_set_value(gpio, 0);
730
731         gpio = MOBILE_GPIO(SUB_MICBIAS_EN);
732         err = gpio_request(gpio, "submic_bias");
733         if (err) {
734                 pr_err(KERN_ERR "SUB_MIC_BIAS_EN GPIO set error!\n");
735                 return;
736         }
737         gpio_direction_output(gpio, 0);
738 }
739
740 /* I2C17: VGA CAM */
741 #if defined(CONFIG_VIDEO_S5K5BAFX)
742 #define VT_CAM_SDA_18V          S5PV310_GPC1(0)
743 #define VT_CAM_SCL_18V          S5PV310_GPC1(2)
744
745 static struct i2c_gpio_platform_data i2c17_gpio_data = {
746         .sda_pin                = VT_CAM_SDA_18V,
747         .scl_pin                = VT_CAM_SCL_18V,
748         .udelay                 = 2,
749         .sda_is_open_drain      = 0,
750         .scl_is_open_drain      = 0,
751         .scl_is_output_only     = 0,
752 };
753
754 static struct platform_device i2c17_gpio = {
755         .name                   = "i2c-gpio",
756         .id                     = 17,
757         .dev                    = {
758                 .platform_data  = &i2c17_gpio_data,
759         },
760 };
761 #endif
762
763 /* Jack */
764 static struct jack_platform_data q1_jack_data = {
765         .usb_online             = 0,
766         .charger_online         = -1,
767         .hdmi_online            = -1,
768         .earjack_online         = 0,
769         .earkey_online          = -1,
770         .ums_online             = -1,
771         .cdrom_online           = -1,
772         .jig_online             = 0,
773 };
774
775 static struct platform_device q1_jack = {
776         .name                   = "jack",
777         .id                     = -1,
778         .dev                    = {
779                 .platform_data  = &q1_jack_data,
780         },
781 };
782
783 /* TZPC */
784 static struct platform_device q1_tzpc = {
785         .name                   = "tzpc",
786         .id                     = -1,
787 };
788
789 /* ADC */
790 static struct s3c_adc_platform_data s3c_adc_pdata __initdata = {
791         .delay                  = 1000,
792         .presc                  = 49,
793         .resolution             = 12,
794         .max_adc_voltage_uV     = 3300000,
795 };
796
797 static void __init q1_adc_init(void)
798 {
799         s3c_adc_set_platdata(&s3c_adc_pdata);
800 }
801
802 static void ramoops_enable(int enable)
803 {
804         struct clk *clk;
805
806         clk = clk_get(NULL, "modem");
807         if (enable)
808                 clk_enable(clk);
809         else
810                 clk_disable(clk);
811         clk_put(clk);
812 }
813
814 static struct ramoops_platform_data q1_ramoops_data = {
815         .mem_address            = 0x13A00000,           /* MODEM I/F */
816         .mem_size               = SZ_16K,
817         .enable                 = ramoops_enable,
818 };
819
820 static struct platform_device q1_ramoops = {
821         .name                   = "ramoops",
822         .dev                    = {
823                 .platform_data  = &q1_ramoops_data,
824         },
825 };
826
827 /* USB EHCI */
828 static struct s5p_usb_ehci_platdata q1_usb_ehci_pdata;
829
830 static void __init q1_usb_ehci_init(void)
831 {
832         struct s5p_usb_ehci_platdata *pdata = &q1_usb_ehci_pdata;
833
834         /* The gpios is initialized from modem_init */
835         pdata->gpio_active = MOBILE_GPIO(ACTIVE_STATE_HSIC);
836
837         s5p_usb_ehci_set_platdata(pdata);
838 }
839
840 /* USB OTG */
841 /* we don't use OTGDRVVBUS pin for powering up otg charging pump */
842 static void q1_otg_power_cb(int enable)
843 {
844         /* We need to control new device SMB328 for powering up,
845          *  but SMB328 driver is not yet added. (20120315)
846          */
847         pr_info("%s:otg_power_cb doesn't work(%d)\n", __func__, enable);
848 }
849
850 static void __init q1_usb_otg_init(void)
851 {
852         struct host_notify_dev *q1_otg_ndev =
853                         dev_get_platdata(&s3c_device_usbgadget.dev);
854         struct sec_otghost_data *q1_otg_host_data =
855                         dev_get_platdata(&s3c_device_usb_otghcd.dev);
856
857         q1_otg_ndev->set_booster = q1_otg_power_cb;
858         q1_otg_host_data->set_pwr_cb = q1_otg_power_cb;
859 }
860
861 /* MODEM Net */
862 static struct platform_device q1_modem_net = {
863         .name                   = "modem_net",
864         .id                     = -1,
865 };
866
867 /* XMM6260 control */
868 static struct xmm6260_gpios q1_xmm6260_gpios;
869
870 static struct xmm6260_platform_data q1_xmm6260_pdata = {
871         .gpios                  = &q1_xmm6260_gpios,
872         .wakeup                 = 1,
873 };
874
875 static struct platform_device q1_xmm6260 = {
876         /* FIXME: Use modemctl name because of platform dependency */
877         .name                   = "modemctl",
878         .id                     = -1,
879         .dev                    = {
880                 .platform_data  = &q1_xmm6260_pdata,
881         },
882 };
883
884 static void __init q1_modem_init(void)
885 {
886         struct xmm6260_gpios *gpios = &q1_xmm6260_gpios;
887         int gpio;
888
889         gpio = MOBILE_GPIO(CP_ON);
890         gpio_request(gpio, "CP_ON");
891         gpio_direction_output(gpio, 0);
892         gpios->cp_on = gpio;
893
894         gpio = MOBILE_GPIO(PHONE_ACTIVE);
895         gpio_request(gpio, "PHONE_ACTIVE");
896         gpios->phone_active = gpio;
897
898         gpio = MOBILE_GPIO(PDA_ACTIVE);
899         gpio_request(gpio, "PDA_ACTIVE");
900         gpio_direction_output(gpio, 0);
901         gpios->pda_active = gpio;
902
903         gpio = MOBILE_GPIO(CP_DUMP_INT);
904         gpio_request(gpio, "CP_DUMP_INT");
905         gpios->cp_dump_int = gpio;
906
907         gpio = MOBILE_GPIO(CP_PMU_RST);
908         gpio_request(gpio, "CP_PMU_RST");
909         gpio_direction_output(gpio, 0);
910         gpios->cp_pmu_rst = gpio;
911
912         gpio = MOBILE_GPIO(RESET_REQ_N);
913         gpio_request(gpio, "RESET_REQ_N");
914         gpio_direction_output(gpio, 0);
915         gpios->reset_req_n = gpio;
916
917         gpio = MOBILE_GPIO(IPC_SLAVE_WAKEUP);
918         gpio_request(gpio, "IPC_SLAVE_WAKEUP");
919         gpio_direction_output(gpio, 0);
920         gpios->ipc_slave_wakeup = gpio;
921
922         gpio = MOBILE_GPIO(IPC_HOST_WAKEUP);
923         gpio_request(gpio, "IPC_HOST_WAKEUP");
924         gpios->ipc_host_wakeup = gpio;
925
926         gpio = MOBILE_GPIO(SUSPEND_REQUEST_HSIC);
927         gpio_request(gpio, "SUSPEND_REQUEST_HSIC");
928         gpios->suspend_request_hsic = gpio;
929
930         gpio = MOBILE_GPIO(ACTIVE_STATE_HSIC);
931         gpio_request(gpio, "ACTIVE_STATE_HSIC");
932         gpio_direction_output(gpio, 0);
933         gpios->active_state_hsic = gpio;
934 }
935
936 static struct regulator_consumer_supply emmc_supplies[] = {
937         REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
938         REGULATOR_SUPPLY("vmmc", "dw_mmc"),
939 };
940
941 static struct regulator_init_data emmc_fixed_voltage_init_data = {
942         .constraints            = {
943                 .name           = "VMEM_VDD_2.8/VDDF_3.0V",
944                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
945         },
946         .num_consumer_supplies  = ARRAY_SIZE(emmc_supplies),
947         .consumer_supplies      = emmc_supplies,
948 };
949
950 static struct fixed_voltage_config emmc_fixed_voltage_config = {
951         .supply_name            = "eMMC_EN",
952         .microvolts             = 2800000,
953         .gpio                   = S5PV310_GPK0(2),
954         .enable_high            = true,
955         .init_data              = &emmc_fixed_voltage_init_data,
956 };
957
958 static struct platform_device emmc_fixed_voltage = {
959         .name                   = "reg-fixed-voltage",
960         .id                     = FIXED_REG_ID_MMC,
961         .dev                    = {
962                 .platform_data  = &emmc_fixed_voltage_config,
963         },
964 };
965
966 /* MALI DRM. */
967 #ifdef CONFIG_DRM_MALI
968 static struct platform_device s5p_device_mali_drm = {
969         .name                   = "mali_drm",
970         .id                     = -1,
971 };
972 #endif
973
974 /* FIMD DRM. */
975 #ifdef CONFIG_DRM_FIMD
976 static struct resource fimd_drm_resource[] = {
977         [0] = {
978                 .start          = S5P_PA_LCD0,
979                 .end            = S5P_PA_LCD0 + S5P_SZ_LCD0 - 1,
980                 .flags          = IORESOURCE_MEM,
981         },
982         [1] = {
983                 .start          = S5P_PA_LCD1,
984                 .end            = S5P_PA_LCD1 + S5P_SZ_LCD1 - 1,
985                 .flags          = IORESOURCE_MEM,
986         },
987         [2] = {
988                 .start          = IRQ_LCD1,
989                 .end            = IRQ_LCD1,
990                 .flags          = IORESOURCE_IRQ,
991         },
992         [3] = {
993                 .start          = IRQ_LCD0,
994                 .end            = IRQ_LCD0,
995                 .flags          = IORESOURCE_IRQ,
996         },
997 };
998
999 static struct fimd_drm_platform_data fimd_drm_pd = {
1000         .hw_ver = 0x70,
1001 };
1002
1003 static struct platform_device s5p_device_fimd_drm = {
1004         .name                   = "fimd_drm",
1005         .id                     = -1,
1006         .num_resources          = ARRAY_SIZE(fimd_drm_resource),
1007         .resource               = fimd_drm_resource,
1008         .dev                    = {
1009                 .platform_data = &fimd_drm_pd,
1010         },
1011 };
1012 #endif
1013
1014 #ifdef CONFIG_ANDROID_RAM_CONSOLE
1015 static struct resource ram_console_resource[] = {
1016         [0] = {
1017                 .flags = IORESOURCE_MEM,
1018         },
1019 };
1020
1021 static struct platform_device ram_console_device = {
1022         .name                   = "ram_console",
1023         .id                     = -1,
1024         .num_resources          = ARRAY_SIZE(ram_console_resource),
1025         .resource               = ram_console_resource,
1026 };
1027 #endif
1028
1029 static void __init q1_map_io(void)
1030 {
1031         s5p_init_io(NULL, 0, S5P_VA_CHIPID);
1032         s5p_xtal_set_parent(CLK_XUSBXTI);
1033         s3c24xx_init_clocks(24000000);
1034         s3c24xx_init_uarts(q1_uartcfgs, ARRAY_SIZE(q1_uartcfgs));
1035 }
1036
1037 static unsigned long fbmem_start, fbmem_size;
1038 static int __init early_fbmem(char *p)
1039 {
1040         char *endp;
1041
1042         if (!p)
1043                 return -EINVAL;
1044
1045         fbmem_size = memparse(p, &endp);
1046         if (*endp == '@')
1047                 fbmem_start = memparse(endp + 1, &endp);
1048
1049         return endp > p ? 0 : -EINVAL;
1050 }
1051 early_param("fbmem", early_fbmem);
1052
1053 static void __init s5pv310_reserve(void)
1054 {
1055         static struct cma_region regions[] = {
1056 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD0
1057                 {
1058                         .name = "fimd",
1059                         .size = (CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD0
1060 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD1
1061                                 + CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD1
1062 #endif
1063                                 ) * SZ_1K,
1064                 },
1065 #endif
1066 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC0
1067                 {
1068                         .name = "fimc0",
1069                         .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC0 * SZ_1K,
1070                         .start = 0
1071                 },
1072 #endif
1073 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1
1074                 {
1075                         .name = "fimc1",
1076                         .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1 * SZ_1K,
1077                         .start = 0
1078                 },
1079 #endif
1080 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC2
1081                 {
1082                         .name = "fimc2",
1083                         .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC2 * SZ_1K,
1084                         .start = 0
1085                 },
1086 #endif
1087 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3
1088                 {
1089                         .name = "fimc3",
1090                         .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3 * SZ_1K,
1091                         .start = 0
1092                 },
1093 #endif
1094
1095 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_S3C_MEM_CMA
1096                 {
1097                         .name = "s3c-mem-cma",
1098                         .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_S3C_MEM_CMA * SZ_1K,
1099                         .start = 0
1100                 },
1101 #endif
1102
1103 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG
1104                 {
1105                         .name           = "jpeg",
1106                         .size           = CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG *  SZ_1K,
1107                 },
1108 #endif
1109 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC
1110                 {
1111                         .name = "mfc",
1112                         .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC *  SZ_1K,
1113                 },
1114 #endif
1115 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0
1116                 {
1117                         .name = "mfc0",
1118                         .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0 * SZ_1K,
1119                         {
1120                                 .alignment = 1 << 17,
1121                         },
1122                 },
1123 #endif
1124 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1
1125                 {
1126                         .name = "mfc1",
1127                         .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1 * SZ_1K,
1128                         {
1129                                 .alignment = 1 << 17,
1130                         },
1131                 },
1132 #endif
1133 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_MFC
1134                 {
1135                         .name           = "fw",
1136                         .size           = 1 << 20,
1137                         { .alignment    = 128 << 10 },
1138                         .start          = 0x42000000,
1139                 },
1140                 {
1141                         .name           = "b1",
1142                         .size           = 32 << 20,
1143                         .start          = 0x43000000,
1144                 },
1145                 {
1146                         .name           = "b2",
1147                         .size           = 32 << 20,
1148                         .start          = 0x51000000,
1149                 },
1150 #endif
1151 #ifdef CONFIG_SEC_DEBUG
1152         {
1153                 .name           = "getlog",
1154                 .size           = 1 << 12,
1155                 .start          = 0x40003000,
1156         },
1157 #endif
1158                 { }
1159         };
1160
1161         static const char map[] __initconst =
1162                 "s3cfb=fimd;"
1163 #ifdef CONFIG_VIDEO_FIMC
1164                 "s3c-fimc.0=fimc0;"
1165                 "s3c-fimc.1=fimc1;"
1166                 "s3c-fimc.2=fimc2;"
1167                 "s3c-fimc.3=fimc3;"
1168 #endif
1169 #ifdef CONFIG_S3C_MEM_CMA_ALLOC
1170                 "s3c-mem=s3c-mem-cma;"
1171 #endif
1172
1173                 "s5p-jpeg=jpeg;"
1174 #ifdef CONFIG_SEC_DEBUG
1175                 "s3c-getlog=getlog;"
1176 #endif
1177 #if defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
1178                 "mfc=mfc,mfc0,mfc1;"
1179                 "s5p-mfc/f=fw;s5p-mfc/a=b1;s5p-mfc/b=b2;"
1180 #else
1181 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_PROFILING
1182                 "s3c-mfc/mfc=mfc;s3c-mfc/mfc0=mfc0;s3c-mfc/mfc1=mfc1;"
1183 #else
1184                 "s3c-mfc=mfc,mfc0,mfc1;"
1185 #endif
1186 #endif
1187                 "*=b1,b2";
1188
1189         unsigned int i = 0;
1190
1191 #ifdef CONFIG_ANDROID_RAM_CONSOLE
1192         unsigned int addr;
1193
1194         /* FIXME: ram console MUST be reserved at first time */
1195         addr = memblock_alloc_base(SZ_1M, SZ_4K, 0x60000000);
1196         ram_console_resource[0].start = addr;
1197         ram_console_resource[0].end = addr + SZ_1M - 1;
1198         pr_info("ram_console: 0x%08x ~ 0x%08x (1MB)\n",
1199                         addr, addr + SZ_1M);
1200 #endif
1201
1202         if (fbmem_start)
1203                 regions[0].start = (dma_addr_t)fbmem_start;
1204         if (fbmem_size)
1205                 regions[0].size = (size_t)fbmem_size;
1206
1207         cma_set_defaults(regions, map);
1208         cma_early_regions_reserve(NULL);
1209
1210         for (; i < ARRAY_SIZE(regions) - 1 /* terminator */; ++i) {
1211                 pr_info("cma: region: %-8s: 0x%08x ~ 0x%08x (%dMB)\n",
1212                         regions[i].name, regions[i].start,
1213                         regions[i].start + regions[i].size,
1214                         regions[i].size / SZ_1M);
1215         }
1216 }
1217
1218 /*
1219  * GPX are saved and restored at plat-samsung/pm.c:s5c_pm_enter.
1220  * However, they are inside of pm_prepare and pm_finish, so it
1221  * does not save ours against universal_pm_prepare:2.
1222  */
1223 static struct sleep_save s5pc210_gpx[] = {
1224         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C00),
1225         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C04),
1226         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C08),
1227         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C0C),
1228         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C20),
1229         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C24),
1230         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C28),
1231         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C2C),
1232         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C40),
1233         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C44),
1234         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C48),
1235         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C4C),
1236         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C60),
1237         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C64),
1238         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C68),
1239         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C6C),
1240 };
1241
1242 /* GPIO KEYS */
1243 static struct gpio_keys_button q1_gpio_keys_tables[] = {
1244         {
1245                 .code                   = KEY_VOLUMEUP,
1246                 .gpio                   = S5PV310_GPX2(0),      /* XEINT16 */
1247                 .desc                   = "gpio-keys: KEY_VOLUMEUP",
1248                 .type                   = EV_KEY,
1249                 .active_low             = 1,
1250                 .debounce_interval      = 1,
1251         }, {
1252                 .code                   = KEY_VOLUMEDOWN,
1253                 .gpio                   = S5PV310_GPX2(1),      /* XEINT17 */
1254                 .desc                   = "gpio-keys: KEY_VOLUMEDOWN",
1255                 .type                   = EV_KEY,
1256                 .active_low             = 1,
1257                 .debounce_interval      = 1,
1258         }, {
1259                 .code                   = KEY_POWER,
1260                 .gpio                   = S5PV310_GPX2(7),      /* XEINT23 */
1261                 .desc                   = "gpio-keys: KEY_POWER",
1262                 .type                   = EV_KEY,
1263                 .active_low             = 1,
1264                 .wakeup                 = 1,
1265                 .debounce_interval      = 1,
1266         }, {
1267                 .code                   = KEY_HOME,
1268                 .gpio                   = S5PV310_GPX3(5),      /* XEINT29 */
1269                 .desc                   = "gpio-keys: KEY_HOME",
1270                 .type                   = EV_KEY,
1271                 .active_low             = 1,
1272                 .debounce_interval      = 1,
1273         },
1274 };
1275
1276 static struct gpio_keys_platform_data q1_gpio_keys_data = {
1277         .buttons                = q1_gpio_keys_tables,
1278         .nbuttons               = ARRAY_SIZE(q1_gpio_keys_tables),
1279 };
1280
1281 static struct platform_device q1_gpio_keys = {
1282         .name                   = "gpio-keys",
1283         .dev                    = {
1284                 .platform_data  = &q1_gpio_keys_data,
1285         },
1286 };
1287 /* s6e8aa0 panel. */
1288 static struct s3cfb_lcd s6e8aa0 = {
1289         .width = 800,
1290         .height = 1280,
1291         .width_mm = 64,
1292         .height_mm = 106,
1293         .bpp = 24,
1294
1295         .freq = 55,
1296         .timing = {
1297                 .h_fp = 10,
1298                 .h_bp = 10,
1299                 .h_sw = 10,
1300                 .v_fp = 13,
1301                 .v_fpe = 1,
1302                 .v_bp = 1,
1303                 .v_bpe = 1,
1304                 .v_sw = 2,
1305                 .cmd_allow_len = 0xf,
1306         },
1307         .polarity = {
1308                 .rise_vclk = 1,
1309                 .inv_hsync = 0,
1310                 .inv_vsync = 0,
1311                 .inv_vden = 0,
1312         },
1313 };
1314
1315 static int lcd_power_on(struct lcd_device *ld, int enable)
1316 {
1317         struct regulator *regulator;
1318
1319         if (ld == NULL) {
1320                 printk(KERN_ERR "lcd device object is NULL.\n");
1321                 return 0;
1322         }
1323
1324         if (enable) {
1325                 regulator = regulator_get(&ld->dev, "vcc_1.8v");
1326                 if (IS_ERR(regulator))
1327                         return -1;
1328                 regulator_enable(regulator);
1329                 regulator_put(regulator);
1330                 regulator = regulator_get(&ld->dev, "vcc_2.1v");
1331                 if (IS_ERR(regulator))
1332                         return -1;
1333                 regulator_enable(regulator);
1334                 regulator_put(regulator);
1335
1336                 regulator = regulator_get(&ld->dev, "vcc_3.1v");
1337                 if (IS_ERR(regulator))
1338                         return -1;
1339                 regulator_enable(regulator);
1340                 regulator_put(regulator);
1341         } else {
1342                 regulator = regulator_get(&ld->dev, "vcc_1.8v");
1343                 if (IS_ERR(regulator))
1344                         return -1;
1345                 if (regulator_is_enabled(regulator))
1346                         regulator_disable(regulator);
1347                 regulator_put(regulator);
1348
1349                 regulator = regulator_get(&ld->dev, "vcc_2.1v");
1350                 if (IS_ERR(regulator))
1351                         return -1;
1352                 if (regulator_is_enabled(regulator))
1353                         regulator_disable(regulator);
1354                 regulator_put(regulator);
1355
1356                 regulator = regulator_get(&ld->dev, "vcc_3.1v");
1357                 if (IS_ERR(regulator))
1358                         return -1;
1359                 if (regulator_is_enabled(regulator))
1360                         regulator_disable(regulator);
1361                 regulator_put(regulator);
1362         }
1363
1364         return 0;
1365 }
1366
1367 static int reset_lcd(struct lcd_device *ld)
1368 {
1369         static unsigned int first = 1;
1370         int reset_gpio = -1;
1371
1372         reset_gpio = S5PV310_GPY4(5);
1373
1374         if (first) {
1375                 gpio_request(reset_gpio, "MLCD_RST");
1376                 first = 0;
1377         }
1378
1379         mdelay(10);
1380         gpio_direction_output(reset_gpio, 0);
1381         mdelay(10);
1382         gpio_direction_output(reset_gpio, 1);
1383
1384         return 1;
1385 }
1386
1387 static int s5p_mipi_dphy_power(struct platform_device *pdev, unsigned int enable)
1388 {
1389         struct regulator *regulator;
1390
1391         if (enable) {
1392                 regulator = regulator_get(&pdev->dev, "vmipi_1.1v");
1393                 if (IS_ERR(regulator))
1394                         return -1;
1395                 regulator_enable(regulator);
1396                 regulator_put(regulator);
1397                 regulator = regulator_get(&pdev->dev, "vmipi_1.8v");
1398                 if (IS_ERR(regulator))
1399                         return -1;
1400                 regulator_enable(regulator);
1401                 regulator_put(regulator);
1402         } else {
1403                 regulator = regulator_get(&pdev->dev, "vmipi_1.1v");
1404                 if (IS_ERR(regulator))
1405                         return -1;
1406                 if (regulator_is_enabled(regulator))
1407                         regulator_disable(regulator);
1408                 regulator_put(regulator);
1409
1410                 regulator = regulator_get(&pdev->dev, "vmipi_1.8v");
1411                 if (IS_ERR(regulator))
1412                         return -1;
1413                 if (regulator_is_enabled(regulator))
1414                         regulator_disable(regulator);
1415                 regulator_put(regulator);
1416
1417         }
1418
1419         printk("[%d] %s : %s\n", __LINE__, __func__, dev_name(&pdev->dev));
1420         return 0;
1421 }
1422
1423 static struct mipi_dsim_config dsim_config = {
1424         .e_interface            = DSIM_VIDEO,
1425         .e_virtual_ch           = DSIM_VIRTUAL_CH_0,
1426         .e_pixel_format         = DSIM_24BPP_888,
1427         .e_burst_mode           = DSIM_BURST_SYNC_EVENT,
1428         .e_no_data_lane         = DSIM_DATA_LANE_4,
1429         .e_byte_clk             = DSIM_PLL_OUT_DIV8,
1430
1431         /*
1432          * ===========================================
1433          * |    P    |    M    |    S    |    MHz    |
1434          * -------------------------------------------
1435          * |    3    |   100   |    3    |    100    |
1436          * |    3    |   100   |    2    |    200    |
1437          * |    3    |    63   |    1    |    252    |
1438          * |    4    |   100   |    1    |    300    |
1439          * |    4    |   110   |    1    |    330    |
1440          * |   12    |   350   |    1    |    350    |
1441          * |    3    |   100   |    1    |    400    |
1442          * |    4    |   150   |    1    |    450    |
1443          * |    6    |   118   |    1    |    472    |
1444          * |   12    |   250   |    0    |    500    |
1445          * |    4    |   100   |    0    |    600    |
1446          * |    3    |    81   |    0    |    648    |
1447          * |    3    |    88   |    0    |    704    |
1448          * |    3    |    90   |    0    |    720    |
1449          * |    3    |   100   |    0    |    800    |
1450          * |   12    |   425   |    0    |    850    |
1451          * |    4    |   150   |    0    |    900    |
1452          * |   12    |   475   |    0    |    950    |
1453          * |    6    |   250   |    0    |   1000    |
1454          * -------------------------------------------
1455          */
1456
1457         .p                      = 12,
1458         .m                      = 250,
1459         .s                      = 0,
1460
1461         /* D-PHY PLL stable time spec :min = 200usec ~ max 400usec */
1462         .pll_stable_time        = 500,
1463
1464         /* escape clk : 10MHz */
1465         .esc_clk                = 10 * 1000000,
1466
1467         /* stop state holding counter after bta change count 0 ~ 0xfff */
1468         .stop_holding_cnt       = 0x7ff,
1469         /* bta timeout 0 ~ 0xff */
1470         .bta_timeout            = 0xff,
1471         /* lp rx timeout 0 ~ 0xffff */
1472         .rx_timeout             = 0xffff,
1473 };
1474
1475 static struct s5p_platform_mipi_dsim dsim_platform_data = {
1476         /* FIXME. */
1477         .enabled                = 1,
1478         .phy_enable             = s5p_dsim_phy_enable,
1479         .dsim_config            = &dsim_config,
1480 };
1481
1482 static struct lcd_platform_data s6e8aa0_pd = {
1483         .reset                  = reset_lcd,
1484         .power_on               = lcd_power_on,
1485         .reset_delay            = 25,
1486         .power_off_delay        = 120,
1487         .power_on_delay         = 120,
1488 };
1489
1490 static struct mipi_dsim_lcd_device mipi_lcd_device = {
1491         .name                   = "s6e8aa0",
1492         .panel_id               = "ams529ha01", /* Q1 */
1493         .id                     = -1,
1494         .bus_id                 = 0,
1495
1496         .platform_data          = (void *)&s6e8aa0_pd,
1497 };
1498
1499 #ifdef CONFIG_VIDEO_FIMG2D
1500 static struct fimg2d_platdata fimg2d_data __initdata = {
1501         .hw_ver                 = 30,
1502         .parent_clkname         = "mout_g2d0",
1503         .clkname                = "sclk_fimg2d",
1504         .gate_clkname           = "fimg2d",
1505         .smmu_gate_clkname      = "smmu_fimg2d",
1506         .clkrate                = 250 * 1000000,
1507 };
1508 #endif
1509
1510 static struct s3c_platform_fb fb_platform_data __initdata = {
1511         .hw_ver                 = 0x70,
1512         .nr_wins                = 5,
1513 #ifdef CONFIG_FB_S3C_DEFAULT_WINDOW
1514         .default_win            = CONFIG_FB_S3C_DEFAULT_WINDOW,
1515 #else
1516         .default_win            = 0,
1517 #endif
1518         .swap                   = FB_SWAP_HWORD | FB_SWAP_WORD,
1519 };
1520
1521 #ifdef CONFIG_FB_S3C_HIBERNATION_LOADING
1522 #include <linux/hib_ani.h>
1523
1524 static struct s3cfb_hib_ani hib_ani_set __initdata = {
1525         .text_ani1 = {
1526                 .width = 378,
1527                 .height = 39,
1528                 .x_point = 51,
1529                 .y_point =193,
1530
1531         },
1532         .text_ani2 = {
1533                 .width = 184,
1534                 .height = 64,
1535                 .x_point = 150,
1536                 .y_point = 650,
1537
1538         },
1539         .count_ani = {
1540                 .width = 170,
1541                 .height = 171,
1542                 .x_point = 154,
1543                 .y_point = 320,
1544         },
1545         .delay = 400,
1546         .hib_animation = hib_anis,
1547
1548 };
1549 #endif
1550
1551
1552 static struct resource s5p_fimd_lite_resource[] = {
1553         [0] = {
1554                 .start  = S5P_PA_LCD_LITE0,
1555                 .end    = S5P_PA_LCD_LITE0 + S5P_SZ_LCD_LITE0 - 1,
1556                 .flags  = IORESOURCE_MEM,
1557         },
1558         [1] = {
1559                 .start  = IRQ_LCD_LITE0,
1560                 .end    = IRQ_LCD_LITE0,
1561                 .flags  = IORESOURCE_IRQ,
1562         },
1563 };
1564
1565 static struct resource s5p_mdnie_resource[] = {
1566         [0] = {
1567                 .start  = S5P_PA_MDNIE0,
1568                 .end    = S5P_PA_MDNIE0 + S5P_SZ_MDNIE0 - 1,
1569                 .flags  = IORESOURCE_MEM,
1570         },
1571 };
1572
1573 extern struct mdnie_tables cmc623_tables;
1574 static struct mdnie_platform_data q1_mdnie_pd = {
1575         .width                  = 800,
1576         .height                 = 1280,
1577
1578         .tables                 = &cmc623_tables,
1579 };
1580
1581 static struct s5p_fimd_ext_device q1_fimd_lite_device = {
1582         .name                   = "fimd_lite",
1583         .id                     = -1,
1584         .num_resources          = ARRAY_SIZE(s5p_fimd_lite_resource),
1585         .resource               = s5p_fimd_lite_resource,
1586         .dev                    = {
1587                 .platform_data  = &s6e8aa0,
1588         },
1589 };
1590
1591 static struct s5p_fimd_ext_device q1_mdnie_device = {
1592         .name                   = "mdnie",
1593         .id                     = -1,
1594         .num_resources          = ARRAY_SIZE(s5p_mdnie_resource),
1595         .resource               = s5p_mdnie_resource,
1596         .dev                    = {
1597                 .platform_data  = &q1_mdnie_pd,
1598         },
1599 };
1600
1601 static void __init q1_fb_init(void)
1602 {
1603         struct device *dev = s3c_device_fb.dev.parent;
1604         struct samsung_pd_info *pdinfo;
1605         struct s5p_platform_mipi_dsim *dsim_pd;
1606
1607         if (dev) {
1608                 pdinfo = (struct samsung_pd_info *)dev->platform_data;
1609                 /* fimd driver have to know LCD domain power status. */
1610                 if (pdinfo)
1611                         fb_platform_data.boot_on = pdinfo->boot_on;
1612         }
1613
1614         if (fbmem_start)
1615                 fb_platform_data.logo_on = 1;
1616
1617         s5p_device_mipi_dsim0.dev.platform_data = (void *)&dsim_platform_data;
1618         dsim_pd = (struct s5p_platform_mipi_dsim *)&dsim_platform_data;
1619
1620         strcpy(dsim_pd->lcd_panel_name, "s6e8aa0");
1621         dsim_pd->mipi_power = s5p_mipi_dphy_power;
1622         dsim_pd->lcd_panel_info = &s6e8aa0;
1623         s5p_mipi_dsi_register_lcd_device(&mipi_lcd_device);
1624         platform_device_register(&s5p_device_mipi_dsim0);
1625
1626 #ifdef CONFIG_FB_S3C_HIBERNATION_LOADING
1627         fb_platform_data.hib_ani = (void *)&hib_ani_set;
1628 #endif
1629
1630         fb_platform_data.lcd_data = (struct s3cfb_lcd *)&s6e8aa0;
1631         s3cfb_set_platdata(&fb_platform_data);
1632
1633         s3cfb_cfg_gpio(NULL);
1634 }
1635
1636 static void q1_pm_finish(void)
1637 {
1638         /* Restore GPX conf */
1639         s3c_pm_do_restore(s5pc210_gpx, ARRAY_SIZE(s5pc210_gpx));
1640 }
1641
1642 static void q1_pm_prepare(void)
1643 {
1644         /* 1. Save GPX conf */
1645         s3c_pm_do_save(s5pc210_gpx, ARRAY_SIZE(s5pc210_gpx));
1646
1647         /* 2. Set GPX as Power Save Mode */
1648
1649         /* 3. Debug: Look at the diff */
1650         mobile_gpios_groupx_difference();
1651
1652 }
1653
1654 int q1_common_setup_clock(const char *sclk_name, const char *pclk_name,
1655                 unsigned long rate, unsigned int rate_set)
1656 {
1657         struct clk *sclk = NULL;
1658         struct clk *pclk = NULL;
1659
1660         sclk = clk_get(NULL, sclk_name);
1661         if (IS_ERR(sclk)) {
1662                 printk(KERN_ERR "failed to get %s clock.\n", sclk_name);
1663                 goto err_clk1;
1664         }
1665
1666         pclk = clk_get(NULL, pclk_name);
1667         if (IS_ERR(pclk)) {
1668                 printk(KERN_ERR "failed to get %s clock.\n", pclk_name);
1669                 goto err_clk2;
1670         }
1671
1672         clk_set_parent(sclk, pclk);
1673
1674         printk(KERN_INFO "set parent clock of %s to %s\n", sclk_name,
1675                         pclk_name);
1676         if (!rate_set)
1677                 goto set_end;
1678
1679         if (!rate)
1680                 rate = 200 * MHZ;
1681
1682         clk_set_rate(sclk, rate);
1683         printk(KERN_INFO "set %s rate to %lu\n", sclk_name, rate);
1684
1685 set_end:
1686         clk_put(sclk);
1687         clk_put(pclk);
1688
1689         return 0;
1690
1691 err_clk2:
1692         clk_put(pclk);
1693 err_clk1:
1694         clk_put(sclk);
1695
1696         return -EINVAL;
1697
1698 }
1699
1700 #ifdef CONFIG_S5PV310_DEV_PD
1701 static inline void powerdomain_boot_on(int pd)
1702 {
1703         struct samsung_pd_info *pdinfo = (struct samsung_pd_info *)
1704                 s5pv310_device_pd[pd].dev.platform_data;
1705
1706         pdinfo->boot_on = true;
1707 }
1708 #endif
1709
1710 static struct regulator_consumer_supply supplies_cam_io_en[] = {
1711         REGULATOR_SUPPLY("vdda", "17-002d"),
1712         REGULATOR_SUPPLY("a_sensor", "0-001f"),
1713 };
1714
1715 static struct regulator_consumer_supply supplies_vt_cam_15v_en[] = {
1716         REGULATOR_SUPPLY("vt_core", "17-002d"),
1717 };
1718
1719 static struct regulator_consumer_supply supplies_cam_af_28v[] = {
1720         REGULATOR_SUPPLY("af_28", "0-001f"),
1721 };
1722
1723 static struct regulator_consumer_supply supplies_cam_sensor_core_12v_en[] = {
1724         REGULATOR_SUPPLY("dig_12", "0-001f"),
1725         REGULATOR_SUPPLY("dig_12", "17-002d"),
1726 };
1727
1728 static struct regulator_init_data cam_fixreg_init_data[] = {
1729         [0] = {
1730                 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1731                 .num_consumer_supplies  = ARRAY_SIZE(supplies_cam_io_en),
1732                 .consumer_supplies      = supplies_cam_io_en,
1733         },
1734         [1] = {
1735                 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1736                 .num_consumer_supplies  = ARRAY_SIZE(supplies_vt_cam_15v_en),
1737                 .consumer_supplies      = supplies_vt_cam_15v_en,
1738         },
1739         [2] = {
1740                 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1741                 .num_consumer_supplies  = ARRAY_SIZE(supplies_cam_sensor_core_12v_en),
1742                 .consumer_supplies      = supplies_cam_sensor_core_12v_en,
1743         },
1744         [3] = {
1745                 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1746                 .num_consumer_supplies  = ARRAY_SIZE(supplies_cam_af_28v),
1747                 .consumer_supplies      = supplies_cam_af_28v,
1748         },
1749 };
1750
1751 static struct fixed_voltage_config cam_fixreg_cfg[] = {
1752         [0] = {
1753                 .supply_name    = "CAM_IO_EN",
1754                 .microvolts     = 2800000,
1755                 .gpio           = S5PV310_GPE2(1),
1756                 .enable_high    = 1,
1757                 .init_data      = &cam_fixreg_init_data[0],
1758         },
1759         [1] = {
1760                 .supply_name    = "VT_CAM_1.5V_EN",
1761                 .microvolts     = 1500000,
1762                 .gpio           = S5PV310_GPE2(2),
1763                 .enable_high    = 1,
1764                 .init_data      = &cam_fixreg_init_data[1],
1765         },
1766         [2] = {
1767                 .supply_name    = "CAM_SENSOR_CORE_1.2V_EN",
1768                 .microvolts     = 1200000,
1769                 .gpio           = S5PV310_GPE2(5),
1770                 .enable_high    = 1,
1771                 .init_data      = &cam_fixreg_init_data[2],
1772         },
1773         [3] = {
1774                 .supply_name    = "CAM_AF_2.8V",
1775                 .microvolts     = 2800000,
1776                 .gpio           = S5PV310_GPK1(1),
1777                 .enable_high    = 1,
1778                 .init_data      = &cam_fixreg_init_data[3],
1779         },
1780 };
1781
1782 static struct platform_device camera_fixed_reg_dev[] = {
1783         {
1784                 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM0,
1785                 .dev = { .platform_data = &cam_fixreg_cfg[0] },
1786         }, {
1787                 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM1,
1788                 .dev = { .platform_data = &cam_fixreg_cfg[1] },
1789         }, {
1790                 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM2,
1791                 .dev = { .platform_data = &cam_fixreg_cfg[2] },
1792         }, {
1793                 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM3,
1794                 .dev = { .platform_data = &cam_fixreg_cfg[3] },
1795         },
1796 };
1797
1798 static int q1_host_notify_cb(int enable)
1799 {
1800         struct host_notify_dev *ndev = NULL;
1801
1802         if (s3c_device_usbgadget.dev.platform_data)
1803                 ndev = s3c_device_usbgadget.dev.platform_data;
1804         else {
1805                 pr_err("%s: ndev is null.\n", __func__);
1806                 return -1;
1807         }
1808
1809         ndev->booster = enable ? NOTIFY_POWER_ON : NOTIFY_POWER_OFF;
1810         pr_info("%s: mode %d, enable %d\n", __func__, ndev->mode, enable);
1811         return ndev->mode;
1812 }
1813
1814 static struct switch_dev switch_dock = {
1815         .name = "dock",
1816 };
1817
1818 static const char *switch_cable_names[] = {
1819         "TA",
1820         "USB",
1821         NULL,
1822 };
1823
1824 static struct switch_dev switch_usb = {
1825         .name = "switch-usb",
1826         .supported_cable = switch_cable_names,
1827 };
1828
1829 static void q1_switch_dev_init(void)
1830 {
1831         int ret;
1832
1833         /* for CarDock, DeskDock */
1834         ret = switch_dev_register(&switch_dock);
1835         if (ret < 0)
1836                 pr_err("Failed to register dock switch. %d\n", ret);
1837
1838         ret = switch_dev_register(&switch_usb);
1839         if (ret < 0)
1840                 pr_err("Failed to register switch-usb. %d\n", ret);
1841 }
1842
1843 static bool is_cable_attached;
1844
1845 static int q1_charger_cb(cable_type_t cable_type)
1846 {
1847         struct power_supply *psy = power_supply_get_by_name("smb328-charger");
1848         union power_supply_propval value;
1849         int ret = 0;
1850
1851         switch (cable_type) {
1852         case CABLE_TYPE_NONE:
1853         case CABLE_TYPE_OTG:
1854         case CABLE_TYPE_JIG_UART_OFF:
1855                 value.intval = POWER_SUPPLY_TYPE_BATTERY;
1856                 is_cable_attached = false;
1857                 break;
1858         case CABLE_TYPE_USB:
1859         case CABLE_TYPE_JIG_USB_OFF:
1860         case CABLE_TYPE_JIG_USB_ON:
1861                 value.intval = POWER_SUPPLY_TYPE_USB;
1862                 is_cable_attached = true;
1863                 break;
1864         case CABLE_TYPE_DESKDOCK:
1865         case CABLE_TYPE_CARDOCK:
1866                 value.intval = POWER_SUPPLY_TYPE_DOCK;
1867                 is_cable_attached = true;
1868                 break;
1869         case CABLE_TYPE_TA:
1870         case CABLE_TYPE_JIG_UART_OFF_VB:
1871                 value.intval = POWER_SUPPLY_TYPE_MAINS;
1872                 is_cable_attached = true;
1873                 break;
1874         default:
1875                 pr_err("%s: invalid type:%d\n", __func__, cable_type);
1876                 return -EINVAL;
1877         }
1878
1879         /* need to check for q1
1880          * if (charging_cbs.tsp_set_charging_cable)
1881          *      charging_cbs.tsp_set_charging_cable(value.intval);
1882          */
1883
1884         psy->set_property(psy, POWER_SUPPLY_PROP_ONLINE, &value);
1885
1886 #ifdef CONFIG_JACK_MON
1887         jack_event_handler("charger", is_cable_attached);
1888 #endif
1889
1890         return ret;
1891 }
1892
1893 static struct regulator *regulator_vbus_ap;
1894 static bool ap_enabled;
1895 static DEFINE_MUTEX(usb_ap_lock);
1896
1897 static int q1_charger_topoff_cb(void)
1898 {
1899         struct power_supply *psy = power_supply_get_by_name("battery");
1900         union power_supply_propval value;
1901
1902         if (!psy) {
1903                 pr_err("%s: fail to get battery ps\n", __func__);
1904                 return -ENODEV;
1905         }
1906
1907         value.intval = POWER_SUPPLY_STATUS_FULL;
1908         return psy->set_property(psy, POWER_SUPPLY_PROP_STATUS, &value);
1909 }
1910
1911 static void q1_usb_cb(u8 usb_mode)
1912 {
1913         int ret;
1914         struct s3c_udc *udc = platform_get_drvdata(&s3c_device_usbgadget);
1915         struct sec_otghost_data *otg_data =
1916                         dev_get_platdata(&s3c_device_usb_otghcd.dev);
1917
1918         unsigned long inform6 = __raw_readl(S5P_INFORM6);
1919
1920         pr_info("%s: usb mode=%d, inform6=0x%08lx\n",
1921                                 __func__, usb_mode, inform6);
1922
1923         if (inform6 & RST_FLAG_CHARGE_REBOOT_CHECK) {
1924                 pr_info("%s: lpcharging: disable USB\n", __func__);
1925                 ret = udc->change_usb_mode(USB_CABLE_DETACHED);
1926                 if (ret < 0)
1927                         pr_warn("%s: fail to change mode!!!\n", __func__);
1928
1929                 mutex_lock(&usb_ap_lock);
1930
1931                 if (regulator_vbus_ap == NULL)
1932                         regulator_vbus_ap =
1933                             regulator_get_exclusive(NULL, "usb_vbus_ap_5v");
1934                 if (IS_ERR_OR_NULL(regulator_vbus_ap)) {
1935                         pr_err("%s: fail to get regulator\n", __func__);
1936                         regulator_vbus_ap = NULL;
1937                         goto out;
1938                 }
1939
1940                 if (ap_enabled) {
1941                         ret = regulator_disable(regulator_vbus_ap);
1942                         if (ret)
1943                                 goto out;
1944                         ap_enabled = false;
1945                 }
1946 out:
1947                 mutex_unlock(&usb_ap_lock);
1948                 return;
1949         }
1950
1951         if (udc) {
1952                 if (usb_mode == USB_OTGHOST_ATTACHED) {
1953                         otg_data->set_pwr_cb(1);
1954                         q1_charger_cb(CABLE_TYPE_OTG);
1955                 }
1956
1957                 pr_info("%s: prev_usb_mode=%d\n",
1958                                 __func__, udc->get_usb_mode());
1959
1960                 ret = udc->change_usb_mode(usb_mode);
1961                 if (ret < 0)
1962                         pr_err("%s: fail to change mode!!!\n", __func__);
1963
1964                 if (usb_mode == USB_OTGHOST_DETACHED)
1965                         otg_data->set_pwr_cb(0);
1966
1967 #ifdef CONFIG_JACK_MON
1968                 if (usb_mode == USB_OTGHOST_ATTACHED)
1969                         jack_event_handler("host", USB_CABLE_ATTACHED);
1970                 else if (usb_mode == USB_OTGHOST_DETACHED)
1971                         jack_event_handler("host", USB_CABLE_DETACHED);
1972                 else if ((usb_mode == USB_CABLE_ATTACHED)
1973                                 || (usb_mode == USB_CABLE_DETACHED))
1974                         jack_event_handler("usb", usb_mode);
1975 #endif
1976         }
1977 }
1978
1979 static bool q1_is_mhl_attached(void)
1980 {
1981         int val;
1982         int gpio;
1983
1984         gpio = MOBILE_GPIO(MHL_SEL);
1985         gpio_request(gpio, "MHL_SEL");
1986         val = gpio_get_value(gpio);
1987         gpio_free(gpio);
1988
1989         return !!val;
1990 }
1991
1992 static int q1_set_safeout(int path)
1993 {
1994         static struct regulator *regulator_vbus_cp;
1995         static bool cp_enabled;
1996         int ret = 0;
1997
1998         mutex_lock(&usb_ap_lock);
1999
2000         if (regulator_vbus_ap == NULL)
2001                 regulator_vbus_ap =
2002                     regulator_get_exclusive(NULL, "usb_vbus_ap_5v");
2003         if (IS_ERR_OR_NULL(regulator_vbus_ap)) {
2004                 ret = -ENODEV;
2005                 regulator_vbus_ap = NULL;
2006                 goto out;
2007         }
2008
2009         if (regulator_vbus_cp == NULL)
2010                 regulator_vbus_cp =
2011                     regulator_get_exclusive(NULL, "usb_vbus_cp_5v");
2012         if (IS_ERR_OR_NULL(regulator_vbus_cp)) {
2013                 ret = -ENODEV;
2014                 regulator_vbus_cp = NULL;
2015                 goto out;
2016         }
2017
2018         if (path == CP_USB_MODE) {
2019                 if (ap_enabled) {
2020                         ret = regulator_disable(regulator_vbus_ap);
2021                         if (ret)
2022                                 goto out;
2023                         ap_enabled = false;
2024                 }
2025
2026                 if (!cp_enabled) {
2027                         /* regulator_vbus_cp is exclusively got */
2028                         if (!regulator_is_enabled(regulator_vbus_cp))
2029                                 ret = regulator_enable(regulator_vbus_cp);
2030                         if (ret)
2031                                 goto out;
2032                         cp_enabled = true;
2033                 }
2034         } else {
2035                 /* AP_USB_MODE || AUDIO_MODE */
2036                 if (!ap_enabled) {
2037                         /* regulator_vbus_ap is exclusively got */
2038                         if (!regulator_is_enabled(regulator_vbus_ap))
2039                                 ret = regulator_enable(regulator_vbus_ap);
2040                         if (ret)
2041                                 goto out;
2042                         ap_enabled = true;
2043                 }
2044
2045                 if (cp_enabled) {
2046                         ret = regulator_disable(regulator_vbus_cp);
2047                         if (ret)
2048                                 goto out;
2049                         cp_enabled = false;
2050                 }
2051         }
2052 out:
2053         mutex_unlock(&usb_ap_lock);
2054         return ret;
2055 }
2056 struct max8997_muic_platform_data q1_muic_pdata = {
2057         .usb_cb = q1_usb_cb,    /* done */
2058         .charger_cb = q1_charger_cb,
2059         .is_mhl_attached = q1_is_mhl_attached, /* done */
2060         .set_safeout = q1_set_safeout, /* done */
2061         .host_notify_cb = q1_host_notify_cb, /* done */
2062         .gpio_usb_sel = S5PV310_GPL0(6),        /* done */
2063         .uart_path = -1,        /* muic does not control uart path*/
2064 };
2065
2066 #ifdef CONFIG_CHARGER_MANAGER
2067 extern struct platform_device q1_charger_manager;
2068 extern struct platform_device q1_ncp15wb473_thermistor;
2069 extern struct charger_global_desc q1_charger_g_desc;
2070 #endif
2071
2072 #ifdef CONFIG_SMB328_CHARGER
2073 #define GPIO_CHG_SDA    S5PV310_GPY0(4)
2074 #define GPIO_CHG_SCL    S5PV310_GPY0(5)
2075 #define GPIO_CHG_EN     S5PV310_GPL2(2)
2076 #define GPIO_OTG_EN     S5PV310_GPX3(3)
2077 #define GPIO_CHG_ING_N  S5PV310_GPL2(5)
2078
2079 static struct regulator_consumer_supply supplies_smb328[] = {
2080         REGULATOR_SUPPLY("vinchg2", "charger-manager.0"),
2081         REGULATOR_SUPPLY("vinchg2_mach", NULL),
2082 };
2083
2084 static struct regulator_init_data smb328_charger_en_data = {
2085         .constraints = {
2086                 .name           = "SMB328_CHARGER",
2087                 .min_uA = 395000,
2088                 .max_uA = 650000,
2089                 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
2090                                 REGULATOR_CHANGE_CURRENT,
2091         },
2092         .num_consumer_supplies = ARRAY_SIZE(supplies_smb328),
2093         .consumer_supplies = supplies_smb328,
2094 };
2095
2096 static struct smb328_platform_data smb328_pdata = {
2097         .topoff_cb = q1_charger_topoff_cb,
2098         .gpio_chg_ing = GPIO_CHG_ING_N,
2099         .gpio_ta_nconnected = NULL,     /*GPIO_TA_nCONNECTED,*/
2100         .init_data = &smb328_charger_en_data,
2101 };
2102
2103 static struct platform_device smb328_device_charger = {
2104         .name = "smb328-charger",
2105         .id = 0,
2106         .dev.platform_data = &smb328_pdata,
2107 };
2108
2109 static struct i2c_gpio_platform_data gpio_i2c_data19 = {
2110         .sda_pin = GPIO_CHG_SDA,
2111         .scl_pin = GPIO_CHG_SCL,
2112 };
2113
2114 static struct platform_device s3c_device_i2c19 = {
2115         .name = "i2c-gpio",
2116         .id = 19,
2117         .dev.platform_data = &gpio_i2c_data19,
2118 };
2119
2120 static struct i2c_board_info i2c_devs19_emul[] __initdata = {
2121         {
2122                 I2C_BOARD_INFO("smb328-charger", SMB328_SLAVE_ADDR>>1),
2123                 .platform_data  = &smb328_pdata,
2124         },
2125 };
2126 #endif /* CONFIG_SMB328_CHARGER */
2127
2128 static struct platform_device *q1_devices[] __initdata = {
2129         /* Samsung Platform Devices */
2130 #ifdef CONFIG_S5PV310_DEV_PD
2131         &s5pv310_device_pd[PD_MFC],
2132         &s5pv310_device_pd[PD_G3D],
2133         &s5pv310_device_pd[PD_LCD0],
2134         &s5pv310_device_pd[PD_LCD1],
2135         &s5pv310_device_pd[PD_TV],
2136         &s5pv310_device_pd[PD_CAM],
2137         &s5pv310_device_pd[PD_GPS],
2138 #endif
2139 #ifdef CONFIG_DRM_MALI
2140         &s5p_device_mali_drm,
2141 #endif
2142 #ifdef CONFIG_DRM_FIMD
2143         &s5p_device_fimd_drm,
2144 #endif
2145         &s3c_device_i2c0,
2146         &s3c_device_i2c1,
2147         &s3c_device_i2c3,
2148         &s3c_device_i2c4,
2149         &s3c_device_i2c5,
2150         &s3c_device_i2c6,
2151         &s3c_device_i2c7,
2152 #if defined(CONFIG_SMB328_CHARGER)
2153         &s3c_device_i2c19,
2154 #endif
2155         &i2c9_gpio,
2156         &i2c12_gpio,
2157         &i2c14_gpio,
2158         &i2c17_gpio,
2159
2160         &s3c_device_timer[0],
2161         &s3c_device_timer[1],
2162         &s5p_device_usb_ehci,
2163         &q1_xmm6260,
2164         &q1_modem_net,
2165         &s3c_device_rtc,
2166         &s3c_device_adc,
2167 #ifdef CONFIG_SMB328_CHARGER
2168         &smb328_device_charger,
2169 #endif
2170         &camera_fixed_reg_dev[0],
2171         &camera_fixed_reg_dev[1],
2172         &camera_fixed_reg_dev[2],
2173         &camera_fixed_reg_dev[3],
2174 #ifdef CONFIG_VIDEO_FIMC_MIPI
2175         &s3c_device_csis0,
2176         &s3c_device_csis1,
2177 #endif
2178 #ifdef CONFIG_VIDEO_FIMC
2179         &s3c_device_fimc0,
2180         &s3c_device_fimc1,
2181         &s3c_device_fimc2,
2182         &s3c_device_fimc3,
2183 #endif
2184 #ifdef CONFIG_VIDEO_JPEG
2185         &s5p_device_jpeg,
2186 #endif
2187
2188 #ifdef CONFIG_S3C_DEV_HSMMC4
2189         &s3c_device_hsmmc4,
2190 #else
2191         &s3c_device_hsmmc0,
2192 #endif
2193         &emmc_fixed_voltage,
2194         &haptic_inmotor_fixed_voltage,
2195         &s3c_device_hsmmc2,
2196         &s3c_device_hsmmc3,
2197 #ifdef CONFIG_SND_S3C64XX_SOC_I2S_V4
2198         &s5pv310_device_iis0,
2199 #endif
2200 #ifdef CONFIG_SND_S3C_SOC_PCM
2201         &s5pv310_device_pcm1,
2202 #endif
2203 #ifdef CONFIG_SND_SOC_SMDK_WM9713
2204         &s5pv310_device_ac97,
2205 #endif
2206 #ifdef CONFIG_SND_SAMSUNG_SOC_SPDIF
2207         &s5pv310_device_spdif,
2208 #endif
2209 #ifdef CONFIG_SND_S5P_RP
2210         &s5pv310_device_rp,
2211 #endif
2212         &q1_jack,
2213         &q1_tzpc,
2214         &s5pv310_bcm4330,
2215         &q1_gpio_keys,
2216         &q1_ramoops,
2217
2218 #ifdef CONFIG_FB_S3C
2219         &s3c_device_fb,
2220 #endif
2221 #ifdef CONFIG_VIDEO_FIMG2D
2222         &s5p_device_fimg2d,
2223 #endif
2224 #if defined(CONFIG_VIDEO_MFC5X) || defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
2225         &s5p_device_mfc,
2226 #endif
2227 #ifdef CONFIG_S5P_SYSMMU
2228         &s5p_device_sysmmu[SYSMMU_G2D],
2229         &s5p_device_sysmmu[SYSMMU_MFC_L],
2230         &s5p_device_sysmmu[SYSMMU_MFC_R],
2231         &s5p_device_sysmmu[SYSMMU_FIMC0],
2232         &s5p_device_sysmmu[SYSMMU_FIMC1],
2233         &s5p_device_sysmmu[SYSMMU_FIMC2],
2234         &s5p_device_sysmmu[SYSMMU_FIMC3],
2235 #endif
2236 #ifdef CONFIG_ANDROID_RAM_CONSOLE
2237         &ram_console_device,
2238 #endif
2239 #ifdef CONFIG_CHARGER_MANAGER
2240         /* Should be placed after fuel gauge, charger control chips, pmics */
2241         &q1_ncp15wb473_thermistor,
2242         &q1_charger_manager,
2243 #endif
2244 #ifdef CONFIG_SEC_DEBUG
2245         &s3c_device_getlog,
2246 #endif
2247 #ifdef CONFIG_USB_GADGET
2248         &s3c_device_usbgadget,
2249 #endif
2250 #ifdef CONFIG_USB_ANDROID_RNDIS
2251         &s3c_device_rndis,
2252 #endif
2253 #ifdef CONFIG_USB_ANDROID_ECM
2254         &s3c_device_ecm,
2255 #endif
2256 #ifdef CONFIG_USB_ANDROID
2257         &s3c_device_android_usb,
2258         &s3c_device_usb_mass_storage,
2259 #endif
2260 #ifdef CONFIG_USB_S3C_OTG_HOST
2261         &s3c_device_usb_otghcd,
2262 #endif
2263 };
2264
2265 #ifdef CONFIG_EPEN_WACOM_G5SP
2266 static int q1_wacom_init_hw(void)
2267 {
2268         int gpio;
2269         int ret;
2270
2271         gpio = S5PV310_GPE0(2); /*XMDMRN*/
2272         ret = gpio_request(gpio, "PEN_RESET");
2273         s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);
2274         gpio_direction_output(gpio, 1);
2275
2276         gpio = S5PV310_GPE1(7); /*XMDMADDR_7*/
2277         ret = gpio_request(gpio, "PEN_SLP");
2278         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0x1));
2279         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
2280         gpio_direction_output(gpio, 0);
2281
2282         gpio = S5PV310_GPE1(6); /*XMDMADDR_6*/
2283         ret = gpio_request(gpio, "PEN_PDCT");
2284         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
2285         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
2286         gpio_direction_input(gpio);
2287
2288         set_irq_type(gpio_to_irq(gpio), IRQ_TYPE_EDGE_BOTH);
2289
2290         gpio = S5PV310_GPE0(0); /*XMDMWEN*/
2291         ret = gpio_request(gpio, "PEN_IRQ");
2292         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2293         gpio_direction_input(gpio);
2294
2295         i2c6_devs[1].irq = gpio_to_irq(gpio);
2296         set_irq_type(i2c6_devs[1].irq, IRQ_TYPE_EDGE_RISING);
2297
2298         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
2299
2300         return 0;
2301 }
2302
2303 static int __init q1_wacom_init(void)
2304 {
2305         q1_wacom_init_hw();
2306         printk(KERN_INFO "[E-PEN] : wacom IC initialized.\n");
2307         return 0;
2308 }
2309 #endif
2310
2311 static void __init q1_machine_init(void)
2312 {
2313         int gpio;
2314
2315         /* Initialize GPIO default setting */
2316         mobile_gpios_init();
2317
2318         q1_switch_dev_init();
2319
2320         s3c_i2c0_set_platdata(&q1_i2c0_platdata);
2321
2322         s3c_i2c1_set_platdata(NULL);
2323         i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
2324
2325         q1_tsp_init();
2326         s3c_i2c3_set_platdata(NULL);
2327         i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
2328
2329
2330 #ifdef CONFIG_S5PV310_DEV_PD
2331 #ifdef CONFIG_FB_S3C
2332         s3c_device_fb.dev.parent = &s5pv310_device_pd[PD_LCD0].dev;
2333         powerdomain_boot_on(PD_LCD0);
2334 #endif
2335 #endif
2336         q1_radio_init();
2337         s3c_i2c4_set_platdata(NULL);
2338         i2c_register_board_info(4, i2c4_devs, ARRAY_SIZE(i2c4_devs));
2339
2340         q1_fb_init();
2341
2342         q1_common_setup_clock("sclk_mdnie0", "mout_mpll", 400 * MHZ, 1);
2343
2344 #ifdef CONFIG_S5PV310_DEV_PD
2345 #if defined(CONFIG_VIDEO_MFC5X) || defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
2346         s5p_device_mfc.dev.parent = &s5pv310_device_pd[PD_MFC].dev;
2347         q1_common_setup_clock("mout_mfc0", "mout_mpll", 0, 0);
2348         q1_common_setup_clock("sclk_mfc", "mout_mfc0", 200 * MHZ, 1);
2349 #endif
2350 #endif
2351         q1_pmic_init();
2352         s3c_i2c5_set_platdata(NULL);
2353         i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(S5PV310_GPX0(7)),
2354         i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
2355
2356         q1_sound_init();
2357 #ifdef CONFIG_EPEN_WACOM_G5SP
2358         q1_wacom_init();
2359 #endif
2360         s3c_i2c6_set_platdata(NULL);
2361         i2c_register_board_info(6, i2c6_devs, ARRAY_SIZE(i2c6_devs));
2362
2363         q1_sensor_init();
2364         s3c_i2c7_set_platdata(NULL);
2365         i2c_register_board_info(7, i2c7_devs, ARRAY_SIZE(i2c7_devs));
2366
2367         gpio = S5PV310_GPX2(3);
2368         gpio_request(gpio, "FUEL_ALERT");
2369         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
2370         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2371         i2c9_devs[0].irq = gpio_to_irq(gpio);
2372         i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
2373
2374         gpio = S5PV310_GPL0(5);                 /* XGNSS_MCLK */
2375         gpio_request(gpio, "3_TOUCH_INT");
2376         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
2377         i2c12_devs[0].irq = gpio_to_irq(gpio);
2378         i2c_register_board_info(12, i2c12_devs, ARRAY_SIZE(i2c12_devs));
2379
2380         s5pv310_sdhci_init();
2381
2382         q1_usb_ehci_init();
2383         q1_modem_init();
2384
2385         q1_usb_otg_init();
2386         s3c_usb_set_serial();
2387
2388 #if defined(CONFIG_SMB328_CHARGER)
2389         i2c_register_board_info(19, i2c_devs19_emul, ARRAY_SIZE(i2c_devs19_emul));
2390 #endif
2391
2392 #ifdef CONFIG_VIDEO_FIMG2D
2393         s5p_fimg2d_set_platdata(&fimg2d_data);
2394 #ifdef CONFIG_S5PV310_DEV_PD
2395         s5p_device_fimg2d.dev.parent = &s5pv310_device_pd[PD_LCD0].dev;
2396 #endif
2397 #endif
2398
2399 #ifdef CONFIG_PM
2400         pm_cpu_prepare = q1_pm_prepare;
2401         pm_cpu_finish = q1_pm_finish;
2402
2403         s3c_pm_init();
2404         s3c_irq_wake(IRQ_RTC_ALARM, 1);
2405 #endif
2406
2407 #if defined(CONFIG_S5PV310_DEV_PD) && !defined(CONFIG_PM_RUNTIME)
2408         /*
2409          * These power domains should be always on
2410          * without runtime pm support.
2411          */
2412         s5pv310_pd_enable(&s5pv310_device_pd[PD_MFC].dev);
2413         s5pv310_pd_enable(&s5pv310_device_pd[PD_G3D].dev);
2414         s5pv310_pd_enable(&s5pv310_device_pd[PD_LCD0].dev);
2415         s5pv310_pd_enable(&s5pv310_device_pd[PD_LCD1].dev);
2416         s5pv310_pd_enable(&s5pv310_device_pd[PD_CAM].dev);
2417         s5pv310_pd_enable(&s5pv310_device_pd[PD_TV].dev);
2418         s5pv310_pd_enable(&s5pv310_device_pd[PD_GPS].dev);
2419 #endif
2420
2421 #ifdef CONFIG_VIDEO_FIMG2D
2422         /* setup fimg2d parent clock. */
2423         universal_fimg2d_setup_clock("mout_g2d0", "mout_mpll");
2424 #endif
2425
2426 #ifdef CONFIG_S5P_ADC
2427         q1_adc_init();
2428 #endif
2429
2430 #ifdef CONFIG_VIDEO_JPEG
2431 #ifdef CONFIG_S5PV310_DEV_PD
2432         s5p_device_jpeg.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
2433 #endif
2434 #endif
2435
2436 #ifdef CONFIG_CHARGER_MANAGER
2437         setup_charger_manager(&q1_charger_g_desc);
2438 #endif
2439
2440         s5pv310_camera_init();
2441
2442         /* Last */
2443         platform_add_devices(q1_devices, ARRAY_SIZE(q1_devices));
2444 }
2445
2446 MACHINE_START(Q1_C210, "Q1SLP_C210")
2447         /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
2448         .phys_io        = S3C_PA_UART & 0xfff00000,
2449         .io_pg_offst    = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
2450         .boot_params    = S5P_PA_SDRAM + 0x100,
2451         .init_irq       = s5pv310_init_irq,
2452         .map_io         = q1_map_io,
2453         .init_machine   = q1_machine_init,
2454         .timer          = &s5pv310_timer,
2455         .reserve        = &s5pv310_reserve,
2456 MACHINE_END