blob: d4b664362f420b57ff1c8b66717958be8ecfa42f [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -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#include <linux/regulator/gpio-regulator.h>
16
17#include "board-msm8960.h"
18
19#define VREG_CONSUMERS(_id) \
20 static struct regulator_consumer_supply vreg_consumers_##_id[]
21
22/*
23 * Consumer specific regulator names:
24 * regulator name consumer dev_name
25 */
26VREG_CONSUMERS(L1) = {
27 REGULATOR_SUPPLY("8921_l1", NULL),
28};
29VREG_CONSUMERS(L2) = {
30 REGULATOR_SUPPLY("8921_l2", NULL),
31 REGULATOR_SUPPLY("dsi_vdda", "mipi_dsi.1"),
32 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_camera_imx074.0"),
33 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_camera_ov2720.0"),
34};
35VREG_CONSUMERS(L3) = {
36 REGULATOR_SUPPLY("8921_l3", NULL),
37 REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"),
38};
39VREG_CONSUMERS(L4) = {
40 REGULATOR_SUPPLY("8921_l4", NULL),
41 REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"),
42 REGULATOR_SUPPLY("iris_vddxo", "wcnss_wlan.0"),
43};
44VREG_CONSUMERS(L5) = {
45 REGULATOR_SUPPLY("8921_l5", NULL),
46 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.1"),
47};
48VREG_CONSUMERS(L6) = {
49 REGULATOR_SUPPLY("8921_l6", NULL),
50 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.3"),
51};
52VREG_CONSUMERS(L7) = {
53 REGULATOR_SUPPLY("8921_l7", NULL),
54 REGULATOR_SUPPLY("sdc_vddp", "msm_sdcc.3"),
55};
56VREG_CONSUMERS(L8) = {
57 REGULATOR_SUPPLY("8921_l8", NULL),
58 REGULATOR_SUPPLY("dsi_vdc", "mipi_dsi.1"),
59};
60VREG_CONSUMERS(L9) = {
61 REGULATOR_SUPPLY("8921_l9", NULL),
62 REGULATOR_SUPPLY("vdd", "3-0024"),
63};
64VREG_CONSUMERS(L10) = {
65 REGULATOR_SUPPLY("8921_l10", NULL),
66 REGULATOR_SUPPLY("iris_vddpa", "wcnss_wlan.0"),
67
68};
69VREG_CONSUMERS(L11) = {
70 REGULATOR_SUPPLY("8921_l11", NULL),
71 REGULATOR_SUPPLY("cam_vana", "msm_camera_imx074.0"),
72 REGULATOR_SUPPLY("cam_vana", "msm_camera_ov2720.0"),
73};
74VREG_CONSUMERS(L12) = {
75 REGULATOR_SUPPLY("8921_l12", NULL),
76 REGULATOR_SUPPLY("cam_vdig", "msm_camera_imx074.0"),
77 REGULATOR_SUPPLY("cam_vdig", "msm_camera_ov2720.0"),
78};
79VREG_CONSUMERS(L14) = {
80 REGULATOR_SUPPLY("8921_l14", NULL),
81};
82VREG_CONSUMERS(L15) = {
83 REGULATOR_SUPPLY("8921_l15", NULL),
84};
85VREG_CONSUMERS(L16) = {
86 REGULATOR_SUPPLY("8921_l16", NULL),
87 REGULATOR_SUPPLY("cam_vaf", "msm_camera_imx074.0"),
88 REGULATOR_SUPPLY("cam_vaf", "msm_camera_ov2720.0"),
89};
90VREG_CONSUMERS(L17) = {
91 REGULATOR_SUPPLY("8921_l17", NULL),
92};
93VREG_CONSUMERS(L18) = {
94 REGULATOR_SUPPLY("8921_l18", NULL),
95};
96VREG_CONSUMERS(L21) = {
97 REGULATOR_SUPPLY("8921_l21", NULL),
98};
99VREG_CONSUMERS(L22) = {
100 REGULATOR_SUPPLY("8921_l22", NULL),
101};
102VREG_CONSUMERS(L23) = {
103 REGULATOR_SUPPLY("8921_l23", NULL),
104 REGULATOR_SUPPLY("dsi_vddio", "mipi_dsi.1"),
105 REGULATOR_SUPPLY("hdmi_avdd", "hdmi_msm.0"),
106};
107VREG_CONSUMERS(L24) = {
108 REGULATOR_SUPPLY("8921_l24", NULL),
109 REGULATOR_SUPPLY("riva_vddmx", "wcnss_wlan.0"),
110};
111VREG_CONSUMERS(L25) = {
112 REGULATOR_SUPPLY("8921_l25", NULL),
113 REGULATOR_SUPPLY("VDDD_CDC_D", "tabla-slim"),
114 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "tabla-slim"),
115};
116VREG_CONSUMERS(L26) = {
117 REGULATOR_SUPPLY("8921_l26", NULL),
118 REGULATOR_SUPPLY("lpass_q6", NULL),
119};
120VREG_CONSUMERS(L27) = {
121 REGULATOR_SUPPLY("8921_l27", NULL),
122 REGULATOR_SUPPLY("modem_sw_q6", NULL),
123};
124VREG_CONSUMERS(L28) = {
125 REGULATOR_SUPPLY("8921_l28", NULL),
126 REGULATOR_SUPPLY("modem_fw_q6", NULL),
127};
128VREG_CONSUMERS(L29) = {
129 REGULATOR_SUPPLY("8921_l29", NULL),
130};
131VREG_CONSUMERS(S1) = {
132 REGULATOR_SUPPLY("8921_s1", NULL),
133};
134VREG_CONSUMERS(S2) = {
135 REGULATOR_SUPPLY("8921_s2", NULL),
136 REGULATOR_SUPPLY("iris_vddrfa", "wcnss_wlan.0"),
137
138};
139VREG_CONSUMERS(S3) = {
140 REGULATOR_SUPPLY("8921_s3", NULL),
141 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_otg"),
142 REGULATOR_SUPPLY("riva_vddcx", "wcnss_wlan.0"),
143};
144VREG_CONSUMERS(S4) = {
145 REGULATOR_SUPPLY("8921_s4", NULL),
146 REGULATOR_SUPPLY("sdc_vccq", "msm_sdcc.1"),
147 REGULATOR_SUPPLY("riva_vddpx", "wcnss_wlan.0"),
148 REGULATOR_SUPPLY("hdmi_vcc", "hdmi_msm.0"),
149 REGULATOR_SUPPLY("VDDIO_CDC", "tabla-slim"),
150 REGULATOR_SUPPLY("CDC_VDD_CP", "tabla-slim"),
151 REGULATOR_SUPPLY("CDC_VDDA_TX", "tabla-slim"),
152 REGULATOR_SUPPLY("CDC_VDDA_RX", "tabla-slim"),
153};
154VREG_CONSUMERS(S5) = {
155 REGULATOR_SUPPLY("8921_s5", NULL),
156 REGULATOR_SUPPLY("krait0", NULL),
157};
158VREG_CONSUMERS(S6) = {
159 REGULATOR_SUPPLY("8921_s6", NULL),
160 REGULATOR_SUPPLY("krait1", NULL),
161};
162VREG_CONSUMERS(S7) = {
163 REGULATOR_SUPPLY("8921_s7", NULL),
164};
165VREG_CONSUMERS(S8) = {
166 REGULATOR_SUPPLY("8921_s8", NULL),
167};
168VREG_CONSUMERS(LVS1) = {
169 REGULATOR_SUPPLY("8921_lvs1", NULL),
170 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.4"),
171 REGULATOR_SUPPLY("iris_vddio", "wcnss_wlan.0"),
172};
173VREG_CONSUMERS(LVS2) = {
174 REGULATOR_SUPPLY("8921_lvs2", NULL),
175 REGULATOR_SUPPLY("iris_vdddig", "wcnss_wlan.0"),
176};
177VREG_CONSUMERS(LVS3) = {
178 REGULATOR_SUPPLY("8921_lvs3", NULL),
179};
180VREG_CONSUMERS(LVS4) = {
181 REGULATOR_SUPPLY("8921_lvs4", NULL),
182 REGULATOR_SUPPLY("vcc_i2c", "3-0024"),
183};
184VREG_CONSUMERS(LVS5) = {
185 REGULATOR_SUPPLY("8921_lvs5", NULL),
186 REGULATOR_SUPPLY("cam_vio", "msm_camera_imx074.0"),
187 REGULATOR_SUPPLY("cam_vio", "msm_camera_ov2720.0"),
188};
189VREG_CONSUMERS(LVS6) = {
190 REGULATOR_SUPPLY("8921_lvs6", NULL),
191 REGULATOR_SUPPLY("vdd_io", "spi0.0"),
192};
193VREG_CONSUMERS(LVS7) = {
194 REGULATOR_SUPPLY("8921_lvs7", NULL),
195};
196VREG_CONSUMERS(USB_OTG) = {
197 REGULATOR_SUPPLY("8921_usb_otg", NULL),
198 REGULATOR_SUPPLY("vbus_otg", "msm_otg"),
199};
200VREG_CONSUMERS(HDMI_MVS) = {
201 REGULATOR_SUPPLY("8921_hdmi_mvs", NULL),
202 REGULATOR_SUPPLY("hdmi_mvs", "hdmi_msm.0"),
203};
204VREG_CONSUMERS(NCP) = {
205 REGULATOR_SUPPLY("8921_ncp", NULL),
206};
207VREG_CONSUMERS(EXT_5V) = {
208 REGULATOR_SUPPLY("ext_5v", NULL),
209};
210VREG_CONSUMERS(EXT_L2) = {
211 REGULATOR_SUPPLY("ext_l2", NULL),
212 REGULATOR_SUPPLY("vdd_phy", "spi0.0"),
213};
214
215#define PM8921_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \
216 _pull_down, _always_on, _supply_regulator, \
217 _system_uA) \
218 { \
219 .init_data = { \
220 .constraints = { \
221 .valid_modes_mask = _modes, \
222 .valid_ops_mask = _ops, \
223 .min_uV = _min_uV, \
224 .max_uV = _max_uV, \
225 .input_uV = _max_uV, \
226 .apply_uV = _apply_uV, \
227 .always_on = _always_on, \
228 }, \
229 .num_consumer_supplies = \
230 ARRAY_SIZE(vreg_consumers_##_id), \
231 .consumer_supplies = vreg_consumers_##_id, \
232 .supply_regulator = _supply_regulator, \
233 }, \
234 .id = PM8921_VREG_ID_##_id, \
235 .pull_down_enable = _pull_down, \
236 .system_uA = _system_uA, \
237 }
238
239#define PM8921_VREG_INIT_LDO(_id, _always_on, _pull_down, _min_uV, _max_uV, \
240 _supply_regulator, _system_uA) \
241 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
242 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
243 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
244 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
245 _supply_regulator, _system_uA)
246
247#define PM8921_VREG_INIT_NLDO1200(_id, _always_on, _pull_down, _min_uV, \
248 _max_uV, _supply_regulator, _system_uA) \
249 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
250 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
251 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
252 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
253 _supply_regulator, _system_uA)
254
255#define PM8921_VREG_INIT_SMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
256 _supply_regulator, _system_uA) \
257 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
258 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
259 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
260 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
261 _supply_regulator, _system_uA)
262
263#define PM8921_VREG_INIT_FTSMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
264 _supply_regulator, _system_uA) \
265 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
266 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
267 | REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
268 _supply_regulator, _system_uA)
269
270#define PM8921_VREG_INIT_VS(_id, _always_on, _pull_down, _supply_regulator) \
271 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
272 _always_on, _supply_regulator, 0)
273
274#define PM8921_VREG_INIT_VS300(_id, _always_on, _pull_down, _supply_regulator) \
275 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
276 _always_on, _supply_regulator, 0)
277
278#define PM8921_VREG_INIT_NCP(_id, _always_on, _min_uV, _max_uV, \
279 _supply_regulator) \
280 PM8921_VREG_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE | \
281 REGULATOR_CHANGE_STATUS, 0, 0, _always_on, _supply_regulator, 0)
282
283/* Pin control initialization */
284#define PM8921_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
285 { \
286 .init_data = { \
287 .constraints = { \
288 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
289 .always_on = _always_on, \
290 }, \
291 .num_consumer_supplies = \
292 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
293 .consumer_supplies = vreg_consumers_##_id##_PC, \
294 .supply_regulator = _supply_regulator, \
295 }, \
296 .id = PM8921_VREG_ID_##_id##_PC, \
297 .pin_fn = PM8921_VREG_PIN_FN_##_pin_fn, \
298 .pin_ctrl = _pin_ctrl, \
299 }
300
301#define GPIO_VREG_INIT(_id, _reg_name, _gpio_label, _gpio) \
302 [GPIO_VREG_ID_##_id] = { \
303 .init_data = { \
304 .constraints = { \
305 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
306 }, \
307 .num_consumer_supplies = \
308 ARRAY_SIZE(vreg_consumers_##_id), \
309 .consumer_supplies = vreg_consumers_##_id, \
310 }, \
311 .regulator_name = _reg_name, \
312 .gpio_label = _gpio_label, \
313 .gpio = _gpio, \
314 }
315
316#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
317 { \
318 .constraints = { \
319 .name = _name, \
320 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, \
321 .min_uV = _min_uV, \
322 .max_uV = _max_uV, \
323 }, \
324 .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \
325 .consumer_supplies = vreg_consumers_##_id, \
326 }
327
328/* GPIO regulator constraints */
329struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] __devinitdata = {
330 GPIO_VREG_INIT(EXT_5V, "ext_5v", "ext_5v_en", PM8921_MPP_PM_TO_SYS(7)),
331 GPIO_VREG_INIT(EXT_L2, "ext_l2", "ext_l2_en", 91),
332};
333
334/* SAW regulator constraints */
335struct regulator_init_data msm_saw_regulator_pdata_s5 =
336 /* ID vreg_name min_uV max_uV */
337 SAW_VREG_INIT(S5, "8921_s5", 1050000, 1150000);
338struct regulator_init_data msm_saw_regulator_pdata_s6 =
339 SAW_VREG_INIT(S6, "8921_s6", 1050000, 1150000);
340
341/* PM8921 regulator constraints */
342struct pm8921_regulator_platform_data
343msm_pm8921_regulator_pdata[] __devinitdata = {
344 /* ID always_on pd min_uV max_uV supply sys_uA */
345 PM8921_VREG_INIT_SMPS(S1, 1, 1, 1225000, 1225000, NULL, 100000),
346 PM8921_VREG_INIT_SMPS(S2, 0, 1, 1300000, 1300000, NULL, 0),
347 PM8921_VREG_INIT_SMPS(S3, 1, 1, 1150000, 1150000, NULL, 100000),
348 PM8921_VREG_INIT_SMPS(S4, 1, 1, 1800000, 1800000, NULL, 100000),
349 PM8921_VREG_INIT_SMPS(S7, 0, 1, 1150000, 1150000, NULL, 100000),
350 PM8921_VREG_INIT_SMPS(S8, 0, 1, 2200000, 2200000, NULL, 100000),
351
352 PM8921_VREG_INIT_LDO(L1, 1, 1, 1050000, 1050000, "8921_s4", 0),
353 PM8921_VREG_INIT_LDO(L2, 0, 1, 1200000, 1200000, "8921_s4", 0),
354 PM8921_VREG_INIT_LDO(L3, 0, 1, 3075000, 3075000, NULL, 0),
355 PM8921_VREG_INIT_LDO(L4, 1, 1, 1800000, 1800000, NULL, 0),
356 PM8921_VREG_INIT_LDO(L5, 0, 1, 2950000, 2950000, NULL, 0),
357 PM8921_VREG_INIT_LDO(L6, 0, 1, 2950000, 2950000, NULL, 0),
358 PM8921_VREG_INIT_LDO(L7, 1, 1, 1850000, 2950000, NULL, 0),
359 PM8921_VREG_INIT_LDO(L8, 0, 1, 2800000, 3000000, NULL, 0),
360 PM8921_VREG_INIT_LDO(L9, 0, 1, 2850000, 2850000, NULL, 0),
361 PM8921_VREG_INIT_LDO(L10, 0, 1, 2900000, 2900000, NULL, 0),
362 PM8921_VREG_INIT_LDO(L11, 0, 1, 2850000, 2850000, NULL, 0),
363 PM8921_VREG_INIT_LDO(L12, 0, 1, 1200000, 1200000, "8921_s4", 0),
364 PM8921_VREG_INIT_LDO(L14, 0, 1, 1800000, 1800000, NULL, 0),
365 PM8921_VREG_INIT_LDO(L15, 0, 1, 1800000, 2950000, NULL, 0),
366 PM8921_VREG_INIT_LDO(L16, 0, 1, 2800000, 2800000, NULL, 0),
367 PM8921_VREG_INIT_LDO(L17, 0, 1, 1800000, 2950000, NULL, 0),
368 PM8921_VREG_INIT_LDO(L18, 0, 1, 1300000, 1300000, "8921_s4", 0),
369 PM8921_VREG_INIT_LDO(L21, 0, 1, 1900000, 1900000, "8921_s8", 0),
370 PM8921_VREG_INIT_LDO(L22, 0, 1, 2750000, 2750000, NULL, 0),
371 PM8921_VREG_INIT_LDO(L23, 1, 1, 1800000, 1800000, "8921_s8", 0),
372 PM8921_VREG_INIT_NLDO1200(L24, 1, 1, 1150000, 1150000, "8921_s1",
373 10000),
374 PM8921_VREG_INIT_NLDO1200(L25, 1, 1, 1225000, 1225000, "8921_s1", 0),
375 PM8921_VREG_INIT_NLDO1200(L26, 0, 1, 1050000, 1050000, "8921_s7", 0),
376 PM8921_VREG_INIT_NLDO1200(L27, 0, 1, 1050000, 1050000, "8921_s7", 0),
377 PM8921_VREG_INIT_NLDO1200(L28, 0, 1, 1050000, 1050000, "8921_s7", 0),
378 PM8921_VREG_INIT_LDO(L29, 0, 1, 2050000, 2100000, "8921_s8", 0),
379
380 PM8921_VREG_INIT_VS(LVS1, 0, 1, "8921_s4"),
381 PM8921_VREG_INIT_VS300(LVS2, 0, 1, "8921_s1"),
382 PM8921_VREG_INIT_VS(LVS3, 0, 1, "8921_s4"),
383 PM8921_VREG_INIT_VS(LVS4, 0, 1, "8921_s4"),
384 PM8921_VREG_INIT_VS(LVS5, 0, 1, "8921_s4"),
385 PM8921_VREG_INIT_VS(LVS6, 0, 1, "8921_s4"),
386 PM8921_VREG_INIT_VS(LVS7, 0, 1, "8921_s4"),
387
388 PM8921_VREG_INIT_VS300(USB_OTG, 0, 1, "ext_5v"),
389 PM8921_VREG_INIT_VS300(HDMI_MVS, 0, 1, "ext_5v"),
390
391 PM8921_VREG_INIT_NCP(NCP, 0, 1800000, 1800000, "8921_l6"),
392};
393
394int msm_pm8921_regulator_pdata_len __devinitdata =
395 ARRAY_SIZE(msm_pm8921_regulator_pdata);