blob: 8e0400305b170cc6a5e6a0692f61f76870f8cac4 [file] [log] [blame]
David Collins1d4061b2011-12-06 15:36:40 -08001/*
Mohan Pallakab90c7a22013-04-10 10:53:16 +05302 * Copyright (c) 2011-2013, The Linux Foundation. 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
David Collins4614cb92012-08-20 12:17:09 -070014/*
15 * This file contains regulator configuration and mappings for targets
16 * consisting of MSM8930 and PM8038.
17 */
18
David Collins1d4061b2011-12-06 15:36:40 -080019#include <linux/regulator/pm8xxx-regulator.h>
20
21#include "board-8930.h"
22
23#define VREG_CONSUMERS(_id) \
24 static struct regulator_consumer_supply vreg_consumers_##_id[]
25
26/*
27 * Consumer specific regulator names:
28 * regulator name consumer dev_name
29 */
30VREG_CONSUMERS(L1) = {
31 REGULATOR_SUPPLY("8038_l1", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080032 REGULATOR_SUPPLY("iris_vddrfa", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080033};
34VREG_CONSUMERS(L2) = {
35 REGULATOR_SUPPLY("8038_l2", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080036 REGULATOR_SUPPLY("iris_vdddig", "wcnss_wlan.0"),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -080037 REGULATOR_SUPPLY("dsi_vdda", "mipi_dsi.1"),
Ravishangar Kalyanamad320022012-07-23 18:26:09 -070038 REGULATOR_SUPPLY("dsi_pll_vdda", "mdp.0"),
Kevin Chan330e4d52012-02-18 23:11:24 -080039 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_csid.0"),
40 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_csid.1"),
41 REGULATOR_SUPPLY("mipi_csi_vdd", "msm_csid.2"),
David Collins1d4061b2011-12-06 15:36:40 -080042};
43VREG_CONSUMERS(L3) = {
44 REGULATOR_SUPPLY("8038_l3", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +053045 REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -080046};
47VREG_CONSUMERS(L4) = {
48 REGULATOR_SUPPLY("8038_l4", NULL),
Mayank Ranabf5084a2011-12-12 17:06:54 +053049 REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080050 REGULATOR_SUPPLY("iris_vddxo", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080051};
52VREG_CONSUMERS(L5) = {
53 REGULATOR_SUPPLY("8038_l5", NULL),
Krishna Konda40ec7e92011-12-20 19:28:25 -080054 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.1"),
David Collins1d4061b2011-12-06 15:36:40 -080055};
56VREG_CONSUMERS(L6) = {
57 REGULATOR_SUPPLY("8038_l6", NULL),
Krishna Konda40ec7e92011-12-20 19:28:25 -080058 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.3"),
David Collins1d4061b2011-12-06 15:36:40 -080059};
60VREG_CONSUMERS(L7) = {
61 REGULATOR_SUPPLY("8038_l7", NULL),
62};
63VREG_CONSUMERS(L8) = {
64 REGULATOR_SUPPLY("8038_l8", NULL),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -080065 REGULATOR_SUPPLY("dsi_vdc", "mipi_dsi.1"),
David Collins1d4061b2011-12-06 15:36:40 -080066};
67VREG_CONSUMERS(L9) = {
68 REGULATOR_SUPPLY("8038_l9", NULL),
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +053069 REGULATOR_SUPPLY("vdd_ana", "3-004a"),
Amy Maloche32a36c32012-01-11 10:39:11 -080070 REGULATOR_SUPPLY("vdd", "3-0024"),
Kevin Chan6776a372012-01-12 14:18:53 -080071 REGULATOR_SUPPLY("cam_vana", "4-001a"),
72 REGULATOR_SUPPLY("cam_vana", "4-006c"),
73 REGULATOR_SUPPLY("cam_vana", "4-0048"),
74 REGULATOR_SUPPLY("cam_vaf", "4-001a"),
75 REGULATOR_SUPPLY("cam_vaf", "4-006c"),
76 REGULATOR_SUPPLY("cam_vaf", "4-0048"),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -080077 REGULATOR_SUPPLY("cam_vana", "4-0020"),
78 REGULATOR_SUPPLY("cam_vaf", "4-0020"),
Wentao Xuf59ce4e2012-05-22 17:30:13 -040079 REGULATOR_SUPPLY("vdd", "12-0018"),
80 REGULATOR_SUPPLY("vdd", "12-0068"),
David Collins1d4061b2011-12-06 15:36:40 -080081};
82VREG_CONSUMERS(L10) = {
83 REGULATOR_SUPPLY("8038_l10", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080084 REGULATOR_SUPPLY("iris_vddpa", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -080085};
86VREG_CONSUMERS(L11) = {
87 REGULATOR_SUPPLY("8038_l11", NULL),
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +053088 REGULATOR_SUPPLY("vdd_dig", "3-004a"),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -080089 REGULATOR_SUPPLY("iris_vddio", "wcnss_wlan.0"),
90 REGULATOR_SUPPLY("riva_vddpx", "wcnss_wlan.0"),
Subhash Jadavani937c7502012-06-01 15:34:46 +053091 REGULATOR_SUPPLY("sdc_vdd_io", "msm_sdcc.1"),
Asish Bhattacharyacdaa99d2012-01-10 06:05:00 +053092 REGULATOR_SUPPLY("VDDIO_CDC", "sitar-slim"),
93 REGULATOR_SUPPLY("CDC_VDDA_TX", "sitar-slim"),
94 REGULATOR_SUPPLY("CDC_VDDA_RX", "sitar-slim"),
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -070095 REGULATOR_SUPPLY("VDDIO_CDC", "sitar1p1-slim"),
96 REGULATOR_SUPPLY("CDC_VDDA_TX", "sitar1p1-slim"),
97 REGULATOR_SUPPLY("CDC_VDDA_RX", "sitar1p1-slim"),
Mohan Pallakab90c7a22013-04-10 10:53:16 +053098 REGULATOR_SUPPLY("vcc_i2c", "0-0048"),
Manoj Raoc6d904c2012-06-22 00:32:14 -070099 REGULATOR_SUPPLY("mhl_iovcc18", "0-0039"),
Stepan Moskovchenko22083ab2012-09-11 12:41:48 -0700100 REGULATOR_SUPPLY("vdd-io", "spi0.0"),
101 REGULATOR_SUPPLY("vdd-phy", "spi0.0"),
Krishna Kondae88a7ae2012-06-25 20:36:36 -0700102 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.2"),
David Collins1d4061b2011-12-06 15:36:40 -0800103};
104VREG_CONSUMERS(L12) = {
105 REGULATOR_SUPPLY("8038_l12", NULL),
Kevin Chan6776a372012-01-12 14:18:53 -0800106 REGULATOR_SUPPLY("cam_vdig", "4-001a"),
107 REGULATOR_SUPPLY("cam_vdig", "4-006c"),
108 REGULATOR_SUPPLY("cam_vdig", "4-0048"),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800109 REGULATOR_SUPPLY("cam_vdig", "4-0020"),
David Collins1d4061b2011-12-06 15:36:40 -0800110};
David Collins652b3442012-08-09 14:47:51 -0700111VREG_CONSUMERS(L13) = {
112 REGULATOR_SUPPLY("8038_l13", NULL),
113};
David Collins1d4061b2011-12-06 15:36:40 -0800114VREG_CONSUMERS(L14) = {
115 REGULATOR_SUPPLY("8038_l14", NULL),
Siddartha Mohanadoss6a392d32012-01-12 11:30:58 -0800116 REGULATOR_SUPPLY("pa_therm", "pm8xxx-adc"),
David Collins1d4061b2011-12-06 15:36:40 -0800117};
118VREG_CONSUMERS(L15) = {
119 REGULATOR_SUPPLY("8038_l15", NULL),
120};
121VREG_CONSUMERS(L16) = {
122 REGULATOR_SUPPLY("8038_l16", NULL),
Stephen Boydbdb53f32012-06-05 18:39:47 -0700123 REGULATOR_SUPPLY("sw_core_vdd", "pil-q6v4-modem"),
David Collins1d4061b2011-12-06 15:36:40 -0800124};
125VREG_CONSUMERS(L17) = {
126 REGULATOR_SUPPLY("8038_l17", NULL),
127};
128VREG_CONSUMERS(L18) = {
129 REGULATOR_SUPPLY("8038_l18", NULL),
130};
131VREG_CONSUMERS(L19) = {
132 REGULATOR_SUPPLY("8038_l19", NULL),
Stephen Boydbdb53f32012-06-05 18:39:47 -0700133 REGULATOR_SUPPLY("fw_core_vdd", "pil-q6v4-modem"),
David Collins1d4061b2011-12-06 15:36:40 -0800134};
135VREG_CONSUMERS(L20) = {
136 REGULATOR_SUPPLY("8038_l20", NULL),
Asish Bhattacharyacdaa99d2012-01-10 06:05:00 +0530137 REGULATOR_SUPPLY("VDDD_CDC_D", "sitar-slim"),
138 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "sitar-slim"),
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700139 REGULATOR_SUPPLY("VDDD_CDC_D", "sitar1p1-slim"),
140 REGULATOR_SUPPLY("CDC_VDDA_A_1P2V", "sitar1p1-slim"),
Manoj Raoc6d904c2012-06-22 00:32:14 -0700141 REGULATOR_SUPPLY("mhl_avcc12", "0-0039"),
David Collins1d4061b2011-12-06 15:36:40 -0800142};
143VREG_CONSUMERS(L21) = {
144 REGULATOR_SUPPLY("8038_l21", NULL),
145};
146VREG_CONSUMERS(L22) = {
147 REGULATOR_SUPPLY("8038_l22", NULL),
Subhash Jadavani937c7502012-06-01 15:34:46 +0530148 REGULATOR_SUPPLY("sdc_vdd_io", "msm_sdcc.3"),
David Collins1d4061b2011-12-06 15:36:40 -0800149};
150VREG_CONSUMERS(L23) = {
151 REGULATOR_SUPPLY("8038_l23", NULL),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -0800152 REGULATOR_SUPPLY("dsi_vddio", "mipi_dsi.1"),
Ravishangar Kalyanamad320022012-07-23 18:26:09 -0700153 REGULATOR_SUPPLY("dsi_pll_vddio", "mdp.0"),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -0800154 REGULATOR_SUPPLY("hdmi_avdd", "hdmi_msm.0"),
155 REGULATOR_SUPPLY("hdmi_vcc", "hdmi_msm.0"),
Stephen Boyd3bbdf6c2011-12-21 16:02:26 -0800156 REGULATOR_SUPPLY("pll_vdd", "pil_riva"),
Stephen Boydbdb53f32012-06-05 18:39:47 -0700157 REGULATOR_SUPPLY("pll_vdd", "pil-q6v4-modem"),
David Collins1d4061b2011-12-06 15:36:40 -0800158};
159VREG_CONSUMERS(L24) = {
160 REGULATOR_SUPPLY("8038_l24", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -0800161 REGULATOR_SUPPLY("riva_vddmx", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -0800162};
David Collins652b3442012-08-09 14:47:51 -0700163VREG_CONSUMERS(L25) = {
164 REGULATOR_SUPPLY("8038_l25", NULL),
165};
David Collins1d4061b2011-12-06 15:36:40 -0800166VREG_CONSUMERS(L26) = {
167 REGULATOR_SUPPLY("8038_l26", NULL),
168};
169VREG_CONSUMERS(L27) = {
170 REGULATOR_SUPPLY("8038_l27", NULL),
Stephen Boydbdb53f32012-06-05 18:39:47 -0700171 REGULATOR_SUPPLY("core_vdd", "pil-q6v4-lpass"),
David Collins1d4061b2011-12-06 15:36:40 -0800172};
173VREG_CONSUMERS(S1) = {
174 REGULATOR_SUPPLY("8038_s1", NULL),
Subramanian Srinivasanc698a442012-01-11 13:41:57 -0800175 REGULATOR_SUPPLY("riva_vddcx", "wcnss_wlan.0"),
David Collins1d4061b2011-12-06 15:36:40 -0800176};
177VREG_CONSUMERS(S2) = {
178 REGULATOR_SUPPLY("8038_s2", NULL),
179};
180VREG_CONSUMERS(S3) = {
181 REGULATOR_SUPPLY("8038_s3", NULL),
182};
183VREG_CONSUMERS(S4) = {
184 REGULATOR_SUPPLY("8038_s4", NULL),
Asish Bhattacharyacdaa99d2012-01-10 06:05:00 +0530185 REGULATOR_SUPPLY("CDC_VDD_CP", "sitar-slim"),
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700186 REGULATOR_SUPPLY("CDC_VDD_CP", "sitar1p1-slim"),
David Collins1d4061b2011-12-06 15:36:40 -0800187};
188VREG_CONSUMERS(S5) = {
189 REGULATOR_SUPPLY("8038_s5", NULL),
Matt Wagantallab730bd2012-06-07 20:13:51 -0700190 REGULATOR_SUPPLY("krait0", "acpuclk-8627"),
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700191 REGULATOR_SUPPLY("krait0", "acpuclk-8930"),
Tianyi Gou12370f12012-07-23 19:13:57 -0700192 REGULATOR_SUPPLY("krait0", "acpuclk-8930aa"),
Tianyi Gou2520b6e2012-10-29 19:13:53 -0700193 REGULATOR_SUPPLY("krait0", "acpuclk-8930ab"),
David Collins1d4061b2011-12-06 15:36:40 -0800194};
195VREG_CONSUMERS(S6) = {
196 REGULATOR_SUPPLY("8038_s6", NULL),
Matt Wagantallab730bd2012-06-07 20:13:51 -0700197 REGULATOR_SUPPLY("krait1", "acpuclk-8627"),
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700198 REGULATOR_SUPPLY("krait1", "acpuclk-8930"),
Tianyi Gou12370f12012-07-23 19:13:57 -0700199 REGULATOR_SUPPLY("krait1", "acpuclk-8930aa"),
Tianyi Gou2520b6e2012-10-29 19:13:53 -0700200 REGULATOR_SUPPLY("krait1", "acpuclk-8930ab"),
David Collins1d4061b2011-12-06 15:36:40 -0800201};
202VREG_CONSUMERS(LVS1) = {
203 REGULATOR_SUPPLY("8038_lvs1", NULL),
David Collinsf4c3d642012-03-02 09:04:57 -0800204 REGULATOR_SUPPLY("cam_vio", "4-001a"),
205 REGULATOR_SUPPLY("cam_vio", "4-006c"),
206 REGULATOR_SUPPLY("cam_vio", "4-0048"),
207 REGULATOR_SUPPLY("cam_vio", "4-0020"),
David Collins1d4061b2011-12-06 15:36:40 -0800208};
209VREG_CONSUMERS(LVS2) = {
210 REGULATOR_SUPPLY("8038_lvs2", NULL),
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +0530211 REGULATOR_SUPPLY("vcc_i2c", "3-004a"),
Amy Maloche32a36c32012-01-11 10:39:11 -0800212 REGULATOR_SUPPLY("vcc_i2c", "3-0024"),
Wentao Xuf59ce4e2012-05-22 17:30:13 -0400213 REGULATOR_SUPPLY("vddio", "12-0018"),
214 REGULATOR_SUPPLY("vlogic", "12-0068"),
David Collins1d4061b2011-12-06 15:36:40 -0800215};
216VREG_CONSUMERS(EXT_5V) = {
217 REGULATOR_SUPPLY("ext_5v", NULL),
Chandan Uddaraju59894ca2011-12-05 17:07:02 -0800218 REGULATOR_SUPPLY("hdmi_mvs", "hdmi_msm.0"),
Manoj Raoc6d904c2012-06-22 00:32:14 -0700219 REGULATOR_SUPPLY("mhl_usb_hs_switch", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -0800220};
221VREG_CONSUMERS(EXT_OTG_SW) = {
222 REGULATOR_SUPPLY("ext_otg_sw", NULL),
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530223 REGULATOR_SUPPLY("vbus_otg", "msm_otg"),
David Collins1d4061b2011-12-06 15:36:40 -0800224};
David Collins04907312012-02-08 14:17:57 -0800225VREG_CONSUMERS(VDD_DIG_CORNER) = {
226 REGULATOR_SUPPLY("vdd_dig_corner", NULL),
Mayank Rana248698c2012-04-19 00:03:16 +0530227 REGULATOR_SUPPLY("hsusb_vdd_dig", "msm_otg"),
David Collins04907312012-02-08 14:17:57 -0800228};
David Collins1d4061b2011-12-06 15:36:40 -0800229
230#define PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
231 _apply_uV, _pull_down, _always_on, _supply_regulator, \
232 _system_uA, _enable_time, _reg_id) \
233 { \
234 .init_data = { \
235 .constraints = { \
236 .valid_modes_mask = _modes, \
237 .valid_ops_mask = _ops, \
238 .min_uV = _min_uV, \
239 .max_uV = _max_uV, \
240 .input_uV = _max_uV, \
241 .apply_uV = _apply_uV, \
242 .always_on = _always_on, \
243 .name = _name, \
244 }, \
245 .num_consumer_supplies = \
246 ARRAY_SIZE(vreg_consumers_##_id), \
247 .consumer_supplies = vreg_consumers_##_id, \
248 .supply_regulator = _supply_regulator, \
249 }, \
250 .id = _reg_id, \
251 .pull_down_enable = _pull_down, \
252 .system_uA = _system_uA, \
253 .enable_time = _enable_time, \
254 }
255
256#define PM8XXX_LDO(_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_NLDO1200(_id, _name, _always_on, _pull_down, _min_uV, \
265 _max_uV, _enable_time, _supply_regulator, _system_uA, _reg_id) \
266 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
267 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
268 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
269 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
270 _supply_regulator, _system_uA, _enable_time, _reg_id)
271
272#define PM8XXX_SMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
273 _enable_time, _supply_regulator, _system_uA, _reg_id) \
274 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
275 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
276 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
277 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
278 _supply_regulator, _system_uA, _enable_time, _reg_id)
279
280#define PM8XXX_FTSMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
281 _enable_time, _supply_regulator, _system_uA, _reg_id) \
282 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
283 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
284 | REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
285 _supply_regulator, _system_uA, _enable_time, _reg_id)
286
287#define PM8XXX_VS(_id, _name, _always_on, _pull_down, _enable_time, \
288 _supply_regulator, _reg_id) \
289 PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
290 _pull_down, _always_on, _supply_regulator, 0, _enable_time, \
291 _reg_id)
292
293#define PM8XXX_VS300(_id, _name, _always_on, _pull_down, _enable_time, \
294 _supply_regulator, _reg_id) \
295 PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
296 _pull_down, _always_on, _supply_regulator, 0, _enable_time, \
297 _reg_id)
298
299#define PM8XXX_NCP(_id, _name, _always_on, _min_uV, _max_uV, _enable_time, \
300 _supply_regulator, _reg_id) \
301 PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, 0, \
302 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, 0, 0, \
303 _always_on, _supply_regulator, 0, _enable_time, _reg_id)
304
305/* Pin control initialization */
306#define PM8XXX_PC(_id, _name, _always_on, _pin_fn, _pin_ctrl, \
307 _supply_regulator, _reg_id) \
308 { \
309 .init_data = { \
310 .constraints = { \
311 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
312 .always_on = _always_on, \
313 .name = _name, \
314 }, \
315 .num_consumer_supplies = \
316 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
317 .consumer_supplies = vreg_consumers_##_id##_PC, \
318 .supply_regulator = _supply_regulator, \
319 }, \
320 .id = _reg_id, \
321 .pin_fn = PM8XXX_VREG_PIN_FN_##_pin_fn, \
322 .pin_ctrl = _pin_ctrl, \
323 }
324
David Collins8af872e2012-01-06 11:31:56 -0800325#define RPM_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, _default_uV, \
326 _peak_uA, _avg_uA, _pull_down, _pin_ctrl, _freq, _pin_fn, \
David Collins15789042012-03-19 10:44:36 -0700327 _force_mode, _sleep_set_force_mode, _power_mode, _state, \
328 _sleep_selectable, _always_on, _supply_regulator, _system_uA) \
David Collins8af872e2012-01-06 11:31:56 -0800329 { \
330 .init_data = { \
331 .constraints = { \
332 .valid_modes_mask = _modes, \
333 .valid_ops_mask = _ops, \
334 .min_uV = _min_uV, \
335 .max_uV = _max_uV, \
336 .input_uV = _min_uV, \
337 .apply_uV = _apply_uV, \
338 .always_on = _always_on, \
339 }, \
340 .num_consumer_supplies = \
341 ARRAY_SIZE(vreg_consumers_##_id), \
342 .consumer_supplies = vreg_consumers_##_id, \
343 .supply_regulator = _supply_regulator, \
344 }, \
345 .id = RPM_VREG_ID_PM8038_##_id, \
346 .default_uV = _default_uV, \
347 .peak_uA = _peak_uA, \
348 .avg_uA = _avg_uA, \
349 .pull_down_enable = _pull_down, \
350 .pin_ctrl = _pin_ctrl, \
351 .freq = RPM_VREG_FREQ_##_freq, \
352 .pin_fn = _pin_fn, \
353 .force_mode = _force_mode, \
David Collins15789042012-03-19 10:44:36 -0700354 .sleep_set_force_mode = _sleep_set_force_mode, \
David Collins8af872e2012-01-06 11:31:56 -0800355 .power_mode = _power_mode, \
356 .state = _state, \
357 .sleep_selectable = _sleep_selectable, \
358 .system_uA = _system_uA, \
359 }
360
361#define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
362 _supply_regulator, _system_uA, _init_peak_uA) \
363 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
364 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
365 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
366 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _init_peak_uA, 0, _pd, \
367 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8930_NONE, \
David Collins15789042012-03-19 10:44:36 -0700368 RPM_VREG_FORCE_MODE_8930_NONE, \
David Collins8af872e2012-01-06 11:31:56 -0800369 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
370 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
371 _supply_regulator, _system_uA)
372
373#define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
David Collins3d2b9452012-03-19 11:00:30 -0700374 _supply_regulator, _system_uA, _freq, _force_mode, \
375 _sleep_set_force_mode) \
David Collins8af872e2012-01-06 11:31:56 -0800376 RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
377 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
378 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
David Collins226f2512012-03-19 13:18:39 -0700379 | REGULATOR_CHANGE_DRMS, 0, _min_uV, _system_uA, 0, _pd, \
David Collins8af872e2012-01-06 11:31:56 -0800380 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8930_NONE, \
David Collins3d2b9452012-03-19 11:00:30 -0700381 RPM_VREG_FORCE_MODE_8930_##_force_mode, \
382 RPM_VREG_FORCE_MODE_8930_##_sleep_set_force_mode, \
383 RPM_VREG_POWER_MODE_8930_PWM, RPM_VREG_STATE_OFF, \
384 _sleep_selectable, _always_on, _supply_regulator, _system_uA)
David Collins8af872e2012-01-06 11:31:56 -0800385
386#define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \
387 RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \
388 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8930_NONE, \
David Collins15789042012-03-19 10:44:36 -0700389 RPM_VREG_FORCE_MODE_8930_NONE, \
David Collins8af872e2012-01-06 11:31:56 -0800390 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
391 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
392 _supply_regulator, 0)
393
394#define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
395 _supply_regulator, _freq) \
396 RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
397 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \
398 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8930_NONE, \
David Collins15789042012-03-19 10:44:36 -0700399 RPM_VREG_FORCE_MODE_8930_NONE, \
David Collins8af872e2012-01-06 11:31:56 -0800400 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
401 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
402 _supply_regulator, 0)
403
David Collins04907312012-02-08 14:17:57 -0800404#define RPM_CORNER(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
405 _supply_regulator) \
406 RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
407 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 0, 0, 0, \
408 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8930_NONE, \
David Collins15789042012-03-19 10:44:36 -0700409 RPM_VREG_FORCE_MODE_8930_NONE, \
David Collins04907312012-02-08 14:17:57 -0800410 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
411 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
412 _supply_regulator, 0)
413
David Collins8af872e2012-01-06 11:31:56 -0800414/* Pin control initialization */
415#define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
416 { \
417 .init_data = { \
418 .constraints = { \
419 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
420 .always_on = _always_on, \
421 }, \
422 .num_consumer_supplies = \
423 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
424 .consumer_supplies = vreg_consumers_##_id##_PC, \
425 .supply_regulator = _supply_regulator, \
426 }, \
427 .id = RPM_VREG_ID_PM8038_##_id##_PC, \
428 .pin_fn = RPM_VREG_PIN_FN_8930_##_pin_fn, \
429 .pin_ctrl = _pin_ctrl, \
430 }
431
David Collins1d4061b2011-12-06 15:36:40 -0800432#define GPIO_VREG(_id, _reg_name, _gpio_label, _gpio, _supply_regulator) \
433 [MSM8930_GPIO_VREG_ID_##_id] = { \
434 .init_data = { \
435 .constraints = { \
436 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
437 }, \
438 .num_consumer_supplies = \
439 ARRAY_SIZE(vreg_consumers_##_id), \
440 .consumer_supplies = vreg_consumers_##_id, \
441 .supply_regulator = _supply_regulator, \
442 }, \
443 .regulator_name = _reg_name, \
444 .gpio_label = _gpio_label, \
445 .gpio = _gpio, \
446 }
447
David Collinsb4558422012-01-05 10:50:49 -0800448#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
449 { \
450 .constraints = { \
451 .name = _name, \
Michael Bohanee3ce19c2012-11-13 14:57:40 -0800452 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | \
453 REGULATOR_CHANGE_STATUS, \
David Collinsb4558422012-01-05 10:50:49 -0800454 .min_uV = _min_uV, \
455 .max_uV = _max_uV, \
456 }, \
457 .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \
458 .consumer_supplies = vreg_consumers_##_id, \
459 }
460
David Collins1d4061b2011-12-06 15:36:40 -0800461/* GPIO regulator constraints */
462struct gpio_regulator_platform_data
David Collins4614cb92012-08-20 12:17:09 -0700463msm8930_pm8038_gpio_regulator_pdata[] __devinitdata = {
David Collins1d4061b2011-12-06 15:36:40 -0800464 /* ID vreg_name gpio_label gpio supply */
465 GPIO_VREG(EXT_5V, "ext_5v", "ext_5v_en", 63, NULL),
466 GPIO_VREG(EXT_OTG_SW, "ext_otg_sw", "ext_otg_sw_en", 97, "ext_5v"),
467};
468
David Collinsb4558422012-01-05 10:50:49 -0800469/* SAW regulator constraints */
David Collins4614cb92012-08-20 12:17:09 -0700470struct regulator_init_data msm8930_pm8038_saw_regulator_core0_pdata =
David Collinsb4558422012-01-05 10:50:49 -0800471 /* ID vreg_name min_uV max_uV */
472 SAW_VREG_INIT(S5, "8038_s5", 850000, 1300000);
David Collins4614cb92012-08-20 12:17:09 -0700473struct regulator_init_data msm8930_pm8038_saw_regulator_core1_pdata =
David Collinsb4558422012-01-05 10:50:49 -0800474 SAW_VREG_INIT(S6, "8038_s6", 850000, 1300000);
475
David Collins1d4061b2011-12-06 15:36:40 -0800476/* PM8038 regulator constraints */
477struct pm8xxx_regulator_platform_data
478msm8930_pm8038_regulator_pdata[] __devinitdata = {
479 /*
480 * ID name always_on pd min_uV max_uV en_t supply
481 * system_uA reg_ID
482 */
Matt Wagantalled36d822012-05-25 18:13:40 -0700483 PM8XXX_NLDO1200(L16, "8038_l16", 0, 1, 375000, 1050000, 200, "8038_s3",
David Collins8af872e2012-01-06 11:31:56 -0800484 0, 0),
Matt Wagantalled36d822012-05-25 18:13:40 -0700485 PM8XXX_NLDO1200(L19, "8038_l19", 0, 1, 375000, 1050000, 200, "8038_s3",
David Collins8af872e2012-01-06 11:31:56 -0800486 0, 1),
Matt Wagantalled36d822012-05-25 18:13:40 -0700487 PM8XXX_NLDO1200(L27, "8038_l27", 0, 1, 375000, 1050000, 200, "8038_s3",
David Collins8af872e2012-01-06 11:31:56 -0800488 0, 2),
489};
David Collins1d4061b2011-12-06 15:36:40 -0800490
David Collins8af872e2012-01-06 11:31:56 -0800491static struct rpm_regulator_init_data
492msm8930_rpm_regulator_init_data[] __devinitdata = {
David Collins3d2b9452012-03-19 11:00:30 -0700493 /* ID a_on pd ss min_uV max_uV supply sys_uA freq fm ss_fm */
David Collinsc4208cc2012-03-19 12:53:10 -0700494 RPM_SMPS(S1, 0, 1, 1, 500000, 1150000, NULL, 100000, 4p80, AUTO, LPM),
495 RPM_SMPS(S2, 1, 1, 1, 1400000, 1400000, NULL, 100000, 1p60, AUTO, LPM),
David Collins3dac4312012-11-15 15:24:29 -0800496 RPM_SMPS(S3, 0, 1, 1, 1150000, 1150000, NULL, 100000, 3p20, AUTO, AUTO),
David Collins226f2512012-03-19 13:18:39 -0700497 RPM_SMPS(S4, 1, 1, 1, 1950000, 2200000, NULL, 100000, 1p60, AUTO, LPM),
David Collins1d4061b2011-12-06 15:36:40 -0800498
David Collins8af872e2012-01-06 11:31:56 -0800499 /* ID a_on pd ss min_uV max_uV supply sys_uA init_ip */
500 RPM_LDO(L1, 0, 1, 0, 1300000, 1300000, "8038_s2", 0, 0),
501 RPM_LDO(L2, 0, 1, 0, 1200000, 1200000, "8038_s2", 0, 0),
502 RPM_LDO(L3, 0, 1, 0, 3075000, 3075000, NULL, 0, 0),
503 RPM_LDO(L4, 1, 1, 0, 1800000, 1800000, NULL, 10000, 10000),
504 RPM_LDO(L5, 0, 1, 0, 2950000, 2950000, NULL, 0, 0),
505 RPM_LDO(L6, 0, 1, 0, 2950000, 2950000, NULL, 0, 0),
506 RPM_LDO(L7, 0, 1, 0, 2050000, 2050000, "8038_s4", 0, 0),
507 RPM_LDO(L8, 0, 1, 0, 2800000, 2800000, NULL, 0, 0),
508 RPM_LDO(L9, 0, 1, 0, 2850000, 2850000, NULL, 0, 0),
509 RPM_LDO(L10, 0, 1, 0, 2900000, 2900000, NULL, 0, 0),
510 RPM_LDO(L11, 1, 1, 0, 1800000, 1800000, "8038_s4", 10000, 10000),
511 RPM_LDO(L12, 0, 1, 0, 1200000, 1200000, "8038_s2", 0, 0),
David Collins652b3442012-08-09 14:47:51 -0700512 RPM_LDO(L13, 0, 0, 0, 2220000, 2220000, NULL, 0, 0),
David Collins8af872e2012-01-06 11:31:56 -0800513 RPM_LDO(L14, 0, 1, 0, 1800000, 1800000, NULL, 0, 0),
514 RPM_LDO(L15, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
515 RPM_LDO(L17, 0, 1, 0, 1800000, 2950000, NULL, 0, 0),
516 RPM_LDO(L18, 0, 1, 0, 1800000, 1800000, NULL, 0, 0),
David Collins19e78812012-06-04 15:50:09 -0700517 RPM_LDO(L20, 1, 1, 0, 1250000, 1250000, "8038_s2", 10000, 10000),
David Collins8af872e2012-01-06 11:31:56 -0800518 RPM_LDO(L21, 0, 1, 0, 1900000, 1900000, "8038_s4", 0, 0),
519 RPM_LDO(L22, 1, 1, 0, 1850000, 2950000, NULL, 10000, 10000),
520 RPM_LDO(L23, 1, 1, 1, 1800000, 1800000, "8038_s4", 0, 0),
David Collinsad96fa32012-03-02 08:41:38 -0800521 RPM_LDO(L24, 0, 1, 1, 500000, 1150000, "8038_s2", 10000, 10000),
David Collins652b3442012-08-09 14:47:51 -0700522 RPM_LDO(L25, 0, 0, 0, 1740000, 1740000, "8038_l13", 0, 0),
David Collins8af872e2012-01-06 11:31:56 -0800523 RPM_LDO(L26, 1, 1, 0, 1050000, 1050000, "8038_s2", 10000, 10000),
524
525 /* ID a_on pd ss supply */
526 RPM_VS(LVS1, 0, 1, 0, "8038_l11"),
527 RPM_VS(LVS2, 0, 1, 0, "8038_l11"),
David Collins04907312012-02-08 14:17:57 -0800528
529 /* ID a_on ss min_corner max_corner supply */
530 RPM_CORNER(VDD_DIG_CORNER, 0, 1, RPM_VREG_CORNER_NONE,
531 RPM_VREG_CORNER_HIGH, NULL),
David Collins1d4061b2011-12-06 15:36:40 -0800532};
533
534int msm8930_pm8038_regulator_pdata_len __devinitdata =
535 ARRAY_SIZE(msm8930_pm8038_regulator_pdata);
David Collins8af872e2012-01-06 11:31:56 -0800536
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700537#define RPM_REG_MAP(_id, _sleep_also, _voter, _supply, _dev_name) \
538 { \
539 .vreg_id = RPM_VREG_ID_PM8038_##_id, \
540 .sleep_also = _sleep_also, \
541 .voter = _voter, \
542 .supply = _supply, \
543 .dev_name = _dev_name, \
544 }
545static struct rpm_regulator_consumer_mapping
546 msm_rpm_regulator_consumer_mapping[] __devinitdata = {
547 RPM_REG_MAP(L23, 0, 1, "krait0_hfpll", "acpuclk-8930"),
548 RPM_REG_MAP(L23, 0, 2, "krait1_hfpll", "acpuclk-8930"),
549 RPM_REG_MAP(L23, 0, 6, "l2_hfpll", "acpuclk-8930"),
550 RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8930"),
551 RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8930"),
552 RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig", "acpuclk-8930"),
553 RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig", "acpuclk-8930"),
Matt Wagantallab730bd2012-06-07 20:13:51 -0700554
555 RPM_REG_MAP(L23, 0, 1, "krait0_hfpll", "acpuclk-8627"),
556 RPM_REG_MAP(L23, 0, 2, "krait1_hfpll", "acpuclk-8627"),
557 RPM_REG_MAP(L23, 0, 6, "l2_hfpll", "acpuclk-8627"),
558 RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8627"),
559 RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8627"),
560 RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig", "acpuclk-8627"),
561 RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig", "acpuclk-8627"),
Tianyi Gou12370f12012-07-23 19:13:57 -0700562
563 RPM_REG_MAP(L23, 0, 1, "krait0_hfpll", "acpuclk-8930aa"),
564 RPM_REG_MAP(L23, 0, 2, "krait1_hfpll", "acpuclk-8930aa"),
565 RPM_REG_MAP(L23, 0, 6, "l2_hfpll", "acpuclk-8930aa"),
566 RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8930aa"),
567 RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8930aa"),
568 RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig", "acpuclk-8930aa"),
569 RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig", "acpuclk-8930aa"),
Tianyi Gou2520b6e2012-10-29 19:13:53 -0700570
571 RPM_REG_MAP(L23, 0, 1, "krait0_hfpll", "acpuclk-8930ab"),
572 RPM_REG_MAP(L23, 0, 2, "krait1_hfpll", "acpuclk-8930ab"),
573 RPM_REG_MAP(L23, 0, 6, "l2_hfpll", "acpuclk-8930ab"),
574 RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8930ab"),
575 RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8930ab"),
576 RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig", "acpuclk-8930ab"),
577 RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig", "acpuclk-8930ab"),
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700578};
579
David Collins4614cb92012-08-20 12:17:09 -0700580struct rpm_regulator_platform_data
581msm8930_pm8038_rpm_regulator_pdata __devinitdata = {
David Collins8af872e2012-01-06 11:31:56 -0800582 .init_data = msm8930_rpm_regulator_init_data,
583 .num_regulators = ARRAY_SIZE(msm8930_rpm_regulator_init_data),
584 .version = RPM_VREG_VERSION_8930,
585 .vreg_id_vdd_mem = RPM_VREG_ID_PM8038_L24,
David Collins04907312012-02-08 14:17:57 -0800586 .vreg_id_vdd_dig = RPM_VREG_ID_PM8038_VDD_DIG_CORNER,
Matt Wagantall6dcfa922012-06-07 20:13:51 -0700587 .consumer_map = msm_rpm_regulator_consumer_mapping,
588 .consumer_map_len = ARRAY_SIZE(msm_rpm_regulator_consumer_mapping),
David Collins8af872e2012-01-06 11:31:56 -0800589};