blob: f8984f837f4d2658d67a870e36d09b3a3b874a0c [file] [log] [blame]
Jay Chokshiea67c622011-07-29 17:12:26 -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
16#include "board-apq8064.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("8921_l1", NULL),
27};
28VREG_CONSUMERS(L2) = {
29 REGULATOR_SUPPLY("8921_l2", NULL),
30};
31VREG_CONSUMERS(L3) = {
32 REGULATOR_SUPPLY("8921_l3", NULL),
Hemant Kumar6ddad592011-08-03 19:31:56 -070033 REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"),
Manu Gautamdccbca42011-11-08 15:13:38 +053034 REGULATOR_SUPPLY("HSUSB_3p3", "msm_ehci_host.0"),
35 REGULATOR_SUPPLY("HSUSB_3p3", "msm_ehci_host.1"),
Jay Chokshiea67c622011-07-29 17:12:26 -070036};
37VREG_CONSUMERS(L4) = {
38 REGULATOR_SUPPLY("8921_l4", NULL),
Hemant Kumar6ddad592011-08-03 19:31:56 -070039 REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"),
Manu Gautamdccbca42011-11-08 15:13:38 +053040 REGULATOR_SUPPLY("HSUSB_1p8", "msm_ehci_host.0"),
41 REGULATOR_SUPPLY("HSUSB_1p8", "msm_ehci_host.1"),
Jay Chokshiea67c622011-07-29 17:12:26 -070042};
43VREG_CONSUMERS(L5) = {
44 REGULATOR_SUPPLY("8921_l5", NULL),
Sahitya Tummalab4d883f2011-08-23 10:44:51 +053045 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.1"),
Jay Chokshiea67c622011-07-29 17:12:26 -070046};
47VREG_CONSUMERS(L6) = {
48 REGULATOR_SUPPLY("8921_l6", NULL),
Sahitya Tummalab4d883f2011-08-23 10:44:51 +053049 REGULATOR_SUPPLY("sdc_vdd", "msm_sdcc.3"),
Jay Chokshiea67c622011-07-29 17:12:26 -070050};
51VREG_CONSUMERS(L7) = {
52 REGULATOR_SUPPLY("8921_l7", NULL),
Sahitya Tummalab4d883f2011-08-23 10:44:51 +053053 REGULATOR_SUPPLY("sdc_vddp", "msm_sdcc.3"),
Jay Chokshiea67c622011-07-29 17:12:26 -070054};
55VREG_CONSUMERS(L8) = {
56 REGULATOR_SUPPLY("8921_l8", NULL),
57};
58VREG_CONSUMERS(L9) = {
59 REGULATOR_SUPPLY("8921_l9", NULL),
60};
61VREG_CONSUMERS(L10) = {
62 REGULATOR_SUPPLY("8921_l10", NULL),
63};
64VREG_CONSUMERS(L11) = {
65 REGULATOR_SUPPLY("8921_l11", NULL),
66};
67VREG_CONSUMERS(L12) = {
68 REGULATOR_SUPPLY("8921_l12", NULL),
69};
70VREG_CONSUMERS(L14) = {
71 REGULATOR_SUPPLY("8921_l14", NULL),
72};
73VREG_CONSUMERS(L15) = {
74 REGULATOR_SUPPLY("8921_l15", NULL),
75};
76VREG_CONSUMERS(L16) = {
77 REGULATOR_SUPPLY("8921_l16", NULL),
78};
79VREG_CONSUMERS(L17) = {
80 REGULATOR_SUPPLY("8921_l17", NULL),
81};
82VREG_CONSUMERS(L18) = {
83 REGULATOR_SUPPLY("8921_l18", NULL),
84};
85VREG_CONSUMERS(L22) = {
86 REGULATOR_SUPPLY("8921_l22", NULL),
87};
88VREG_CONSUMERS(L23) = {
89 REGULATOR_SUPPLY("8921_l23", NULL),
90};
91VREG_CONSUMERS(L24) = {
92 REGULATOR_SUPPLY("8921_l24", NULL),
93};
94VREG_CONSUMERS(L25) = {
95 REGULATOR_SUPPLY("8921_l25", NULL),
96};
97VREG_CONSUMERS(L26) = {
98 REGULATOR_SUPPLY("8921_l26", NULL),
99};
100VREG_CONSUMERS(L27) = {
101 REGULATOR_SUPPLY("8921_l27", NULL),
102};
103VREG_CONSUMERS(L28) = {
104 REGULATOR_SUPPLY("8921_l28", NULL),
105};
106VREG_CONSUMERS(S1) = {
107 REGULATOR_SUPPLY("8921_s1", NULL),
108};
109VREG_CONSUMERS(S2) = {
110 REGULATOR_SUPPLY("8921_s2", NULL),
111};
112VREG_CONSUMERS(S3) = {
113 REGULATOR_SUPPLY("8921_s3", NULL),
Hemant Kumar6ddad592011-08-03 19:31:56 -0700114 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_otg"),
Manu Gautamdccbca42011-11-08 15:13:38 +0530115 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_ehci_host.0"),
116 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_ehci_host.1"),
Jay Chokshiea67c622011-07-29 17:12:26 -0700117};
118VREG_CONSUMERS(S4) = {
119 REGULATOR_SUPPLY("8921_s4", NULL),
Sahitya Tummalab4d883f2011-08-23 10:44:51 +0530120 REGULATOR_SUPPLY("sdc_vccq", "msm_sdcc.1"),
Jay Chokshiea67c622011-07-29 17:12:26 -0700121};
122VREG_CONSUMERS(S5) = {
123 REGULATOR_SUPPLY("8921_s5", NULL),
124};
125VREG_CONSUMERS(S6) = {
126 REGULATOR_SUPPLY("8921_s6", NULL),
127};
128VREG_CONSUMERS(S7) = {
129 REGULATOR_SUPPLY("8921_s7", NULL),
130};
131VREG_CONSUMERS(LVS1) = {
132 REGULATOR_SUPPLY("8921_lvs1", NULL),
133};
134VREG_CONSUMERS(LVS2) = {
135 REGULATOR_SUPPLY("8921_lvs2", NULL),
136};
137VREG_CONSUMERS(LVS3) = {
138 REGULATOR_SUPPLY("8921_lvs3", NULL),
139};
140VREG_CONSUMERS(LVS4) = {
141 REGULATOR_SUPPLY("8921_lvs4", NULL),
142};
143VREG_CONSUMERS(LVS5) = {
144 REGULATOR_SUPPLY("8921_lvs5", NULL),
145};
146VREG_CONSUMERS(LVS6) = {
147 REGULATOR_SUPPLY("8921_lvs6", NULL),
148};
149VREG_CONSUMERS(LVS7) = {
150 REGULATOR_SUPPLY("8921_lvs7", NULL),
151};
152VREG_CONSUMERS(USB_OTG) = {
153 REGULATOR_SUPPLY("8921_usb_otg", NULL),
154};
155VREG_CONSUMERS(HDMI_MVS) = {
156 REGULATOR_SUPPLY("8921_hdmi_mvs", NULL),
157};
158VREG_CONSUMERS(NCP) = {
159 REGULATOR_SUPPLY("8921_ncp", NULL),
160};
161
162#define PM8921_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \
163 _pull_down, _always_on, _supply_regulator, \
164 _system_uA, _enable_time) \
165 { \
166 .init_data = { \
167 .constraints = { \
168 .valid_modes_mask = _modes, \
169 .valid_ops_mask = _ops, \
170 .min_uV = _min_uV, \
171 .max_uV = _max_uV, \
172 .input_uV = _max_uV, \
173 .apply_uV = _apply_uV, \
174 .always_on = _always_on, \
175 }, \
176 .num_consumer_supplies = \
177 ARRAY_SIZE(vreg_consumers_##_id), \
178 .consumer_supplies = vreg_consumers_##_id, \
179 .supply_regulator = _supply_regulator, \
180 }, \
181 .id = PM8921_VREG_ID_##_id, \
182 .pull_down_enable = _pull_down, \
183 .system_uA = _system_uA, \
184 .enable_time = _enable_time, \
185 }
186
187#define PM8921_VREG_INIT_LDO(_id, _always_on, _pull_down, _min_uV, _max_uV, \
188 _enable_time, _supply_regulator, _system_uA) \
189 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
190 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
191 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
192 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
193 _supply_regulator, _system_uA, _enable_time)
194
195#define PM8921_VREG_INIT_NLDO1200(_id, _always_on, _pull_down, _min_uV, \
196 _max_uV, _enable_time, _supply_regulator, _system_uA) \
197 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
198 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
199 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
200 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
201 _supply_regulator, _system_uA, _enable_time)
202
203#define PM8921_VREG_INIT_SMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
204 _enable_time, _supply_regulator, _system_uA) \
205 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
206 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
207 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
208 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
209 _supply_regulator, _system_uA, _enable_time)
210
211#define PM8921_VREG_INIT_FTSMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
212 _enable_time, _supply_regulator, _system_uA) \
213 PM8921_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
214 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
215 | REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
216 _supply_regulator, _system_uA, _enable_time)
217
218#define PM8921_VREG_INIT_VS(_id, _always_on, _pull_down, _enable_time, \
219 _supply_regulator) \
220 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
221 _always_on, _supply_regulator, 0, _enable_time)
222
223#define PM8921_VREG_INIT_VS300(_id, _always_on, _pull_down, _enable_time, \
224 _supply_regulator) \
225 PM8921_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
226 _always_on, _supply_regulator, 0, _enable_time)
227
228#define PM8921_VREG_INIT_NCP(_id, _always_on, _min_uV, _max_uV, _enable_time, \
229 _supply_regulator) \
230 PM8921_VREG_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE | \
231 REGULATOR_CHANGE_STATUS, 0, 0, _always_on, _supply_regulator, \
232 0, _enable_time)
233
234/* Pin control initialization */
235#define PM8921_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
236 { \
237 .init_data = { \
238 .constraints = { \
239 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
240 .always_on = _always_on, \
241 }, \
242 .num_consumer_supplies = \
243 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
244 .consumer_supplies = vreg_consumers_##_id##_PC, \
245 .supply_regulator = _supply_regulator, \
246 }, \
247 .id = PM8921_VREG_ID_##_id##_PC, \
248 .pin_fn = PM8921_VREG_PIN_FN_##_pin_fn, \
249 .pin_ctrl = _pin_ctrl, \
250 }
251
252#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
253 { \
254 .constraints = { \
255 .name = _name, \
256 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, \
257 .min_uV = _min_uV, \
258 .max_uV = _max_uV, \
259 }, \
260 .num_consumer_supplies = ARRAY_SIZE(vreg_consumers_##_id), \
261 .consumer_supplies = vreg_consumers_##_id, \
262 }
263
264/* SAW regulator constraints */
265struct regulator_init_data msm8064_saw_regulator_pdata_s5 =
266 /* ID vreg_name min_uV max_uV */
267 SAW_VREG_INIT(S5, "8921_s5", 1050000, 1150000);
268struct regulator_init_data msm8064_saw_regulator_pdata_s6 =
269 SAW_VREG_INIT(S6, "8921_s6", 1050000, 1150000);
270
271/* PM8921 regulator constraints */
272struct pm8921_regulator_platform_data
273msm8064_pm8921_regulator_pdata[] __devinitdata = {
274 /* ID a_on pd min_uV max_uV en_t supply sys_uA */
275 PM8921_VREG_INIT_SMPS(S1, 1, 1, 1225000, 1225000, 500, NULL, 100000),
276 PM8921_VREG_INIT_SMPS(S2, 0, 1, 1300000, 1300000, 500, NULL, 0),
277 PM8921_VREG_INIT_SMPS(S3, 1, 1, 1150000, 1150000, 500, NULL, 100000),
278 PM8921_VREG_INIT_SMPS(S4, 1, 1, 1800000, 1800000, 500, NULL, 100000),
279 PM8921_VREG_INIT_SMPS(S7, 0, 1, 1200000, 1200000, 500, NULL, 100000),
280
281 PM8921_VREG_INIT_LDO(L1, 1, 1, 1100000, 1100000, 200, "8921_s4", 0),
282 PM8921_VREG_INIT_LDO(L2, 0, 1, 1200000, 1200000, 200, "8921_s4", 0),
283 PM8921_VREG_INIT_LDO(L3, 0, 1, 3075000, 3075000, 200, NULL, 0),
284 PM8921_VREG_INIT_LDO(L4, 1, 1, 1800000, 1800000, 200, NULL, 0),
285 PM8921_VREG_INIT_LDO(L5, 0, 1, 2950000, 2950000, 200, NULL, 0),
286 PM8921_VREG_INIT_LDO(L6, 0, 1, 2950000, 2950000, 200, NULL, 0),
287 PM8921_VREG_INIT_LDO(L7, 1, 1, 1850000, 2950000, 200, NULL, 0),
288 PM8921_VREG_INIT_LDO(L8, 0, 1, 2800000, 2800000, 200, NULL, 0),
289 PM8921_VREG_INIT_LDO(L9, 0, 1, 2850000, 2850000, 200, NULL, 0),
290 PM8921_VREG_INIT_LDO(L10, 0, 1, 2900000, 2900000, 200, NULL, 0),
291 PM8921_VREG_INIT_LDO(L11, 0, 1, 3000000, 3000000, 200, NULL, 0),
292 PM8921_VREG_INIT_LDO(L12, 0, 1, 1200000, 1200000, 200, "8921_s4", 0),
293 PM8921_VREG_INIT_LDO(L14, 0, 1, 1800000, 1800000, 200, NULL, 0),
294 PM8921_VREG_INIT_LDO(L15, 0, 1, 1800000, 2950000, 200, NULL, 0),
295 PM8921_VREG_INIT_LDO(L16, 0, 1, 2800000, 2800000, 200, NULL, 0),
296 PM8921_VREG_INIT_LDO(L17, 0, 1, 2000000, 2000000, 200, NULL, 0),
297 PM8921_VREG_INIT_LDO(L18, 0, 1, 1300000, 1800000, 200, "8921_s4", 0),
298 PM8921_VREG_INIT_LDO(L22, 0, 1, 2600000, 2600000, 200, NULL, 0),
299 PM8921_VREG_INIT_LDO(L23, 0, 1, 1800000, 1800000, 200, NULL, 0),
300 PM8921_VREG_INIT_NLDO1200(L24, 1, 1, 1150000, 1150000, 200, "8921_s1",
301 10000),
302 PM8921_VREG_INIT_NLDO1200(L25, 1, 1, 1225000, 1225000, 200, "8921_s1",
303 0),
304 PM8921_VREG_INIT_NLDO1200(L26, 0, 1, 1050000, 1050000, 200, "8921_s7",
305 0),
306 PM8921_VREG_INIT_NLDO1200(L27, 0, 1, 1000000, 1000000, 200, "8921_s7",
307 0),
308 PM8921_VREG_INIT_NLDO1200(L28, 0, 1, 1050000, 1050000, 200, "8921_s7",
309 0),
310
311 /* ID always_on pd en_t supply */
312 PM8921_VREG_INIT_VS(LVS1, 0, 1, 0, "8921_s4"),
313 PM8921_VREG_INIT_VS300(LVS2, 0, 1, 0, "8921_s1"),
314 PM8921_VREG_INIT_VS(LVS3, 0, 1, 0, "8921_s4"),
315 PM8921_VREG_INIT_VS(LVS4, 0, 1, 0, "8921_s4"),
316 PM8921_VREG_INIT_VS(LVS5, 0, 1, 0, "8921_s4"),
317 PM8921_VREG_INIT_VS(LVS6, 0, 1, 0, "8921_s4"),
318 PM8921_VREG_INIT_VS(LVS7, 1, 1, 0, "8921_s4"),
319
320 PM8921_VREG_INIT_VS300(USB_OTG, 0, 1, 0, NULL),
321 PM8921_VREG_INIT_VS300(HDMI_MVS, 0, 1, 0, NULL),
322
323 /* ID always_on min_uV max_uV en_t supply */
324 PM8921_VREG_INIT_NCP(NCP, 0, 1800000, 1800000, 200, "8921_l6"),
325};
326
327int msm8064_pm8921_regulator_pdata_len __devinitdata =
328 ARRAY_SIZE(msm8064_pm8921_regulator_pdata);