blob: 7c8c9d9a1a9c321bbde60d59414ae6f5b08332a8 [file] [log] [blame]
Jay Chokshiea67c622011-07-29 17:12:26 -07001/*
2 * Copyright (c) 2011, 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/regulator/pm8921-regulator.h>
15
16#include "board-apq8064.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("8921_l1", NULL),
27};
28VREG_CONSUMERS(L2) = {
29 REGULATOR_SUPPLY("8921_l2", NULL),
30};
31VREG_CONSUMERS(L3) = {
32 REGULATOR_SUPPLY("8921_l3", NULL),
Hemant Kumar6ddad592011-08-03 19:31:56 -070033 REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"),
Jay Chokshiea67c622011-07-29 17:12:26 -070034};
35VREG_CONSUMERS(L4) = {
36 REGULATOR_SUPPLY("8921_l4", NULL),
Hemant Kumar6ddad592011-08-03 19:31:56 -070037 REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"),
Jay Chokshiea67c622011-07-29 17:12:26 -070038};
39VREG_CONSUMERS(L5) = {
40 REGULATOR_SUPPLY("8921_l5", NULL),
41};
42VREG_CONSUMERS(L6) = {
43 REGULATOR_SUPPLY("8921_l6", NULL),
44};
45VREG_CONSUMERS(L7) = {
46 REGULATOR_SUPPLY("8921_l7", NULL),
47};
48VREG_CONSUMERS(L8) = {
49 REGULATOR_SUPPLY("8921_l8", NULL),
50};
51VREG_CONSUMERS(L9) = {
52 REGULATOR_SUPPLY("8921_l9", NULL),
53};
54VREG_CONSUMERS(L10) = {
55 REGULATOR_SUPPLY("8921_l10", NULL),
56};
57VREG_CONSUMERS(L11) = {
58 REGULATOR_SUPPLY("8921_l11", NULL),
59};
60VREG_CONSUMERS(L12) = {
61 REGULATOR_SUPPLY("8921_l12", NULL),
62};
63VREG_CONSUMERS(L14) = {
64 REGULATOR_SUPPLY("8921_l14", NULL),
65};
66VREG_CONSUMERS(L15) = {
67 REGULATOR_SUPPLY("8921_l15", NULL),
68};
69VREG_CONSUMERS(L16) = {
70 REGULATOR_SUPPLY("8921_l16", NULL),
71};
72VREG_CONSUMERS(L17) = {
73 REGULATOR_SUPPLY("8921_l17", NULL),
74};
75VREG_CONSUMERS(L18) = {
76 REGULATOR_SUPPLY("8921_l18", NULL),
77};
78VREG_CONSUMERS(L22) = {
79 REGULATOR_SUPPLY("8921_l22", NULL),
80};
81VREG_CONSUMERS(L23) = {
82 REGULATOR_SUPPLY("8921_l23", NULL),
83};
84VREG_CONSUMERS(L24) = {
85 REGULATOR_SUPPLY("8921_l24", NULL),
86};
87VREG_CONSUMERS(L25) = {
88 REGULATOR_SUPPLY("8921_l25", NULL),
89};
90VREG_CONSUMERS(L26) = {
91 REGULATOR_SUPPLY("8921_l26", NULL),
92};
93VREG_CONSUMERS(L27) = {
94 REGULATOR_SUPPLY("8921_l27", NULL),
95};
96VREG_CONSUMERS(L28) = {
97 REGULATOR_SUPPLY("8921_l28", NULL),
98};
99VREG_CONSUMERS(S1) = {
100 REGULATOR_SUPPLY("8921_s1", NULL),
101};
102VREG_CONSUMERS(S2) = {
103 REGULATOR_SUPPLY("8921_s2", NULL),
104};
105VREG_CONSUMERS(S3) = {
106 REGULATOR_SUPPLY("8921_s3", NULL),
Hemant Kumar6ddad592011-08-03 19:31:56 -0700107 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_otg"),
Jay Chokshiea67c622011-07-29 17:12:26 -0700108};
109VREG_CONSUMERS(S4) = {
110 REGULATOR_SUPPLY("8921_s4", NULL),
111};
112VREG_CONSUMERS(S5) = {
113 REGULATOR_SUPPLY("8921_s5", NULL),
114};
115VREG_CONSUMERS(S6) = {
116 REGULATOR_SUPPLY("8921_s6", NULL),
117};
118VREG_CONSUMERS(S7) = {
119 REGULATOR_SUPPLY("8921_s7", NULL),
120};
121VREG_CONSUMERS(LVS1) = {
122 REGULATOR_SUPPLY("8921_lvs1", NULL),
123};
124VREG_CONSUMERS(LVS2) = {
125 REGULATOR_SUPPLY("8921_lvs2", NULL),
126};
127VREG_CONSUMERS(LVS3) = {
128 REGULATOR_SUPPLY("8921_lvs3", NULL),
129};
130VREG_CONSUMERS(LVS4) = {
131 REGULATOR_SUPPLY("8921_lvs4", NULL),
132};
133VREG_CONSUMERS(LVS5) = {
134 REGULATOR_SUPPLY("8921_lvs5", NULL),
135};
136VREG_CONSUMERS(LVS6) = {
137 REGULATOR_SUPPLY("8921_lvs6", NULL),
138};
139VREG_CONSUMERS(LVS7) = {
140 REGULATOR_SUPPLY("8921_lvs7", NULL),
141};
142VREG_CONSUMERS(USB_OTG) = {
143 REGULATOR_SUPPLY("8921_usb_otg", NULL),
144};
145VREG_CONSUMERS(HDMI_MVS) = {
146 REGULATOR_SUPPLY("8921_hdmi_mvs", NULL),
147};
148VREG_CONSUMERS(NCP) = {
149 REGULATOR_SUPPLY("8921_ncp", NULL),
150};
151
152#define PM8921_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \
153 _pull_down, _always_on, _supply_regulator, \
154 _system_uA, _enable_time) \
155 { \
156 .init_data = { \
157 .constraints = { \
158 .valid_modes_mask = _modes, \
159 .valid_ops_mask = _ops, \
160 .min_uV = _min_uV, \
161 .max_uV = _max_uV, \
162 .input_uV = _max_uV, \
163 .apply_uV = _apply_uV, \
164 .always_on = _always_on, \
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 = PM8921_VREG_ID_##_id, \
172 .pull_down_enable = _pull_down, \
173 .system_uA = _system_uA, \
174 .enable_time = _enable_time, \
175 }
176
177#define PM8921_VREG_INIT_LDO(_id, _always_on, _pull_down, _min_uV, _max_uV, \
178 _enable_time, _supply_regulator, _system_uA) \
179 PM8921_VREG_INIT(_id, _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)
184
185#define PM8921_VREG_INIT_NLDO1200(_id, _always_on, _pull_down, _min_uV, \
186 _max_uV, _enable_time, _supply_regulator, _system_uA) \
187 PM8921_VREG_INIT(_id, _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)
192
193#define PM8921_VREG_INIT_SMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
194 _enable_time, _supply_regulator, _system_uA) \
195 PM8921_VREG_INIT(_id, _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)
200
201#define PM8921_VREG_INIT_FTSMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
202 _enable_time, _supply_regulator, _system_uA) \
203 PM8921_VREG_INIT(_id, _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)
207
208#define PM8921_VREG_INIT_VS(_id, _always_on, _pull_down, _enable_time, \
209 _supply_regulator) \
210 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
211 _always_on, _supply_regulator, 0, _enable_time)
212
213#define PM8921_VREG_INIT_VS300(_id, _always_on, _pull_down, _enable_time, \
214 _supply_regulator) \
215 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
216 _always_on, _supply_regulator, 0, _enable_time)
217
218#define PM8921_VREG_INIT_NCP(_id, _always_on, _min_uV, _max_uV, _enable_time, \
219 _supply_regulator) \
220 PM8921_VREG_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE | \
221 REGULATOR_CHANGE_STATUS, 0, 0, _always_on, _supply_regulator, \
222 0, _enable_time)
223
224/* Pin control initialization */
225#define PM8921_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
226 { \
227 .init_data = { \
228 .constraints = { \
229 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
230 .always_on = _always_on, \
231 }, \
232 .num_consumer_supplies = \
233 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
234 .consumer_supplies = vreg_consumers_##_id##_PC, \
235 .supply_regulator = _supply_regulator, \
236 }, \
237 .id = PM8921_VREG_ID_##_id##_PC, \
238 .pin_fn = PM8921_VREG_PIN_FN_##_pin_fn, \
239 .pin_ctrl = _pin_ctrl, \
240 }
241
242#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
243 { \
244 .constraints = { \
245 .name = _name, \
246 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, \
247 .min_uV = _min_uV, \
248 .max_uV = _max_uV, \
249 }, \
250 .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \
251 .consumer_supplies = vreg_consumers_##_id, \
252 }
253
254/* SAW regulator constraints */
255struct regulator_init_data msm8064_saw_regulator_pdata_s5 =
256 /* ID vreg_name min_uV max_uV */
257 SAW_VREG_INIT(S5, "8921_s5", 1050000, 1150000);
258struct regulator_init_data msm8064_saw_regulator_pdata_s6 =
259 SAW_VREG_INIT(S6, "8921_s6", 1050000, 1150000);
260
261/* PM8921 regulator constraints */
262struct pm8921_regulator_platform_data
263msm8064_pm8921_regulator_pdata[] __devinitdata = {
264 /* ID a_on pd min_uV max_uV en_t supply sys_uA */
265 PM8921_VREG_INIT_SMPS(S1, 1, 1, 1225000, 1225000, 500, NULL, 100000),
266 PM8921_VREG_INIT_SMPS(S2, 0, 1, 1300000, 1300000, 500, NULL, 0),
267 PM8921_VREG_INIT_SMPS(S3, 1, 1, 1150000, 1150000, 500, NULL, 100000),
268 PM8921_VREG_INIT_SMPS(S4, 1, 1, 1800000, 1800000, 500, NULL, 100000),
269 PM8921_VREG_INIT_SMPS(S7, 0, 1, 1200000, 1200000, 500, NULL, 100000),
270
271 PM8921_VREG_INIT_LDO(L1, 1, 1, 1100000, 1100000, 200, "8921_s4", 0),
272 PM8921_VREG_INIT_LDO(L2, 0, 1, 1200000, 1200000, 200, "8921_s4", 0),
273 PM8921_VREG_INIT_LDO(L3, 0, 1, 3075000, 3075000, 200, NULL, 0),
274 PM8921_VREG_INIT_LDO(L4, 1, 1, 1800000, 1800000, 200, NULL, 0),
275 PM8921_VREG_INIT_LDO(L5, 0, 1, 2950000, 2950000, 200, NULL, 0),
276 PM8921_VREG_INIT_LDO(L6, 0, 1, 2950000, 2950000, 200, NULL, 0),
277 PM8921_VREG_INIT_LDO(L7, 1, 1, 1850000, 2950000, 200, NULL, 0),
278 PM8921_VREG_INIT_LDO(L8, 0, 1, 2800000, 2800000, 200, NULL, 0),
279 PM8921_VREG_INIT_LDO(L9, 0, 1, 2850000, 2850000, 200, NULL, 0),
280 PM8921_VREG_INIT_LDO(L10, 0, 1, 2900000, 2900000, 200, NULL, 0),
281 PM8921_VREG_INIT_LDO(L11, 0, 1, 3000000, 3000000, 200, NULL, 0),
282 PM8921_VREG_INIT_LDO(L12, 0, 1, 1200000, 1200000, 200, "8921_s4", 0),
283 PM8921_VREG_INIT_LDO(L14, 0, 1, 1800000, 1800000, 200, NULL, 0),
284 PM8921_VREG_INIT_LDO(L15, 0, 1, 1800000, 2950000, 200, NULL, 0),
285 PM8921_VREG_INIT_LDO(L16, 0, 1, 2800000, 2800000, 200, NULL, 0),
286 PM8921_VREG_INIT_LDO(L17, 0, 1, 2000000, 2000000, 200, NULL, 0),
287 PM8921_VREG_INIT_LDO(L18, 0, 1, 1300000, 1800000, 200, "8921_s4", 0),
288 PM8921_VREG_INIT_LDO(L22, 0, 1, 2600000, 2600000, 200, NULL, 0),
289 PM8921_VREG_INIT_LDO(L23, 0, 1, 1800000, 1800000, 200, NULL, 0),
290 PM8921_VREG_INIT_NLDO1200(L24, 1, 1, 1150000, 1150000, 200, "8921_s1",
291 10000),
292 PM8921_VREG_INIT_NLDO1200(L25, 1, 1, 1225000, 1225000, 200, "8921_s1",
293 0),
294 PM8921_VREG_INIT_NLDO1200(L26, 0, 1, 1050000, 1050000, 200, "8921_s7",
295 0),
296 PM8921_VREG_INIT_NLDO1200(L27, 0, 1, 1000000, 1000000, 200, "8921_s7",
297 0),
298 PM8921_VREG_INIT_NLDO1200(L28, 0, 1, 1050000, 1050000, 200, "8921_s7",
299 0),
300
301 /* ID always_on pd en_t supply */
302 PM8921_VREG_INIT_VS(LVS1, 0, 1, 0, "8921_s4"),
303 PM8921_VREG_INIT_VS300(LVS2, 0, 1, 0, "8921_s1"),
304 PM8921_VREG_INIT_VS(LVS3, 0, 1, 0, "8921_s4"),
305 PM8921_VREG_INIT_VS(LVS4, 0, 1, 0, "8921_s4"),
306 PM8921_VREG_INIT_VS(LVS5, 0, 1, 0, "8921_s4"),
307 PM8921_VREG_INIT_VS(LVS6, 0, 1, 0, "8921_s4"),
308 PM8921_VREG_INIT_VS(LVS7, 1, 1, 0, "8921_s4"),
309
310 PM8921_VREG_INIT_VS300(USB_OTG, 0, 1, 0, NULL),
311 PM8921_VREG_INIT_VS300(HDMI_MVS, 0, 1, 0, NULL),
312
313 /* ID always_on min_uV max_uV en_t supply */
314 PM8921_VREG_INIT_NCP(NCP, 0, 1800000, 1800000, 200, "8921_l6"),
315};
316
317int msm8064_pm8921_regulator_pdata_len __devinitdata =
318 ARRAY_SIZE(msm8064_pm8921_regulator_pdata);