blob: e85202dbcffb0bbb0bcf604f71c869dfe264f5c8 [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),
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -070085 REGULATOR_SUPPLY("pa_therm", "pm8921-adc"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070086};
87VREG_CONSUMERS(L15) = {
88 REGULATOR_SUPPLY("8921_l15", NULL),
89};
90VREG_CONSUMERS(L16) = {
91 REGULATOR_SUPPLY("8921_l16", NULL),
92 REGULATOR_SUPPLY("cam_vaf", "msm_camera_imx074.0"),
93 REGULATOR_SUPPLY("cam_vaf", "msm_camera_ov2720.0"),
Kevin Chandfecce22011-07-13 10:52:41 -070094 REGULATOR_SUPPLY("cam_vaf", "msm_camera_qs_mt9p017.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070095};
96VREG_CONSUMERS(L17) = {
97 REGULATOR_SUPPLY("8921_l17", NULL),
98};
99VREG_CONSUMERS(L18) = {
100 REGULATOR_SUPPLY("8921_l18", NULL),
101};
102VREG_CONSUMERS(L21) = {
103 REGULATOR_SUPPLY("8921_l21", NULL),
104};
105VREG_CONSUMERS(L22) = {
106 REGULATOR_SUPPLY("8921_l22", NULL),
107};
108VREG_CONSUMERS(L23) = {
109 REGULATOR_SUPPLY("8921_l23", NULL),
110 REGULATOR_SUPPLY("dsi_vddio", "mipi_dsi.1"),
111 REGULATOR_SUPPLY("hdmi_avdd", "hdmi_msm.0"),
112};
113VREG_CONSUMERS(L24) = {
114 REGULATOR_SUPPLY("8921_l24", NULL),
115 REGULATOR_SUPPLY("riva_vddmx", "wcnss_wlan.0"),
116};
117VREG_CONSUMERS(L25) = {
118 REGULATOR_SUPPLY("8921_l25", NULL),
119 REGULATOR_SUPPLY("VDDD_CDC_D", "tabla-slim"),
120 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "tabla-slim"),
121};
122VREG_CONSUMERS(L26) = {
123 REGULATOR_SUPPLY("8921_l26", NULL),
Matt Wagantall0b2f9822011-07-12 20:11:28 -0700124 REGULATOR_SUPPLY("q6_lpass", NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700125};
126VREG_CONSUMERS(L27) = {
127 REGULATOR_SUPPLY("8921_l27", NULL),
Matt Wagantall0b2f9822011-07-12 20:11:28 -0700128 REGULATOR_SUPPLY("q6_modem_sw", NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700129};
130VREG_CONSUMERS(L28) = {
131 REGULATOR_SUPPLY("8921_l28", NULL),
Matt Wagantall0b2f9822011-07-12 20:11:28 -0700132 REGULATOR_SUPPLY("q6_modem_fw", NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700133};
134VREG_CONSUMERS(L29) = {
135 REGULATOR_SUPPLY("8921_l29", NULL),
136};
137VREG_CONSUMERS(S1) = {
138 REGULATOR_SUPPLY("8921_s1", NULL),
139};
140VREG_CONSUMERS(S2) = {
141 REGULATOR_SUPPLY("8921_s2", NULL),
142 REGULATOR_SUPPLY("iris_vddrfa", "wcnss_wlan.0"),
143
144};
145VREG_CONSUMERS(S3) = {
146 REGULATOR_SUPPLY("8921_s3", NULL),
147 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_otg"),
148 REGULATOR_SUPPLY("riva_vddcx", "wcnss_wlan.0"),
149};
150VREG_CONSUMERS(S4) = {
151 REGULATOR_SUPPLY("8921_s4", NULL),
152 REGULATOR_SUPPLY("sdc_vccq", "msm_sdcc.1"),
153 REGULATOR_SUPPLY("riva_vddpx", "wcnss_wlan.0"),
154 REGULATOR_SUPPLY("hdmi_vcc", "hdmi_msm.0"),
155 REGULATOR_SUPPLY("VDDIO_CDC", "tabla-slim"),
156 REGULATOR_SUPPLY("CDC_VDD_CP", "tabla-slim"),
157 REGULATOR_SUPPLY("CDC_VDDA_TX", "tabla-slim"),
158 REGULATOR_SUPPLY("CDC_VDDA_RX", "tabla-slim"),
Mohan Pallaka20c876f2011-08-05 12:57:38 +0530159 REGULATOR_SUPPLY("vcc_i2c", "3-005b"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700160};
161VREG_CONSUMERS(S5) = {
162 REGULATOR_SUPPLY("8921_s5", NULL),
163 REGULATOR_SUPPLY("krait0", NULL),
164};
165VREG_CONSUMERS(S6) = {
166 REGULATOR_SUPPLY("8921_s6", NULL),
167 REGULATOR_SUPPLY("krait1", NULL),
168};
169VREG_CONSUMERS(S7) = {
170 REGULATOR_SUPPLY("8921_s7", NULL),
171};
172VREG_CONSUMERS(S8) = {
173 REGULATOR_SUPPLY("8921_s8", NULL),
174};
175VREG_CONSUMERS(LVS1) = {
176 REGULATOR_SUPPLY("8921_lvs1", NULL),
177 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.4"),
178 REGULATOR_SUPPLY("iris_vddio", "wcnss_wlan.0"),
179};
180VREG_CONSUMERS(LVS2) = {
181 REGULATOR_SUPPLY("8921_lvs2", NULL),
182 REGULATOR_SUPPLY("iris_vdddig", "wcnss_wlan.0"),
183};
184VREG_CONSUMERS(LVS3) = {
185 REGULATOR_SUPPLY("8921_lvs3", NULL),
186};
187VREG_CONSUMERS(LVS4) = {
188 REGULATOR_SUPPLY("8921_lvs4", NULL),
189 REGULATOR_SUPPLY("vcc_i2c", "3-0024"),
190};
191VREG_CONSUMERS(LVS5) = {
192 REGULATOR_SUPPLY("8921_lvs5", NULL),
193 REGULATOR_SUPPLY("cam_vio", "msm_camera_imx074.0"),
194 REGULATOR_SUPPLY("cam_vio", "msm_camera_ov2720.0"),
Kevin Chandfecce22011-07-13 10:52:41 -0700195 REGULATOR_SUPPLY("cam_vio", "msm_camera_qs_mt9p017.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700196};
197VREG_CONSUMERS(LVS6) = {
198 REGULATOR_SUPPLY("8921_lvs6", NULL),
199 REGULATOR_SUPPLY("vdd_io", "spi0.0"),
200};
201VREG_CONSUMERS(LVS7) = {
202 REGULATOR_SUPPLY("8921_lvs7", NULL),
203};
204VREG_CONSUMERS(USB_OTG) = {
205 REGULATOR_SUPPLY("8921_usb_otg", NULL),
206 REGULATOR_SUPPLY("vbus_otg", "msm_otg"),
207};
208VREG_CONSUMERS(HDMI_MVS) = {
209 REGULATOR_SUPPLY("8921_hdmi_mvs", NULL),
210 REGULATOR_SUPPLY("hdmi_mvs", "hdmi_msm.0"),
211};
212VREG_CONSUMERS(NCP) = {
213 REGULATOR_SUPPLY("8921_ncp", NULL),
214};
215VREG_CONSUMERS(EXT_5V) = {
216 REGULATOR_SUPPLY("ext_5v", NULL),
217};
218VREG_CONSUMERS(EXT_L2) = {
219 REGULATOR_SUPPLY("ext_l2", NULL),
220 REGULATOR_SUPPLY("vdd_phy", "spi0.0"),
221};
David Collinsb10be1d2011-09-02 10:29:31 -0700222VREG_CONSUMERS(EXT_3P3V) = {
223 REGULATOR_SUPPLY("ext_3p3v", NULL),
Mohan Pallaka20c876f2011-08-05 12:57:38 +0530224 REGULATOR_SUPPLY("vdd", "3-005b"),
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300225 REGULATOR_SUPPLY("vdd_lvds_3p3v", "mipi_dsi.1"),
David Collinsb10be1d2011-09-02 10:29:31 -0700226};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700227
228#define PM8921_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \
229 _pull_down, _always_on, _supply_regulator, \
David Collins43176762011-07-26 15:33:38 -0700230 _system_uA, _enable_time) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700231 { \
232 .init_data = { \
233 .constraints = { \
234 .valid_modes_mask = _modes, \
235 .valid_ops_mask = _ops, \
236 .min_uV = _min_uV, \
237 .max_uV = _max_uV, \
238 .input_uV = _max_uV, \
239 .apply_uV = _apply_uV, \
240 .always_on = _always_on, \
241 }, \
242 .num_consumer_supplies = \
243 ARRAY_SIZE(vreg_consumers_##_id), \
244 .consumer_supplies = vreg_consumers_##_id, \
245 .supply_regulator = _supply_regulator, \
246 }, \
247 .id = PM8921_VREG_ID_##_id, \
248 .pull_down_enable = _pull_down, \
249 .system_uA = _system_uA, \
David Collins43176762011-07-26 15:33:38 -0700250 .enable_time = _enable_time, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700251 }
252
253#define PM8921_VREG_INIT_LDO(_id, _always_on, _pull_down, _min_uV, _max_uV, \
David Collins43176762011-07-26 15:33:38 -0700254 _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700255 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
256 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
257 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
258 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700259 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700260
261#define PM8921_VREG_INIT_NLDO1200(_id, _always_on, _pull_down, _min_uV, \
David Collins43176762011-07-26 15:33:38 -0700262 _max_uV, _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700263 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
264 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
265 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
266 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700267 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700268
269#define PM8921_VREG_INIT_SMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
David Collins43176762011-07-26 15:33:38 -0700270 _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700271 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
272 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
273 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
274 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700275 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700276
277#define PM8921_VREG_INIT_FTSMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
David Collins43176762011-07-26 15:33:38 -0700278 _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700279 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
280 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
281 | REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700282 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700283
David Collins43176762011-07-26 15:33:38 -0700284#define PM8921_VREG_INIT_VS(_id, _always_on, _pull_down, _enable_time, \
285 _supply_regulator) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700286 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
David Collins43176762011-07-26 15:33:38 -0700287 _always_on, _supply_regulator, 0, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700288
David Collins43176762011-07-26 15:33:38 -0700289#define PM8921_VREG_INIT_VS300(_id, _always_on, _pull_down, _enable_time, \
290 _supply_regulator) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700291 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
David Collins43176762011-07-26 15:33:38 -0700292 _always_on, _supply_regulator, 0, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700293
David Collins43176762011-07-26 15:33:38 -0700294#define PM8921_VREG_INIT_NCP(_id, _always_on, _min_uV, _max_uV, _enable_time, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700295 _supply_regulator) \
296 PM8921_VREG_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE | \
David Collins43176762011-07-26 15:33:38 -0700297 REGULATOR_CHANGE_STATUS, 0, 0, _always_on, _supply_regulator, \
298 0, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700299
300/* Pin control initialization */
301#define PM8921_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
302 { \
303 .init_data = { \
304 .constraints = { \
305 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
306 .always_on = _always_on, \
307 }, \
308 .num_consumer_supplies = \
309 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
310 .consumer_supplies = vreg_consumers_##_id##_PC, \
311 .supply_regulator = _supply_regulator, \
312 }, \
313 .id = PM8921_VREG_ID_##_id##_PC, \
314 .pin_fn = PM8921_VREG_PIN_FN_##_pin_fn, \
315 .pin_ctrl = _pin_ctrl, \
316 }
317
318#define GPIO_VREG_INIT(_id, _reg_name, _gpio_label, _gpio) \
319 [GPIO_VREG_ID_##_id] = { \
320 .init_data = { \
321 .constraints = { \
322 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
323 }, \
324 .num_consumer_supplies = \
325 ARRAY_SIZE(vreg_consumers_##_id), \
326 .consumer_supplies = vreg_consumers_##_id, \
327 }, \
328 .regulator_name = _reg_name, \
329 .gpio_label = _gpio_label, \
330 .gpio = _gpio, \
331 }
332
333#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
334 { \
335 .constraints = { \
336 .name = _name, \
337 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, \
338 .min_uV = _min_uV, \
339 .max_uV = _max_uV, \
340 }, \
341 .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \
342 .consumer_supplies = vreg_consumers_##_id, \
343 }
344
David Collins26f05562011-06-20 09:56:28 -0700345#define RPM_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, _default_uV, \
346 _peak_uA, _avg_uA, _pull_down, _pin_ctrl, _freq, _pin_fn, \
347 _force_mode, _power_mode, _state, _sleep_selectable, \
348 _always_on, _supply_regulator, _system_uA) \
349 { \
350 .init_data = { \
351 .constraints = { \
352 .valid_modes_mask = _modes, \
353 .valid_ops_mask = _ops, \
354 .min_uV = _min_uV, \
355 .max_uV = _max_uV, \
356 .input_uV = _min_uV, \
357 .apply_uV = _apply_uV, \
358 .always_on = _always_on, \
359 }, \
360 .num_consumer_supplies = \
361 ARRAY_SIZE(vreg_consumers_##_id), \
362 .consumer_supplies = vreg_consumers_##_id, \
363 .supply_regulator = _supply_regulator, \
364 }, \
365 .id = RPM_VREG_ID_PM8921_##_id, \
366 .default_uV = _default_uV, \
367 .peak_uA = _peak_uA, \
368 .avg_uA = _avg_uA, \
369 .pull_down_enable = _pull_down, \
370 .pin_ctrl = _pin_ctrl, \
371 .freq = RPM_VREG_FREQ_##_freq, \
372 .pin_fn = _pin_fn, \
373 .force_mode = _force_mode, \
374 .power_mode = _power_mode, \
375 .state = _state, \
376 .sleep_selectable = _sleep_selectable, \
377 .system_uA = _system_uA, \
378 }
379
380#define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
381 _supply_regulator, _system_uA, _init_peak_uA) \
382 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
383 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
384 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
385 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _init_peak_uA, 0, _pd, \
David Collins6f032ba2011-08-31 14:08:15 -0700386 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
387 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
David Collins26f05562011-06-20 09:56:28 -0700388 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
389 _supply_regulator, _system_uA)
390
391#define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
392 _supply_regulator, _system_uA, _freq) \
393 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
394 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
395 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
396 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _system_uA, 0, _pd, \
David Collins6f032ba2011-08-31 14:08:15 -0700397 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
398 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
David Collins26f05562011-06-20 09:56:28 -0700399 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
400 _supply_regulator, _system_uA)
401
402#define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \
403 RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \
David Collins6f032ba2011-08-31 14:08:15 -0700404 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
405 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
David Collins26f05562011-06-20 09:56:28 -0700406 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
407 _supply_regulator, 0)
408
409#define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
410 _supply_regulator, _freq) \
411 RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
412 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \
David Collins6f032ba2011-08-31 14:08:15 -0700413 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
414 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
David Collins26f05562011-06-20 09:56:28 -0700415 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
416 _supply_regulator, 0)
417
418/* Pin control initialization */
419#define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
420 { \
421 .init_data = { \
422 .constraints = { \
423 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
424 .always_on = _always_on, \
425 }, \
426 .num_consumer_supplies = \
427 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
428 .consumer_supplies = vreg_consumers_##_id##_PC, \
429 .supply_regulator = _supply_regulator, \
430 }, \
431 .id = RPM_VREG_ID_PM8921_##_id##_PC, \
David Collins6f032ba2011-08-31 14:08:15 -0700432 .pin_fn = RPM_VREG_PIN_FN_8960_##_pin_fn, \
David Collins26f05562011-06-20 09:56:28 -0700433 .pin_ctrl = _pin_ctrl, \
434 }
435
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700436/* GPIO regulator constraints */
437struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] __devinitdata = {
438 GPIO_VREG_INIT(EXT_5V, "ext_5v", "ext_5v_en", PM8921_MPP_PM_TO_SYS(7)),
439 GPIO_VREG_INIT(EXT_L2, "ext_l2", "ext_l2_en", 91),
David Collinsb10be1d2011-09-02 10:29:31 -0700440 GPIO_VREG_INIT(EXT_3P3V, "ext_3p3v", "ext_3p3v_en",
441 PM8921_GPIO_PM_TO_SYS(17)),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700442};
443
444/* SAW regulator constraints */
445struct regulator_init_data msm_saw_regulator_pdata_s5 =
446 /* ID vreg_name min_uV max_uV */
447 SAW_VREG_INIT(S5, "8921_s5", 1050000, 1150000);
448struct regulator_init_data msm_saw_regulator_pdata_s6 =
449 SAW_VREG_INIT(S6, "8921_s6", 1050000, 1150000);
450
451/* PM8921 regulator constraints */
452struct pm8921_regulator_platform_data
453msm_pm8921_regulator_pdata[] __devinitdata = {
David Collins26f05562011-06-20 09:56:28 -0700454 /*
455 * ID a_on pd min_uV max_uV en_t supply
456 * system_uA
457 */
David Collins43176762011-07-26 15:33:38 -0700458 PM8921_VREG_INIT_NLDO1200(L26, 0, 1, 1050000, 1050000, 200, "8921_s7",
459 0),
460 PM8921_VREG_INIT_NLDO1200(L27, 0, 1, 1050000, 1050000, 200, "8921_s7",
461 0),
462 PM8921_VREG_INIT_NLDO1200(L28, 0, 1, 1050000, 1050000, 200, "8921_s7",
463 0),
David Collins26f05562011-06-20 09:56:28 -0700464 PM8921_VREG_INIT_LDO(L29, 0, 1, 2050000, 2100000, 200, "8921_s8",
465 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700466
David Collins26f05562011-06-20 09:56:28 -0700467 /* ID always_on pd enable_time supply */
468 PM8921_VREG_INIT_VS300(USB_OTG, 0, 1, 0, "ext_5v"),
469 PM8921_VREG_INIT_VS300(HDMI_MVS, 0, 1, 0, "ext_5v"),
470};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700471
David Collins26f05562011-06-20 09:56:28 -0700472static struct rpm_regulator_init_data
473msm_rpm_regulator_init_data[] __devinitdata = {
474 /* ID a_on pd ss min_uV max_uV supply sys_uA freq */
475 RPM_SMPS(S1, 1, 1, 0, 1225000, 1225000, NULL, 100000, 3p20),
476 RPM_SMPS(S2, 0, 1, 0, 1300000, 1300000, NULL, 0, 1p60),
David Collins156bca92011-09-07 17:05:21 -0700477 RPM_SMPS(S3, 0, 1, 1, 500000, 1150000, NULL, 100000, 4p80),
David Collins26f05562011-06-20 09:56:28 -0700478 RPM_SMPS(S4, 1, 1, 0, 1800000, 1800000, NULL, 100000, 3p20),
479 RPM_SMPS(S7, 0, 1, 0, 1150000, 1150000, NULL, 100000, 3p20),
480 RPM_SMPS(S8, 1, 1, 0, 2200000, 2200000, NULL, 100000, 1p60),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700481
David Collins26f05562011-06-20 09:56:28 -0700482 /* ID a_on pd ss min_uV max_uV supply sys_uA init_ip */
483 RPM_LDO(L1, 1, 1, 0, 1050000, 1050000, "8921_s4", 0, 10000),
484 RPM_LDO(L2, 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0),
485 RPM_LDO(L3, 0, 1, 0, 3075000, 3075000, NULL, 0, 0),
486 RPM_LDO(L4, 1, 1, 0, 1800000, 1800000, NULL, 10000, 10000),
487 RPM_LDO(L5, 0, 1, 0, 2950000, 2950000, NULL, 0, 0),
488 RPM_LDO(L6, 0, 1, 0, 2950000, 2950000, NULL, 0, 0),
489 RPM_LDO(L7, 1, 1, 0, 1850000, 2950000, NULL, 10000, 10000),
490 RPM_LDO(L8, 0, 1, 0, 2800000, 3000000, NULL, 0, 0),
491 RPM_LDO(L9, 0, 1, 0, 2850000, 2850000, NULL, 0, 0),
Sameer Thalappil1107a182011-09-07 14:42:31 -0700492 RPM_LDO(L10, 0, 1, 0, 3000000, 3000000, NULL, 0, 0),
David Collins26f05562011-06-20 09:56:28 -0700493 RPM_LDO(L11, 0, 1, 0, 2850000, 2850000, NULL, 0, 0),
494 RPM_LDO(L12, 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0),
495 RPM_LDO(L14, 0, 1, 0, 1800000, 1800000, NULL, 0, 0),
496 RPM_LDO(L15, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
497 RPM_LDO(L16, 0, 1, 0, 2800000, 2800000, NULL, 0, 0),
498 RPM_LDO(L17, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
499 RPM_LDO(L18, 0, 1, 0, 1300000, 1300000, "8921_s4", 0, 0),
500 RPM_LDO(L21, 0, 1, 0, 1900000, 1900000, "8921_s8", 0, 0),
501 RPM_LDO(L22, 0, 1, 0, 2750000, 2750000, NULL, 0, 0),
502 RPM_LDO(L23, 1, 1, 0, 1800000, 1800000, "8921_s8", 10000, 10000),
David Collins156bca92011-09-07 17:05:21 -0700503 RPM_LDO(L24, 0, 1, 1, 750000, 1150000, "8921_s1", 10000, 10000),
David Collins26f05562011-06-20 09:56:28 -0700504 RPM_LDO(L25, 1, 1, 0, 1225000, 1225000, "8921_s1", 10000, 10000),
505
506 /* ID a_on pd ss supply */
507 RPM_VS(LVS1, 0, 1, 0, "8921_s4"),
508 RPM_VS(LVS2, 0, 1, 0, "8921_s1"),
509 RPM_VS(LVS3, 0, 1, 0, "8921_s4"),
510 RPM_VS(LVS4, 0, 1, 0, "8921_s4"),
511 RPM_VS(LVS5, 0, 1, 0, "8921_s4"),
512 RPM_VS(LVS6, 0, 1, 0, "8921_s4"),
513 RPM_VS(LVS7, 0, 1, 0, "8921_s4"),
514
515 /* ID a_on ss min_uV max_uV supply freq */
516 RPM_NCP(NCP, 0, 0, 1800000, 1800000, "8921_l6", 1p60),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700517};
518
519int msm_pm8921_regulator_pdata_len __devinitdata =
520 ARRAY_SIZE(msm_pm8921_regulator_pdata);
David Collins26f05562011-06-20 09:56:28 -0700521
522struct rpm_regulator_platform_data msm_rpm_regulator_pdata __devinitdata = {
David Collins6f032ba2011-08-31 14:08:15 -0700523 .init_data = msm_rpm_regulator_init_data,
524 .num_regulators = ARRAY_SIZE(msm_rpm_regulator_init_data),
525 .version = RPM_VREG_VERSION_8960,
526 .vreg_id_vdd_mem = RPM_VREG_ID_PM8921_L24,
527 .vreg_id_vdd_dig = RPM_VREG_ID_PM8921_S3,
David Collins26f05562011-06-20 09:56:28 -0700528};