blob: 89878ced24ae65b1c159d45c51a1950342b2406a [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};
141
142#define PM8X41_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
143 _always_on, _supply_regulator, _hpm_min, _system_uA) \
144 struct stub_regulator_pdata vreg_dev_##_id##_pdata __devinitdata = { \
145 .init_data = { \
146 .constraints = { \
147 .valid_modes_mask = _modes, \
148 .valid_ops_mask = _ops, \
149 .min_uV = _min_uV, \
150 .max_uV = _max_uV, \
151 .input_uV = _max_uV, \
152 .apply_uV = 0, \
153 .always_on = _always_on, \
154 .name = _name, \
155 }, \
156 .num_consumer_supplies = \
157 ARRAY_SIZE(vreg_consumers_##_id), \
158 .consumer_supplies = vreg_consumers_##_id, \
159 .supply_regulator = _supply_regulator, \
160 }, \
161 .hpm_min_load = _hpm_min, \
162 .system_uA = _system_uA, \
163 }
164
165#define PM8X41_LDO(_id, _name, _always_on, _min_uV, _max_uV, \
166 _supply_regulator, _hpm_min, _system_uA) \
167 PM8X41_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
168 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
169 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
170 REGULATOR_CHANGE_DRMS, _always_on, \
171 _supply_regulator, _hpm_min, _system_uA)
172
173#define PM8X41_SMPS(_id, _name, _always_on, _min_uV, _max_uV, \
174 _supply_regulator, _hpm_min, _system_uA) \
175 PM8X41_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
176 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
177 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
178 REGULATOR_CHANGE_DRMS, _always_on, \
179 _supply_regulator, _hpm_min, _system_uA)
180
181#define PM8X41_FTSMPS(_id, _name, _always_on, _min_uV, _max_uV, \
182 _supply_regulator, _hpm_min, _system_uA) \
183 PM8X41_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
184 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
185 | REGULATOR_CHANGE_MODE, _always_on, \
186 _supply_regulator, _hpm_min, _system_uA)
187
188#define PM8X41_VS(_id, _name, _always_on, _supply_regulator) \
189 PM8X41_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, \
190 _always_on, _supply_regulator, 0, 0)
191
192/* PM8x41 regulator constraints */
193
194/* ID name a_on min_uV max_uV supply hpm_min sys_uA */
195PM8X41_SMPS(S1B, "8841_s1", 0, 900000, 1150000, NULL, 100000, 0);
196PM8X41_FTSMPS(S2B, "8841_s2", 0, 900000, 1150000, NULL, 100000, 0);
197PM8X41_SMPS(S3B, "8841_s3", 0, 1150000, 1150000, NULL, 100000, 0);
198PM8X41_FTSMPS(S4B, "8841_s4", 0, 900000, 900000, NULL, 100000, 0);
199PM8X41_FTSMPS(S5B, "8841_s5", 0, 850000, 1100000, NULL, 100000, 0);
200PM8X41_FTSMPS(S6B, "8841_s6", 0, 850000, 1100000, NULL, 100000, 0);
201PM8X41_FTSMPS(S7B, "8841_s7", 0, 850000, 1100000, NULL, 100000, 0);
202PM8X41_FTSMPS(S8B, "8841_s8", 0, 850000, 1100000, NULL, 100000, 0);
203PM8X41_SMPS(S1, "8941_s1", 0, 1300000, 1300000, NULL, 100000, 0);
204PM8X41_SMPS(S2, "8941_s2", 0, 2150000, 2150000, NULL, 100000, 0);
205PM8X41_SMPS(S3, "8941_s3", 0, 1800000, 1800000, NULL, 100000, 0);
206PM8X41_LDO(L1, "8941_l1", 0, 1225000, 1225000, "8941_s1", 100000, 0);
207PM8X41_LDO(L2, "8941_l2", 0, 1200000, 1200000, "8941_s3", 5000, 0);
208PM8X41_LDO(L3, "8941_l3", 0, 1200000, 1200000, "8941_s1", 10000, 0);
209PM8X41_LDO(L4, "8941_l4", 0, 1150000, 1150000, "8941_s1", 10000, 0);
210PM8X41_LDO(L5, "8941_l5", 0, 1800000, 1800000, "8941_s2", 1000, 0);
211PM8X41_LDO(L6, "8941_l6", 0, 1800000, 1800000, "8941_s2", 10000, 0);
212PM8X41_LDO(L7, "8941_l7", 0, 1800000, 1800000, "8941_s2", 1000, 0);
213PM8X41_LDO(L8, "8941_l8", 0, 1800000, 1800000, NULL, 1000, 0);
214PM8X41_LDO(L9, "8941_l9", 0, 1800000, 2950000, NULL, 10000, 0);
215PM8X41_LDO(L10, "8941_l10", 0, 1800000, 2950000, NULL, 10000, 0);
216PM8X41_LDO(L11, "8941_l11", 0, 1250000, 1250000, "8941_s1", 10000, 0);
217PM8X41_LDO(L12, "8941_l12", 0, 1800000, 1800000, "8941_s2", 10000, 0);
218PM8X41_LDO(L13, "8941_l13", 0, 2950000, 2950000, NULL, 10000, 0);
219PM8X41_LDO(L14, "8941_l14", 0, 1800000, 1800000, "8941_s2", 10000, 0);
220PM8X41_LDO(L15, "8941_l15", 0, 2050000, 2050000, "8941_s2", 10000, 0);
221PM8X41_LDO(L16, "8941_l16", 0, 2700000, 2700000, NULL, 10000, 0);
222PM8X41_LDO(L17, "8941_l17", 0, 2850000, 2850000, NULL, 10000, 0);
223PM8X41_LDO(L18, "8941_l18", 0, 2850000, 2850000, NULL, 10000, 0);
224PM8X41_LDO(L19, "8941_l19", 0, 2900000, 2900000, NULL, 10000, 0);
225PM8X41_LDO(L20, "8941_l20", 0, 2950000, 2950000, NULL, 10000, 0);
226PM8X41_LDO(L21, "8941_l21", 0, 2950000, 2950000, NULL, 10000, 0);
227PM8X41_LDO(L22, "8941_l22", 0, 3000000, 3000000, NULL, 10000, 0);
228PM8X41_LDO(L23, "8941_l23", 0, 3000000, 3000000, NULL, 10000, 0);
229PM8X41_LDO(L24, "8941_l24", 0, 3075000, 3075000, NULL, 5000, 0);
230
231/* ID name a_on supply */
232PM8X41_VS(LVS1, "8941_lvs1", 0, "8941_s3");
233PM8X41_VS(LVS2, "8941_lvs2", 0, "8941_s3");
234PM8X41_VS(LVS3, "8941_lvs3", 0, "8941_s3");
235
236#define VREG_DEVICE(_name, _devid) \
237 vreg_device_##_name __devinitdata = \
238 { \
239 .name = STUB_REGULATOR_DRIVER_NAME, \
240 .id = _devid, \
241 .dev = { .platform_data = &vreg_dev_##_name##_pdata }, \
242 }
243
244static struct platform_device VREG_DEVICE(S1B, 0);
245static struct platform_device VREG_DEVICE(S2B, 1);
246static struct platform_device VREG_DEVICE(S3B, 3);
247static struct platform_device VREG_DEVICE(S4B, 4);
248static struct platform_device VREG_DEVICE(S5B, 5);
249static struct platform_device VREG_DEVICE(S6B, 6);
250static struct platform_device VREG_DEVICE(S7B, 7);
251static struct platform_device VREG_DEVICE(S8B, 8);
252static struct platform_device VREG_DEVICE(S1, 9);
253static struct platform_device VREG_DEVICE(S2, 10);
254static struct platform_device VREG_DEVICE(S3, 11);
255static struct platform_device VREG_DEVICE(L1, 12);
256static struct platform_device VREG_DEVICE(L2, 13);
257static struct platform_device VREG_DEVICE(L3, 14);
258static struct platform_device VREG_DEVICE(L4, 15);
259static struct platform_device VREG_DEVICE(L5, 16);
260static struct platform_device VREG_DEVICE(L6, 17);
261static struct platform_device VREG_DEVICE(L7, 18);
262static struct platform_device VREG_DEVICE(L8, 19);
263static struct platform_device VREG_DEVICE(L9, 20);
264static struct platform_device VREG_DEVICE(L10, 21);
265static struct platform_device VREG_DEVICE(L11, 22);
266static struct platform_device VREG_DEVICE(L12, 23);
267static struct platform_device VREG_DEVICE(L13, 24);
268static struct platform_device VREG_DEVICE(L14, 25);
269static struct platform_device VREG_DEVICE(L15, 26);
270static struct platform_device VREG_DEVICE(L16, 27);
271static struct platform_device VREG_DEVICE(L17, 28);
272static struct platform_device VREG_DEVICE(L18, 29);
273static struct platform_device VREG_DEVICE(L19, 30);
274static struct platform_device VREG_DEVICE(L20, 31);
275static struct platform_device VREG_DEVICE(L21, 32);
276static struct platform_device VREG_DEVICE(L22, 33);
277static struct platform_device VREG_DEVICE(L23, 34);
278static struct platform_device VREG_DEVICE(L24, 35);
279static struct platform_device VREG_DEVICE(LVS1, 36);
280static struct platform_device VREG_DEVICE(LVS2, 37);
281static struct platform_device VREG_DEVICE(LVS3, 38);
282
283struct platform_device *msm_copper_stub_regulator_devices[] __devinitdata = {
284 &vreg_device_S1B,
285 &vreg_device_S2B,
286 &vreg_device_S3B,
287 &vreg_device_S4B,
288 &vreg_device_S5B,
289 &vreg_device_S6B,
290 &vreg_device_S7B,
291 &vreg_device_S8B,
292 &vreg_device_S1,
293 &vreg_device_S2,
294 &vreg_device_S3,
295 &vreg_device_L1,
296 &vreg_device_L2,
297 &vreg_device_L3,
298 &vreg_device_L4,
299 &vreg_device_L5,
300 &vreg_device_L6,
301 &vreg_device_L7,
302 &vreg_device_L8,
303 &vreg_device_L9,
304 &vreg_device_L10,
305 &vreg_device_L11,
306 &vreg_device_L12,
307 &vreg_device_L13,
308 &vreg_device_L14,
309 &vreg_device_L15,
310 &vreg_device_L16,
311 &vreg_device_L17,
312 &vreg_device_L18,
313 &vreg_device_L19,
314 &vreg_device_L20,
315 &vreg_device_L21,
316 &vreg_device_L22,
317 &vreg_device_L23,
318 &vreg_device_L24,
319 &vreg_device_LVS1,
320 &vreg_device_LVS2,
321 &vreg_device_LVS3,
322};
323
324int msm_copper_stub_regulator_devices_len __devinitdata =
325 ARRAY_SIZE(msm_copper_stub_regulator_devices);