blob: 936bb1c289aca8db82d30fcbd65c0de26b65d9f0 [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"),
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -080035 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_camera_mt9m114.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"),
Amy Malochef3c9db42011-12-08 15:17:35 -080065 REGULATOR_SUPPLY("vdd_ana", "3-004a"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070066};
67VREG_CONSUMERS(L10) = {
68 REGULATOR_SUPPLY("8921_l10", NULL),
69 REGULATOR_SUPPLY("iris_vddpa", "wcnss_wlan.0"),
70
71};
72VREG_CONSUMERS(L11) = {
73 REGULATOR_SUPPLY("8921_l11", NULL),
74 REGULATOR_SUPPLY("cam_vana", "msm_camera_imx074.0"),
75 REGULATOR_SUPPLY("cam_vana", "msm_camera_ov2720.0"),
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -080076 REGULATOR_SUPPLY("cam_vana", "msm_camera_mt9m114.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077};
78VREG_CONSUMERS(L12) = {
79 REGULATOR_SUPPLY("8921_l12", NULL),
80 REGULATOR_SUPPLY("cam_vdig", "msm_camera_imx074.0"),
81 REGULATOR_SUPPLY("cam_vdig", "msm_camera_ov2720.0"),
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -080082 REGULATOR_SUPPLY("cam_vdig", "msm_camera_mt9m114.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083};
84VREG_CONSUMERS(L14) = {
85 REGULATOR_SUPPLY("8921_l14", NULL),
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070086 REGULATOR_SUPPLY("pa_therm", "pm8xxx-adc"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070087};
88VREG_CONSUMERS(L15) = {
89 REGULATOR_SUPPLY("8921_l15", NULL),
90};
91VREG_CONSUMERS(L16) = {
92 REGULATOR_SUPPLY("8921_l16", NULL),
93 REGULATOR_SUPPLY("cam_vaf", "msm_camera_imx074.0"),
94 REGULATOR_SUPPLY("cam_vaf", "msm_camera_ov2720.0"),
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -080095 REGULATOR_SUPPLY("cam_vaf", "msm_camera_mt9m114.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096};
97VREG_CONSUMERS(L17) = {
98 REGULATOR_SUPPLY("8921_l17", NULL),
99};
100VREG_CONSUMERS(L18) = {
101 REGULATOR_SUPPLY("8921_l18", NULL),
102};
103VREG_CONSUMERS(L21) = {
104 REGULATOR_SUPPLY("8921_l21", NULL),
105};
106VREG_CONSUMERS(L22) = {
107 REGULATOR_SUPPLY("8921_l22", NULL),
108};
109VREG_CONSUMERS(L23) = {
110 REGULATOR_SUPPLY("8921_l23", NULL),
111 REGULATOR_SUPPLY("dsi_vddio", "mipi_dsi.1"),
112 REGULATOR_SUPPLY("hdmi_avdd", "hdmi_msm.0"),
113};
114VREG_CONSUMERS(L24) = {
115 REGULATOR_SUPPLY("8921_l24", NULL),
116 REGULATOR_SUPPLY("riva_vddmx", "wcnss_wlan.0"),
117};
118VREG_CONSUMERS(L25) = {
119 REGULATOR_SUPPLY("8921_l25", NULL),
120 REGULATOR_SUPPLY("VDDD_CDC_D", "tabla-slim"),
121 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "tabla-slim"),
Santosh Mardi60e19d92011-10-28 01:15:14 +0530122 REGULATOR_SUPPLY("VDDD_CDC_D", "tabla2x-slim"),
123 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "tabla2x-slim"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700124};
125VREG_CONSUMERS(L26) = {
126 REGULATOR_SUPPLY("8921_l26", NULL),
Stephen Boydeb819882011-08-29 14:46:30 -0700127 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700128};
129VREG_CONSUMERS(L27) = {
130 REGULATOR_SUPPLY("8921_l27", NULL),
Stephen Boydeb819882011-08-29 14:46:30 -0700131 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.2"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700132};
133VREG_CONSUMERS(L28) = {
134 REGULATOR_SUPPLY("8921_l28", NULL),
Stephen Boydeb819882011-08-29 14:46:30 -0700135 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.1"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700136};
137VREG_CONSUMERS(L29) = {
138 REGULATOR_SUPPLY("8921_l29", NULL),
139};
140VREG_CONSUMERS(S1) = {
141 REGULATOR_SUPPLY("8921_s1", NULL),
142};
143VREG_CONSUMERS(S2) = {
144 REGULATOR_SUPPLY("8921_s2", NULL),
145 REGULATOR_SUPPLY("iris_vddrfa", "wcnss_wlan.0"),
146
147};
148VREG_CONSUMERS(S3) = {
149 REGULATOR_SUPPLY("8921_s3", NULL),
150 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_otg"),
151 REGULATOR_SUPPLY("riva_vddcx", "wcnss_wlan.0"),
Vijayavardhan Vennapusa39025fe2011-10-15 05:55:10 +0530152 REGULATOR_SUPPLY("HSIC_VDDCX", "msm_hsic_host"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700153};
154VREG_CONSUMERS(S4) = {
155 REGULATOR_SUPPLY("8921_s4", NULL),
156 REGULATOR_SUPPLY("sdc_vccq", "msm_sdcc.1"),
157 REGULATOR_SUPPLY("riva_vddpx", "wcnss_wlan.0"),
158 REGULATOR_SUPPLY("hdmi_vcc", "hdmi_msm.0"),
159 REGULATOR_SUPPLY("VDDIO_CDC", "tabla-slim"),
160 REGULATOR_SUPPLY("CDC_VDD_CP", "tabla-slim"),
161 REGULATOR_SUPPLY("CDC_VDDA_TX", "tabla-slim"),
162 REGULATOR_SUPPLY("CDC_VDDA_RX", "tabla-slim"),
Santosh Mardi60e19d92011-10-28 01:15:14 +0530163 REGULATOR_SUPPLY("VDDIO_CDC", "tabla2x-slim"),
164 REGULATOR_SUPPLY("CDC_VDD_CP", "tabla2x-slim"),
165 REGULATOR_SUPPLY("CDC_VDDA_TX", "tabla2x-slim"),
166 REGULATOR_SUPPLY("CDC_VDDA_RX", "tabla2x-slim"),
Mohan Pallaka20c876f2011-08-05 12:57:38 +0530167 REGULATOR_SUPPLY("vcc_i2c", "3-005b"),
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530168 REGULATOR_SUPPLY("EXT_HUB_VDDIO", "msm_hsic_host"),
Mohan Pallaka5e490392011-09-09 15:18:41 +0530169 REGULATOR_SUPPLY("vcc_i2c", "10-0048"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700170};
171VREG_CONSUMERS(S5) = {
172 REGULATOR_SUPPLY("8921_s5", NULL),
173 REGULATOR_SUPPLY("krait0", NULL),
174};
175VREG_CONSUMERS(S6) = {
176 REGULATOR_SUPPLY("8921_s6", NULL),
177 REGULATOR_SUPPLY("krait1", NULL),
178};
179VREG_CONSUMERS(S7) = {
180 REGULATOR_SUPPLY("8921_s7", NULL),
181};
182VREG_CONSUMERS(S8) = {
183 REGULATOR_SUPPLY("8921_s8", NULL),
184};
185VREG_CONSUMERS(LVS1) = {
186 REGULATOR_SUPPLY("8921_lvs1", NULL),
187 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.4"),
188 REGULATOR_SUPPLY("iris_vddio", "wcnss_wlan.0"),
189};
190VREG_CONSUMERS(LVS2) = {
191 REGULATOR_SUPPLY("8921_lvs2", NULL),
192 REGULATOR_SUPPLY("iris_vdddig", "wcnss_wlan.0"),
193};
194VREG_CONSUMERS(LVS3) = {
195 REGULATOR_SUPPLY("8921_lvs3", NULL),
196};
197VREG_CONSUMERS(LVS4) = {
198 REGULATOR_SUPPLY("8921_lvs4", NULL),
199 REGULATOR_SUPPLY("vcc_i2c", "3-0024"),
Amy Malochef3c9db42011-12-08 15:17:35 -0800200 REGULATOR_SUPPLY("vcc_i2c", "3-004a"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700201};
202VREG_CONSUMERS(LVS5) = {
203 REGULATOR_SUPPLY("8921_lvs5", NULL),
204 REGULATOR_SUPPLY("cam_vio", "msm_camera_imx074.0"),
205 REGULATOR_SUPPLY("cam_vio", "msm_camera_ov2720.0"),
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800206 REGULATOR_SUPPLY("cam_vio", "msm_camera_mt9m114.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700207};
208VREG_CONSUMERS(LVS6) = {
209 REGULATOR_SUPPLY("8921_lvs6", NULL),
210 REGULATOR_SUPPLY("vdd_io", "spi0.0"),
211};
212VREG_CONSUMERS(LVS7) = {
213 REGULATOR_SUPPLY("8921_lvs7", NULL),
214};
215VREG_CONSUMERS(USB_OTG) = {
216 REGULATOR_SUPPLY("8921_usb_otg", NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700217};
218VREG_CONSUMERS(HDMI_MVS) = {
219 REGULATOR_SUPPLY("8921_hdmi_mvs", NULL),
220 REGULATOR_SUPPLY("hdmi_mvs", "hdmi_msm.0"),
221};
222VREG_CONSUMERS(NCP) = {
223 REGULATOR_SUPPLY("8921_ncp", NULL),
224};
225VREG_CONSUMERS(EXT_5V) = {
226 REGULATOR_SUPPLY("ext_5v", NULL),
227};
228VREG_CONSUMERS(EXT_L2) = {
229 REGULATOR_SUPPLY("ext_l2", NULL),
230 REGULATOR_SUPPLY("vdd_phy", "spi0.0"),
231};
David Collinsb10be1d2011-09-02 10:29:31 -0700232VREG_CONSUMERS(EXT_3P3V) = {
233 REGULATOR_SUPPLY("ext_3p3v", NULL),
Amy Maloche21115eb2011-11-02 09:04:37 -0700234 REGULATOR_SUPPLY("vdd_ana", "3-005b"),
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300235 REGULATOR_SUPPLY("vdd_lvds_3p3v", "mipi_dsi.1"),
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +0530236 REGULATOR_SUPPLY("mhl_ext_3p3v", "msm_otg"),
David Collinsb10be1d2011-09-02 10:29:31 -0700237};
David Collins35a78f52011-12-14 15:54:25 -0800238VREG_CONSUMERS(EXT_OTG_SW) = {
239 REGULATOR_SUPPLY("ext_otg_sw", NULL),
David Collins57954fa2011-12-15 09:14:40 -0800240 REGULATOR_SUPPLY("vbus_otg", "msm_otg"),
David Collins35a78f52011-12-14 15:54:25 -0800241};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700242
243#define PM8921_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \
244 _pull_down, _always_on, _supply_regulator, \
David Collins43176762011-07-26 15:33:38 -0700245 _system_uA, _enable_time) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700246 { \
247 .init_data = { \
248 .constraints = { \
249 .valid_modes_mask = _modes, \
250 .valid_ops_mask = _ops, \
251 .min_uV = _min_uV, \
252 .max_uV = _max_uV, \
253 .input_uV = _max_uV, \
254 .apply_uV = _apply_uV, \
255 .always_on = _always_on, \
256 }, \
257 .num_consumer_supplies = \
258 ARRAY_SIZE(vreg_consumers_##_id), \
259 .consumer_supplies = vreg_consumers_##_id, \
260 .supply_regulator = _supply_regulator, \
261 }, \
262 .id = PM8921_VREG_ID_##_id, \
263 .pull_down_enable = _pull_down, \
264 .system_uA = _system_uA, \
David Collins43176762011-07-26 15:33:38 -0700265 .enable_time = _enable_time, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700266 }
267
268#define PM8921_VREG_INIT_LDO(_id, _always_on, _pull_down, _min_uV, _max_uV, \
David Collins43176762011-07-26 15:33:38 -0700269 _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700270 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
271 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
272 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
273 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700274 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700275
276#define PM8921_VREG_INIT_NLDO1200(_id, _always_on, _pull_down, _min_uV, \
David Collins43176762011-07-26 15:33:38 -0700277 _max_uV, _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700278 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
279 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
280 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
281 REGULATOR_CHANGE_DRMS, 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
284#define PM8921_VREG_INIT_SMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
David Collins43176762011-07-26 15:33:38 -0700285 _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700286 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
287 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
288 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
289 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700290 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700291
292#define PM8921_VREG_INIT_FTSMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
David Collins43176762011-07-26 15:33:38 -0700293 _enable_time, _supply_regulator, _system_uA) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700294 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
295 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
296 | REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
David Collins43176762011-07-26 15:33:38 -0700297 _supply_regulator, _system_uA, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700298
David Collins43176762011-07-26 15:33:38 -0700299#define PM8921_VREG_INIT_VS(_id, _always_on, _pull_down, _enable_time, \
300 _supply_regulator) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700301 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
David Collins43176762011-07-26 15:33:38 -0700302 _always_on, _supply_regulator, 0, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700303
David Collins43176762011-07-26 15:33:38 -0700304#define PM8921_VREG_INIT_VS300(_id, _always_on, _pull_down, _enable_time, \
305 _supply_regulator) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700306 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
David Collins43176762011-07-26 15:33:38 -0700307 _always_on, _supply_regulator, 0, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700308
David Collins43176762011-07-26 15:33:38 -0700309#define PM8921_VREG_INIT_NCP(_id, _always_on, _min_uV, _max_uV, _enable_time, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700310 _supply_regulator) \
311 PM8921_VREG_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE | \
David Collins43176762011-07-26 15:33:38 -0700312 REGULATOR_CHANGE_STATUS, 0, 0, _always_on, _supply_regulator, \
313 0, _enable_time)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314
315/* Pin control initialization */
316#define PM8921_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
317 { \
318 .init_data = { \
319 .constraints = { \
320 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
321 .always_on = _always_on, \
322 }, \
323 .num_consumer_supplies = \
324 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
325 .consumer_supplies = vreg_consumers_##_id##_PC, \
326 .supply_regulator = _supply_regulator, \
327 }, \
328 .id = PM8921_VREG_ID_##_id##_PC, \
329 .pin_fn = PM8921_VREG_PIN_FN_##_pin_fn, \
330 .pin_ctrl = _pin_ctrl, \
331 }
332
David Collins35a78f52011-12-14 15:54:25 -0800333#define GPIO_VREG(_id, _reg_name, _gpio_label, _gpio, _supply_regulator) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700334 [GPIO_VREG_ID_##_id] = { \
335 .init_data = { \
336 .constraints = { \
337 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
338 }, \
339 .num_consumer_supplies = \
340 ARRAY_SIZE(vreg_consumers_##_id), \
341 .consumer_supplies = vreg_consumers_##_id, \
David Collins35a78f52011-12-14 15:54:25 -0800342 .supply_regulator = _supply_regulator, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700343 }, \
344 .regulator_name = _reg_name, \
345 .gpio_label = _gpio_label, \
346 .gpio = _gpio, \
347 }
348
349#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
350 { \
351 .constraints = { \
352 .name = _name, \
353 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, \
354 .min_uV = _min_uV, \
355 .max_uV = _max_uV, \
356 }, \
357 .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \
358 .consumer_supplies = vreg_consumers_##_id, \
359 }
360
David Collins26f05562011-06-20 09:56:28 -0700361#define RPM_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, _default_uV, \
362 _peak_uA, _avg_uA, _pull_down, _pin_ctrl, _freq, _pin_fn, \
363 _force_mode, _power_mode, _state, _sleep_selectable, \
364 _always_on, _supply_regulator, _system_uA) \
365 { \
366 .init_data = { \
367 .constraints = { \
368 .valid_modes_mask = _modes, \
369 .valid_ops_mask = _ops, \
370 .min_uV = _min_uV, \
371 .max_uV = _max_uV, \
372 .input_uV = _min_uV, \
373 .apply_uV = _apply_uV, \
374 .always_on = _always_on, \
375 }, \
376 .num_consumer_supplies = \
377 ARRAY_SIZE(vreg_consumers_##_id), \
378 .consumer_supplies = vreg_consumers_##_id, \
379 .supply_regulator = _supply_regulator, \
380 }, \
381 .id = RPM_VREG_ID_PM8921_##_id, \
382 .default_uV = _default_uV, \
383 .peak_uA = _peak_uA, \
384 .avg_uA = _avg_uA, \
385 .pull_down_enable = _pull_down, \
386 .pin_ctrl = _pin_ctrl, \
387 .freq = RPM_VREG_FREQ_##_freq, \
388 .pin_fn = _pin_fn, \
389 .force_mode = _force_mode, \
390 .power_mode = _power_mode, \
391 .state = _state, \
392 .sleep_selectable = _sleep_selectable, \
393 .system_uA = _system_uA, \
394 }
395
396#define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
397 _supply_regulator, _system_uA, _init_peak_uA) \
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, _init_peak_uA, 0, _pd, \
David Collins6f032ba2011-08-31 14:08:15 -0700402 RPM_VREG_PIN_CTRL_NONE, NONE, 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_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
408 _supply_regulator, _system_uA, _freq) \
409 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
410 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
411 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
412 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _system_uA, 0, _pd, \
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, _system_uA)
417
418#define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \
419 RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \
David Collins6f032ba2011-08-31 14:08:15 -0700420 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
421 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
David Collins26f05562011-06-20 09:56:28 -0700422 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
423 _supply_regulator, 0)
424
425#define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
426 _supply_regulator, _freq) \
427 RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
428 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \
David Collins6f032ba2011-08-31 14:08:15 -0700429 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
430 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
David Collins26f05562011-06-20 09:56:28 -0700431 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
432 _supply_regulator, 0)
433
434/* Pin control initialization */
435#define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
436 { \
437 .init_data = { \
438 .constraints = { \
439 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
440 .always_on = _always_on, \
441 }, \
442 .num_consumer_supplies = \
443 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
444 .consumer_supplies = vreg_consumers_##_id##_PC, \
445 .supply_regulator = _supply_regulator, \
446 }, \
447 .id = RPM_VREG_ID_PM8921_##_id##_PC, \
David Collins6f032ba2011-08-31 14:08:15 -0700448 .pin_fn = RPM_VREG_PIN_FN_8960_##_pin_fn, \
David Collins26f05562011-06-20 09:56:28 -0700449 .pin_ctrl = _pin_ctrl, \
450 }
451
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700452/* GPIO regulator constraints */
453struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] __devinitdata = {
David Collins35a78f52011-12-14 15:54:25 -0800454 /* ID vreg_name gpio_label gpio supply */
455 GPIO_VREG(EXT_5V, "ext_5v", "ext_5v_en", PM8921_MPP_PM_TO_SYS(7), NULL),
456 GPIO_VREG(EXT_L2, "ext_l2", "ext_l2_en", 91, NULL),
457 GPIO_VREG(EXT_3P3V, "ext_3p3v", "ext_3p3v_en",
458 PM8921_GPIO_PM_TO_SYS(17), NULL),
459 GPIO_VREG(EXT_OTG_SW, "ext_otg_sw", "ext_otg_sw_en",
460 PM8921_GPIO_PM_TO_SYS(42), "8921_usb_otg"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700461};
462
463/* SAW regulator constraints */
464struct regulator_init_data msm_saw_regulator_pdata_s5 =
465 /* ID vreg_name min_uV max_uV */
Stephen Boyd9d0fab12011-12-08 10:56:06 -0800466 SAW_VREG_INIT(S5, "8921_s5", 850000, 1300000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700467struct regulator_init_data msm_saw_regulator_pdata_s6 =
Stephen Boyd9d0fab12011-12-08 10:56:06 -0800468 SAW_VREG_INIT(S6, "8921_s6", 850000, 1300000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700469
470/* PM8921 regulator constraints */
471struct pm8921_regulator_platform_data
472msm_pm8921_regulator_pdata[] __devinitdata = {
David Collins26f05562011-06-20 09:56:28 -0700473 /*
474 * ID a_on pd min_uV max_uV en_t supply
475 * system_uA
476 */
David Collins43176762011-07-26 15:33:38 -0700477 PM8921_VREG_INIT_NLDO1200(L26, 0, 1, 1050000, 1050000, 200, "8921_s7",
478 0),
479 PM8921_VREG_INIT_NLDO1200(L27, 0, 1, 1050000, 1050000, 200, "8921_s7",
480 0),
481 PM8921_VREG_INIT_NLDO1200(L28, 0, 1, 1050000, 1050000, 200, "8921_s7",
482 0),
David Collins26f05562011-06-20 09:56:28 -0700483 PM8921_VREG_INIT_LDO(L29, 0, 1, 2050000, 2100000, 200, "8921_s8",
484 0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700485
David Collins26f05562011-06-20 09:56:28 -0700486 /* ID always_on pd enable_time supply */
487 PM8921_VREG_INIT_VS300(USB_OTG, 0, 1, 0, "ext_5v"),
488 PM8921_VREG_INIT_VS300(HDMI_MVS, 0, 1, 0, "ext_5v"),
489};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700490
David Collins26f05562011-06-20 09:56:28 -0700491static struct rpm_regulator_init_data
492msm_rpm_regulator_init_data[] __devinitdata = {
493 /* ID a_on pd ss min_uV max_uV supply sys_uA freq */
494 RPM_SMPS(S1, 1, 1, 0, 1225000, 1225000, NULL, 100000, 3p20),
495 RPM_SMPS(S2, 0, 1, 0, 1300000, 1300000, NULL, 0, 1p60),
David Collins156bca92011-09-07 17:05:21 -0700496 RPM_SMPS(S3, 0, 1, 1, 500000, 1150000, NULL, 100000, 4p80),
David Collins26f05562011-06-20 09:56:28 -0700497 RPM_SMPS(S4, 1, 1, 0, 1800000, 1800000, NULL, 100000, 3p20),
498 RPM_SMPS(S7, 0, 1, 0, 1150000, 1150000, NULL, 100000, 3p20),
Matt Wagantall627f4312011-12-13 13:33:47 -0800499 RPM_SMPS(S8, 1, 1, 1, 2100000, 2100000, NULL, 100000, 1p60),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700500
David Collins26f05562011-06-20 09:56:28 -0700501 /* ID a_on pd ss min_uV max_uV supply sys_uA init_ip */
502 RPM_LDO(L1, 1, 1, 0, 1050000, 1050000, "8921_s4", 0, 10000),
503 RPM_LDO(L2, 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0),
504 RPM_LDO(L3, 0, 1, 0, 3075000, 3075000, NULL, 0, 0),
505 RPM_LDO(L4, 1, 1, 0, 1800000, 1800000, NULL, 10000, 10000),
506 RPM_LDO(L5, 0, 1, 0, 2950000, 2950000, NULL, 0, 0),
507 RPM_LDO(L6, 0, 1, 0, 2950000, 2950000, NULL, 0, 0),
508 RPM_LDO(L7, 1, 1, 0, 1850000, 2950000, NULL, 10000, 10000),
509 RPM_LDO(L8, 0, 1, 0, 2800000, 3000000, NULL, 0, 0),
510 RPM_LDO(L9, 0, 1, 0, 2850000, 2850000, NULL, 0, 0),
Sameer Thalappil1107a182011-09-07 14:42:31 -0700511 RPM_LDO(L10, 0, 1, 0, 3000000, 3000000, NULL, 0, 0),
David Collins26f05562011-06-20 09:56:28 -0700512 RPM_LDO(L11, 0, 1, 0, 2850000, 2850000, NULL, 0, 0),
513 RPM_LDO(L12, 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0),
514 RPM_LDO(L14, 0, 1, 0, 1800000, 1800000, NULL, 0, 0),
515 RPM_LDO(L15, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
516 RPM_LDO(L16, 0, 1, 0, 2800000, 2800000, NULL, 0, 0),
517 RPM_LDO(L17, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
518 RPM_LDO(L18, 0, 1, 0, 1300000, 1300000, "8921_s4", 0, 0),
519 RPM_LDO(L21, 0, 1, 0, 1900000, 1900000, "8921_s8", 0, 0),
520 RPM_LDO(L22, 0, 1, 0, 2750000, 2750000, NULL, 0, 0),
Matt Wagantallcb12c392011-10-19 10:32:07 -0700521 RPM_LDO(L23, 1, 1, 1, 1800000, 1800000, "8921_s8", 10000, 10000),
David Collins156bca92011-09-07 17:05:21 -0700522 RPM_LDO(L24, 0, 1, 1, 750000, 1150000, "8921_s1", 10000, 10000),
David Collins26f05562011-06-20 09:56:28 -0700523 RPM_LDO(L25, 1, 1, 0, 1225000, 1225000, "8921_s1", 10000, 10000),
524
525 /* ID a_on pd ss supply */
526 RPM_VS(LVS1, 0, 1, 0, "8921_s4"),
527 RPM_VS(LVS2, 0, 1, 0, "8921_s1"),
528 RPM_VS(LVS3, 0, 1, 0, "8921_s4"),
529 RPM_VS(LVS4, 0, 1, 0, "8921_s4"),
530 RPM_VS(LVS5, 0, 1, 0, "8921_s4"),
531 RPM_VS(LVS6, 0, 1, 0, "8921_s4"),
532 RPM_VS(LVS7, 0, 1, 0, "8921_s4"),
533
534 /* ID a_on ss min_uV max_uV supply freq */
535 RPM_NCP(NCP, 0, 0, 1800000, 1800000, "8921_l6", 1p60),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700536};
537
538int msm_pm8921_regulator_pdata_len __devinitdata =
539 ARRAY_SIZE(msm_pm8921_regulator_pdata);
David Collins26f05562011-06-20 09:56:28 -0700540
541struct rpm_regulator_platform_data msm_rpm_regulator_pdata __devinitdata = {
David Collins6f032ba2011-08-31 14:08:15 -0700542 .init_data = msm_rpm_regulator_init_data,
543 .num_regulators = ARRAY_SIZE(msm_rpm_regulator_init_data),
544 .version = RPM_VREG_VERSION_8960,
545 .vreg_id_vdd_mem = RPM_VREG_ID_PM8921_L24,
546 .vreg_id_vdd_dig = RPM_VREG_ID_PM8921_S3,
David Collins26f05562011-06-20 09:56:28 -0700547};