2 * linux/arch/arm/mach-s5pv310/max8997-p8.c
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * MAX8997 Setting for U1 Board
14 #include <linux/mfd/max8997.h>
15 #include <linux/regulator/machine.h>
17 #include <mach/gpio.h>
18 #include <mach/irqs.h>
20 #include <plat/gpio-cfg.h>
22 void __init p8_pmic_init(void)
26 /* TODO: SET1, SET2, SET3, AP_PMIC_IRQ< ... */
27 gpio = S5PV310_GPX0(7);
28 gpio_request(gpio, "AP_PMIC_IRQ");
29 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
30 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
33 static struct regulator_consumer_supply p8_max8997_ldo1_consumer[] = {
34 REGULATOR_SUPPLY("vadc", NULL),
35 REGULATOR_SUPPLY("vadc", "s5p-charger"),
37 static struct regulator_consumer_supply p8_max8997_ldo2_consumer[] = {
38 REGULATOR_SUPPLY("vdd_alive", "s5pc210"), /* FIXME: device name */
40 static struct regulator_consumer_supply p8_max8997_ldo3_consumer[] = {
41 REGULATOR_SUPPLY("vusb_a", NULL), /* TODO: DEV NAME? */
42 REGULATOR_SUPPLY("mipi_1.1v_c210", "s5p-mipi-dsim.0"), /* obsolete */
43 REGULATOR_SUPPLY("vdd11_mipi", "s3c-csis.0"),
44 REGULATOR_SUPPLY("vdd11_mipi", "s3c-csis.1"),
46 static struct regulator_consumer_supply p8_max8997_ldo4_consumer[] = {
47 REGULATOR_SUPPLY("vmipi_1.8v", "s5p-mipi-dsim.0"), /* obsolete */
48 REGULATOR_SUPPLY("vdd18_mipi", "s3c-csis.0"),
49 REGULATOR_SUPPLY("vdd18_mipi", "s3c-csis.1"),
51 static struct regulator_consumer_supply p8_max8997_ldo5_consumer[] = {
52 REGULATOR_SUPPLY("vhsic", NULL), /* obsolete? 8*/
53 REGULATOR_SUPPLY("vdd12_uhost", "s5pc210"), /* FIXME: device name */
55 static struct regulator_consumer_supply p8_max8997_ldo6_consumer[] = {
56 REGULATOR_SUPPLY("vcc_1.8v", "ld9040"),
57 REGULATOR_SUPPLY("v_gps_1.8v", "gsd4t"),
59 static struct regulator_consumer_supply p8_max8997_ldo7_consumer[] = {
60 REGULATOR_SUPPLY("dig_18", "0-001f"),
61 REGULATOR_SUPPLY("dig_vt_18", "17-002d"),
63 static struct regulator_consumer_supply p8_max8997_ldo8_consumer[] = {
64 REGULATOR_SUPPLY("vusb_d", NULL), /* TODO: DEV NAME? */
65 REGULATOR_SUPPLY("vdac", NULL), /* TODO: DEV NAME? */
67 static struct regulator_consumer_supply p8_max8997_ldo9_consumer[] = {
68 REGULATOR_SUPPLY("vcc_2.8v_pda", NULL), /* FIXME: update name */
70 static struct regulator_consumer_supply p8_max8997_ldo10_consumer[] = {
71 REGULATOR_SUPPLY("vpll", NULL), /* obsolete? */
72 REGULATOR_SUPPLY("vdd11_pll", "s5pc210"), /* FIXME: device name */
74 static struct regulator_consumer_supply p8_max8997_ldo11_consumer[] = {
75 REGULATOR_SUPPLY("touch_2.8v", NULL),
77 static struct regulator_consumer_supply p8_max8997_ldo12_consumer[] = {
78 REGULATOR_SUPPLY("vt_cam_18", "17-002d"), /* TODO: double check the name */
80 static struct regulator_consumer_supply p8_max8997_ldo13_consumer[] = {
81 REGULATOR_SUPPLY("vcc_3.0v_lcd", "s6e8aa0"),
83 static struct regulator_consumer_supply p8_max8997_ldo14_consumer[] = {
84 REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
86 static struct regulator_consumer_supply p8_max8997_ldo15_consumer[] = {
87 REGULATOR_SUPPLY("vlcd_2.2v", "s6e8aa0"), /* FIXME: dev name of motor */
89 static struct regulator_consumer_supply p8_max8997_ldo16_consumer[] = {
90 REGULATOR_SUPPLY("d_sensor", "0-001f"),
92 static struct regulator_consumer_supply p8_max8997_ldo17_consumer[] = {
93 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
95 static struct regulator_consumer_supply p8_max8997_ldo18_consumer[] = {
96 REGULATOR_SUPPLY("touch_led_3.3v", NULL),
98 static struct regulator_consumer_supply p8_max8997_ldo21_consumer[] = {
99 /* "Memory I/O Power" */
102 static struct regulator_consumer_supply p8_max8997_buck1_consumer[] = {
103 REGULATOR_SUPPLY("vdd_arm", NULL),
105 static struct regulator_consumer_supply p8_max8997_buck2_consumer[] = {
106 REGULATOR_SUPPLY("vdd_int", NULL),
108 static struct regulator_consumer_supply p8_max8997_buck3_consumer[] = {
109 REGULATOR_SUPPLY("vg3d", "mali_dev.0"),
111 static struct regulator_consumer_supply p8_max8997_buck4_consumer[] = {
112 REGULATOR_SUPPLY("core", "0-001f"),
114 static struct regulator_consumer_supply p8_max8997_buck5_consumer[] = {
115 REGULATOR_SUPPLY("vdd_mem", NULL), /* LPDDR's Core Power */
117 static struct regulator_consumer_supply p8_max8997_buck6_consumer[] = {
118 REGULATOR_SUPPLY("dig_28", "0-001f"),
119 REGULATOR_SUPPLY("flash_en", "0-001f"), /* Actual SET/EN of FLASH */
120 REGULATOR_SUPPLY("flash_set", "0-001f"), /* Dummy of FLASH */
122 static struct regulator_consumer_supply p8_max8997_buck7_consumer[] = {
123 REGULATOR_SUPPLY("vcc_sub_2.0v", "0-003c"), /* TODO: double check the name */
126 static struct regulator_consumer_supply p8_max8997_esafeout1_consumer[] = {
127 REGULATOR_SUPPLY("usb_vbus_ap_5v", NULL), /* obsolete. FIXME name? */
129 static struct regulator_consumer_supply p8_max8997_esafeout2_consumer[] = {
130 REGULATOR_SUPPLY("usb_vbus_cp_5v", NULL), /* obsolete. FIXME name? */
132 #ifdef CONFIG_CHARGERCTRL_MAX8997
133 static struct regulator_consumer_supply p8_max8997_charger_consumer[] = {
134 REGULATOR_SUPPLY("vinchg1", "charger-manager.0"),
136 static struct regulator_consumer_supply p8_max8997_charger_topoff_consumer[] = {
137 REGULATOR_SUPPLY("vinchg_stop", NULL),
140 static struct regulator_consumer_supply p8_max8997_32khz_ap_consumer[] = {
141 REGULATOR_SUPPLY("gps_clk", "gsd4t"),
142 REGULATOR_SUPPLY("bt_clk", NULL),
143 REGULATOR_SUPPLY("wifi_clk", NULL),
145 static struct regulator_init_data p8_max8997_ldo1_data = {
147 .name = "VADC_3.3V_C210",
150 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
157 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo1_consumer),
158 .consumer_supplies = p8_max8997_ldo1_consumer,
161 static struct regulator_init_data p8_max8997_ldo2_data = {
163 .name = "VALIVE_1.1V_C210",
173 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo2_consumer),
174 .consumer_supplies = p8_max8997_ldo2_consumer,
177 static struct regulator_init_data p8_max8997_ldo3_data = {
179 .name = "VUSB/MIPI_1.1V_C210",
182 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
190 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo3_consumer),
191 .consumer_supplies = p8_max8997_ldo3_consumer,
194 static struct regulator_init_data p8_max8997_ldo4_data = {
196 .name = "VMIPI_1.8V",
199 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
207 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo4_consumer),
208 .consumer_supplies = p8_max8997_ldo4_consumer,
211 static struct regulator_init_data p8_max8997_ldo5_data = {
213 .name = "VHSIC_1.2V_C210",
216 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
223 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo5_consumer),
224 .consumer_supplies = p8_max8997_ldo5_consumer,
227 static struct regulator_init_data p8_max8997_ldo6_data = {
229 .name = "VCC_1.8V_PDA",
239 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo6_consumer),
240 .consumer_supplies = p8_max8997_ldo6_consumer,
243 static struct regulator_init_data p8_max8997_ldo7_data = {
245 .name = "CAM_ISP_1.8V",
248 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
255 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo7_consumer),
256 .consumer_supplies = p8_max8997_ldo7_consumer,
259 static struct regulator_init_data p8_max8997_ldo8_data = {
261 .name = "VUSB/VDAC_3.3V_C210",
264 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
271 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo8_consumer),
272 .consumer_supplies = p8_max8997_ldo8_consumer,
275 static struct regulator_init_data p8_max8997_ldo9_data = {
277 .name = "VCC_2.8V_PDA",
287 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo9_consumer),
288 .consumer_supplies = p8_max8997_ldo9_consumer,
291 static struct regulator_init_data p8_max8997_ldo10_data = {
293 .name = "VPLL_1.1V_C210",
303 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo10_consumer),
304 .consumer_supplies = p8_max8997_ldo10_consumer,
307 static struct regulator_init_data p8_max8997_ldo11_data = {
309 .name = "TOUCH_2.8V",
312 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
319 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo11_consumer),
320 .consumer_supplies = p8_max8997_ldo11_consumer,
323 static struct regulator_init_data p8_max8997_ldo12_data = {
325 .name = "VT_CAM_1.8V",
328 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
335 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo12_consumer),
336 .consumer_supplies = p8_max8997_ldo12_consumer,
339 static struct regulator_init_data p8_max8997_ldo13_data = {
341 .name = "VCC_3.0V_LCD",
344 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
352 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo13_consumer),
353 .consumer_supplies = p8_max8997_ldo13_consumer,
356 static struct regulator_init_data p8_max8997_ldo14_data = {
358 .name = "VCC_3.0V_MOTOR",
361 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
368 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo14_consumer),
369 .consumer_supplies = p8_max8997_ldo14_consumer,
372 static struct regulator_init_data p8_max8997_ldo15_data = {
379 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
385 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo15_consumer),
386 .consumer_supplies = p8_max8997_ldo15_consumer,
389 static struct regulator_init_data p8_max8997_ldo16_data = {
391 .name = "CAM_SENSOR_IO_1.8V",
394 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
401 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo16_consumer),
402 .consumer_supplies = p8_max8997_ldo16_consumer,
405 static struct regulator_init_data p8_max8997_ldo17_data = {
410 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
417 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo17_consumer),
418 .consumer_supplies = p8_max8997_ldo17_consumer,
421 static struct regulator_init_data p8_max8997_ldo18_data = {
423 .name = "TOUCH_LED_3.3V",
426 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
433 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo18_consumer),
434 .consumer_supplies = p8_max8997_ldo18_consumer,
437 static struct regulator_init_data p8_max8997_ldo21_data = {
439 .name = "VDDQ_M1M2_1.2V",
449 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_ldo21_consumer),
450 .consumer_supplies = p8_max8997_ldo21_consumer,
453 static struct regulator_init_data p8_max8997_buck1_data = {
455 .name = "VARM_1.2V_C210",
458 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
465 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_buck1_consumer),
466 .consumer_supplies = p8_max8997_buck1_consumer,
469 static struct regulator_init_data p8_max8997_buck2_data = {
471 .name = "VINT_1.1V_C210",
474 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
481 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_buck2_consumer),
482 .consumer_supplies = p8_max8997_buck2_consumer,
485 static struct regulator_init_data p8_max8997_buck3_data = {
487 .name = "VG3D_1.1V_C210",
490 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
491 REGULATOR_CHANGE_STATUS,
497 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_buck3_consumer),
498 .consumer_supplies = p8_max8997_buck3_consumer,
501 static struct regulator_init_data p8_max8997_buck4_data = {
503 .name = "CAM_ISP_CORE_1.2V",
507 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
513 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_buck4_consumer),
514 .consumer_supplies = p8_max8997_buck4_consumer,
517 static struct regulator_init_data p8_max8997_buck5_data = {
519 .name = "VMEM_1.2V_C210",
529 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_buck5_consumer),
530 .consumer_supplies = p8_max8997_buck5_consumer,
533 static struct regulator_init_data p8_max8997_buck6_data = {
539 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
545 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_buck6_consumer),
546 .consumer_supplies = p8_max8997_buck6_consumer,
549 static struct regulator_init_data p8_max8997_buck7_data = {
551 .name = "VCC_SUB_2.0V",
561 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_buck7_consumer),
562 .consumer_supplies = p8_max8997_buck7_consumer,
565 static struct regulator_init_data p8_max8997_32khz_ap_data = {
569 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
575 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_32khz_ap_consumer),
576 .consumer_supplies = p8_max8997_32khz_ap_consumer,
579 static struct regulator_init_data p8_max8997_32khz_cp_data = {
589 static struct regulator_init_data p8_max8997_vichg_data = {
599 static struct regulator_init_data p8_max8997_esafeout1_data = {
602 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
608 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_esafeout1_consumer),
609 .consumer_supplies = p8_max8997_esafeout1_consumer,
612 static struct regulator_init_data p8_max8997_esafeout2_data = {
615 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
621 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_esafeout2_consumer),
622 .consumer_supplies = p8_max8997_esafeout2_consumer,
625 #ifdef CONFIG_CHARGERCTRL_MAX8997
626 static struct regulator_init_data p8_max8997_charger_cv_data = {
628 .name = "CHARGER_CV",
635 static struct regulator_init_data p8_max8997_charger_data = {
641 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
642 REGULATOR_CHANGE_CURRENT,
644 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_charger_consumer),
645 .consumer_supplies = p8_max8997_charger_consumer,
648 static struct regulator_init_data p8_max8997_charger_topoff_data = {
650 .name = "CHARGER TOPOFF",
653 .valid_ops_mask = REGULATOR_CHANGE_CURRENT,
655 .num_consumer_supplies = ARRAY_SIZE(p8_max8997_charger_topoff_consumer),
656 .consumer_supplies = p8_max8997_charger_topoff_consumer,
660 static struct max8997_regulator_data p8_max8997_regulators[] = {
661 { MAX8997_LDO1, &p8_max8997_ldo1_data },
662 { MAX8997_LDO2, &p8_max8997_ldo2_data },
663 { MAX8997_LDO3, &p8_max8997_ldo3_data },
664 { MAX8997_LDO4, &p8_max8997_ldo4_data },
665 { MAX8997_LDO5, &p8_max8997_ldo5_data },
666 { MAX8997_LDO6, &p8_max8997_ldo6_data },
667 { MAX8997_LDO7, &p8_max8997_ldo7_data },
668 { MAX8997_LDO8, &p8_max8997_ldo8_data },
669 { MAX8997_LDO9, &p8_max8997_ldo9_data },
670 { MAX8997_LDO10, &p8_max8997_ldo10_data },
671 { MAX8997_LDO11, &p8_max8997_ldo11_data },
672 { MAX8997_LDO12, &p8_max8997_ldo12_data },
673 { MAX8997_LDO13, &p8_max8997_ldo13_data },
674 { MAX8997_LDO14, &p8_max8997_ldo14_data },
675 { MAX8997_LDO15, &p8_max8997_ldo15_data },
676 { MAX8997_LDO16, &p8_max8997_ldo16_data },
677 { MAX8997_LDO17, &p8_max8997_ldo17_data },
678 { MAX8997_LDO18, &p8_max8997_ldo18_data },
679 { MAX8997_LDO21, &p8_max8997_ldo21_data },
681 { MAX8997_BUCK1, &p8_max8997_buck1_data },
682 { MAX8997_BUCK2, &p8_max8997_buck2_data },
683 { MAX8997_BUCK3, &p8_max8997_buck3_data },
684 { MAX8997_BUCK4, &p8_max8997_buck4_data },
685 { MAX8997_BUCK5, &p8_max8997_buck5_data },
686 { MAX8997_BUCK6, &p8_max8997_buck6_data },
687 { MAX8997_BUCK7, &p8_max8997_buck7_data },
689 { MAX8997_EN32KHZ_AP, &p8_max8997_32khz_ap_data },
690 { MAX8997_EN32KHZ_CP, &p8_max8997_32khz_cp_data },
692 { MAX8997_ENVICHG, &p8_max8997_vichg_data },
693 { MAX8997_ESAFEOUT1, &p8_max8997_esafeout1_data },
694 { MAX8997_ESAFEOUT2, &p8_max8997_esafeout2_data },
695 #ifdef CONFIG_CHARGERCTRL_MAX8997
696 { MAX8997_CHARGER_CV, &p8_max8997_charger_cv_data },
697 { MAX8997_CHARGER, &p8_max8997_charger_data },
698 { MAX8997_CHARGER_TOPOFF, &p8_max8997_charger_topoff_data },
702 extern struct max8997_muic_platform_data p8_muic_pdata;
703 extern struct max8997_haptic_platform_data p8_haptic_pdata;
705 struct max8997_platform_data p8_max8997_pdata = {
706 .irq_base = IRQ_PMIC_BASE,
710 .num_regulators = ARRAY_SIZE(p8_max8997_regulators),
711 .regulators = p8_max8997_regulators,
713 .buck125_gpios = { S5PV310_GPX0(5), S5PV310_GPX0(6), S5PV310_GPL0(0) },
714 .buck125_default_idx = 0,
715 .buck1_gpiodvs = false,
716 .buck2_gpiodvs = false,
717 .buck5_gpiodvs = false,
719 .buck1_voltage[0] = 1350000, /* 1.35V */
720 .buck1_voltage[1] = 1300000, /* 1.3V */
721 .buck1_voltage[2] = 1250000, /* 1.25V */
722 .buck1_voltage[3] = 1200000, /* 1.2V */
723 .buck1_voltage[4] = 1150000, /* 1.15V */
724 .buck1_voltage[5] = 1100000, /* 1.1V */
725 .buck1_voltage[6] = 1000000, /* 1.0V */ /* No room for 1.05V */
726 .buck1_voltage[7] = 950000, /* 0.95V */
728 .buck2_voltage[0] = 1100000, /* 1.1V */
729 .buck2_voltage[1] = 1000000, /* 1.0V */
730 .buck2_voltage[2] = 950000, /* 0.95V */
731 .buck2_voltage[3] = 900000, /* 0.9V */
732 .buck2_voltage[4] = 1100000, /* 1.1V */
733 .buck2_voltage[5] = 1000000, /* 1.0V */
734 .buck2_voltage[6] = 950000, /* 0.95V */
735 .buck2_voltage[7] = 900000, /* 0.9V */
737 .buck5_voltage[0] = 1200000, /* 1.2V */
738 .buck5_voltage[1] = 1200000, /* 1.2V */
739 .buck5_voltage[2] = 1200000, /* 1.2V */
740 .buck5_voltage[3] = 1200000, /* 1.2V */
741 .buck5_voltage[4] = 1200000, /* 1.2V */
742 .buck5_voltage[5] = 1200000, /* 1.2V */
743 .buck5_voltage[6] = 1200000, /* 1.2V */
744 .buck5_voltage[7] = 1200000, /* 1.2V */
748 .eoc_ratio = 0, /* TODO: change after ratio is implemented */
749 .vichg_adc_get_uV = NULL, /* TODO: Need to fill this in */
753 .haptic_pdata = &p8_haptic_pdata,
756 .muic_pdata = &p8_muic_pdata,
762 .flash_cntl_val = 0x53, /* Flash safety timer duration: 800msec,
763 Maximum timer mode */