blob: f3e4f2056bfc0402517807d9461310b58bcebf71 [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
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080018#include "board-8960.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070019
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"),
35};
36VREG_CONSUMERS(L3) = {
37 REGULATOR_SUPPLY("8921_l3", NULL),
38 REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"),
39};
40VREG_CONSUMERS(L4) = {
41 REGULATOR_SUPPLY("8921_l4", NULL),
42 REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"),
43 REGULATOR_SUPPLY("iris_vddxo", "wcnss_wlan.0"),
44};
45VREG_CONSUMERS(L5) = {
46 REGULATOR_SUPPLY("8921_l5", NULL),
47 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.1"),
48};
49VREG_CONSUMERS(L6) = {
50 REGULATOR_SUPPLY("8921_l6", NULL),
51 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.3"),
52};
53VREG_CONSUMERS(L7) = {
54 REGULATOR_SUPPLY("8921_l7", NULL),
55 REGULATOR_SUPPLY("sdc_vddp", "msm_sdcc.3"),
56};
57VREG_CONSUMERS(L8) = {
58 REGULATOR_SUPPLY("8921_l8", NULL),
59 REGULATOR_SUPPLY("dsi_vdc", "mipi_dsi.1"),
60};
61VREG_CONSUMERS(L9) = {
62 REGULATOR_SUPPLY("8921_l9", NULL),
63 REGULATOR_SUPPLY("vdd", "3-0024"),
64};
65VREG_CONSUMERS(L10) = {
66 REGULATOR_SUPPLY("8921_l10", NULL),
67 REGULATOR_SUPPLY("iris_vddpa", "wcnss_wlan.0"),
68
69};
70VREG_CONSUMERS(L11) = {
71 REGULATOR_SUPPLY("8921_l11", NULL),
72 REGULATOR_SUPPLY("cam_vana", "msm_camera_imx074.0"),
73 REGULATOR_SUPPLY("cam_vana", "msm_camera_ov2720.0"),
74};
75VREG_CONSUMERS(L12) = {
76 REGULATOR_SUPPLY("8921_l12", NULL),
77 REGULATOR_SUPPLY("cam_vdig", "msm_camera_imx074.0"),
78 REGULATOR_SUPPLY("cam_vdig", "msm_camera_ov2720.0"),
79};
80VREG_CONSUMERS(L14) = {
81 REGULATOR_SUPPLY("8921_l14", NULL),
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070082 REGULATOR_SUPPLY("pa_therm", "pm8xxx-adc"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083};
84VREG_CONSUMERS(L15) = {
85 REGULATOR_SUPPLY("8921_l15", NULL),
86};
87VREG_CONSUMERS(L16) = {
88 REGULATOR_SUPPLY("8921_l16", NULL),
89 REGULATOR_SUPPLY("cam_vaf", "msm_camera_imx074.0"),
90 REGULATOR_SUPPLY("cam_vaf", "msm_camera_ov2720.0"),
91};
92VREG_CONSUMERS(L17) = {
93 REGULATOR_SUPPLY("8921_l17", NULL),
94};
95VREG_CONSUMERS(L18) = {
96 REGULATOR_SUPPLY("8921_l18", NULL),
97};
98VREG_CONSUMERS(L21) = {
99 REGULATOR_SUPPLY("8921_l21", NULL),
100};
101VREG_CONSUMERS(L22) = {
102 REGULATOR_SUPPLY("8921_l22", NULL),
103};
104VREG_CONSUMERS(L23) = {
105 REGULATOR_SUPPLY("8921_l23", NULL),
106 REGULATOR_SUPPLY("dsi_vddio", "mipi_dsi.1"),
107 REGULATOR_SUPPLY("hdmi_avdd", "hdmi_msm.0"),
108};
109VREG_CONSUMERS(L24) = {
110 REGULATOR_SUPPLY("8921_l24", NULL),
111 REGULATOR_SUPPLY("riva_vddmx", "wcnss_wlan.0"),
112};
113VREG_CONSUMERS(L25) = {
114 REGULATOR_SUPPLY("8921_l25", NULL),
115 REGULATOR_SUPPLY("VDDD_CDC_D", "tabla-slim"),
116 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "tabla-slim"),
Santosh Mardi60e19d92011-10-28 01:15:14 +0530117 REGULATOR_SUPPLY("VDDD_CDC_D", "tabla2x-slim"),
118 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "tabla2x-slim"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700119};
120VREG_CONSUMERS(L26) = {
121 REGULATOR_SUPPLY("8921_l26", NULL),
Stephen Boydeb819882011-08-29 14:46:30 -0700122 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700123};
124VREG_CONSUMERS(L27) = {
125 REGULATOR_SUPPLY("8921_l27", NULL),
Stephen Boydeb819882011-08-29 14:46:30 -0700126 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.2"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700127};
128VREG_CONSUMERS(L28) = {
129 REGULATOR_SUPPLY("8921_l28", NULL),
Stephen Boydeb819882011-08-29 14:46:30 -0700130 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.1"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700131};
132VREG_CONSUMERS(L29) = {
133 REGULATOR_SUPPLY("8921_l29", NULL),
134};
135VREG_CONSUMERS(S1) = {
136 REGULATOR_SUPPLY("8921_s1", NULL),
137};
138VREG_CONSUMERS(S2) = {
139 REGULATOR_SUPPLY("8921_s2", NULL),
140 REGULATOR_SUPPLY("iris_vddrfa", "wcnss_wlan.0"),
141
142};
143VREG_CONSUMERS(S3) = {
144 REGULATOR_SUPPLY("8921_s3", NULL),
145 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_otg"),
146 REGULATOR_SUPPLY("riva_vddcx", "wcnss_wlan.0"),
Vijayavardhan Vennapusa39025fe2011-10-15 05:55:10 +0530147 REGULATOR_SUPPLY("HSIC_VDDCX", "msm_hsic_host"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700148};
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"),
Santosh Mardi60e19d92011-10-28 01:15:14 +0530158 REGULATOR_SUPPLY("VDDIO_CDC", "tabla2x-slim"),
159 REGULATOR_SUPPLY("CDC_VDD_CP", "tabla2x-slim"),
160 REGULATOR_SUPPLY("CDC_VDDA_TX", "tabla2x-slim"),
161 REGULATOR_SUPPLY("CDC_VDDA_RX", "tabla2x-slim"),
Mohan Pallaka20c876f2011-08-05 12:57:38 +0530162 REGULATOR_SUPPLY("vcc_i2c", "3-005b"),
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530163 REGULATOR_SUPPLY("EXT_HUB_VDDIO", "msm_hsic_host"),
Mohan Pallaka5e490392011-09-09 15:18:41 +0530164 REGULATOR_SUPPLY("vcc_i2c", "10-0048"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700165};
166VREG_CONSUMERS(S5) = {
167 REGULATOR_SUPPLY("8921_s5", NULL),
168 REGULATOR_SUPPLY("krait0", NULL),
169};
170VREG_CONSUMERS(S6) = {
171 REGULATOR_SUPPLY("8921_s6", NULL),
172 REGULATOR_SUPPLY("krait1", NULL),
173};
174VREG_CONSUMERS(S7) = {
175 REGULATOR_SUPPLY("8921_s7", NULL),
176};
177VREG_CONSUMERS(S8) = {
178 REGULATOR_SUPPLY("8921_s8", NULL),
179};
180VREG_CONSUMERS(LVS1) = {
181 REGULATOR_SUPPLY("8921_lvs1", NULL),
182 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.4"),
183 REGULATOR_SUPPLY("iris_vddio", "wcnss_wlan.0"),
184};
185VREG_CONSUMERS(LVS2) = {
186 REGULATOR_SUPPLY("8921_lvs2", NULL),
187 REGULATOR_SUPPLY("iris_vdddig", "wcnss_wlan.0"),
188};
189VREG_CONSUMERS(LVS3) = {
190 REGULATOR_SUPPLY("8921_lvs3", NULL),
191};
192VREG_CONSUMERS(LVS4) = {
193 REGULATOR_SUPPLY("8921_lvs4", NULL),
194 REGULATOR_SUPPLY("vcc_i2c", "3-0024"),
195};
196VREG_CONSUMERS(LVS5) = {
197 REGULATOR_SUPPLY("8921_lvs5", NULL),
198 REGULATOR_SUPPLY("cam_vio", "msm_camera_imx074.0"),
199 REGULATOR_SUPPLY("cam_vio", "msm_camera_ov2720.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700200};
201VREG_CONSUMERS(LVS6) = {
202 REGULATOR_SUPPLY("8921_lvs6", NULL),
203 REGULATOR_SUPPLY("vdd_io", "spi0.0"),
204};
205VREG_CONSUMERS(LVS7) = {
206 REGULATOR_SUPPLY("8921_lvs7", NULL),
207};
208VREG_CONSUMERS(USB_OTG) = {
209 REGULATOR_SUPPLY("8921_usb_otg", NULL),
210 REGULATOR_SUPPLY("vbus_otg", "msm_otg"),
211};
212VREG_CONSUMERS(HDMI_MVS) = {
213 REGULATOR_SUPPLY("8921_hdmi_mvs", NULL),
214 REGULATOR_SUPPLY("hdmi_mvs", "hdmi_msm.0"),
215};
216VREG_CONSUMERS(NCP) = {
217 REGULATOR_SUPPLY("8921_ncp", NULL),
218};
219VREG_CONSUMERS(EXT_5V) = {
220 REGULATOR_SUPPLY("ext_5v", NULL),
221};
222VREG_CONSUMERS(EXT_L2) = {
223 REGULATOR_SUPPLY("ext_l2", NULL),
224 REGULATOR_SUPPLY("vdd_phy", "spi0.0"),
225};
David Collinsb10be1d2011-09-02 10:29:31 -0700226VREG_CONSUMERS(EXT_3P3V) = {
227 REGULATOR_SUPPLY("ext_3p3v", NULL),
Mohan Pallaka20c876f2011-08-05 12:57:38 +0530228 REGULATOR_SUPPLY("vdd", "3-005b"),
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300229 REGULATOR_SUPPLY("vdd_lvds_3p3v", "mipi_dsi.1"),
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +0530230 REGULATOR_SUPPLY("mhl_ext_3p3v", "msm_otg"),
David Collinsb10be1d2011-09-02 10:29:31 -0700231};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700232
233#define PM8921_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \
234 _pull_down, _always_on, _supply_regulator, \
David Collins43176762011-07-26 15:33:38 -0700235 _system_uA, _enable_time) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236 { \
237 .init_data = { \
238 .constraints = { \
239 .valid_modes_mask = _modes, \
240 .valid_ops_mask = _ops, \
241 .min_uV = _min_uV, \
242 .max_uV = _max_uV, \
243 .input_uV = _max_uV, \
244 .apply_uV = _apply_uV, \
245 .always_on = _always_on, \
246 }, \
247 .num_consumer_supplies = \
248 ARRAY_SIZE(vreg_consumers_##_id), \
249 .consumer_supplies = vreg_consumers_##_id, \
250 .supply_regulator = _supply_regulator, \
251 }, \
252 .id = PM8921_VREG_ID_##_id, \
253 .pull_down_enable = _pull_down, \
254 .system_uA = _system_uA, \
David Collins43176762011-07-26 15:33:38 -0700255 .enable_time = _enable_time, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700256 }
257
258#define PM8921_VREG_INIT_LDO(_id, _always_on, _pull_down, _min_uV, _max_uV, \
David Collins43176762011-07-26 15:33:38 -0700259 _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700260 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
261 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
262 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
263 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700264 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700265
266#define PM8921_VREG_INIT_NLDO1200(_id, _always_on, _pull_down, _min_uV, \
David Collins43176762011-07-26 15:33:38 -0700267 _max_uV, _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700268 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
269 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
270 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
271 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700272 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700273
274#define PM8921_VREG_INIT_SMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
David Collins43176762011-07-26 15:33:38 -0700275 _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700276 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
277 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
278 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
279 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700280 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700281
282#define PM8921_VREG_INIT_FTSMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
David Collins43176762011-07-26 15:33:38 -0700283 _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700284 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
285 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
286 | REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700287 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700288
David Collins43176762011-07-26 15:33:38 -0700289#define PM8921_VREG_INIT_VS(_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_VS300(_id, _always_on, _pull_down, _enable_time, \
295 _supply_regulator) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700296 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
David Collins43176762011-07-26 15:33:38 -0700297 _always_on, _supply_regulator, 0, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700298
David Collins43176762011-07-26 15:33:38 -0700299#define PM8921_VREG_INIT_NCP(_id, _always_on, _min_uV, _max_uV, _enable_time, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700300 _supply_regulator) \
301 PM8921_VREG_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE | \
David Collins43176762011-07-26 15:33:38 -0700302 REGULATOR_CHANGE_STATUS, 0, 0, _always_on, _supply_regulator, \
303 0, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700304
305/* Pin control initialization */
306#define PM8921_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
307 { \
308 .init_data = { \
309 .constraints = { \
310 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
311 .always_on = _always_on, \
312 }, \
313 .num_consumer_supplies = \
314 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
315 .consumer_supplies = vreg_consumers_##_id##_PC, \
316 .supply_regulator = _supply_regulator, \
317 }, \
318 .id = PM8921_VREG_ID_##_id##_PC, \
319 .pin_fn = PM8921_VREG_PIN_FN_##_pin_fn, \
320 .pin_ctrl = _pin_ctrl, \
321 }
322
323#define GPIO_VREG_INIT(_id, _reg_name, _gpio_label, _gpio) \
324 [GPIO_VREG_ID_##_id] = { \
325 .init_data = { \
326 .constraints = { \
327 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
328 }, \
329 .num_consumer_supplies = \
330 ARRAY_SIZE(vreg_consumers_##_id), \
331 .consumer_supplies = vreg_consumers_##_id, \
332 }, \
333 .regulator_name = _reg_name, \
334 .gpio_label = _gpio_label, \
335 .gpio = _gpio, \
336 }
337
338#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
339 { \
340 .constraints = { \
341 .name = _name, \
342 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, \
343 .min_uV = _min_uV, \
344 .max_uV = _max_uV, \
345 }, \
346 .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \
347 .consumer_supplies = vreg_consumers_##_id, \
348 }
349
David Collins26f05562011-06-20 09:56:28 -0700350#define RPM_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, _default_uV, \
351 _peak_uA, _avg_uA, _pull_down, _pin_ctrl, _freq, _pin_fn, \
352 _force_mode, _power_mode, _state, _sleep_selectable, \
353 _always_on, _supply_regulator, _system_uA) \
354 { \
355 .init_data = { \
356 .constraints = { \
357 .valid_modes_mask = _modes, \
358 .valid_ops_mask = _ops, \
359 .min_uV = _min_uV, \
360 .max_uV = _max_uV, \
361 .input_uV = _min_uV, \
362 .apply_uV = _apply_uV, \
363 .always_on = _always_on, \
364 }, \
365 .num_consumer_supplies = \
366 ARRAY_SIZE(vreg_consumers_##_id), \
367 .consumer_supplies = vreg_consumers_##_id, \
368 .supply_regulator = _supply_regulator, \
369 }, \
370 .id = RPM_VREG_ID_PM8921_##_id, \
371 .default_uV = _default_uV, \
372 .peak_uA = _peak_uA, \
373 .avg_uA = _avg_uA, \
374 .pull_down_enable = _pull_down, \
375 .pin_ctrl = _pin_ctrl, \
376 .freq = RPM_VREG_FREQ_##_freq, \
377 .pin_fn = _pin_fn, \
378 .force_mode = _force_mode, \
379 .power_mode = _power_mode, \
380 .state = _state, \
381 .sleep_selectable = _sleep_selectable, \
382 .system_uA = _system_uA, \
383 }
384
385#define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
386 _supply_regulator, _system_uA, _init_peak_uA) \
387 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
388 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
389 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
390 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _init_peak_uA, 0, _pd, \
David Collins6f032ba2011-08-31 14:08:15 -0700391 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
392 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
David Collins26f05562011-06-20 09:56:28 -0700393 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
394 _supply_regulator, _system_uA)
395
396#define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
397 _supply_regulator, _system_uA, _freq) \
398 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
399 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
400 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
401 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _system_uA, 0, _pd, \
David Collins6f032ba2011-08-31 14:08:15 -0700402 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
403 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
David Collins26f05562011-06-20 09:56:28 -0700404 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
405 _supply_regulator, _system_uA)
406
407#define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \
408 RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \
David Collins6f032ba2011-08-31 14:08:15 -0700409 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
410 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
David Collins26f05562011-06-20 09:56:28 -0700411 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
412 _supply_regulator, 0)
413
414#define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
415 _supply_regulator, _freq) \
416 RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
417 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \
David Collins6f032ba2011-08-31 14:08:15 -0700418 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
419 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
David Collins26f05562011-06-20 09:56:28 -0700420 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
421 _supply_regulator, 0)
422
423/* Pin control initialization */
424#define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
425 { \
426 .init_data = { \
427 .constraints = { \
428 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
429 .always_on = _always_on, \
430 }, \
431 .num_consumer_supplies = \
432 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
433 .consumer_supplies = vreg_consumers_##_id##_PC, \
434 .supply_regulator = _supply_regulator, \
435 }, \
436 .id = RPM_VREG_ID_PM8921_##_id##_PC, \
David Collins6f032ba2011-08-31 14:08:15 -0700437 .pin_fn = RPM_VREG_PIN_FN_8960_##_pin_fn, \
David Collins26f05562011-06-20 09:56:28 -0700438 .pin_ctrl = _pin_ctrl, \
439 }
440
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700441/* GPIO regulator constraints */
442struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] __devinitdata = {
443 GPIO_VREG_INIT(EXT_5V, "ext_5v", "ext_5v_en", PM8921_MPP_PM_TO_SYS(7)),
444 GPIO_VREG_INIT(EXT_L2, "ext_l2", "ext_l2_en", 91),
David Collinsb10be1d2011-09-02 10:29:31 -0700445 GPIO_VREG_INIT(EXT_3P3V, "ext_3p3v", "ext_3p3v_en",
446 PM8921_GPIO_PM_TO_SYS(17)),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700447};
448
449/* SAW regulator constraints */
450struct regulator_init_data msm_saw_regulator_pdata_s5 =
451 /* ID vreg_name min_uV max_uV */
Stephen Boyd9d0fab12011-12-08 10:56:06 -0800452 SAW_VREG_INIT(S5, "8921_s5", 850000, 1300000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700453struct regulator_init_data msm_saw_regulator_pdata_s6 =
Stephen Boyd9d0fab12011-12-08 10:56:06 -0800454 SAW_VREG_INIT(S6, "8921_s6", 850000, 1300000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700455
456/* PM8921 regulator constraints */
457struct pm8921_regulator_platform_data
458msm_pm8921_regulator_pdata[] __devinitdata = {
David Collins26f05562011-06-20 09:56:28 -0700459 /*
460 * ID a_on pd min_uV max_uV en_t supply
461 * system_uA
462 */
David Collins43176762011-07-26 15:33:38 -0700463 PM8921_VREG_INIT_NLDO1200(L26, 0, 1, 1050000, 1050000, 200, "8921_s7",
464 0),
465 PM8921_VREG_INIT_NLDO1200(L27, 0, 1, 1050000, 1050000, 200, "8921_s7",
466 0),
467 PM8921_VREG_INIT_NLDO1200(L28, 0, 1, 1050000, 1050000, 200, "8921_s7",
468 0),
David Collins26f05562011-06-20 09:56:28 -0700469 PM8921_VREG_INIT_LDO(L29, 0, 1, 2050000, 2100000, 200, "8921_s8",
470 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700471
David Collins26f05562011-06-20 09:56:28 -0700472 /* ID always_on pd enable_time supply */
473 PM8921_VREG_INIT_VS300(USB_OTG, 0, 1, 0, "ext_5v"),
474 PM8921_VREG_INIT_VS300(HDMI_MVS, 0, 1, 0, "ext_5v"),
475};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700476
David Collins26f05562011-06-20 09:56:28 -0700477static struct rpm_regulator_init_data
478msm_rpm_regulator_init_data[] __devinitdata = {
479 /* ID a_on pd ss min_uV max_uV supply sys_uA freq */
480 RPM_SMPS(S1, 1, 1, 0, 1225000, 1225000, NULL, 100000, 3p20),
481 RPM_SMPS(S2, 0, 1, 0, 1300000, 1300000, NULL, 0, 1p60),
David Collins156bca92011-09-07 17:05:21 -0700482 RPM_SMPS(S3, 0, 1, 1, 500000, 1150000, NULL, 100000, 4p80),
David Collins26f05562011-06-20 09:56:28 -0700483 RPM_SMPS(S4, 1, 1, 0, 1800000, 1800000, NULL, 100000, 3p20),
484 RPM_SMPS(S7, 0, 1, 0, 1150000, 1150000, NULL, 100000, 3p20),
Matt Wagantallcb12c392011-10-19 10:32:07 -0700485 RPM_SMPS(S8, 1, 1, 1, 2200000, 2200000, NULL, 100000, 1p60),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700486
David Collins26f05562011-06-20 09:56:28 -0700487 /* ID a_on pd ss min_uV max_uV supply sys_uA init_ip */
488 RPM_LDO(L1, 1, 1, 0, 1050000, 1050000, "8921_s4", 0, 10000),
489 RPM_LDO(L2, 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0),
490 RPM_LDO(L3, 0, 1, 0, 3075000, 3075000, NULL, 0, 0),
491 RPM_LDO(L4, 1, 1, 0, 1800000, 1800000, NULL, 10000, 10000),
492 RPM_LDO(L5, 0, 1, 0, 2950000, 2950000, NULL, 0, 0),
493 RPM_LDO(L6, 0, 1, 0, 2950000, 2950000, NULL, 0, 0),
494 RPM_LDO(L7, 1, 1, 0, 1850000, 2950000, NULL, 10000, 10000),
495 RPM_LDO(L8, 0, 1, 0, 2800000, 3000000, NULL, 0, 0),
496 RPM_LDO(L9, 0, 1, 0, 2850000, 2850000, NULL, 0, 0),
Sameer Thalappil1107a182011-09-07 14:42:31 -0700497 RPM_LDO(L10, 0, 1, 0, 3000000, 3000000, NULL, 0, 0),
David Collins26f05562011-06-20 09:56:28 -0700498 RPM_LDO(L11, 0, 1, 0, 2850000, 2850000, NULL, 0, 0),
499 RPM_LDO(L12, 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0),
500 RPM_LDO(L14, 0, 1, 0, 1800000, 1800000, NULL, 0, 0),
501 RPM_LDO(L15, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
502 RPM_LDO(L16, 0, 1, 0, 2800000, 2800000, NULL, 0, 0),
503 RPM_LDO(L17, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
504 RPM_LDO(L18, 0, 1, 0, 1300000, 1300000, "8921_s4", 0, 0),
505 RPM_LDO(L21, 0, 1, 0, 1900000, 1900000, "8921_s8", 0, 0),
506 RPM_LDO(L22, 0, 1, 0, 2750000, 2750000, NULL, 0, 0),
Matt Wagantallcb12c392011-10-19 10:32:07 -0700507 RPM_LDO(L23, 1, 1, 1, 1800000, 1800000, "8921_s8", 10000, 10000),
David Collins156bca92011-09-07 17:05:21 -0700508 RPM_LDO(L24, 0, 1, 1, 750000, 1150000, "8921_s1", 10000, 10000),
David Collins26f05562011-06-20 09:56:28 -0700509 RPM_LDO(L25, 1, 1, 0, 1225000, 1225000, "8921_s1", 10000, 10000),
510
511 /* ID a_on pd ss supply */
512 RPM_VS(LVS1, 0, 1, 0, "8921_s4"),
513 RPM_VS(LVS2, 0, 1, 0, "8921_s1"),
514 RPM_VS(LVS3, 0, 1, 0, "8921_s4"),
515 RPM_VS(LVS4, 0, 1, 0, "8921_s4"),
516 RPM_VS(LVS5, 0, 1, 0, "8921_s4"),
517 RPM_VS(LVS6, 0, 1, 0, "8921_s4"),
518 RPM_VS(LVS7, 0, 1, 0, "8921_s4"),
519
520 /* ID a_on ss min_uV max_uV supply freq */
521 RPM_NCP(NCP, 0, 0, 1800000, 1800000, "8921_l6", 1p60),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700522};
523
524int msm_pm8921_regulator_pdata_len __devinitdata =
525 ARRAY_SIZE(msm_pm8921_regulator_pdata);
David Collins26f05562011-06-20 09:56:28 -0700526
527struct rpm_regulator_platform_data msm_rpm_regulator_pdata __devinitdata = {
David Collins6f032ba2011-08-31 14:08:15 -0700528 .init_data = msm_rpm_regulator_init_data,
529 .num_regulators = ARRAY_SIZE(msm_rpm_regulator_init_data),
530 .version = RPM_VREG_VERSION_8960,
531 .vreg_id_vdd_mem = RPM_VREG_ID_PM8921_L24,
532 .vreg_id_vdd_dig = RPM_VREG_ID_PM8921_S3,
David Collins26f05562011-06-20 09:56:28 -0700533};