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