blob: 208f15b2017b0fd3eaecc5ec51562bdf0fbd708c [file] [log] [blame]
David Collins1d4061b2011-12-06 15:36:40 -08001/*
David Collinsb4558422012-01-05 10:50:49 -08002 * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
David Collins1d4061b2011-12-06 15:36:40 -08003 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
David Collins4614cb92012-08-20 12:17:09 -070014/*
15 * This file contains regulator configuration and mappings for targets
16 * consisting of MSM8930 and PM8038.
17 */
18
David Collins1d4061b2011-12-06 15:36:40 -080019#include <linux/regulator/pm8xxx-regulator.h>
20
21#include "board-8930.h"
22
23#define VREG_CONSUMERS(_id) \
24 static struct regulator_consumer_supply vreg_consumers_##_id[]
25
26/*
27 * Consumer specific regulator names:
28 * regulator name consumer dev_name
29 */
30VREG_CONSUMERS(L1) = {
31 REGULATOR_SUPPLY("8038_l1", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080032 REGULATOR_SUPPLY("iris_vddrfa", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080033};
34VREG_CONSUMERS(L2) = {
35 REGULATOR_SUPPLY("8038_l2", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080036 REGULATOR_SUPPLY("iris_vdddig", "wcnss_wlan.0"),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -080037 REGULATOR_SUPPLY("dsi_vdda", "mipi_dsi.1"),
Ravishangar Kalyanamad320022012-07-23 18:26:09 -070038 REGULATOR_SUPPLY("dsi_pll_vdda", "mdp.0"),
Kevin Chan330e4d52012-02-18 23:11:24 -080039 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_csid.0"),
40 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_csid.1"),
41 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_csid.2"),
David Collins1d4061b2011-12-06 15:36:40 -080042};
43VREG_CONSUMERS(L3) = {
44 REGULATOR_SUPPLY("8038_l3", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +053045 REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -080046};
47VREG_CONSUMERS(L4) = {
48 REGULATOR_SUPPLY("8038_l4", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +053049 REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080050 REGULATOR_SUPPLY("iris_vddxo", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080051};
52VREG_CONSUMERS(L5) = {
53 REGULATOR_SUPPLY("8038_l5", NULL),
Krishna Konda40ec7e92011-12-20 19:28:25 -080054 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.1"),
David Collins1d4061b2011-12-06 15:36:40 -080055};
56VREG_CONSUMERS(L6) = {
57 REGULATOR_SUPPLY("8038_l6", NULL),
Krishna Konda40ec7e92011-12-20 19:28:25 -080058 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.3"),
David Collins1d4061b2011-12-06 15:36:40 -080059};
60VREG_CONSUMERS(L7) = {
61 REGULATOR_SUPPLY("8038_l7", NULL),
62};
63VREG_CONSUMERS(L8) = {
64 REGULATOR_SUPPLY("8038_l8", NULL),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -080065 REGULATOR_SUPPLY("dsi_vdc", "mipi_dsi.1"),
David Collins1d4061b2011-12-06 15:36:40 -080066};
67VREG_CONSUMERS(L9) = {
68 REGULATOR_SUPPLY("8038_l9", NULL),
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +053069 REGULATOR_SUPPLY("vdd_ana", "3-004a"),
Amy Maloche32a36c32012-01-11 10:39:11 -080070 REGULATOR_SUPPLY("vdd", "3-0024"),
Kevin Chan6776a372012-01-12 14:18:53 -080071 REGULATOR_SUPPLY("cam_vana", "4-001a"),
72 REGULATOR_SUPPLY("cam_vana", "4-006c"),
73 REGULATOR_SUPPLY("cam_vana", "4-0048"),
74 REGULATOR_SUPPLY("cam_vaf", "4-001a"),
75 REGULATOR_SUPPLY("cam_vaf", "4-006c"),
76 REGULATOR_SUPPLY("cam_vaf", "4-0048"),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -080077 REGULATOR_SUPPLY("cam_vana", "4-0020"),
78 REGULATOR_SUPPLY("cam_vaf", "4-0020"),
Wentao Xuf59ce4e2012-05-22 17:30:13 -040079 REGULATOR_SUPPLY("vdd", "12-0018"),
80 REGULATOR_SUPPLY("vdd", "12-0068"),
David Collins1d4061b2011-12-06 15:36:40 -080081};
82VREG_CONSUMERS(L10) = {
83 REGULATOR_SUPPLY("8038_l10", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080084 REGULATOR_SUPPLY("iris_vddpa", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080085};
86VREG_CONSUMERS(L11) = {
87 REGULATOR_SUPPLY("8038_l11", NULL),
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +053088 REGULATOR_SUPPLY("vdd_dig", "3-004a"),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080089 REGULATOR_SUPPLY("iris_vddio", "wcnss_wlan.0"),
90 REGULATOR_SUPPLY("riva_vddpx", "wcnss_wlan.0"),
Subhash Jadavani937c7502012-06-01 15:34:46 +053091 REGULATOR_SUPPLY("sdc_vdd_io", "msm_sdcc.1"),
Asish Bhattacharyacdaa99d2012-01-10 06:05:00 +053092 REGULATOR_SUPPLY("VDDIO_CDC", "sitar-slim"),
93 REGULATOR_SUPPLY("CDC_VDDA_TX", "sitar-slim"),
94 REGULATOR_SUPPLY("CDC_VDDA_RX", "sitar-slim"),
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -070095 REGULATOR_SUPPLY("VDDIO_CDC", "sitar1p1-slim"),
96 REGULATOR_SUPPLY("CDC_VDDA_TX", "sitar1p1-slim"),
97 REGULATOR_SUPPLY("CDC_VDDA_RX", "sitar1p1-slim"),
Amy Malochee8de95d2012-02-23 10:40:25 -080098 REGULATOR_SUPPLY("vddp", "0-0048"),
Manoj Raoc6d904c2012-06-22 00:32:14 -070099 REGULATOR_SUPPLY("mhl_iovcc18", "0-0039"),
David Collins1d4061b2011-12-06 15:36:40 -0800100};
101VREG_CONSUMERS(L12) = {
102 REGULATOR_SUPPLY("8038_l12", NULL),
Kevin Chan6776a372012-01-12 14:18:53 -0800103 REGULATOR_SUPPLY("cam_vdig", "4-001a"),
104 REGULATOR_SUPPLY("cam_vdig", "4-006c"),
105 REGULATOR_SUPPLY("cam_vdig", "4-0048"),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800106 REGULATOR_SUPPLY("cam_vdig", "4-0020"),
David Collins1d4061b2011-12-06 15:36:40 -0800107};
David Collins652b3442012-08-09 14:47:51 -0700108VREG_CONSUMERS(L13) = {
109 REGULATOR_SUPPLY("8038_l13", NULL),
110};
David Collins1d4061b2011-12-06 15:36:40 -0800111VREG_CONSUMERS(L14) = {
112 REGULATOR_SUPPLY("8038_l14", NULL),
Siddartha Mohanadoss6a392d32012-01-12 11:30:58 -0800113 REGULATOR_SUPPLY("pa_therm", "pm8xxx-adc"),
David Collins1d4061b2011-12-06 15:36:40 -0800114};
115VREG_CONSUMERS(L15) = {
116 REGULATOR_SUPPLY("8038_l15", NULL),
117};
118VREG_CONSUMERS(L16) = {
119 REGULATOR_SUPPLY("8038_l16", NULL),
Stephen Boyd868d8992012-01-06 14:11:02 -0800120 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.2"),
David Collins1d4061b2011-12-06 15:36:40 -0800121};
122VREG_CONSUMERS(L17) = {
123 REGULATOR_SUPPLY("8038_l17", NULL),
124};
125VREG_CONSUMERS(L18) = {
126 REGULATOR_SUPPLY("8038_l18", NULL),
127};
128VREG_CONSUMERS(L19) = {
129 REGULATOR_SUPPLY("8038_l19", NULL),
Stephen Boyd868d8992012-01-06 14:11:02 -0800130 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.1"),
David Collins1d4061b2011-12-06 15:36:40 -0800131};
132VREG_CONSUMERS(L20) = {
133 REGULATOR_SUPPLY("8038_l20", NULL),
Asish Bhattacharyacdaa99d2012-01-10 06:05:00 +0530134 REGULATOR_SUPPLY("VDDD_CDC_D", "sitar-slim"),
135 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "sitar-slim"),
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700136 REGULATOR_SUPPLY("VDDD_CDC_D", "sitar1p1-slim"),
137 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "sitar1p1-slim"),
Manoj Raoc6d904c2012-06-22 00:32:14 -0700138 REGULATOR_SUPPLY("mhl_avcc12", "0-0039"),
David Collins1d4061b2011-12-06 15:36:40 -0800139};
140VREG_CONSUMERS(L21) = {
141 REGULATOR_SUPPLY("8038_l21", NULL),
142};
143VREG_CONSUMERS(L22) = {
144 REGULATOR_SUPPLY("8038_l22", NULL),
Subhash Jadavani937c7502012-06-01 15:34:46 +0530145 REGULATOR_SUPPLY("sdc_vdd_io", "msm_sdcc.3"),
David Collins1d4061b2011-12-06 15:36:40 -0800146};
147VREG_CONSUMERS(L23) = {
148 REGULATOR_SUPPLY("8038_l23", NULL),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -0800149 REGULATOR_SUPPLY("dsi_vddio", "mipi_dsi.1"),
Ravishangar Kalyanamad320022012-07-23 18:26:09 -0700150 REGULATOR_SUPPLY("dsi_pll_vddio", "mdp.0"),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -0800151 REGULATOR_SUPPLY("hdmi_avdd", "hdmi_msm.0"),
152 REGULATOR_SUPPLY("hdmi_vcc", "hdmi_msm.0"),
Stephen Boyd3bbdf6c2011-12-21 16:02:26 -0800153 REGULATOR_SUPPLY("pll_vdd", "pil_riva"),
Stephen Boydcc0f5342011-12-29 17:28:57 -0800154 REGULATOR_SUPPLY("pll_vdd", "pil_qdsp6v4.1"),
155 REGULATOR_SUPPLY("pll_vdd", "pil_qdsp6v4.2"),
David Collins1d4061b2011-12-06 15:36:40 -0800156};
157VREG_CONSUMERS(L24) = {
158 REGULATOR_SUPPLY("8038_l24", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -0800159 REGULATOR_SUPPLY("riva_vddmx", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -0800160};
David Collins652b3442012-08-09 14:47:51 -0700161VREG_CONSUMERS(L25) = {
162 REGULATOR_SUPPLY("8038_l25", NULL),
163};
David Collins1d4061b2011-12-06 15:36:40 -0800164VREG_CONSUMERS(L26) = {
165 REGULATOR_SUPPLY("8038_l26", NULL),
166};
167VREG_CONSUMERS(L27) = {
168 REGULATOR_SUPPLY("8038_l27", NULL),
Stephen Boyd868d8992012-01-06 14:11:02 -0800169 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.0"),
David Collins1d4061b2011-12-06 15:36:40 -0800170};
171VREG_CONSUMERS(S1) = {
172 REGULATOR_SUPPLY("8038_s1", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -0800173 REGULATOR_SUPPLY("riva_vddcx", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -0800174};
175VREG_CONSUMERS(S2) = {
176 REGULATOR_SUPPLY("8038_s2", NULL),
177};
178VREG_CONSUMERS(S3) = {
179 REGULATOR_SUPPLY("8038_s3", NULL),
180};
181VREG_CONSUMERS(S4) = {
182 REGULATOR_SUPPLY("8038_s4", NULL),
Asish Bhattacharyacdaa99d2012-01-10 06:05:00 +0530183 REGULATOR_SUPPLY("CDC_VDD_CP", "sitar-slim"),
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700184 REGULATOR_SUPPLY("CDC_VDD_CP", "sitar1p1-slim"),
David Collins1d4061b2011-12-06 15:36:40 -0800185};
186VREG_CONSUMERS(S5) = {
187 REGULATOR_SUPPLY("8038_s5", NULL),
Matt Wagantallab730bd2012-06-07 20:13:51 -0700188 REGULATOR_SUPPLY("krait0", "acpuclk-8627"),
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700189 REGULATOR_SUPPLY("krait0", "acpuclk-8930"),
Tianyi Gou12370f12012-07-23 19:13:57 -0700190 REGULATOR_SUPPLY("krait0", "acpuclk-8930aa"),
David Collins1d4061b2011-12-06 15:36:40 -0800191};
192VREG_CONSUMERS(S6) = {
193 REGULATOR_SUPPLY("8038_s6", NULL),
Matt Wagantallab730bd2012-06-07 20:13:51 -0700194 REGULATOR_SUPPLY("krait1", "acpuclk-8627"),
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700195 REGULATOR_SUPPLY("krait1", "acpuclk-8930"),
Tianyi Gou12370f12012-07-23 19:13:57 -0700196 REGULATOR_SUPPLY("krait1", "acpuclk-8930aa"),
David Collins1d4061b2011-12-06 15:36:40 -0800197};
198VREG_CONSUMERS(LVS1) = {
199 REGULATOR_SUPPLY("8038_lvs1", NULL),
David Collinsf4c3d642012-03-02 09:04:57 -0800200 REGULATOR_SUPPLY("cam_vio", "4-001a"),
201 REGULATOR_SUPPLY("cam_vio", "4-006c"),
202 REGULATOR_SUPPLY("cam_vio", "4-0048"),
203 REGULATOR_SUPPLY("cam_vio", "4-0020"),
David Collins1d4061b2011-12-06 15:36:40 -0800204};
205VREG_CONSUMERS(LVS2) = {
206 REGULATOR_SUPPLY("8038_lvs2", NULL),
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +0530207 REGULATOR_SUPPLY("vcc_i2c", "3-004a"),
Amy Maloche32a36c32012-01-11 10:39:11 -0800208 REGULATOR_SUPPLY("vcc_i2c", "3-0024"),
Amy Malochee8de95d2012-02-23 10:40:25 -0800209 REGULATOR_SUPPLY("vcc_i2c", "0-0048"),
Wentao Xuf59ce4e2012-05-22 17:30:13 -0400210 REGULATOR_SUPPLY("vddio", "12-0018"),
211 REGULATOR_SUPPLY("vlogic", "12-0068"),
David Collins1d4061b2011-12-06 15:36:40 -0800212};
213VREG_CONSUMERS(EXT_5V) = {
214 REGULATOR_SUPPLY("ext_5v", NULL),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -0800215 REGULATOR_SUPPLY("hdmi_mvs", "hdmi_msm.0"),
Manoj Raoc6d904c2012-06-22 00:32:14 -0700216 REGULATOR_SUPPLY("mhl_usb_hs_switch", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -0800217};
218VREG_CONSUMERS(EXT_OTG_SW) = {
219 REGULATOR_SUPPLY("ext_otg_sw", NULL),
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530220 REGULATOR_SUPPLY("vbus_otg", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -0800221};
David Collins04907312012-02-08 14:17:57 -0800222VREG_CONSUMERS(VDD_DIG_CORNER) = {
223 REGULATOR_SUPPLY("vdd_dig_corner", NULL),
Mayank Rana248698c2012-04-19 00:03:16 +0530224 REGULATOR_SUPPLY("hsusb_vdd_dig", "msm_otg"),
David Collins04907312012-02-08 14:17:57 -0800225};
David Collins1d4061b2011-12-06 15:36:40 -0800226
227#define PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
228 _apply_uV, _pull_down, _always_on, _supply_regulator, \
229 _system_uA, _enable_time, _reg_id) \
230 { \
231 .init_data = { \
232 .constraints = { \
233 .valid_modes_mask = _modes, \
234 .valid_ops_mask = _ops, \
235 .min_uV = _min_uV, \
236 .max_uV = _max_uV, \
237 .input_uV = _max_uV, \
238 .apply_uV = _apply_uV, \
239 .always_on = _always_on, \
240 .name = _name, \
241 }, \
242 .num_consumer_supplies = \
243 ARRAY_SIZE(vreg_consumers_##_id), \
244 .consumer_supplies = vreg_consumers_##_id, \
245 .supply_regulator = _supply_regulator, \
246 }, \
247 .id = _reg_id, \
248 .pull_down_enable = _pull_down, \
249 .system_uA = _system_uA, \
250 .enable_time = _enable_time, \
251 }
252
253#define PM8XXX_LDO(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
254 _enable_time, _supply_regulator, _system_uA, _reg_id) \
255 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
256 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
257 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
258 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
259 _supply_regulator, _system_uA, _enable_time, _reg_id)
260
261#define PM8XXX_NLDO1200(_id, _name, _always_on, _pull_down, _min_uV, \
262 _max_uV, _enable_time, _supply_regulator, _system_uA, _reg_id) \
263 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
264 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
265 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
266 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
267 _supply_regulator, _system_uA, _enable_time, _reg_id)
268
269#define PM8XXX_SMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
270 _enable_time, _supply_regulator, _system_uA, _reg_id) \
271 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
272 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
273 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
274 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
275 _supply_regulator, _system_uA, _enable_time, _reg_id)
276
277#define PM8XXX_FTSMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
278 _enable_time, _supply_regulator, _system_uA, _reg_id) \
279 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
280 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
281 | REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
282 _supply_regulator, _system_uA, _enable_time, _reg_id)
283
284#define PM8XXX_VS(_id, _name, _always_on, _pull_down, _enable_time, \
285 _supply_regulator, _reg_id) \
286 PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
287 _pull_down, _always_on, _supply_regulator, 0, _enable_time, \
288 _reg_id)
289
290#define PM8XXX_VS300(_id, _name, _always_on, _pull_down, _enable_time, \
291 _supply_regulator, _reg_id) \
292 PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
293 _pull_down, _always_on, _supply_regulator, 0, _enable_time, \
294 _reg_id)
295
296#define PM8XXX_NCP(_id, _name, _always_on, _min_uV, _max_uV, _enable_time, \
297 _supply_regulator, _reg_id) \
298 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, 0, \
299 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, 0, 0, \
300 _always_on, _supply_regulator, 0, _enable_time, _reg_id)
301
302/* Pin control initialization */
303#define PM8XXX_PC(_id, _name, _always_on, _pin_fn, _pin_ctrl, \
304 _supply_regulator, _reg_id) \
305 { \
306 .init_data = { \
307 .constraints = { \
308 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
309 .always_on = _always_on, \
310 .name = _name, \
311 }, \
312 .num_consumer_supplies = \
313 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
314 .consumer_supplies = vreg_consumers_##_id##_PC, \
315 .supply_regulator = _supply_regulator, \
316 }, \
317 .id = _reg_id, \
318 .pin_fn = PM8XXX_VREG_PIN_FN_##_pin_fn, \
319 .pin_ctrl = _pin_ctrl, \
320 }
321
David Collins8af872e2012-01-06 11:31:56 -0800322#define RPM_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, _default_uV, \
323 _peak_uA, _avg_uA, _pull_down, _pin_ctrl, _freq, _pin_fn, \
David Collins15789042012-03-19 10:44:36 -0700324 _force_mode, _sleep_set_force_mode, _power_mode, _state, \
325 _sleep_selectable, _always_on, _supply_regulator, _system_uA) \
David Collins8af872e2012-01-06 11:31:56 -0800326 { \
327 .init_data = { \
328 .constraints = { \
329 .valid_modes_mask = _modes, \
330 .valid_ops_mask = _ops, \
331 .min_uV = _min_uV, \
332 .max_uV = _max_uV, \
333 .input_uV = _min_uV, \
334 .apply_uV = _apply_uV, \
335 .always_on = _always_on, \
336 }, \
337 .num_consumer_supplies = \
338 ARRAY_SIZE(vreg_consumers_##_id), \
339 .consumer_supplies = vreg_consumers_##_id, \
340 .supply_regulator = _supply_regulator, \
341 }, \
342 .id = RPM_VREG_ID_PM8038_##_id, \
343 .default_uV = _default_uV, \
344 .peak_uA = _peak_uA, \
345 .avg_uA = _avg_uA, \
346 .pull_down_enable = _pull_down, \
347 .pin_ctrl = _pin_ctrl, \
348 .freq = RPM_VREG_FREQ_##_freq, \
349 .pin_fn = _pin_fn, \
350 .force_mode = _force_mode, \
David Collins15789042012-03-19 10:44:36 -0700351 .sleep_set_force_mode = _sleep_set_force_mode, \
David Collins8af872e2012-01-06 11:31:56 -0800352 .power_mode = _power_mode, \
353 .state = _state, \
354 .sleep_selectable = _sleep_selectable, \
355 .system_uA = _system_uA, \
356 }
357
358#define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
359 _supply_regulator, _system_uA, _init_peak_uA) \
360 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
361 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
362 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
363 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _init_peak_uA, 0, _pd, \
364 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8930_NONE, \
David Collins15789042012-03-19 10:44:36 -0700365 RPM_VREG_FORCE_MODE_8930_NONE, \
David Collins8af872e2012-01-06 11:31:56 -0800366 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
367 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
368 _supply_regulator, _system_uA)
369
370#define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
David Collins3d2b9452012-03-19 11:00:30 -0700371 _supply_regulator, _system_uA, _freq, _force_mode, \
372 _sleep_set_force_mode) \
David Collins8af872e2012-01-06 11:31:56 -0800373 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
374 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
375 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
David Collins226f2512012-03-19 13:18:39 -0700376 | REGULATOR_CHANGE_DRMS, 0, _min_uV, _system_uA, 0, _pd, \
David Collins8af872e2012-01-06 11:31:56 -0800377 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8930_NONE, \
David Collins3d2b9452012-03-19 11:00:30 -0700378 RPM_VREG_FORCE_MODE_8930_##_force_mode, \
379 RPM_VREG_FORCE_MODE_8930_##_sleep_set_force_mode, \
380 RPM_VREG_POWER_MODE_8930_PWM, RPM_VREG_STATE_OFF, \
381 _sleep_selectable, _always_on, _supply_regulator, _system_uA)
David Collins8af872e2012-01-06 11:31:56 -0800382
383#define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \
384 RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \
385 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8930_NONE, \
David Collins15789042012-03-19 10:44:36 -0700386 RPM_VREG_FORCE_MODE_8930_NONE, \
David Collins8af872e2012-01-06 11:31:56 -0800387 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
388 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
389 _supply_regulator, 0)
390
391#define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
392 _supply_regulator, _freq) \
393 RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
394 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \
395 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8930_NONE, \
David Collins15789042012-03-19 10:44:36 -0700396 RPM_VREG_FORCE_MODE_8930_NONE, \
David Collins8af872e2012-01-06 11:31:56 -0800397 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
398 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
399 _supply_regulator, 0)
400
David Collins04907312012-02-08 14:17:57 -0800401#define RPM_CORNER(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
402 _supply_regulator) \
403 RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
404 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 0, 0, 0, \
405 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8930_NONE, \
David Collins15789042012-03-19 10:44:36 -0700406 RPM_VREG_FORCE_MODE_8930_NONE, \
David Collins04907312012-02-08 14:17:57 -0800407 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
408 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
409 _supply_regulator, 0)
410
David Collins8af872e2012-01-06 11:31:56 -0800411/* Pin control initialization */
412#define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
413 { \
414 .init_data = { \
415 .constraints = { \
416 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
417 .always_on = _always_on, \
418 }, \
419 .num_consumer_supplies = \
420 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
421 .consumer_supplies = vreg_consumers_##_id##_PC, \
422 .supply_regulator = _supply_regulator, \
423 }, \
424 .id = RPM_VREG_ID_PM8038_##_id##_PC, \
425 .pin_fn = RPM_VREG_PIN_FN_8930_##_pin_fn, \
426 .pin_ctrl = _pin_ctrl, \
427 }
428
David Collins1d4061b2011-12-06 15:36:40 -0800429#define GPIO_VREG(_id, _reg_name, _gpio_label, _gpio, _supply_regulator) \
430 [MSM8930_GPIO_VREG_ID_##_id] = { \
431 .init_data = { \
432 .constraints = { \
433 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
434 }, \
435 .num_consumer_supplies = \
436 ARRAY_SIZE(vreg_consumers_##_id), \
437 .consumer_supplies = vreg_consumers_##_id, \
438 .supply_regulator = _supply_regulator, \
439 }, \
440 .regulator_name = _reg_name, \
441 .gpio_label = _gpio_label, \
442 .gpio = _gpio, \
443 }
444
David Collinsb4558422012-01-05 10:50:49 -0800445#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
446 { \
447 .constraints = { \
448 .name = _name, \
449 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, \
450 .min_uV = _min_uV, \
451 .max_uV = _max_uV, \
452 }, \
453 .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \
454 .consumer_supplies = vreg_consumers_##_id, \
455 }
456
David Collins1d4061b2011-12-06 15:36:40 -0800457/* GPIO regulator constraints */
458struct gpio_regulator_platform_data
David Collins4614cb92012-08-20 12:17:09 -0700459msm8930_pm8038_gpio_regulator_pdata[] __devinitdata = {
David Collins1d4061b2011-12-06 15:36:40 -0800460 /* ID vreg_name gpio_label gpio supply */
461 GPIO_VREG(EXT_5V, "ext_5v", "ext_5v_en", 63, NULL),
462 GPIO_VREG(EXT_OTG_SW, "ext_otg_sw", "ext_otg_sw_en", 97, "ext_5v"),
463};
464
David Collinsb4558422012-01-05 10:50:49 -0800465/* SAW regulator constraints */
David Collins4614cb92012-08-20 12:17:09 -0700466struct regulator_init_data msm8930_pm8038_saw_regulator_core0_pdata =
David Collinsb4558422012-01-05 10:50:49 -0800467 /* ID vreg_name min_uV max_uV */
468 SAW_VREG_INIT(S5, "8038_s5", 850000, 1300000);
David Collins4614cb92012-08-20 12:17:09 -0700469struct regulator_init_data msm8930_pm8038_saw_regulator_core1_pdata =
David Collinsb4558422012-01-05 10:50:49 -0800470 SAW_VREG_INIT(S6, "8038_s6", 850000, 1300000);
471
David Collins1d4061b2011-12-06 15:36:40 -0800472/* PM8038 regulator constraints */
473struct pm8xxx_regulator_platform_data
474msm8930_pm8038_regulator_pdata[] __devinitdata = {
475 /*
476 * ID name always_on pd min_uV max_uV en_t supply
477 * system_uA reg_ID
478 */
Matt Wagantalled36d822012-05-25 18:13:40 -0700479 PM8XXX_NLDO1200(L16, "8038_l16", 0, 1, 375000, 1050000, 200, "8038_s3",
David Collins8af872e2012-01-06 11:31:56 -0800480 0, 0),
Matt Wagantalled36d822012-05-25 18:13:40 -0700481 PM8XXX_NLDO1200(L19, "8038_l19", 0, 1, 375000, 1050000, 200, "8038_s3",
David Collins8af872e2012-01-06 11:31:56 -0800482 0, 1),
Matt Wagantalled36d822012-05-25 18:13:40 -0700483 PM8XXX_NLDO1200(L27, "8038_l27", 0, 1, 375000, 1050000, 200, "8038_s3",
David Collins8af872e2012-01-06 11:31:56 -0800484 0, 2),
485};
David Collins1d4061b2011-12-06 15:36:40 -0800486
David Collins8af872e2012-01-06 11:31:56 -0800487static struct rpm_regulator_init_data
488msm8930_rpm_regulator_init_data[] __devinitdata = {
David Collins3d2b9452012-03-19 11:00:30 -0700489 /* ID a_on pd ss min_uV max_uV supply sys_uA freq fm ss_fm */
David Collinsc4208cc2012-03-19 12:53:10 -0700490 RPM_SMPS(S1, 0, 1, 1, 500000, 1150000, NULL, 100000, 4p80, AUTO, LPM),
491 RPM_SMPS(S2, 1, 1, 1, 1400000, 1400000, NULL, 100000, 1p60, AUTO, LPM),
492 RPM_SMPS(S3, 0, 1, 1, 1150000, 1150000, NULL, 100000, 3p20, AUTO, LPM),
David Collins226f2512012-03-19 13:18:39 -0700493 RPM_SMPS(S4, 1, 1, 1, 1950000, 2200000, NULL, 100000, 1p60, AUTO, LPM),
David Collins1d4061b2011-12-06 15:36:40 -0800494
David Collins8af872e2012-01-06 11:31:56 -0800495 /* ID a_on pd ss min_uV max_uV supply sys_uA init_ip */
496 RPM_LDO(L1, 0, 1, 0, 1300000, 1300000, "8038_s2", 0, 0),
497 RPM_LDO(L2, 0, 1, 0, 1200000, 1200000, "8038_s2", 0, 0),
498 RPM_LDO(L3, 0, 1, 0, 3075000, 3075000, NULL, 0, 0),
499 RPM_LDO(L4, 1, 1, 0, 1800000, 1800000, NULL, 10000, 10000),
500 RPM_LDO(L5, 0, 1, 0, 2950000, 2950000, NULL, 0, 0),
501 RPM_LDO(L6, 0, 1, 0, 2950000, 2950000, NULL, 0, 0),
502 RPM_LDO(L7, 0, 1, 0, 2050000, 2050000, "8038_s4", 0, 0),
503 RPM_LDO(L8, 0, 1, 0, 2800000, 2800000, NULL, 0, 0),
504 RPM_LDO(L9, 0, 1, 0, 2850000, 2850000, NULL, 0, 0),
505 RPM_LDO(L10, 0, 1, 0, 2900000, 2900000, NULL, 0, 0),
506 RPM_LDO(L11, 1, 1, 0, 1800000, 1800000, "8038_s4", 10000, 10000),
507 RPM_LDO(L12, 0, 1, 0, 1200000, 1200000, "8038_s2", 0, 0),
David Collins652b3442012-08-09 14:47:51 -0700508 RPM_LDO(L13, 0, 0, 0, 2220000, 2220000, NULL, 0, 0),
David Collins8af872e2012-01-06 11:31:56 -0800509 RPM_LDO(L14, 0, 1, 0, 1800000, 1800000, NULL, 0, 0),
510 RPM_LDO(L15, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
511 RPM_LDO(L17, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
512 RPM_LDO(L18, 0, 1, 0, 1800000, 1800000, NULL, 0, 0),
David Collins19e78812012-06-04 15:50:09 -0700513 RPM_LDO(L20, 1, 1, 0, 1250000, 1250000, "8038_s2", 10000, 10000),
David Collins8af872e2012-01-06 11:31:56 -0800514 RPM_LDO(L21, 0, 1, 0, 1900000, 1900000, "8038_s4", 0, 0),
515 RPM_LDO(L22, 1, 1, 0, 1850000, 2950000, NULL, 10000, 10000),
516 RPM_LDO(L23, 1, 1, 1, 1800000, 1800000, "8038_s4", 0, 0),
David Collinsad96fa32012-03-02 08:41:38 -0800517 RPM_LDO(L24, 0, 1, 1, 500000, 1150000, "8038_s2", 10000, 10000),
David Collins652b3442012-08-09 14:47:51 -0700518 RPM_LDO(L25, 0, 0, 0, 1740000, 1740000, "8038_l13", 0, 0),
David Collins8af872e2012-01-06 11:31:56 -0800519 RPM_LDO(L26, 1, 1, 0, 1050000, 1050000, "8038_s2", 10000, 10000),
520
521 /* ID a_on pd ss supply */
522 RPM_VS(LVS1, 0, 1, 0, "8038_l11"),
523 RPM_VS(LVS2, 0, 1, 0, "8038_l11"),
David Collins04907312012-02-08 14:17:57 -0800524
525 /* ID a_on ss min_corner max_corner supply */
526 RPM_CORNER(VDD_DIG_CORNER, 0, 1, RPM_VREG_CORNER_NONE,
527 RPM_VREG_CORNER_HIGH, NULL),
David Collins1d4061b2011-12-06 15:36:40 -0800528};
529
530int msm8930_pm8038_regulator_pdata_len __devinitdata =
531 ARRAY_SIZE(msm8930_pm8038_regulator_pdata);
David Collins8af872e2012-01-06 11:31:56 -0800532
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700533#define RPM_REG_MAP(_id, _sleep_also, _voter, _supply, _dev_name) \
534 { \
535 .vreg_id = RPM_VREG_ID_PM8038_##_id, \
536 .sleep_also = _sleep_also, \
537 .voter = _voter, \
538 .supply = _supply, \
539 .dev_name = _dev_name, \
540 }
541static struct rpm_regulator_consumer_mapping
542 msm_rpm_regulator_consumer_mapping[] __devinitdata = {
543 RPM_REG_MAP(L23, 0, 1, "krait0_hfpll", "acpuclk-8930"),
544 RPM_REG_MAP(L23, 0, 2, "krait1_hfpll", "acpuclk-8930"),
545 RPM_REG_MAP(L23, 0, 6, "l2_hfpll", "acpuclk-8930"),
546 RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8930"),
547 RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8930"),
548 RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig", "acpuclk-8930"),
549 RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig", "acpuclk-8930"),
Matt Wagantallab730bd2012-06-07 20:13:51 -0700550
551 RPM_REG_MAP(L23, 0, 1, "krait0_hfpll", "acpuclk-8627"),
552 RPM_REG_MAP(L23, 0, 2, "krait1_hfpll", "acpuclk-8627"),
553 RPM_REG_MAP(L23, 0, 6, "l2_hfpll", "acpuclk-8627"),
554 RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8627"),
555 RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8627"),
556 RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig", "acpuclk-8627"),
557 RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig", "acpuclk-8627"),
Tianyi Gou12370f12012-07-23 19:13:57 -0700558
559 RPM_REG_MAP(L23, 0, 1, "krait0_hfpll", "acpuclk-8930aa"),
560 RPM_REG_MAP(L23, 0, 2, "krait1_hfpll", "acpuclk-8930aa"),
561 RPM_REG_MAP(L23, 0, 6, "l2_hfpll", "acpuclk-8930aa"),
562 RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8930aa"),
563 RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8930aa"),
564 RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig", "acpuclk-8930aa"),
565 RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig", "acpuclk-8930aa"),
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700566};
567
David Collins4614cb92012-08-20 12:17:09 -0700568struct rpm_regulator_platform_data
569msm8930_pm8038_rpm_regulator_pdata __devinitdata = {
David Collins8af872e2012-01-06 11:31:56 -0800570 .init_data = msm8930_rpm_regulator_init_data,
571 .num_regulators = ARRAY_SIZE(msm8930_rpm_regulator_init_data),
572 .version = RPM_VREG_VERSION_8930,
573 .vreg_id_vdd_mem = RPM_VREG_ID_PM8038_L24,
David Collins04907312012-02-08 14:17:57 -0800574 .vreg_id_vdd_dig = RPM_VREG_ID_PM8038_VDD_DIG_CORNER,
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700575 .consumer_map = msm_rpm_regulator_consumer_mapping,
576 .consumer_map_len = ARRAY_SIZE(msm_rpm_regulator_consumer_mapping),
David Collins8af872e2012-01-06 11:31:56 -0800577};