blob: 94099366b1729ce34a320ec638576b09dc603568 [file] [log] [blame]
Michael Bohan037a0f52012-02-29 19:13:09 -08001/*
2 * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
3 *
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/platform_device.h>
15#include <linux/regulator/stub-regulator.h>
16
17#define VREG_CONSUMERS(_name) \
18 static struct regulator_consumer_supply vreg_consumers_##_name[]
19
20/*
21 * Consumer specific regulator names:
22 * regulator name consumer dev_name
23 */
24VREG_CONSUMERS(S1B) = {
25 REGULATOR_SUPPLY("8841_s1", NULL),
26};
27VREG_CONSUMERS(S2B) = {
28 REGULATOR_SUPPLY("8841_s2", NULL),
David Ngd3b64252012-03-21 16:08:34 -070029 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_otg"),
Michael Bohan037a0f52012-02-29 19:13:09 -080030};
31VREG_CONSUMERS(S3B) = {
32 REGULATOR_SUPPLY("8841_s3", NULL),
33};
34VREG_CONSUMERS(S4B) = {
35 REGULATOR_SUPPLY("8841_s4", NULL),
36};
37VREG_CONSUMERS(S5B) = {
38 REGULATOR_SUPPLY("8841_s5", NULL),
39};
40VREG_CONSUMERS(S6B) = {
41 REGULATOR_SUPPLY("8841_s6", NULL),
42};
43VREG_CONSUMERS(S7B) = {
44 REGULATOR_SUPPLY("8841_s7", NULL),
45};
46VREG_CONSUMERS(S8B) = {
47 REGULATOR_SUPPLY("8841_s8", NULL),
48};
49VREG_CONSUMERS(S1) = {
50 REGULATOR_SUPPLY("8941_s1", NULL),
51};
52VREG_CONSUMERS(S2) = {
53 REGULATOR_SUPPLY("8941_s2", NULL),
54};
55VREG_CONSUMERS(S3) = {
56 REGULATOR_SUPPLY("8941_s3", NULL),
57};
58VREG_CONSUMERS(L1) = {
59 REGULATOR_SUPPLY("8941_l1", NULL),
60};
61VREG_CONSUMERS(L2) = {
62 REGULATOR_SUPPLY("8941_l2", NULL),
63};
64VREG_CONSUMERS(L3) = {
65 REGULATOR_SUPPLY("8941_l3", NULL),
66};
67VREG_CONSUMERS(L4) = {
68 REGULATOR_SUPPLY("8941_l4", NULL),
69};
70VREG_CONSUMERS(L5) = {
71 REGULATOR_SUPPLY("8941_l5", NULL),
72};
73VREG_CONSUMERS(L6) = {
74 REGULATOR_SUPPLY("8941_l6", NULL),
David Ngd3b64252012-03-21 16:08:34 -070075 REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"),
Michael Bohan037a0f52012-02-29 19:13:09 -080076};
77VREG_CONSUMERS(L7) = {
78 REGULATOR_SUPPLY("8941_l7", NULL),
79};
80VREG_CONSUMERS(L8) = {
81 REGULATOR_SUPPLY("8941_l8", NULL),
82};
83VREG_CONSUMERS(L9) = {
84 REGULATOR_SUPPLY("8941_l9", NULL),
85};
86VREG_CONSUMERS(L10) = {
87 REGULATOR_SUPPLY("8941_l10", NULL),
88};
89VREG_CONSUMERS(L11) = {
90 REGULATOR_SUPPLY("8941_l11", NULL),
91};
92VREG_CONSUMERS(L12) = {
93 REGULATOR_SUPPLY("8941_l12", NULL),
94};
95VREG_CONSUMERS(L13) = {
96 REGULATOR_SUPPLY("8941_l13", NULL),
97};
98VREG_CONSUMERS(L14) = {
99 REGULATOR_SUPPLY("8941_l14", NULL),
100};
101VREG_CONSUMERS(L15) = {
102 REGULATOR_SUPPLY("8941_l15", NULL),
103};
104VREG_CONSUMERS(L16) = {
105 REGULATOR_SUPPLY("8941_l16", NULL),
106};
107VREG_CONSUMERS(L17) = {
108 REGULATOR_SUPPLY("8941_l17", NULL),
109};
110VREG_CONSUMERS(L18) = {
111 REGULATOR_SUPPLY("8941_l18", NULL),
112};
113VREG_CONSUMERS(L19) = {
114 REGULATOR_SUPPLY("8941_l19", NULL),
115};
116VREG_CONSUMERS(L20) = {
117 REGULATOR_SUPPLY("8941_l20", NULL),
118};
119VREG_CONSUMERS(L21) = {
120 REGULATOR_SUPPLY("8941_l21", NULL),
121};
122VREG_CONSUMERS(L22) = {
123 REGULATOR_SUPPLY("8941_l22", NULL),
124};
125VREG_CONSUMERS(L23) = {
126 REGULATOR_SUPPLY("8941_l23", NULL),
127};
128VREG_CONSUMERS(L24) = {
129 REGULATOR_SUPPLY("8941_l24", NULL),
David Ngd3b64252012-03-21 16:08:34 -0700130 REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"),
Michael Bohan037a0f52012-02-29 19:13:09 -0800131};
132VREG_CONSUMERS(LVS1) = {
133 REGULATOR_SUPPLY("8941_lvs1", NULL),
134};
135VREG_CONSUMERS(LVS2) = {
136 REGULATOR_SUPPLY("8941_lvs2", NULL),
137};
138VREG_CONSUMERS(LVS3) = {
139 REGULATOR_SUPPLY("8941_lvs3", NULL),
140};
Michael Bohan518a7d32012-03-20 15:43:35 -0700141VREG_CONSUMERS(K0) = {
142 REGULATOR_SUPPLY("krait0", NULL),
143};
144VREG_CONSUMERS(K1) = {
145 REGULATOR_SUPPLY("krait1", NULL),
146};
147VREG_CONSUMERS(K2) = {
148 REGULATOR_SUPPLY("krait2", NULL),
149};
150VREG_CONSUMERS(K3) = {
151 REGULATOR_SUPPLY("krait3", NULL),
152};
Michael Bohan037a0f52012-02-29 19:13:09 -0800153
154#define PM8X41_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
155 _always_on, _supply_regulator, _hpm_min, _system_uA) \
156 struct stub_regulator_pdata vreg_dev_##_id##_pdata __devinitdata = { \
157 .init_data = { \
158 .constraints = { \
159 .valid_modes_mask = _modes, \
160 .valid_ops_mask = _ops, \
161 .min_uV = _min_uV, \
162 .max_uV = _max_uV, \
163 .input_uV = _max_uV, \
164 .apply_uV = 0, \
165 .always_on = _always_on, \
166 .name = _name, \
167 }, \
168 .num_consumer_supplies = \
169 ARRAY_SIZE(vreg_consumers_##_id), \
170 .consumer_supplies = vreg_consumers_##_id, \
171 .supply_regulator = _supply_regulator, \
172 }, \
173 .hpm_min_load = _hpm_min, \
174 .system_uA = _system_uA, \
175 }
176
177#define PM8X41_LDO(_id, _name, _always_on, _min_uV, _max_uV, \
178 _supply_regulator, _hpm_min, _system_uA) \
179 PM8X41_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, _always_on, \
183 _supply_regulator, _hpm_min, _system_uA)
184
185#define PM8X41_SMPS(_id, _name, _always_on, _min_uV, _max_uV, \
186 _supply_regulator, _hpm_min, _system_uA) \
187 PM8X41_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, _always_on, \
191 _supply_regulator, _hpm_min, _system_uA)
192
193#define PM8X41_FTSMPS(_id, _name, _always_on, _min_uV, _max_uV, \
194 _supply_regulator, _hpm_min, _system_uA) \
195 PM8X41_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
196 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
197 | REGULATOR_CHANGE_MODE, _always_on, \
198 _supply_regulator, _hpm_min, _system_uA)
199
200#define PM8X41_VS(_id, _name, _always_on, _supply_regulator) \
201 PM8X41_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, \
202 _always_on, _supply_regulator, 0, 0)
203
Michael Bohan518a7d32012-03-20 15:43:35 -0700204#define KRAIT_PWR(_id, _name, _always_on, _min_uV, _max_uV, \
205 _supply_regulator, _hpm_min, _system_uA) \
206 PM8X41_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
207 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
208 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
209 REGULATOR_CHANGE_DRMS, _always_on, \
210 _supply_regulator, _hpm_min, _system_uA)
211
Michael Bohan037a0f52012-02-29 19:13:09 -0800212/* PM8x41 regulator constraints */
213
214/* ID name a_on min_uV max_uV supply hpm_min sys_uA */
215PM8X41_SMPS(S1B, "8841_s1", 0, 900000, 1150000, NULL, 100000, 0);
216PM8X41_FTSMPS(S2B, "8841_s2", 0, 900000, 1150000, NULL, 100000, 0);
217PM8X41_SMPS(S3B, "8841_s3", 0, 1150000, 1150000, NULL, 100000, 0);
218PM8X41_FTSMPS(S4B, "8841_s4", 0, 900000, 900000, NULL, 100000, 0);
219PM8X41_FTSMPS(S5B, "8841_s5", 0, 850000, 1100000, NULL, 100000, 0);
220PM8X41_FTSMPS(S6B, "8841_s6", 0, 850000, 1100000, NULL, 100000, 0);
221PM8X41_FTSMPS(S7B, "8841_s7", 0, 850000, 1100000, NULL, 100000, 0);
222PM8X41_FTSMPS(S8B, "8841_s8", 0, 850000, 1100000, NULL, 100000, 0);
223PM8X41_SMPS(S1, "8941_s1", 0, 1300000, 1300000, NULL, 100000, 0);
224PM8X41_SMPS(S2, "8941_s2", 0, 2150000, 2150000, NULL, 100000, 0);
225PM8X41_SMPS(S3, "8941_s3", 0, 1800000, 1800000, NULL, 100000, 0);
226PM8X41_LDO(L1, "8941_l1", 0, 1225000, 1225000, "8941_s1", 100000, 0);
227PM8X41_LDO(L2, "8941_l2", 0, 1200000, 1200000, "8941_s3", 5000, 0);
228PM8X41_LDO(L3, "8941_l3", 0, 1200000, 1200000, "8941_s1", 10000, 0);
229PM8X41_LDO(L4, "8941_l4", 0, 1150000, 1150000, "8941_s1", 10000, 0);
230PM8X41_LDO(L5, "8941_l5", 0, 1800000, 1800000, "8941_s2", 1000, 0);
231PM8X41_LDO(L6, "8941_l6", 0, 1800000, 1800000, "8941_s2", 10000, 0);
232PM8X41_LDO(L7, "8941_l7", 0, 1800000, 1800000, "8941_s2", 1000, 0);
233PM8X41_LDO(L8, "8941_l8", 0, 1800000, 1800000, NULL, 1000, 0);
234PM8X41_LDO(L9, "8941_l9", 0, 1800000, 2950000, NULL, 10000, 0);
235PM8X41_LDO(L10, "8941_l10", 0, 1800000, 2950000, NULL, 10000, 0);
236PM8X41_LDO(L11, "8941_l11", 0, 1250000, 1250000, "8941_s1", 10000, 0);
237PM8X41_LDO(L12, "8941_l12", 0, 1800000, 1800000, "8941_s2", 10000, 0);
238PM8X41_LDO(L13, "8941_l13", 0, 2950000, 2950000, NULL, 10000, 0);
239PM8X41_LDO(L14, "8941_l14", 0, 1800000, 1800000, "8941_s2", 10000, 0);
240PM8X41_LDO(L15, "8941_l15", 0, 2050000, 2050000, "8941_s2", 10000, 0);
241PM8X41_LDO(L16, "8941_l16", 0, 2700000, 2700000, NULL, 10000, 0);
242PM8X41_LDO(L17, "8941_l17", 0, 2850000, 2850000, NULL, 10000, 0);
243PM8X41_LDO(L18, "8941_l18", 0, 2850000, 2850000, NULL, 10000, 0);
244PM8X41_LDO(L19, "8941_l19", 0, 2900000, 2900000, NULL, 10000, 0);
245PM8X41_LDO(L20, "8941_l20", 0, 2950000, 2950000, NULL, 10000, 0);
246PM8X41_LDO(L21, "8941_l21", 0, 2950000, 2950000, NULL, 10000, 0);
247PM8X41_LDO(L22, "8941_l22", 0, 3000000, 3000000, NULL, 10000, 0);
248PM8X41_LDO(L23, "8941_l23", 0, 3000000, 3000000, NULL, 10000, 0);
249PM8X41_LDO(L24, "8941_l24", 0, 3075000, 3075000, NULL, 5000, 0);
250
251/* ID name a_on supply */
252PM8X41_VS(LVS1, "8941_lvs1", 0, "8941_s3");
253PM8X41_VS(LVS2, "8941_lvs2", 0, "8941_s3");
254PM8X41_VS(LVS3, "8941_lvs3", 0, "8941_s3");
255
Michael Bohan518a7d32012-03-20 15:43:35 -0700256/* ID name a_on min_uV max_uV supply hpm_min sys_uA */
257KRAIT_PWR(K0, "krait0", 0, 850000, 1100000, NULL, 100000, 0);
258KRAIT_PWR(K1, "krait1", 0, 850000, 1100000, NULL, 100000, 0);
259KRAIT_PWR(K2, "krait2", 0, 850000, 1100000, NULL, 100000, 0);
260KRAIT_PWR(K3, "krait3", 0, 850000, 1100000, NULL, 100000, 0);
261
Michael Bohan037a0f52012-02-29 19:13:09 -0800262#define VREG_DEVICE(_name, _devid) \
263 vreg_device_##_name __devinitdata = \
264 { \
265 .name = STUB_REGULATOR_DRIVER_NAME, \
266 .id = _devid, \
267 .dev = { .platform_data = &vreg_dev_##_name##_pdata }, \
268 }
269
270static struct platform_device VREG_DEVICE(S1B, 0);
271static struct platform_device VREG_DEVICE(S2B, 1);
272static struct platform_device VREG_DEVICE(S3B, 3);
273static struct platform_device VREG_DEVICE(S4B, 4);
274static struct platform_device VREG_DEVICE(S5B, 5);
275static struct platform_device VREG_DEVICE(S6B, 6);
276static struct platform_device VREG_DEVICE(S7B, 7);
277static struct platform_device VREG_DEVICE(S8B, 8);
278static struct platform_device VREG_DEVICE(S1, 9);
279static struct platform_device VREG_DEVICE(S2, 10);
280static struct platform_device VREG_DEVICE(S3, 11);
281static struct platform_device VREG_DEVICE(L1, 12);
282static struct platform_device VREG_DEVICE(L2, 13);
283static struct platform_device VREG_DEVICE(L3, 14);
284static struct platform_device VREG_DEVICE(L4, 15);
285static struct platform_device VREG_DEVICE(L5, 16);
286static struct platform_device VREG_DEVICE(L6, 17);
287static struct platform_device VREG_DEVICE(L7, 18);
288static struct platform_device VREG_DEVICE(L8, 19);
289static struct platform_device VREG_DEVICE(L9, 20);
290static struct platform_device VREG_DEVICE(L10, 21);
291static struct platform_device VREG_DEVICE(L11, 22);
292static struct platform_device VREG_DEVICE(L12, 23);
293static struct platform_device VREG_DEVICE(L13, 24);
294static struct platform_device VREG_DEVICE(L14, 25);
295static struct platform_device VREG_DEVICE(L15, 26);
296static struct platform_device VREG_DEVICE(L16, 27);
297static struct platform_device VREG_DEVICE(L17, 28);
298static struct platform_device VREG_DEVICE(L18, 29);
299static struct platform_device VREG_DEVICE(L19, 30);
300static struct platform_device VREG_DEVICE(L20, 31);
301static struct platform_device VREG_DEVICE(L21, 32);
302static struct platform_device VREG_DEVICE(L22, 33);
303static struct platform_device VREG_DEVICE(L23, 34);
304static struct platform_device VREG_DEVICE(L24, 35);
305static struct platform_device VREG_DEVICE(LVS1, 36);
306static struct platform_device VREG_DEVICE(LVS2, 37);
307static struct platform_device VREG_DEVICE(LVS3, 38);
Michael Bohan518a7d32012-03-20 15:43:35 -0700308static struct platform_device VREG_DEVICE(K0, 39);
309static struct platform_device VREG_DEVICE(K1, 40);
310static struct platform_device VREG_DEVICE(K2, 41);
311static struct platform_device VREG_DEVICE(K3, 42);
Michael Bohan037a0f52012-02-29 19:13:09 -0800312
313struct platform_device *msm_copper_stub_regulator_devices[] __devinitdata = {
314 &vreg_device_S1B,
315 &vreg_device_S2B,
316 &vreg_device_S3B,
317 &vreg_device_S4B,
318 &vreg_device_S5B,
319 &vreg_device_S6B,
320 &vreg_device_S7B,
321 &vreg_device_S8B,
322 &vreg_device_S1,
323 &vreg_device_S2,
324 &vreg_device_S3,
325 &vreg_device_L1,
326 &vreg_device_L2,
327 &vreg_device_L3,
328 &vreg_device_L4,
329 &vreg_device_L5,
330 &vreg_device_L6,
331 &vreg_device_L7,
332 &vreg_device_L8,
333 &vreg_device_L9,
334 &vreg_device_L10,
335 &vreg_device_L11,
336 &vreg_device_L12,
337 &vreg_device_L13,
338 &vreg_device_L14,
339 &vreg_device_L15,
340 &vreg_device_L16,
341 &vreg_device_L17,
342 &vreg_device_L18,
343 &vreg_device_L19,
344 &vreg_device_L20,
345 &vreg_device_L21,
346 &vreg_device_L22,
347 &vreg_device_L23,
348 &vreg_device_L24,
349 &vreg_device_LVS1,
350 &vreg_device_LVS2,
351 &vreg_device_LVS3,
Michael Bohan518a7d32012-03-20 15:43:35 -0700352 &vreg_device_K0,
353 &vreg_device_K1,
354 &vreg_device_K2,
355 &vreg_device_K3,
Michael Bohan037a0f52012-02-29 19:13:09 -0800356};
357
358int msm_copper_stub_regulator_devices_len __devinitdata =
359 ARRAY_SIZE(msm_copper_stub_regulator_devices);