blob: 5d98ab816037ba494eeb9d7f2f9036af20f39c11 [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
14#include <linux/regulator/pm8xxx-regulator.h>
15
16#include "board-8930.h"
17
18#define VREG_CONSUMERS(_id) \
19 static struct regulator_consumer_supply vreg_consumers_##_id[]
20
21/*
22 * Consumer specific regulator names:
23 * regulator name consumer dev_name
24 */
25VREG_CONSUMERS(L1) = {
26 REGULATOR_SUPPLY("8038_l1", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080027 REGULATOR_SUPPLY("iris_vddrfa", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080028};
29VREG_CONSUMERS(L2) = {
30 REGULATOR_SUPPLY("8038_l2", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080031 REGULATOR_SUPPLY("iris_vdddig", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080032};
33VREG_CONSUMERS(L3) = {
34 REGULATOR_SUPPLY("8038_l3", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +053035 REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -080036};
37VREG_CONSUMERS(L4) = {
38 REGULATOR_SUPPLY("8038_l4", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +053039 REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080040 REGULATOR_SUPPLY("iris_vddxo", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080041};
42VREG_CONSUMERS(L5) = {
43 REGULATOR_SUPPLY("8038_l5", NULL),
44};
45VREG_CONSUMERS(L6) = {
46 REGULATOR_SUPPLY("8038_l6", NULL),
47};
48VREG_CONSUMERS(L7) = {
49 REGULATOR_SUPPLY("8038_l7", NULL),
50};
51VREG_CONSUMERS(L8) = {
52 REGULATOR_SUPPLY("8038_l8", NULL),
53};
54VREG_CONSUMERS(L9) = {
55 REGULATOR_SUPPLY("8038_l9", NULL),
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +053056 REGULATOR_SUPPLY("vdd_ana", "3-004a"),
David Collins1d4061b2011-12-06 15:36:40 -080057};
58VREG_CONSUMERS(L10) = {
59 REGULATOR_SUPPLY("8038_l10", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080060 REGULATOR_SUPPLY("iris_vddpa", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080061};
62VREG_CONSUMERS(L11) = {
63 REGULATOR_SUPPLY("8038_l11", NULL),
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +053064 REGULATOR_SUPPLY("vdd_dig", "3-004a"),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080065 REGULATOR_SUPPLY("iris_vddio", "wcnss_wlan.0"),
66 REGULATOR_SUPPLY("riva_vddpx", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080067};
68VREG_CONSUMERS(L12) = {
69 REGULATOR_SUPPLY("8038_l12", NULL),
70};
71VREG_CONSUMERS(L14) = {
72 REGULATOR_SUPPLY("8038_l14", NULL),
73};
74VREG_CONSUMERS(L15) = {
75 REGULATOR_SUPPLY("8038_l15", NULL),
76};
77VREG_CONSUMERS(L16) = {
78 REGULATOR_SUPPLY("8038_l16", NULL),
Stephen Boyd868d8992012-01-06 14:11:02 -080079 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.2"),
David Collins1d4061b2011-12-06 15:36:40 -080080};
81VREG_CONSUMERS(L17) = {
82 REGULATOR_SUPPLY("8038_l17", NULL),
83};
84VREG_CONSUMERS(L18) = {
85 REGULATOR_SUPPLY("8038_l18", NULL),
86};
87VREG_CONSUMERS(L19) = {
88 REGULATOR_SUPPLY("8038_l19", NULL),
Stephen Boyd868d8992012-01-06 14:11:02 -080089 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.1"),
David Collins1d4061b2011-12-06 15:36:40 -080090};
91VREG_CONSUMERS(L20) = {
92 REGULATOR_SUPPLY("8038_l20", NULL),
93};
94VREG_CONSUMERS(L21) = {
95 REGULATOR_SUPPLY("8038_l21", NULL),
96};
97VREG_CONSUMERS(L22) = {
98 REGULATOR_SUPPLY("8038_l22", NULL),
99};
100VREG_CONSUMERS(L23) = {
101 REGULATOR_SUPPLY("8038_l23", NULL),
102};
103VREG_CONSUMERS(L24) = {
104 REGULATOR_SUPPLY("8038_l24", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -0800105 REGULATOR_SUPPLY("riva_vddmx", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -0800106};
107VREG_CONSUMERS(L26) = {
108 REGULATOR_SUPPLY("8038_l26", NULL),
109};
110VREG_CONSUMERS(L27) = {
111 REGULATOR_SUPPLY("8038_l27", NULL),
Stephen Boyd868d8992012-01-06 14:11:02 -0800112 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.0"),
David Collins1d4061b2011-12-06 15:36:40 -0800113};
114VREG_CONSUMERS(S1) = {
115 REGULATOR_SUPPLY("8038_s1", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +0530116 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_otg"),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -0800117 REGULATOR_SUPPLY("riva_vddcx", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -0800118};
119VREG_CONSUMERS(S2) = {
120 REGULATOR_SUPPLY("8038_s2", NULL),
121};
122VREG_CONSUMERS(S3) = {
123 REGULATOR_SUPPLY("8038_s3", NULL),
124};
125VREG_CONSUMERS(S4) = {
126 REGULATOR_SUPPLY("8038_s4", NULL),
127};
128VREG_CONSUMERS(S5) = {
129 REGULATOR_SUPPLY("8038_s5", NULL),
David Collinsb4558422012-01-05 10:50:49 -0800130 REGULATOR_SUPPLY("krait0", NULL),
David Collins1d4061b2011-12-06 15:36:40 -0800131};
132VREG_CONSUMERS(S6) = {
133 REGULATOR_SUPPLY("8038_s6", NULL),
David Collinsb4558422012-01-05 10:50:49 -0800134 REGULATOR_SUPPLY("krait1", NULL),
David Collins1d4061b2011-12-06 15:36:40 -0800135};
136VREG_CONSUMERS(LVS1) = {
137 REGULATOR_SUPPLY("8038_lvs1", NULL),
138};
139VREG_CONSUMERS(LVS2) = {
140 REGULATOR_SUPPLY("8038_lvs2", NULL),
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +0530141 REGULATOR_SUPPLY("vcc_i2c", "3-004a"),
David Collins1d4061b2011-12-06 15:36:40 -0800142};
143VREG_CONSUMERS(EXT_5V) = {
144 REGULATOR_SUPPLY("ext_5v", NULL),
145};
146VREG_CONSUMERS(EXT_OTG_SW) = {
147 REGULATOR_SUPPLY("ext_otg_sw", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +0530148 REGULATOR_SUPPLY("vbus_otg", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -0800149};
150
151#define PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
152 _apply_uV, _pull_down, _always_on, _supply_regulator, \
153 _system_uA, _enable_time, _reg_id) \
154 { \
155 .init_data = { \
156 .constraints = { \
157 .valid_modes_mask = _modes, \
158 .valid_ops_mask = _ops, \
159 .min_uV = _min_uV, \
160 .max_uV = _max_uV, \
161 .input_uV = _max_uV, \
162 .apply_uV = _apply_uV, \
163 .always_on = _always_on, \
164 .name = _name, \
165 }, \
166 .num_consumer_supplies = \
167 ARRAY_SIZE(vreg_consumers_##_id), \
168 .consumer_supplies = vreg_consumers_##_id, \
169 .supply_regulator = _supply_regulator, \
170 }, \
171 .id = _reg_id, \
172 .pull_down_enable = _pull_down, \
173 .system_uA = _system_uA, \
174 .enable_time = _enable_time, \
175 }
176
177#define PM8XXX_LDO(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
178 _enable_time, _supply_regulator, _system_uA, _reg_id) \
179 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
180 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
181 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
182 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
183 _supply_regulator, _system_uA, _enable_time, _reg_id)
184
185#define PM8XXX_NLDO1200(_id, _name, _always_on, _pull_down, _min_uV, \
186 _max_uV, _enable_time, _supply_regulator, _system_uA, _reg_id) \
187 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
188 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
189 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
190 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
191 _supply_regulator, _system_uA, _enable_time, _reg_id)
192
193#define PM8XXX_SMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
194 _enable_time, _supply_regulator, _system_uA, _reg_id) \
195 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
196 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
197 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
198 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
199 _supply_regulator, _system_uA, _enable_time, _reg_id)
200
201#define PM8XXX_FTSMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
202 _enable_time, _supply_regulator, _system_uA, _reg_id) \
203 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
204 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
205 | REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
206 _supply_regulator, _system_uA, _enable_time, _reg_id)
207
208#define PM8XXX_VS(_id, _name, _always_on, _pull_down, _enable_time, \
209 _supply_regulator, _reg_id) \
210 PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
211 _pull_down, _always_on, _supply_regulator, 0, _enable_time, \
212 _reg_id)
213
214#define PM8XXX_VS300(_id, _name, _always_on, _pull_down, _enable_time, \
215 _supply_regulator, _reg_id) \
216 PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
217 _pull_down, _always_on, _supply_regulator, 0, _enable_time, \
218 _reg_id)
219
220#define PM8XXX_NCP(_id, _name, _always_on, _min_uV, _max_uV, _enable_time, \
221 _supply_regulator, _reg_id) \
222 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, 0, \
223 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, 0, 0, \
224 _always_on, _supply_regulator, 0, _enable_time, _reg_id)
225
226/* Pin control initialization */
227#define PM8XXX_PC(_id, _name, _always_on, _pin_fn, _pin_ctrl, \
228 _supply_regulator, _reg_id) \
229 { \
230 .init_data = { \
231 .constraints = { \
232 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
233 .always_on = _always_on, \
234 .name = _name, \
235 }, \
236 .num_consumer_supplies = \
237 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
238 .consumer_supplies = vreg_consumers_##_id##_PC, \
239 .supply_regulator = _supply_regulator, \
240 }, \
241 .id = _reg_id, \
242 .pin_fn = PM8XXX_VREG_PIN_FN_##_pin_fn, \
243 .pin_ctrl = _pin_ctrl, \
244 }
245
246#define GPIO_VREG(_id, _reg_name, _gpio_label, _gpio, _supply_regulator) \
247 [MSM8930_GPIO_VREG_ID_##_id] = { \
248 .init_data = { \
249 .constraints = { \
250 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
251 }, \
252 .num_consumer_supplies = \
253 ARRAY_SIZE(vreg_consumers_##_id), \
254 .consumer_supplies = vreg_consumers_##_id, \
255 .supply_regulator = _supply_regulator, \
256 }, \
257 .regulator_name = _reg_name, \
258 .gpio_label = _gpio_label, \
259 .gpio = _gpio, \
260 }
261
David Collinsb4558422012-01-05 10:50:49 -0800262#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
263 { \
264 .constraints = { \
265 .name = _name, \
266 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, \
267 .min_uV = _min_uV, \
268 .max_uV = _max_uV, \
269 }, \
270 .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \
271 .consumer_supplies = vreg_consumers_##_id, \
272 }
273
David Collins1d4061b2011-12-06 15:36:40 -0800274/* GPIO regulator constraints */
275struct gpio_regulator_platform_data
276msm8930_gpio_regulator_pdata[] __devinitdata = {
277 /* ID vreg_name gpio_label gpio supply */
278 GPIO_VREG(EXT_5V, "ext_5v", "ext_5v_en", 63, NULL),
279 GPIO_VREG(EXT_OTG_SW, "ext_otg_sw", "ext_otg_sw_en", 97, "ext_5v"),
280};
281
David Collinsb4558422012-01-05 10:50:49 -0800282/* SAW regulator constraints */
283struct regulator_init_data msm8930_saw_regulator_core0_pdata =
284 /* ID vreg_name min_uV max_uV */
285 SAW_VREG_INIT(S5, "8038_s5", 850000, 1300000);
286struct regulator_init_data msm8930_saw_regulator_core1_pdata =
287 SAW_VREG_INIT(S6, "8038_s6", 850000, 1300000);
288
David Collins1d4061b2011-12-06 15:36:40 -0800289/* PM8038 regulator constraints */
290struct pm8xxx_regulator_platform_data
291msm8930_pm8038_regulator_pdata[] __devinitdata = {
292 /*
293 * ID name always_on pd min_uV max_uV en_t supply
294 * system_uA reg_ID
295 */
296 PM8XXX_SMPS(S1, "8038_s1", 1, 1, 1150000, 1150000, 500, NULL, 100000,
297 26),
298 PM8XXX_SMPS(S2, "8038_s2", 1, 1, 1400000, 1400000, 500, NULL, 100000,
299 27),
300 PM8XXX_SMPS(S3, "8038_s3", 0, 1, 1150000, 1150000, 500, NULL, 0, 28),
301 PM8XXX_SMPS(S4, "8038_s4", 1, 1, 2200000, 2200000, 500, NULL, 100000,
302 29),
303
David Collins1d4061b2011-12-06 15:36:40 -0800304 PM8XXX_NLDO1200(L1, "8038_l1", 0, 1, 1300000, 1300000, 200, "8038_s2",
305 0, 1),
306 PM8XXX_LDO(L2, "8038_l2", 0, 1, 1200000, 1200000, 200, "8038_s2", 0,
307 2),
308 PM8XXX_LDO(L3, "8038_l3", 0, 1, 3075000, 3075000, 200, NULL, 0, 3),
309 PM8XXX_LDO(L4, "8038_l4", 1, 1, 1800000, 1800000, 200, NULL, 10000,
310 4),
311 PM8XXX_LDO(L5, "8038_l5", 0, 1, 2950000, 2950000, 200, NULL, 0, 5),
312 PM8XXX_LDO(L6, "8038_l6", 0, 1, 2950000, 2950000, 200, NULL, 0, 6),
313 PM8XXX_LDO(L7, "8038_l7", 0, 1, 2050000, 2050000, 200, "8038_s4", 0,
314 7),
315 PM8XXX_LDO(L8, "8038_l8", 0, 1, 2800000, 2800000, 200, NULL, 0, 8),
316 PM8XXX_LDO(L9, "8038_l9", 0, 1, 2850000, 2850000, 200, NULL, 0, 9),
317 PM8XXX_LDO(L10, "8038_l10", 0, 1, 2900000, 2900000, 200, NULL, 0, 10),
318 PM8XXX_LDO(L11, "8038_l11", 1, 1, 1800000, 1800000, 200, "8038_s4",
319 10000, 11),
320 PM8XXX_LDO(L12, "8038_l12", 0, 1, 1200000, 1200000, 200, "8038_s2", 0,
321 12),
322 PM8XXX_LDO(L14, "8038_l14", 0, 1, 1800000, 1800000, 200, NULL, 0, 13),
323 PM8XXX_LDO(L15, "8038_l15", 0, 1, 1800000, 2950000, 200, NULL, 0, 14),
324 PM8XXX_NLDO1200(L16, "8038_l16", 0, 1, 1050000, 1050000, 200, "8038_s3",
325 0, 15),
326 PM8XXX_LDO(L17, "8038_l17", 0, 1, 1800000, 2950000, 200, NULL, 0, 16),
327 PM8XXX_LDO(L18, "8038_l18", 0, 1, 1800000, 1800000, 200, NULL, 0, 17),
328 PM8XXX_NLDO1200(L19, "8038_l19", 0, 1, 1050000, 1050000, 200, "8038_s3",
329 0, 18),
330 PM8XXX_NLDO1200(L20, "8038_l20", 1, 1, 1200000, 1200000, 200, "8038_s2",
331 10000, 19),
332 PM8XXX_LDO(L21, "8038_l21", 0, 1, 1900000, 1900000, 200, "8038_s4", 0,
333 20),
334 PM8XXX_LDO(L22, "8038_l22", 1, 1, 2950000, 2950000, 200, NULL, 10000,
335 21),
336 PM8XXX_LDO(L23, "8038_l23", 0, 1, 1800000, 1800000, 200, "8038_s4", 0,
337 22),
338 PM8XXX_NLDO1200(L24, "8038_l24", 1, 1, 1150000, 1150000, 200, "8038_s2",
339 10000, 23),
340 PM8XXX_LDO(L26, "8038_l26", 1, 1, 1050000, 1050000, 200, "8038_s2",
341 10000, 24),
342 PM8XXX_NLDO1200(L27, "8038_l27", 0, 1, 1050000, 1050000, 200, "8038_s3",
343 0, 25),
344
345 /* ID name always_on pd en_t supply reg_ID */
346 PM8XXX_VS(LVS1, "8038_lvs1", 0, 1, 0, "8038_l11", 32),
347 PM8XXX_VS(LVS2, "8038_lvs2", 0, 1, 0, "8038_l11", 33),
348
349};
350
351int msm8930_pm8038_regulator_pdata_len __devinitdata =
352 ARRAY_SIZE(msm8930_pm8038_regulator_pdata);