blob: d3e19a0b585490e2ae95d80ba9fe62574191de7f [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),
27};
28VREG_CONSUMERS(L2) = {
29 REGULATOR_SUPPLY("8038_l2", NULL),
30};
31VREG_CONSUMERS(L3) = {
32 REGULATOR_SUPPLY("8038_l3", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +053033 REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -080034};
35VREG_CONSUMERS(L4) = {
36 REGULATOR_SUPPLY("8038_l4", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +053037 REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -080038};
39VREG_CONSUMERS(L5) = {
40 REGULATOR_SUPPLY("8038_l5", NULL),
41};
42VREG_CONSUMERS(L6) = {
43 REGULATOR_SUPPLY("8038_l6", NULL),
44};
45VREG_CONSUMERS(L7) = {
46 REGULATOR_SUPPLY("8038_l7", NULL),
47};
48VREG_CONSUMERS(L8) = {
49 REGULATOR_SUPPLY("8038_l8", NULL),
50};
51VREG_CONSUMERS(L9) = {
52 REGULATOR_SUPPLY("8038_l9", NULL),
53};
54VREG_CONSUMERS(L10) = {
55 REGULATOR_SUPPLY("8038_l10", NULL),
56};
57VREG_CONSUMERS(L11) = {
58 REGULATOR_SUPPLY("8038_l11", NULL),
59};
60VREG_CONSUMERS(L12) = {
61 REGULATOR_SUPPLY("8038_l12", NULL),
62};
63VREG_CONSUMERS(L14) = {
64 REGULATOR_SUPPLY("8038_l14", NULL),
65};
66VREG_CONSUMERS(L15) = {
67 REGULATOR_SUPPLY("8038_l15", NULL),
68};
69VREG_CONSUMERS(L16) = {
70 REGULATOR_SUPPLY("8038_l16", NULL),
Stephen Boyd868d8992012-01-06 14:11:02 -080071 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.2"),
David Collins1d4061b2011-12-06 15:36:40 -080072};
73VREG_CONSUMERS(L17) = {
74 REGULATOR_SUPPLY("8038_l17", NULL),
75};
76VREG_CONSUMERS(L18) = {
77 REGULATOR_SUPPLY("8038_l18", NULL),
78};
79VREG_CONSUMERS(L19) = {
80 REGULATOR_SUPPLY("8038_l19", NULL),
Stephen Boyd868d8992012-01-06 14:11:02 -080081 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.1"),
David Collins1d4061b2011-12-06 15:36:40 -080082};
83VREG_CONSUMERS(L20) = {
84 REGULATOR_SUPPLY("8038_l20", NULL),
85};
86VREG_CONSUMERS(L21) = {
87 REGULATOR_SUPPLY("8038_l21", NULL),
88};
89VREG_CONSUMERS(L22) = {
90 REGULATOR_SUPPLY("8038_l22", NULL),
91};
92VREG_CONSUMERS(L23) = {
93 REGULATOR_SUPPLY("8038_l23", NULL),
94};
95VREG_CONSUMERS(L24) = {
96 REGULATOR_SUPPLY("8038_l24", NULL),
97};
98VREG_CONSUMERS(L26) = {
99 REGULATOR_SUPPLY("8038_l26", NULL),
100};
101VREG_CONSUMERS(L27) = {
102 REGULATOR_SUPPLY("8038_l27", NULL),
Stephen Boyd868d8992012-01-06 14:11:02 -0800103 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.0"),
David Collins1d4061b2011-12-06 15:36:40 -0800104};
105VREG_CONSUMERS(S1) = {
106 REGULATOR_SUPPLY("8038_s1", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +0530107 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -0800108};
109VREG_CONSUMERS(S2) = {
110 REGULATOR_SUPPLY("8038_s2", NULL),
111};
112VREG_CONSUMERS(S3) = {
113 REGULATOR_SUPPLY("8038_s3", NULL),
114};
115VREG_CONSUMERS(S4) = {
116 REGULATOR_SUPPLY("8038_s4", NULL),
117};
118VREG_CONSUMERS(S5) = {
119 REGULATOR_SUPPLY("8038_s5", NULL),
David Collinsb4558422012-01-05 10:50:49 -0800120 REGULATOR_SUPPLY("krait0", NULL),
David Collins1d4061b2011-12-06 15:36:40 -0800121};
122VREG_CONSUMERS(S6) = {
123 REGULATOR_SUPPLY("8038_s6", NULL),
David Collinsb4558422012-01-05 10:50:49 -0800124 REGULATOR_SUPPLY("krait1", NULL),
David Collins1d4061b2011-12-06 15:36:40 -0800125};
126VREG_CONSUMERS(LVS1) = {
127 REGULATOR_SUPPLY("8038_lvs1", NULL),
128};
129VREG_CONSUMERS(LVS2) = {
130 REGULATOR_SUPPLY("8038_lvs2", NULL),
131};
132VREG_CONSUMERS(EXT_5V) = {
133 REGULATOR_SUPPLY("ext_5v", NULL),
134};
135VREG_CONSUMERS(EXT_OTG_SW) = {
136 REGULATOR_SUPPLY("ext_otg_sw", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +0530137 REGULATOR_SUPPLY("vbus_otg", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -0800138};
139
140#define PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
141 _apply_uV, _pull_down, _always_on, _supply_regulator, \
142 _system_uA, _enable_time, _reg_id) \
143 { \
144 .init_data = { \
145 .constraints = { \
146 .valid_modes_mask = _modes, \
147 .valid_ops_mask = _ops, \
148 .min_uV = _min_uV, \
149 .max_uV = _max_uV, \
150 .input_uV = _max_uV, \
151 .apply_uV = _apply_uV, \
152 .always_on = _always_on, \
153 .name = _name, \
154 }, \
155 .num_consumer_supplies = \
156 ARRAY_SIZE(vreg_consumers_##_id), \
157 .consumer_supplies = vreg_consumers_##_id, \
158 .supply_regulator = _supply_regulator, \
159 }, \
160 .id = _reg_id, \
161 .pull_down_enable = _pull_down, \
162 .system_uA = _system_uA, \
163 .enable_time = _enable_time, \
164 }
165
166#define PM8XXX_LDO(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
167 _enable_time, _supply_regulator, _system_uA, _reg_id) \
168 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
169 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
170 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
171 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
172 _supply_regulator, _system_uA, _enable_time, _reg_id)
173
174#define PM8XXX_NLDO1200(_id, _name, _always_on, _pull_down, _min_uV, \
175 _max_uV, _enable_time, _supply_regulator, _system_uA, _reg_id) \
176 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
177 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
178 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
179 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
180 _supply_regulator, _system_uA, _enable_time, _reg_id)
181
182#define PM8XXX_SMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
183 _enable_time, _supply_regulator, _system_uA, _reg_id) \
184 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
185 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
186 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
187 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
188 _supply_regulator, _system_uA, _enable_time, _reg_id)
189
190#define PM8XXX_FTSMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
191 _enable_time, _supply_regulator, _system_uA, _reg_id) \
192 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
193 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
194 | REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
195 _supply_regulator, _system_uA, _enable_time, _reg_id)
196
197#define PM8XXX_VS(_id, _name, _always_on, _pull_down, _enable_time, \
198 _supply_regulator, _reg_id) \
199 PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
200 _pull_down, _always_on, _supply_regulator, 0, _enable_time, \
201 _reg_id)
202
203#define PM8XXX_VS300(_id, _name, _always_on, _pull_down, _enable_time, \
204 _supply_regulator, _reg_id) \
205 PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
206 _pull_down, _always_on, _supply_regulator, 0, _enable_time, \
207 _reg_id)
208
209#define PM8XXX_NCP(_id, _name, _always_on, _min_uV, _max_uV, _enable_time, \
210 _supply_regulator, _reg_id) \
211 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, 0, \
212 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, 0, 0, \
213 _always_on, _supply_regulator, 0, _enable_time, _reg_id)
214
215/* Pin control initialization */
216#define PM8XXX_PC(_id, _name, _always_on, _pin_fn, _pin_ctrl, \
217 _supply_regulator, _reg_id) \
218 { \
219 .init_data = { \
220 .constraints = { \
221 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
222 .always_on = _always_on, \
223 .name = _name, \
224 }, \
225 .num_consumer_supplies = \
226 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
227 .consumer_supplies = vreg_consumers_##_id##_PC, \
228 .supply_regulator = _supply_regulator, \
229 }, \
230 .id = _reg_id, \
231 .pin_fn = PM8XXX_VREG_PIN_FN_##_pin_fn, \
232 .pin_ctrl = _pin_ctrl, \
233 }
234
235#define GPIO_VREG(_id, _reg_name, _gpio_label, _gpio, _supply_regulator) \
236 [MSM8930_GPIO_VREG_ID_##_id] = { \
237 .init_data = { \
238 .constraints = { \
239 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
240 }, \
241 .num_consumer_supplies = \
242 ARRAY_SIZE(vreg_consumers_##_id), \
243 .consumer_supplies = vreg_consumers_##_id, \
244 .supply_regulator = _supply_regulator, \
245 }, \
246 .regulator_name = _reg_name, \
247 .gpio_label = _gpio_label, \
248 .gpio = _gpio, \
249 }
250
David Collinsb4558422012-01-05 10:50:49 -0800251#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
252 { \
253 .constraints = { \
254 .name = _name, \
255 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, \
256 .min_uV = _min_uV, \
257 .max_uV = _max_uV, \
258 }, \
259 .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \
260 .consumer_supplies = vreg_consumers_##_id, \
261 }
262
David Collins1d4061b2011-12-06 15:36:40 -0800263/* GPIO regulator constraints */
264struct gpio_regulator_platform_data
265msm8930_gpio_regulator_pdata[] __devinitdata = {
266 /* ID vreg_name gpio_label gpio supply */
267 GPIO_VREG(EXT_5V, "ext_5v", "ext_5v_en", 63, NULL),
268 GPIO_VREG(EXT_OTG_SW, "ext_otg_sw", "ext_otg_sw_en", 97, "ext_5v"),
269};
270
David Collinsb4558422012-01-05 10:50:49 -0800271/* SAW regulator constraints */
272struct regulator_init_data msm8930_saw_regulator_core0_pdata =
273 /* ID vreg_name min_uV max_uV */
274 SAW_VREG_INIT(S5, "8038_s5", 850000, 1300000);
275struct regulator_init_data msm8930_saw_regulator_core1_pdata =
276 SAW_VREG_INIT(S6, "8038_s6", 850000, 1300000);
277
David Collins1d4061b2011-12-06 15:36:40 -0800278/* PM8038 regulator constraints */
279struct pm8xxx_regulator_platform_data
280msm8930_pm8038_regulator_pdata[] __devinitdata = {
281 /*
282 * ID name always_on pd min_uV max_uV en_t supply
283 * system_uA reg_ID
284 */
285 PM8XXX_SMPS(S1, "8038_s1", 1, 1, 1150000, 1150000, 500, NULL, 100000,
286 26),
287 PM8XXX_SMPS(S2, "8038_s2", 1, 1, 1400000, 1400000, 500, NULL, 100000,
288 27),
289 PM8XXX_SMPS(S3, "8038_s3", 0, 1, 1150000, 1150000, 500, NULL, 0, 28),
290 PM8XXX_SMPS(S4, "8038_s4", 1, 1, 2200000, 2200000, 500, NULL, 100000,
291 29),
292
David Collins1d4061b2011-12-06 15:36:40 -0800293 PM8XXX_NLDO1200(L1, "8038_l1", 0, 1, 1300000, 1300000, 200, "8038_s2",
294 0, 1),
295 PM8XXX_LDO(L2, "8038_l2", 0, 1, 1200000, 1200000, 200, "8038_s2", 0,
296 2),
297 PM8XXX_LDO(L3, "8038_l3", 0, 1, 3075000, 3075000, 200, NULL, 0, 3),
298 PM8XXX_LDO(L4, "8038_l4", 1, 1, 1800000, 1800000, 200, NULL, 10000,
299 4),
300 PM8XXX_LDO(L5, "8038_l5", 0, 1, 2950000, 2950000, 200, NULL, 0, 5),
301 PM8XXX_LDO(L6, "8038_l6", 0, 1, 2950000, 2950000, 200, NULL, 0, 6),
302 PM8XXX_LDO(L7, "8038_l7", 0, 1, 2050000, 2050000, 200, "8038_s4", 0,
303 7),
304 PM8XXX_LDO(L8, "8038_l8", 0, 1, 2800000, 2800000, 200, NULL, 0, 8),
305 PM8XXX_LDO(L9, "8038_l9", 0, 1, 2850000, 2850000, 200, NULL, 0, 9),
306 PM8XXX_LDO(L10, "8038_l10", 0, 1, 2900000, 2900000, 200, NULL, 0, 10),
307 PM8XXX_LDO(L11, "8038_l11", 1, 1, 1800000, 1800000, 200, "8038_s4",
308 10000, 11),
309 PM8XXX_LDO(L12, "8038_l12", 0, 1, 1200000, 1200000, 200, "8038_s2", 0,
310 12),
311 PM8XXX_LDO(L14, "8038_l14", 0, 1, 1800000, 1800000, 200, NULL, 0, 13),
312 PM8XXX_LDO(L15, "8038_l15", 0, 1, 1800000, 2950000, 200, NULL, 0, 14),
313 PM8XXX_NLDO1200(L16, "8038_l16", 0, 1, 1050000, 1050000, 200, "8038_s3",
314 0, 15),
315 PM8XXX_LDO(L17, "8038_l17", 0, 1, 1800000, 2950000, 200, NULL, 0, 16),
316 PM8XXX_LDO(L18, "8038_l18", 0, 1, 1800000, 1800000, 200, NULL, 0, 17),
317 PM8XXX_NLDO1200(L19, "8038_l19", 0, 1, 1050000, 1050000, 200, "8038_s3",
318 0, 18),
319 PM8XXX_NLDO1200(L20, "8038_l20", 1, 1, 1200000, 1200000, 200, "8038_s2",
320 10000, 19),
321 PM8XXX_LDO(L21, "8038_l21", 0, 1, 1900000, 1900000, 200, "8038_s4", 0,
322 20),
323 PM8XXX_LDO(L22, "8038_l22", 1, 1, 2950000, 2950000, 200, NULL, 10000,
324 21),
325 PM8XXX_LDO(L23, "8038_l23", 0, 1, 1800000, 1800000, 200, "8038_s4", 0,
326 22),
327 PM8XXX_NLDO1200(L24, "8038_l24", 1, 1, 1150000, 1150000, 200, "8038_s2",
328 10000, 23),
329 PM8XXX_LDO(L26, "8038_l26", 1, 1, 1050000, 1050000, 200, "8038_s2",
330 10000, 24),
331 PM8XXX_NLDO1200(L27, "8038_l27", 0, 1, 1050000, 1050000, 200, "8038_s3",
332 0, 25),
333
334 /* ID name always_on pd en_t supply reg_ID */
335 PM8XXX_VS(LVS1, "8038_lvs1", 0, 1, 0, "8038_l11", 32),
336 PM8XXX_VS(LVS2, "8038_lvs2", 0, 1, 0, "8038_l11", 33),
337
338};
339
340int msm8930_pm8038_regulator_pdata_len __devinitdata =
341 ARRAY_SIZE(msm8930_pm8038_regulator_pdata);