blob: d3a4960302d1cd8c511f0fd0cf7d4a6840832170 [file] [log] [blame]
David Collins1d4061b2011-12-06 15:36:40 -08001/*
David Collinsb4558422012-01-05 10:50:49 -08002 * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
David Collins1d4061b2011-12-06 15:36:40 -08003 *
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/pm8xxx-regulator.h>
15
16#include "board-8930.h"
17
18#define VREG_CONSUMERS(_id) \
19 static struct regulator_consumer_supply vreg_consumers_##_id[]
20
21/*
22 * Consumer specific regulator names:
23 * regulator name consumer dev_name
24 */
25VREG_CONSUMERS(L1) = {
26 REGULATOR_SUPPLY("8038_l1", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080027 REGULATOR_SUPPLY("iris_vddrfa", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080028};
29VREG_CONSUMERS(L2) = {
30 REGULATOR_SUPPLY("8038_l2", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080031 REGULATOR_SUPPLY("iris_vdddig", "wcnss_wlan.0"),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -080032 REGULATOR_SUPPLY("dsi_vdda", "mipi_dsi.1"),
Kevin Chan330e4d52012-02-18 23:11:24 -080033 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_csid.0"),
34 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_csid.1"),
35 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_csid.2"),
David Collins1d4061b2011-12-06 15:36:40 -080036};
37VREG_CONSUMERS(L3) = {
38 REGULATOR_SUPPLY("8038_l3", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +053039 REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -080040};
41VREG_CONSUMERS(L4) = {
42 REGULATOR_SUPPLY("8038_l4", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +053043 REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080044 REGULATOR_SUPPLY("iris_vddxo", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080045};
46VREG_CONSUMERS(L5) = {
47 REGULATOR_SUPPLY("8038_l5", NULL),
Krishna Konda40ec7e92011-12-20 19:28:25 -080048 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.1"),
David Collins1d4061b2011-12-06 15:36:40 -080049};
50VREG_CONSUMERS(L6) = {
51 REGULATOR_SUPPLY("8038_l6", NULL),
Krishna Konda40ec7e92011-12-20 19:28:25 -080052 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.3"),
David Collins1d4061b2011-12-06 15:36:40 -080053};
54VREG_CONSUMERS(L7) = {
55 REGULATOR_SUPPLY("8038_l7", NULL),
56};
57VREG_CONSUMERS(L8) = {
58 REGULATOR_SUPPLY("8038_l8", NULL),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -080059 REGULATOR_SUPPLY("dsi_vdc", "mipi_dsi.1"),
David Collins1d4061b2011-12-06 15:36:40 -080060};
61VREG_CONSUMERS(L9) = {
62 REGULATOR_SUPPLY("8038_l9", NULL),
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +053063 REGULATOR_SUPPLY("vdd_ana", "3-004a"),
Amy Maloche32a36c32012-01-11 10:39:11 -080064 REGULATOR_SUPPLY("vdd", "3-0024"),
Kevin Chan6776a372012-01-12 14:18:53 -080065 REGULATOR_SUPPLY("cam_vana", "4-001a"),
66 REGULATOR_SUPPLY("cam_vana", "4-006c"),
67 REGULATOR_SUPPLY("cam_vana", "4-0048"),
68 REGULATOR_SUPPLY("cam_vaf", "4-001a"),
69 REGULATOR_SUPPLY("cam_vaf", "4-006c"),
70 REGULATOR_SUPPLY("cam_vaf", "4-0048"),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -080071 REGULATOR_SUPPLY("cam_vana", "4-0020"),
72 REGULATOR_SUPPLY("cam_vaf", "4-0020"),
Wentao Xuf59ce4e2012-05-22 17:30:13 -040073 REGULATOR_SUPPLY("vdd", "12-0018"),
74 REGULATOR_SUPPLY("vdd", "12-0068"),
David Collins1d4061b2011-12-06 15:36:40 -080075};
76VREG_CONSUMERS(L10) = {
77 REGULATOR_SUPPLY("8038_l10", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080078 REGULATOR_SUPPLY("iris_vddpa", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080079};
80VREG_CONSUMERS(L11) = {
81 REGULATOR_SUPPLY("8038_l11", NULL),
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +053082 REGULATOR_SUPPLY("vdd_dig", "3-004a"),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080083 REGULATOR_SUPPLY("iris_vddio", "wcnss_wlan.0"),
84 REGULATOR_SUPPLY("riva_vddpx", "wcnss_wlan.0"),
Subhash Jadavani937c7502012-06-01 15:34:46 +053085 REGULATOR_SUPPLY("sdc_vdd_io", "msm_sdcc.1"),
Asish Bhattacharyacdaa99d2012-01-10 06:05:00 +053086 REGULATOR_SUPPLY("VDDIO_CDC", "sitar-slim"),
87 REGULATOR_SUPPLY("CDC_VDDA_TX", "sitar-slim"),
88 REGULATOR_SUPPLY("CDC_VDDA_RX", "sitar-slim"),
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -070089 REGULATOR_SUPPLY("VDDIO_CDC", "sitar1p1-slim"),
90 REGULATOR_SUPPLY("CDC_VDDA_TX", "sitar1p1-slim"),
91 REGULATOR_SUPPLY("CDC_VDDA_RX", "sitar1p1-slim"),
Amy Malochee8de95d2012-02-23 10:40:25 -080092 REGULATOR_SUPPLY("vddp", "0-0048"),
Manoj Raoc6d904c2012-06-22 00:32:14 -070093 REGULATOR_SUPPLY("mhl_iovcc18", "0-0039"),
David Collins1d4061b2011-12-06 15:36:40 -080094};
95VREG_CONSUMERS(L12) = {
96 REGULATOR_SUPPLY("8038_l12", NULL),
Kevin Chan6776a372012-01-12 14:18:53 -080097 REGULATOR_SUPPLY("cam_vdig", "4-001a"),
98 REGULATOR_SUPPLY("cam_vdig", "4-006c"),
99 REGULATOR_SUPPLY("cam_vdig", "4-0048"),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800100 REGULATOR_SUPPLY("cam_vdig", "4-0020"),
David Collins1d4061b2011-12-06 15:36:40 -0800101};
102VREG_CONSUMERS(L14) = {
103 REGULATOR_SUPPLY("8038_l14", NULL),
Siddartha Mohanadoss6a392d32012-01-12 11:30:58 -0800104 REGULATOR_SUPPLY("pa_therm", "pm8xxx-adc"),
David Collins1d4061b2011-12-06 15:36:40 -0800105};
106VREG_CONSUMERS(L15) = {
107 REGULATOR_SUPPLY("8038_l15", NULL),
108};
109VREG_CONSUMERS(L16) = {
110 REGULATOR_SUPPLY("8038_l16", NULL),
Stephen Boyd868d8992012-01-06 14:11:02 -0800111 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.2"),
David Collins1d4061b2011-12-06 15:36:40 -0800112};
113VREG_CONSUMERS(L17) = {
114 REGULATOR_SUPPLY("8038_l17", NULL),
115};
116VREG_CONSUMERS(L18) = {
117 REGULATOR_SUPPLY("8038_l18", NULL),
118};
119VREG_CONSUMERS(L19) = {
120 REGULATOR_SUPPLY("8038_l19", NULL),
Stephen Boyd868d8992012-01-06 14:11:02 -0800121 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.1"),
David Collins1d4061b2011-12-06 15:36:40 -0800122};
123VREG_CONSUMERS(L20) = {
124 REGULATOR_SUPPLY("8038_l20", NULL),
Asish Bhattacharyacdaa99d2012-01-10 06:05:00 +0530125 REGULATOR_SUPPLY("VDDD_CDC_D", "sitar-slim"),
126 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "sitar-slim"),
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700127 REGULATOR_SUPPLY("VDDD_CDC_D", "sitar1p1-slim"),
128 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "sitar1p1-slim"),
Manoj Raoc6d904c2012-06-22 00:32:14 -0700129 REGULATOR_SUPPLY("mhl_avcc12", "0-0039"),
David Collins1d4061b2011-12-06 15:36:40 -0800130};
131VREG_CONSUMERS(L21) = {
132 REGULATOR_SUPPLY("8038_l21", NULL),
133};
134VREG_CONSUMERS(L22) = {
135 REGULATOR_SUPPLY("8038_l22", NULL),
Subhash Jadavani937c7502012-06-01 15:34:46 +0530136 REGULATOR_SUPPLY("sdc_vdd_io", "msm_sdcc.3"),
David Collins1d4061b2011-12-06 15:36:40 -0800137};
138VREG_CONSUMERS(L23) = {
139 REGULATOR_SUPPLY("8038_l23", NULL),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -0800140 REGULATOR_SUPPLY("dsi_vddio", "mipi_dsi.1"),
141 REGULATOR_SUPPLY("hdmi_avdd", "hdmi_msm.0"),
142 REGULATOR_SUPPLY("hdmi_vcc", "hdmi_msm.0"),
Stephen Boyd3bbdf6c2011-12-21 16:02:26 -0800143 REGULATOR_SUPPLY("pll_vdd", "pil_riva"),
Stephen Boydcc0f5342011-12-29 17:28:57 -0800144 REGULATOR_SUPPLY("pll_vdd", "pil_qdsp6v4.1"),
145 REGULATOR_SUPPLY("pll_vdd", "pil_qdsp6v4.2"),
David Collins1d4061b2011-12-06 15:36:40 -0800146};
147VREG_CONSUMERS(L24) = {
148 REGULATOR_SUPPLY("8038_l24", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -0800149 REGULATOR_SUPPLY("riva_vddmx", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -0800150};
151VREG_CONSUMERS(L26) = {
152 REGULATOR_SUPPLY("8038_l26", NULL),
153};
154VREG_CONSUMERS(L27) = {
155 REGULATOR_SUPPLY("8038_l27", NULL),
Stephen Boyd868d8992012-01-06 14:11:02 -0800156 REGULATOR_SUPPLY("core_vdd", "pil_qdsp6v4.0"),
David Collins1d4061b2011-12-06 15:36:40 -0800157};
158VREG_CONSUMERS(S1) = {
159 REGULATOR_SUPPLY("8038_s1", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -0800160 REGULATOR_SUPPLY("riva_vddcx", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -0800161};
162VREG_CONSUMERS(S2) = {
163 REGULATOR_SUPPLY("8038_s2", NULL),
164};
165VREG_CONSUMERS(S3) = {
166 REGULATOR_SUPPLY("8038_s3", NULL),
167};
168VREG_CONSUMERS(S4) = {
169 REGULATOR_SUPPLY("8038_s4", NULL),
Asish Bhattacharyacdaa99d2012-01-10 06:05:00 +0530170 REGULATOR_SUPPLY("CDC_VDD_CP", "sitar-slim"),
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700171 REGULATOR_SUPPLY("CDC_VDD_CP", "sitar1p1-slim"),
David Collins1d4061b2011-12-06 15:36:40 -0800172};
173VREG_CONSUMERS(S5) = {
174 REGULATOR_SUPPLY("8038_s5", NULL),
Matt Wagantallab730bd2012-06-07 20:13:51 -0700175 REGULATOR_SUPPLY("krait0", "acpuclk-8627"),
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700176 REGULATOR_SUPPLY("krait0", "acpuclk-8930"),
Tianyi Gou12370f12012-07-23 19:13:57 -0700177 REGULATOR_SUPPLY("krait0", "acpuclk-8930aa"),
David Collins1d4061b2011-12-06 15:36:40 -0800178};
179VREG_CONSUMERS(S6) = {
180 REGULATOR_SUPPLY("8038_s6", NULL),
Matt Wagantallab730bd2012-06-07 20:13:51 -0700181 REGULATOR_SUPPLY("krait1", "acpuclk-8627"),
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700182 REGULATOR_SUPPLY("krait1", "acpuclk-8930"),
Tianyi Gou12370f12012-07-23 19:13:57 -0700183 REGULATOR_SUPPLY("krait1", "acpuclk-8930aa"),
David Collins1d4061b2011-12-06 15:36:40 -0800184};
185VREG_CONSUMERS(LVS1) = {
186 REGULATOR_SUPPLY("8038_lvs1", NULL),
David Collinsf4c3d642012-03-02 09:04:57 -0800187 REGULATOR_SUPPLY("cam_vio", "4-001a"),
188 REGULATOR_SUPPLY("cam_vio", "4-006c"),
189 REGULATOR_SUPPLY("cam_vio", "4-0048"),
190 REGULATOR_SUPPLY("cam_vio", "4-0020"),
David Collins1d4061b2011-12-06 15:36:40 -0800191};
192VREG_CONSUMERS(LVS2) = {
193 REGULATOR_SUPPLY("8038_lvs2", NULL),
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +0530194 REGULATOR_SUPPLY("vcc_i2c", "3-004a"),
Amy Maloche32a36c32012-01-11 10:39:11 -0800195 REGULATOR_SUPPLY("vcc_i2c", "3-0024"),
Amy Malochee8de95d2012-02-23 10:40:25 -0800196 REGULATOR_SUPPLY("vcc_i2c", "0-0048"),
Wentao Xuf59ce4e2012-05-22 17:30:13 -0400197 REGULATOR_SUPPLY("vddio", "12-0018"),
198 REGULATOR_SUPPLY("vlogic", "12-0068"),
David Collins1d4061b2011-12-06 15:36:40 -0800199};
200VREG_CONSUMERS(EXT_5V) = {
201 REGULATOR_SUPPLY("ext_5v", NULL),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -0800202 REGULATOR_SUPPLY("hdmi_mvs", "hdmi_msm.0"),
Manoj Raoc6d904c2012-06-22 00:32:14 -0700203 REGULATOR_SUPPLY("mhl_usb_hs_switch", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -0800204};
205VREG_CONSUMERS(EXT_OTG_SW) = {
206 REGULATOR_SUPPLY("ext_otg_sw", NULL),
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530207 REGULATOR_SUPPLY("vbus_otg", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -0800208};
David Collins04907312012-02-08 14:17:57 -0800209VREG_CONSUMERS(VDD_DIG_CORNER) = {
210 REGULATOR_SUPPLY("vdd_dig_corner", NULL),
Mayank Rana248698c2012-04-19 00:03:16 +0530211 REGULATOR_SUPPLY("hsusb_vdd_dig", "msm_otg"),
David Collins04907312012-02-08 14:17:57 -0800212};
David Collins1d4061b2011-12-06 15:36:40 -0800213
214#define PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
215 _apply_uV, _pull_down, _always_on, _supply_regulator, \
216 _system_uA, _enable_time, _reg_id) \
217 { \
218 .init_data = { \
219 .constraints = { \
220 .valid_modes_mask = _modes, \
221 .valid_ops_mask = _ops, \
222 .min_uV = _min_uV, \
223 .max_uV = _max_uV, \
224 .input_uV = _max_uV, \
225 .apply_uV = _apply_uV, \
226 .always_on = _always_on, \
227 .name = _name, \
228 }, \
229 .num_consumer_supplies = \
230 ARRAY_SIZE(vreg_consumers_##_id), \
231 .consumer_supplies = vreg_consumers_##_id, \
232 .supply_regulator = _supply_regulator, \
233 }, \
234 .id = _reg_id, \
235 .pull_down_enable = _pull_down, \
236 .system_uA = _system_uA, \
237 .enable_time = _enable_time, \
238 }
239
240#define PM8XXX_LDO(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
241 _enable_time, _supply_regulator, _system_uA, _reg_id) \
242 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
243 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
244 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
245 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
246 _supply_regulator, _system_uA, _enable_time, _reg_id)
247
248#define PM8XXX_NLDO1200(_id, _name, _always_on, _pull_down, _min_uV, \
249 _max_uV, _enable_time, _supply_regulator, _system_uA, _reg_id) \
250 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
251 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
252 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
253 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
254 _supply_regulator, _system_uA, _enable_time, _reg_id)
255
256#define PM8XXX_SMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
257 _enable_time, _supply_regulator, _system_uA, _reg_id) \
258 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
259 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
260 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
261 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
262 _supply_regulator, _system_uA, _enable_time, _reg_id)
263
264#define PM8XXX_FTSMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
265 _enable_time, _supply_regulator, _system_uA, _reg_id) \
266 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
267 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
268 | REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
269 _supply_regulator, _system_uA, _enable_time, _reg_id)
270
271#define PM8XXX_VS(_id, _name, _always_on, _pull_down, _enable_time, \
272 _supply_regulator, _reg_id) \
273 PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
274 _pull_down, _always_on, _supply_regulator, 0, _enable_time, \
275 _reg_id)
276
277#define PM8XXX_VS300(_id, _name, _always_on, _pull_down, _enable_time, \
278 _supply_regulator, _reg_id) \
279 PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
280 _pull_down, _always_on, _supply_regulator, 0, _enable_time, \
281 _reg_id)
282
283#define PM8XXX_NCP(_id, _name, _always_on, _min_uV, _max_uV, _enable_time, \
284 _supply_regulator, _reg_id) \
285 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, 0, \
286 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, 0, 0, \
287 _always_on, _supply_regulator, 0, _enable_time, _reg_id)
288
289/* Pin control initialization */
290#define PM8XXX_PC(_id, _name, _always_on, _pin_fn, _pin_ctrl, \
291 _supply_regulator, _reg_id) \
292 { \
293 .init_data = { \
294 .constraints = { \
295 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
296 .always_on = _always_on, \
297 .name = _name, \
298 }, \
299 .num_consumer_supplies = \
300 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
301 .consumer_supplies = vreg_consumers_##_id##_PC, \
302 .supply_regulator = _supply_regulator, \
303 }, \
304 .id = _reg_id, \
305 .pin_fn = PM8XXX_VREG_PIN_FN_##_pin_fn, \
306 .pin_ctrl = _pin_ctrl, \
307 }
308
David Collins8af872e2012-01-06 11:31:56 -0800309#define RPM_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, _default_uV, \
310 _peak_uA, _avg_uA, _pull_down, _pin_ctrl, _freq, _pin_fn, \
David Collins15789042012-03-19 10:44:36 -0700311 _force_mode, _sleep_set_force_mode, _power_mode, _state, \
312 _sleep_selectable, _always_on, _supply_regulator, _system_uA) \
David Collins8af872e2012-01-06 11:31:56 -0800313 { \
314 .init_data = { \
315 .constraints = { \
316 .valid_modes_mask = _modes, \
317 .valid_ops_mask = _ops, \
318 .min_uV = _min_uV, \
319 .max_uV = _max_uV, \
320 .input_uV = _min_uV, \
321 .apply_uV = _apply_uV, \
322 .always_on = _always_on, \
323 }, \
324 .num_consumer_supplies = \
325 ARRAY_SIZE(vreg_consumers_##_id), \
326 .consumer_supplies = vreg_consumers_##_id, \
327 .supply_regulator = _supply_regulator, \
328 }, \
329 .id = RPM_VREG_ID_PM8038_##_id, \
330 .default_uV = _default_uV, \
331 .peak_uA = _peak_uA, \
332 .avg_uA = _avg_uA, \
333 .pull_down_enable = _pull_down, \
334 .pin_ctrl = _pin_ctrl, \
335 .freq = RPM_VREG_FREQ_##_freq, \
336 .pin_fn = _pin_fn, \
337 .force_mode = _force_mode, \
David Collins15789042012-03-19 10:44:36 -0700338 .sleep_set_force_mode = _sleep_set_force_mode, \
David Collins8af872e2012-01-06 11:31:56 -0800339 .power_mode = _power_mode, \
340 .state = _state, \
341 .sleep_selectable = _sleep_selectable, \
342 .system_uA = _system_uA, \
343 }
344
345#define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
346 _supply_regulator, _system_uA, _init_peak_uA) \
347 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
348 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
349 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
350 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _init_peak_uA, 0, _pd, \
351 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8930_NONE, \
David Collins15789042012-03-19 10:44:36 -0700352 RPM_VREG_FORCE_MODE_8930_NONE, \
David Collins8af872e2012-01-06 11:31:56 -0800353 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
354 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
355 _supply_regulator, _system_uA)
356
357#define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
David Collins3d2b9452012-03-19 11:00:30 -0700358 _supply_regulator, _system_uA, _freq, _force_mode, \
359 _sleep_set_force_mode) \
David Collins8af872e2012-01-06 11:31:56 -0800360 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
361 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
362 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
David Collins226f2512012-03-19 13:18:39 -0700363 | REGULATOR_CHANGE_DRMS, 0, _min_uV, _system_uA, 0, _pd, \
David Collins8af872e2012-01-06 11:31:56 -0800364 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8930_NONE, \
David Collins3d2b9452012-03-19 11:00:30 -0700365 RPM_VREG_FORCE_MODE_8930_##_force_mode, \
366 RPM_VREG_FORCE_MODE_8930_##_sleep_set_force_mode, \
367 RPM_VREG_POWER_MODE_8930_PWM, RPM_VREG_STATE_OFF, \
368 _sleep_selectable, _always_on, _supply_regulator, _system_uA)
David Collins8af872e2012-01-06 11:31:56 -0800369
370#define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \
371 RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \
372 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8930_NONE, \
David Collins15789042012-03-19 10:44:36 -0700373 RPM_VREG_FORCE_MODE_8930_NONE, \
David Collins8af872e2012-01-06 11:31:56 -0800374 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
375 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
376 _supply_regulator, 0)
377
378#define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
379 _supply_regulator, _freq) \
380 RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
381 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \
382 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8930_NONE, \
David Collins15789042012-03-19 10:44:36 -0700383 RPM_VREG_FORCE_MODE_8930_NONE, \
David Collins8af872e2012-01-06 11:31:56 -0800384 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
385 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
386 _supply_regulator, 0)
387
David Collins04907312012-02-08 14:17:57 -0800388#define RPM_CORNER(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
389 _supply_regulator) \
390 RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
391 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 0, 0, 0, \
392 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8930_NONE, \
David Collins15789042012-03-19 10:44:36 -0700393 RPM_VREG_FORCE_MODE_8930_NONE, \
David Collins04907312012-02-08 14:17:57 -0800394 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
395 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
396 _supply_regulator, 0)
397
David Collins8af872e2012-01-06 11:31:56 -0800398/* Pin control initialization */
399#define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
400 { \
401 .init_data = { \
402 .constraints = { \
403 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
404 .always_on = _always_on, \
405 }, \
406 .num_consumer_supplies = \
407 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
408 .consumer_supplies = vreg_consumers_##_id##_PC, \
409 .supply_regulator = _supply_regulator, \
410 }, \
411 .id = RPM_VREG_ID_PM8038_##_id##_PC, \
412 .pin_fn = RPM_VREG_PIN_FN_8930_##_pin_fn, \
413 .pin_ctrl = _pin_ctrl, \
414 }
415
David Collins1d4061b2011-12-06 15:36:40 -0800416#define GPIO_VREG(_id, _reg_name, _gpio_label, _gpio, _supply_regulator) \
417 [MSM8930_GPIO_VREG_ID_##_id] = { \
418 .init_data = { \
419 .constraints = { \
420 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
421 }, \
422 .num_consumer_supplies = \
423 ARRAY_SIZE(vreg_consumers_##_id), \
424 .consumer_supplies = vreg_consumers_##_id, \
425 .supply_regulator = _supply_regulator, \
426 }, \
427 .regulator_name = _reg_name, \
428 .gpio_label = _gpio_label, \
429 .gpio = _gpio, \
430 }
431
David Collinsb4558422012-01-05 10:50:49 -0800432#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
433 { \
434 .constraints = { \
435 .name = _name, \
436 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, \
437 .min_uV = _min_uV, \
438 .max_uV = _max_uV, \
439 }, \
440 .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \
441 .consumer_supplies = vreg_consumers_##_id, \
442 }
443
David Collins1d4061b2011-12-06 15:36:40 -0800444/* GPIO regulator constraints */
445struct gpio_regulator_platform_data
446msm8930_gpio_regulator_pdata[] __devinitdata = {
447 /* ID vreg_name gpio_label gpio supply */
448 GPIO_VREG(EXT_5V, "ext_5v", "ext_5v_en", 63, NULL),
449 GPIO_VREG(EXT_OTG_SW, "ext_otg_sw", "ext_otg_sw_en", 97, "ext_5v"),
450};
451
David Collinsb4558422012-01-05 10:50:49 -0800452/* SAW regulator constraints */
453struct regulator_init_data msm8930_saw_regulator_core0_pdata =
454 /* ID vreg_name min_uV max_uV */
455 SAW_VREG_INIT(S5, "8038_s5", 850000, 1300000);
456struct regulator_init_data msm8930_saw_regulator_core1_pdata =
457 SAW_VREG_INIT(S6, "8038_s6", 850000, 1300000);
458
David Collins1d4061b2011-12-06 15:36:40 -0800459/* PM8038 regulator constraints */
460struct pm8xxx_regulator_platform_data
461msm8930_pm8038_regulator_pdata[] __devinitdata = {
462 /*
463 * ID name always_on pd min_uV max_uV en_t supply
464 * system_uA reg_ID
465 */
Matt Wagantalled36d822012-05-25 18:13:40 -0700466 PM8XXX_NLDO1200(L16, "8038_l16", 0, 1, 375000, 1050000, 200, "8038_s3",
David Collins8af872e2012-01-06 11:31:56 -0800467 0, 0),
Matt Wagantalled36d822012-05-25 18:13:40 -0700468 PM8XXX_NLDO1200(L19, "8038_l19", 0, 1, 375000, 1050000, 200, "8038_s3",
David Collins8af872e2012-01-06 11:31:56 -0800469 0, 1),
Matt Wagantalled36d822012-05-25 18:13:40 -0700470 PM8XXX_NLDO1200(L27, "8038_l27", 0, 1, 375000, 1050000, 200, "8038_s3",
David Collins8af872e2012-01-06 11:31:56 -0800471 0, 2),
472};
David Collins1d4061b2011-12-06 15:36:40 -0800473
David Collins8af872e2012-01-06 11:31:56 -0800474static struct rpm_regulator_init_data
475msm8930_rpm_regulator_init_data[] __devinitdata = {
David Collins3d2b9452012-03-19 11:00:30 -0700476 /* ID a_on pd ss min_uV max_uV supply sys_uA freq fm ss_fm */
David Collinsc4208cc2012-03-19 12:53:10 -0700477 RPM_SMPS(S1, 0, 1, 1, 500000, 1150000, NULL, 100000, 4p80, AUTO, LPM),
478 RPM_SMPS(S2, 1, 1, 1, 1400000, 1400000, NULL, 100000, 1p60, AUTO, LPM),
479 RPM_SMPS(S3, 0, 1, 1, 1150000, 1150000, NULL, 100000, 3p20, AUTO, LPM),
David Collins226f2512012-03-19 13:18:39 -0700480 RPM_SMPS(S4, 1, 1, 1, 1950000, 2200000, NULL, 100000, 1p60, AUTO, LPM),
David Collins1d4061b2011-12-06 15:36:40 -0800481
David Collins8af872e2012-01-06 11:31:56 -0800482 /* ID a_on pd ss min_uV max_uV supply sys_uA init_ip */
483 RPM_LDO(L1, 0, 1, 0, 1300000, 1300000, "8038_s2", 0, 0),
484 RPM_LDO(L2, 0, 1, 0, 1200000, 1200000, "8038_s2", 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, 0, 1, 0, 2050000, 2050000, "8038_s4", 0, 0),
490 RPM_LDO(L8, 0, 1, 0, 2800000, 2800000, NULL, 0, 0),
491 RPM_LDO(L9, 0, 1, 0, 2850000, 2850000, NULL, 0, 0),
492 RPM_LDO(L10, 0, 1, 0, 2900000, 2900000, NULL, 0, 0),
493 RPM_LDO(L11, 1, 1, 0, 1800000, 1800000, "8038_s4", 10000, 10000),
494 RPM_LDO(L12, 0, 1, 0, 1200000, 1200000, "8038_s2", 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(L17, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
498 RPM_LDO(L18, 0, 1, 0, 1800000, 1800000, NULL, 0, 0),
David Collins19e78812012-06-04 15:50:09 -0700499 RPM_LDO(L20, 1, 1, 0, 1250000, 1250000, "8038_s2", 10000, 10000),
David Collins8af872e2012-01-06 11:31:56 -0800500 RPM_LDO(L21, 0, 1, 0, 1900000, 1900000, "8038_s4", 0, 0),
501 RPM_LDO(L22, 1, 1, 0, 1850000, 2950000, NULL, 10000, 10000),
502 RPM_LDO(L23, 1, 1, 1, 1800000, 1800000, "8038_s4", 0, 0),
David Collinsad96fa32012-03-02 08:41:38 -0800503 RPM_LDO(L24, 0, 1, 1, 500000, 1150000, "8038_s2", 10000, 10000),
David Collins8af872e2012-01-06 11:31:56 -0800504 RPM_LDO(L26, 1, 1, 0, 1050000, 1050000, "8038_s2", 10000, 10000),
505
506 /* ID a_on pd ss supply */
507 RPM_VS(LVS1, 0, 1, 0, "8038_l11"),
508 RPM_VS(LVS2, 0, 1, 0, "8038_l11"),
David Collins04907312012-02-08 14:17:57 -0800509
510 /* ID a_on ss min_corner max_corner supply */
511 RPM_CORNER(VDD_DIG_CORNER, 0, 1, RPM_VREG_CORNER_NONE,
512 RPM_VREG_CORNER_HIGH, NULL),
David Collins1d4061b2011-12-06 15:36:40 -0800513};
514
515int msm8930_pm8038_regulator_pdata_len __devinitdata =
516 ARRAY_SIZE(msm8930_pm8038_regulator_pdata);
David Collins8af872e2012-01-06 11:31:56 -0800517
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700518#define RPM_REG_MAP(_id, _sleep_also, _voter, _supply, _dev_name) \
519 { \
520 .vreg_id = RPM_VREG_ID_PM8038_##_id, \
521 .sleep_also = _sleep_also, \
522 .voter = _voter, \
523 .supply = _supply, \
524 .dev_name = _dev_name, \
525 }
526static struct rpm_regulator_consumer_mapping
527 msm_rpm_regulator_consumer_mapping[] __devinitdata = {
528 RPM_REG_MAP(L23, 0, 1, "krait0_hfpll", "acpuclk-8930"),
529 RPM_REG_MAP(L23, 0, 2, "krait1_hfpll", "acpuclk-8930"),
530 RPM_REG_MAP(L23, 0, 6, "l2_hfpll", "acpuclk-8930"),
531 RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8930"),
532 RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8930"),
533 RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig", "acpuclk-8930"),
534 RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig", "acpuclk-8930"),
Matt Wagantallab730bd2012-06-07 20:13:51 -0700535
536 RPM_REG_MAP(L23, 0, 1, "krait0_hfpll", "acpuclk-8627"),
537 RPM_REG_MAP(L23, 0, 2, "krait1_hfpll", "acpuclk-8627"),
538 RPM_REG_MAP(L23, 0, 6, "l2_hfpll", "acpuclk-8627"),
539 RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8627"),
540 RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8627"),
541 RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig", "acpuclk-8627"),
542 RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig", "acpuclk-8627"),
Tianyi Gou12370f12012-07-23 19:13:57 -0700543
544 RPM_REG_MAP(L23, 0, 1, "krait0_hfpll", "acpuclk-8930aa"),
545 RPM_REG_MAP(L23, 0, 2, "krait1_hfpll", "acpuclk-8930aa"),
546 RPM_REG_MAP(L23, 0, 6, "l2_hfpll", "acpuclk-8930aa"),
547 RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8930aa"),
548 RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8930aa"),
549 RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig", "acpuclk-8930aa"),
550 RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig", "acpuclk-8930aa"),
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700551};
552
David Collins8af872e2012-01-06 11:31:56 -0800553struct rpm_regulator_platform_data msm8930_rpm_regulator_pdata __devinitdata = {
554 .init_data = msm8930_rpm_regulator_init_data,
555 .num_regulators = ARRAY_SIZE(msm8930_rpm_regulator_init_data),
556 .version = RPM_VREG_VERSION_8930,
557 .vreg_id_vdd_mem = RPM_VREG_ID_PM8038_L24,
David Collins04907312012-02-08 14:17:57 -0800558 .vreg_id_vdd_dig = RPM_VREG_ID_PM8038_VDD_DIG_CORNER,
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700559 .consumer_map = msm_rpm_regulator_consumer_mapping,
560 .consumer_map_len = ARRAY_SIZE(msm_rpm_regulator_consumer_mapping),
David Collins8af872e2012-01-06 11:31:56 -0800561};