blob: da2a1246c43762eac42ac0d131907935de7be0df [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>
David Collins26f05562011-06-20 09:56:28 -070016#include <mach/rpm-regulator.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017
18#include "board-msm8960.h"
19
20#define VREG_CONSUMERS(_id) \
21 static struct regulator_consumer_supply vreg_consumers_##_id[]
22
23/*
24 * Consumer specific regulator names:
25 * regulator name consumer dev_name
26 */
27VREG_CONSUMERS(L1) = {
28 REGULATOR_SUPPLY("8921_l1", NULL),
29};
30VREG_CONSUMERS(L2) = {
31 REGULATOR_SUPPLY("8921_l2", NULL),
32 REGULATOR_SUPPLY("dsi_vdda", "mipi_dsi.1"),
33 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_camera_imx074.0"),
34 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_camera_ov2720.0"),
Kevin Chandfecce22011-07-13 10:52:41 -070035 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_camera_qs_mt9p017.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036};
37VREG_CONSUMERS(L3) = {
38 REGULATOR_SUPPLY("8921_l3", NULL),
39 REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"),
40};
41VREG_CONSUMERS(L4) = {
42 REGULATOR_SUPPLY("8921_l4", NULL),
43 REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"),
44 REGULATOR_SUPPLY("iris_vddxo", "wcnss_wlan.0"),
45};
46VREG_CONSUMERS(L5) = {
47 REGULATOR_SUPPLY("8921_l5", NULL),
48 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.1"),
49};
50VREG_CONSUMERS(L6) = {
51 REGULATOR_SUPPLY("8921_l6", NULL),
52 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.3"),
53};
54VREG_CONSUMERS(L7) = {
55 REGULATOR_SUPPLY("8921_l7", NULL),
56 REGULATOR_SUPPLY("sdc_vddp", "msm_sdcc.3"),
57};
58VREG_CONSUMERS(L8) = {
59 REGULATOR_SUPPLY("8921_l8", NULL),
60 REGULATOR_SUPPLY("dsi_vdc", "mipi_dsi.1"),
61};
62VREG_CONSUMERS(L9) = {
63 REGULATOR_SUPPLY("8921_l9", NULL),
64 REGULATOR_SUPPLY("vdd", "3-0024"),
65};
66VREG_CONSUMERS(L10) = {
67 REGULATOR_SUPPLY("8921_l10", NULL),
68 REGULATOR_SUPPLY("iris_vddpa", "wcnss_wlan.0"),
69
70};
71VREG_CONSUMERS(L11) = {
72 REGULATOR_SUPPLY("8921_l11", NULL),
73 REGULATOR_SUPPLY("cam_vana", "msm_camera_imx074.0"),
74 REGULATOR_SUPPLY("cam_vana", "msm_camera_ov2720.0"),
Kevin Chandfecce22011-07-13 10:52:41 -070075 REGULATOR_SUPPLY("cam_vana", "msm_camera_qs_mt9p017.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076};
77VREG_CONSUMERS(L12) = {
78 REGULATOR_SUPPLY("8921_l12", NULL),
79 REGULATOR_SUPPLY("cam_vdig", "msm_camera_imx074.0"),
80 REGULATOR_SUPPLY("cam_vdig", "msm_camera_ov2720.0"),
Kevin Chandfecce22011-07-13 10:52:41 -070081 REGULATOR_SUPPLY("cam_vdig", "msm_camera_qs_mt9p017.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082};
83VREG_CONSUMERS(L14) = {
84 REGULATOR_SUPPLY("8921_l14", NULL),
85};
86VREG_CONSUMERS(L15) = {
87 REGULATOR_SUPPLY("8921_l15", NULL),
88};
89VREG_CONSUMERS(L16) = {
90 REGULATOR_SUPPLY("8921_l16", NULL),
91 REGULATOR_SUPPLY("cam_vaf", "msm_camera_imx074.0"),
92 REGULATOR_SUPPLY("cam_vaf", "msm_camera_ov2720.0"),
Kevin Chandfecce22011-07-13 10:52:41 -070093 REGULATOR_SUPPLY("cam_vaf", "msm_camera_qs_mt9p017.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094};
95VREG_CONSUMERS(L17) = {
96 REGULATOR_SUPPLY("8921_l17", NULL),
97};
98VREG_CONSUMERS(L18) = {
99 REGULATOR_SUPPLY("8921_l18", NULL),
100};
101VREG_CONSUMERS(L21) = {
102 REGULATOR_SUPPLY("8921_l21", NULL),
103};
104VREG_CONSUMERS(L22) = {
105 REGULATOR_SUPPLY("8921_l22", NULL),
106};
107VREG_CONSUMERS(L23) = {
108 REGULATOR_SUPPLY("8921_l23", NULL),
109 REGULATOR_SUPPLY("dsi_vddio", "mipi_dsi.1"),
110 REGULATOR_SUPPLY("hdmi_avdd", "hdmi_msm.0"),
111};
112VREG_CONSUMERS(L24) = {
113 REGULATOR_SUPPLY("8921_l24", NULL),
114 REGULATOR_SUPPLY("riva_vddmx", "wcnss_wlan.0"),
115};
116VREG_CONSUMERS(L25) = {
117 REGULATOR_SUPPLY("8921_l25", NULL),
118 REGULATOR_SUPPLY("VDDD_CDC_D", "tabla-slim"),
119 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "tabla-slim"),
120};
121VREG_CONSUMERS(L26) = {
122 REGULATOR_SUPPLY("8921_l26", NULL),
Matt Wagantall0b2f9822011-07-12 20:11:28 -0700123 REGULATOR_SUPPLY("q6_lpass", NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700124};
125VREG_CONSUMERS(L27) = {
126 REGULATOR_SUPPLY("8921_l27", NULL),
Matt Wagantall0b2f9822011-07-12 20:11:28 -0700127 REGULATOR_SUPPLY("q6_modem_sw", NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700128};
129VREG_CONSUMERS(L28) = {
130 REGULATOR_SUPPLY("8921_l28", NULL),
Matt Wagantall0b2f9822011-07-12 20:11:28 -0700131 REGULATOR_SUPPLY("q6_modem_fw", NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700132};
133VREG_CONSUMERS(L29) = {
134 REGULATOR_SUPPLY("8921_l29", NULL),
135};
136VREG_CONSUMERS(S1) = {
137 REGULATOR_SUPPLY("8921_s1", NULL),
138};
139VREG_CONSUMERS(S2) = {
140 REGULATOR_SUPPLY("8921_s2", NULL),
141 REGULATOR_SUPPLY("iris_vddrfa", "wcnss_wlan.0"),
142
143};
144VREG_CONSUMERS(S3) = {
145 REGULATOR_SUPPLY("8921_s3", NULL),
146 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_otg"),
147 REGULATOR_SUPPLY("riva_vddcx", "wcnss_wlan.0"),
148};
149VREG_CONSUMERS(S4) = {
150 REGULATOR_SUPPLY("8921_s4", NULL),
151 REGULATOR_SUPPLY("sdc_vccq", "msm_sdcc.1"),
152 REGULATOR_SUPPLY("riva_vddpx", "wcnss_wlan.0"),
153 REGULATOR_SUPPLY("hdmi_vcc", "hdmi_msm.0"),
154 REGULATOR_SUPPLY("VDDIO_CDC", "tabla-slim"),
155 REGULATOR_SUPPLY("CDC_VDD_CP", "tabla-slim"),
156 REGULATOR_SUPPLY("CDC_VDDA_TX", "tabla-slim"),
157 REGULATOR_SUPPLY("CDC_VDDA_RX", "tabla-slim"),
158};
159VREG_CONSUMERS(S5) = {
160 REGULATOR_SUPPLY("8921_s5", NULL),
161 REGULATOR_SUPPLY("krait0", NULL),
162};
163VREG_CONSUMERS(S6) = {
164 REGULATOR_SUPPLY("8921_s6", NULL),
165 REGULATOR_SUPPLY("krait1", NULL),
166};
167VREG_CONSUMERS(S7) = {
168 REGULATOR_SUPPLY("8921_s7", NULL),
169};
170VREG_CONSUMERS(S8) = {
171 REGULATOR_SUPPLY("8921_s8", NULL),
172};
173VREG_CONSUMERS(LVS1) = {
174 REGULATOR_SUPPLY("8921_lvs1", NULL),
175 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.4"),
176 REGULATOR_SUPPLY("iris_vddio", "wcnss_wlan.0"),
177};
178VREG_CONSUMERS(LVS2) = {
179 REGULATOR_SUPPLY("8921_lvs2", NULL),
180 REGULATOR_SUPPLY("iris_vdddig", "wcnss_wlan.0"),
181};
182VREG_CONSUMERS(LVS3) = {
183 REGULATOR_SUPPLY("8921_lvs3", NULL),
184};
185VREG_CONSUMERS(LVS4) = {
186 REGULATOR_SUPPLY("8921_lvs4", NULL),
187 REGULATOR_SUPPLY("vcc_i2c", "3-0024"),
188};
189VREG_CONSUMERS(LVS5) = {
190 REGULATOR_SUPPLY("8921_lvs5", NULL),
191 REGULATOR_SUPPLY("cam_vio", "msm_camera_imx074.0"),
192 REGULATOR_SUPPLY("cam_vio", "msm_camera_ov2720.0"),
Kevin Chandfecce22011-07-13 10:52:41 -0700193 REGULATOR_SUPPLY("cam_vio", "msm_camera_qs_mt9p017.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700194};
195VREG_CONSUMERS(LVS6) = {
196 REGULATOR_SUPPLY("8921_lvs6", NULL),
197 REGULATOR_SUPPLY("vdd_io", "spi0.0"),
198};
199VREG_CONSUMERS(LVS7) = {
200 REGULATOR_SUPPLY("8921_lvs7", NULL),
201};
202VREG_CONSUMERS(USB_OTG) = {
203 REGULATOR_SUPPLY("8921_usb_otg", NULL),
204 REGULATOR_SUPPLY("vbus_otg", "msm_otg"),
205};
206VREG_CONSUMERS(HDMI_MVS) = {
207 REGULATOR_SUPPLY("8921_hdmi_mvs", NULL),
208 REGULATOR_SUPPLY("hdmi_mvs", "hdmi_msm.0"),
209};
210VREG_CONSUMERS(NCP) = {
211 REGULATOR_SUPPLY("8921_ncp", NULL),
212};
213VREG_CONSUMERS(EXT_5V) = {
214 REGULATOR_SUPPLY("ext_5v", NULL),
215};
216VREG_CONSUMERS(EXT_L2) = {
217 REGULATOR_SUPPLY("ext_l2", NULL),
218 REGULATOR_SUPPLY("vdd_phy", "spi0.0"),
219};
David Collinsb10be1d2011-09-02 10:29:31 -0700220VREG_CONSUMERS(EXT_3P3V) = {
221 REGULATOR_SUPPLY("ext_3p3v", NULL),
222};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700223
224#define PM8921_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \
225 _pull_down, _always_on, _supply_regulator, \
David Collins43176762011-07-26 15:33:38 -0700226 _system_uA, _enable_time) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700227 { \
228 .init_data = { \
229 .constraints = { \
230 .valid_modes_mask = _modes, \
231 .valid_ops_mask = _ops, \
232 .min_uV = _min_uV, \
233 .max_uV = _max_uV, \
234 .input_uV = _max_uV, \
235 .apply_uV = _apply_uV, \
236 .always_on = _always_on, \
237 }, \
238 .num_consumer_supplies = \
239 ARRAY_SIZE(vreg_consumers_##_id), \
240 .consumer_supplies = vreg_consumers_##_id, \
241 .supply_regulator = _supply_regulator, \
242 }, \
243 .id = PM8921_VREG_ID_##_id, \
244 .pull_down_enable = _pull_down, \
245 .system_uA = _system_uA, \
David Collins43176762011-07-26 15:33:38 -0700246 .enable_time = _enable_time, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700247 }
248
249#define PM8921_VREG_INIT_LDO(_id, _always_on, _pull_down, _min_uV, _max_uV, \
David Collins43176762011-07-26 15:33:38 -0700250 _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700251 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
252 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
253 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
254 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700255 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700256
257#define PM8921_VREG_INIT_NLDO1200(_id, _always_on, _pull_down, _min_uV, \
David Collins43176762011-07-26 15:33:38 -0700258 _max_uV, _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700259 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
260 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
261 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
262 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700263 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700264
265#define PM8921_VREG_INIT_SMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
David Collins43176762011-07-26 15:33:38 -0700266 _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700267 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
268 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
269 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
270 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700271 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700272
273#define PM8921_VREG_INIT_FTSMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
David Collins43176762011-07-26 15:33:38 -0700274 _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700275 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
276 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
277 | REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700278 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700279
David Collins43176762011-07-26 15:33:38 -0700280#define PM8921_VREG_INIT_VS(_id, _always_on, _pull_down, _enable_time, \
281 _supply_regulator) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700282 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
David Collins43176762011-07-26 15:33:38 -0700283 _always_on, _supply_regulator, 0, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700284
David Collins43176762011-07-26 15:33:38 -0700285#define PM8921_VREG_INIT_VS300(_id, _always_on, _pull_down, _enable_time, \
286 _supply_regulator) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700287 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
David Collins43176762011-07-26 15:33:38 -0700288 _always_on, _supply_regulator, 0, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700289
David Collins43176762011-07-26 15:33:38 -0700290#define PM8921_VREG_INIT_NCP(_id, _always_on, _min_uV, _max_uV, _enable_time, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700291 _supply_regulator) \
292 PM8921_VREG_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE | \
David Collins43176762011-07-26 15:33:38 -0700293 REGULATOR_CHANGE_STATUS, 0, 0, _always_on, _supply_regulator, \
294 0, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700295
296/* Pin control initialization */
297#define PM8921_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
298 { \
299 .init_data = { \
300 .constraints = { \
301 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
302 .always_on = _always_on, \
303 }, \
304 .num_consumer_supplies = \
305 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
306 .consumer_supplies = vreg_consumers_##_id##_PC, \
307 .supply_regulator = _supply_regulator, \
308 }, \
309 .id = PM8921_VREG_ID_##_id##_PC, \
310 .pin_fn = PM8921_VREG_PIN_FN_##_pin_fn, \
311 .pin_ctrl = _pin_ctrl, \
312 }
313
314#define GPIO_VREG_INIT(_id, _reg_name, _gpio_label, _gpio) \
315 [GPIO_VREG_ID_##_id] = { \
316 .init_data = { \
317 .constraints = { \
318 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
319 }, \
320 .num_consumer_supplies = \
321 ARRAY_SIZE(vreg_consumers_##_id), \
322 .consumer_supplies = vreg_consumers_##_id, \
323 }, \
324 .regulator_name = _reg_name, \
325 .gpio_label = _gpio_label, \
326 .gpio = _gpio, \
327 }
328
329#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
330 { \
331 .constraints = { \
332 .name = _name, \
333 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, \
334 .min_uV = _min_uV, \
335 .max_uV = _max_uV, \
336 }, \
337 .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \
338 .consumer_supplies = vreg_consumers_##_id, \
339 }
340
David Collins26f05562011-06-20 09:56:28 -0700341#define RPM_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, _default_uV, \
342 _peak_uA, _avg_uA, _pull_down, _pin_ctrl, _freq, _pin_fn, \
343 _force_mode, _power_mode, _state, _sleep_selectable, \
344 _always_on, _supply_regulator, _system_uA) \
345 { \
346 .init_data = { \
347 .constraints = { \
348 .valid_modes_mask = _modes, \
349 .valid_ops_mask = _ops, \
350 .min_uV = _min_uV, \
351 .max_uV = _max_uV, \
352 .input_uV = _min_uV, \
353 .apply_uV = _apply_uV, \
354 .always_on = _always_on, \
355 }, \
356 .num_consumer_supplies = \
357 ARRAY_SIZE(vreg_consumers_##_id), \
358 .consumer_supplies = vreg_consumers_##_id, \
359 .supply_regulator = _supply_regulator, \
360 }, \
361 .id = RPM_VREG_ID_PM8921_##_id, \
362 .default_uV = _default_uV, \
363 .peak_uA = _peak_uA, \
364 .avg_uA = _avg_uA, \
365 .pull_down_enable = _pull_down, \
366 .pin_ctrl = _pin_ctrl, \
367 .freq = RPM_VREG_FREQ_##_freq, \
368 .pin_fn = _pin_fn, \
369 .force_mode = _force_mode, \
370 .power_mode = _power_mode, \
371 .state = _state, \
372 .sleep_selectable = _sleep_selectable, \
373 .system_uA = _system_uA, \
374 }
375
376#define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
377 _supply_regulator, _system_uA, _init_peak_uA) \
378 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
379 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
380 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
381 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _init_peak_uA, 0, _pd, \
382 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_NONE, \
383 RPM_VREG_FORCE_MODE_NONE, RPM_VREG_POWER_MODE_PWM, \
384 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
385 _supply_regulator, _system_uA)
386
387#define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
388 _supply_regulator, _system_uA, _freq) \
389 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
390 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
391 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
392 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _system_uA, 0, _pd, \
393 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_NONE, \
394 RPM_VREG_FORCE_MODE_NONE, RPM_VREG_POWER_MODE_PWM, \
395 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
396 _supply_regulator, _system_uA)
397
398#define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \
399 RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \
400 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_NONE, \
401 RPM_VREG_FORCE_MODE_NONE, RPM_VREG_POWER_MODE_PWM, \
402 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
403 _supply_regulator, 0)
404
405#define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
406 _supply_regulator, _freq) \
407 RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
408 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \
409 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_NONE, \
410 RPM_VREG_FORCE_MODE_NONE, RPM_VREG_POWER_MODE_PWM, \
411 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
412 _supply_regulator, 0)
413
414/* Pin control initialization */
415#define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
416 { \
417 .init_data = { \
418 .constraints = { \
419 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
420 .always_on = _always_on, \
421 }, \
422 .num_consumer_supplies = \
423 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
424 .consumer_supplies = vreg_consumers_##_id##_PC, \
425 .supply_regulator = _supply_regulator, \
426 }, \
427 .id = RPM_VREG_ID_PM8921_##_id##_PC, \
428 .pin_fn = RPM_VREG_PIN_FN_##_pin_fn, \
429 .pin_ctrl = _pin_ctrl, \
430 }
431
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700432/* GPIO regulator constraints */
433struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] __devinitdata = {
434 GPIO_VREG_INIT(EXT_5V, "ext_5v", "ext_5v_en", PM8921_MPP_PM_TO_SYS(7)),
435 GPIO_VREG_INIT(EXT_L2, "ext_l2", "ext_l2_en", 91),
David Collinsb10be1d2011-09-02 10:29:31 -0700436 GPIO_VREG_INIT(EXT_3P3V, "ext_3p3v", "ext_3p3v_en",
437 PM8921_GPIO_PM_TO_SYS(17)),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700438};
439
440/* SAW regulator constraints */
441struct regulator_init_data msm_saw_regulator_pdata_s5 =
442 /* ID vreg_name min_uV max_uV */
443 SAW_VREG_INIT(S5, "8921_s5", 1050000, 1150000);
444struct regulator_init_data msm_saw_regulator_pdata_s6 =
445 SAW_VREG_INIT(S6, "8921_s6", 1050000, 1150000);
446
447/* PM8921 regulator constraints */
448struct pm8921_regulator_platform_data
449msm_pm8921_regulator_pdata[] __devinitdata = {
David Collins26f05562011-06-20 09:56:28 -0700450 /*
451 * ID a_on pd min_uV max_uV en_t supply
452 * system_uA
453 */
David Collins43176762011-07-26 15:33:38 -0700454 PM8921_VREG_INIT_NLDO1200(L26, 0, 1, 1050000, 1050000, 200, "8921_s7",
455 0),
456 PM8921_VREG_INIT_NLDO1200(L27, 0, 1, 1050000, 1050000, 200, "8921_s7",
457 0),
458 PM8921_VREG_INIT_NLDO1200(L28, 0, 1, 1050000, 1050000, 200, "8921_s7",
459 0),
David Collins26f05562011-06-20 09:56:28 -0700460 PM8921_VREG_INIT_LDO(L29, 0, 1, 2050000, 2100000, 200, "8921_s8",
461 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700462
David Collins26f05562011-06-20 09:56:28 -0700463 /* ID always_on pd enable_time supply */
464 PM8921_VREG_INIT_VS300(USB_OTG, 0, 1, 0, "ext_5v"),
465 PM8921_VREG_INIT_VS300(HDMI_MVS, 0, 1, 0, "ext_5v"),
466};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700467
David Collins26f05562011-06-20 09:56:28 -0700468static struct rpm_regulator_init_data
469msm_rpm_regulator_init_data[] __devinitdata = {
470 /* ID a_on pd ss min_uV max_uV supply sys_uA freq */
471 RPM_SMPS(S1, 1, 1, 0, 1225000, 1225000, NULL, 100000, 3p20),
472 RPM_SMPS(S2, 0, 1, 0, 1300000, 1300000, NULL, 0, 1p60),
473 RPM_SMPS(S3, 0, 1, 1, 1150000, 1150000, NULL, 100000, 4p80),
474 RPM_SMPS(S4, 1, 1, 0, 1800000, 1800000, NULL, 100000, 3p20),
475 RPM_SMPS(S7, 0, 1, 0, 1150000, 1150000, NULL, 100000, 3p20),
476 RPM_SMPS(S8, 1, 1, 0, 2200000, 2200000, NULL, 100000, 1p60),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700477
David Collins26f05562011-06-20 09:56:28 -0700478 /* ID a_on pd ss min_uV max_uV supply sys_uA init_ip */
479 RPM_LDO(L1, 1, 1, 0, 1050000, 1050000, "8921_s4", 0, 10000),
480 RPM_LDO(L2, 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0),
481 RPM_LDO(L3, 0, 1, 0, 3075000, 3075000, NULL, 0, 0),
482 RPM_LDO(L4, 1, 1, 0, 1800000, 1800000, NULL, 10000, 10000),
483 RPM_LDO(L5, 0, 1, 0, 2950000, 2950000, NULL, 0, 0),
484 RPM_LDO(L6, 0, 1, 0, 2950000, 2950000, NULL, 0, 0),
485 RPM_LDO(L7, 1, 1, 0, 1850000, 2950000, NULL, 10000, 10000),
486 RPM_LDO(L8, 0, 1, 0, 2800000, 3000000, NULL, 0, 0),
487 RPM_LDO(L9, 0, 1, 0, 2850000, 2850000, NULL, 0, 0),
488 RPM_LDO(L10, 0, 1, 0, 2900000, 2900000, NULL, 0, 0),
489 RPM_LDO(L11, 0, 1, 0, 2850000, 2850000, NULL, 0, 0),
490 RPM_LDO(L12, 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0),
491 RPM_LDO(L14, 0, 1, 0, 1800000, 1800000, NULL, 0, 0),
492 RPM_LDO(L15, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
493 RPM_LDO(L16, 0, 1, 0, 2800000, 2800000, NULL, 0, 0),
494 RPM_LDO(L17, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
495 RPM_LDO(L18, 0, 1, 0, 1300000, 1300000, "8921_s4", 0, 0),
496 RPM_LDO(L21, 0, 1, 0, 1900000, 1900000, "8921_s8", 0, 0),
497 RPM_LDO(L22, 0, 1, 0, 2750000, 2750000, NULL, 0, 0),
498 RPM_LDO(L23, 1, 1, 0, 1800000, 1800000, "8921_s8", 10000, 10000),
499 RPM_LDO(L24, 0, 1, 1, 1150000, 1150000, "8921_s1", 10000, 10000),
500 RPM_LDO(L25, 1, 1, 0, 1225000, 1225000, "8921_s1", 10000, 10000),
501
502 /* ID a_on pd ss supply */
503 RPM_VS(LVS1, 0, 1, 0, "8921_s4"),
504 RPM_VS(LVS2, 0, 1, 0, "8921_s1"),
505 RPM_VS(LVS3, 0, 1, 0, "8921_s4"),
506 RPM_VS(LVS4, 0, 1, 0, "8921_s4"),
507 RPM_VS(LVS5, 0, 1, 0, "8921_s4"),
508 RPM_VS(LVS6, 0, 1, 0, "8921_s4"),
509 RPM_VS(LVS7, 0, 1, 0, "8921_s4"),
510
511 /* ID a_on ss min_uV max_uV supply freq */
512 RPM_NCP(NCP, 0, 0, 1800000, 1800000, "8921_l6", 1p60),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700513};
514
515int msm_pm8921_regulator_pdata_len __devinitdata =
516 ARRAY_SIZE(msm_pm8921_regulator_pdata);
David Collins26f05562011-06-20 09:56:28 -0700517
518struct rpm_regulator_platform_data msm_rpm_regulator_pdata __devinitdata = {
519 .init_data = msm_rpm_regulator_init_data,
520 .num_regulators = ARRAY_SIZE(msm_rpm_regulator_init_data),
521};