blob: 9133856562256b2ff1e760fcd7f1c1cd3a55f0ba [file] [log] [blame]
David Collins5779cea2012-01-05 15:09:21 -08001/*
2 * Copyright (c) 2012, 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#define pr_fmt(fmt) "%s: " fmt, __func__
15
16#include "rpm-regulator-private.h"
17
18/* RPM regulator request formats */
19static struct rpm_vreg_parts ldo_parts = {
20 .request_len = 2,
21 .uV = REQUEST_MEMBER(0, 0x007FFFFF, 0),
22 .pd = REQUEST_MEMBER(0, 0x00800000, 23),
23 .pc = REQUEST_MEMBER(0, 0x0F000000, 24),
24 .pf = REQUEST_MEMBER(0, 0xF0000000, 28),
25 .ip = REQUEST_MEMBER(1, 0x000003FF, 0),
26 .ia = REQUEST_MEMBER(1, 0x000FFC00, 10),
27 .fm = REQUEST_MEMBER(1, 0x00700000, 20),
28};
29
30static struct rpm_vreg_parts smps_parts = {
31 .request_len = 2,
32 .uV = REQUEST_MEMBER(0, 0x007FFFFF, 0),
33 .pd = REQUEST_MEMBER(0, 0x00800000, 23),
34 .pc = REQUEST_MEMBER(0, 0x0F000000, 24),
35 .pf = REQUEST_MEMBER(0, 0xF0000000, 28),
36 .ip = REQUEST_MEMBER(1, 0x000003FF, 0),
37 .ia = REQUEST_MEMBER(1, 0x000FFC00, 10),
38 .fm = REQUEST_MEMBER(1, 0x00700000, 20),
39 .pm = REQUEST_MEMBER(1, 0x00800000, 23),
40 .freq = REQUEST_MEMBER(1, 0x1F000000, 24),
41 .freq_clk_src = REQUEST_MEMBER(1, 0x60000000, 29),
42};
43
44static struct rpm_vreg_parts switch_parts = {
45 .request_len = 1,
46 .enable_state = REQUEST_MEMBER(0, 0x00000001, 0),
47 .pd = REQUEST_MEMBER(0, 0x00000002, 1),
48 .pc = REQUEST_MEMBER(0, 0x0000003C, 2),
49 .pf = REQUEST_MEMBER(0, 0x000003C0, 6),
50 .hpm = REQUEST_MEMBER(0, 0x00000C00, 10),
51};
52
David Collins49177a72012-02-06 17:01:19 -080053static struct rpm_vreg_parts corner_parts = {
54 .request_len = 1,
55 .uV = REQUEST_MEMBER(0, 0x00000003, 0),
56};
57
David Collins5779cea2012-01-05 15:09:21 -080058/* Physically available PMIC regulator voltage setpoint ranges */
59static struct vreg_range pldo_ranges[] = {
60 VOLTAGE_RANGE( 750000, 1487500, 12500),
61 VOLTAGE_RANGE(1500000, 3075000, 25000),
62 VOLTAGE_RANGE(3100000, 4900000, 50000),
63};
64
65static struct vreg_range nldo_ranges[] = {
66 VOLTAGE_RANGE( 750000, 1537500, 12500),
67};
68
69static struct vreg_range nldo1200_ranges[] = {
70 VOLTAGE_RANGE( 375000, 743750, 6250),
71 VOLTAGE_RANGE( 750000, 1537500, 12500),
72};
73
David Collins18a54422012-08-09 14:41:06 -070074static struct vreg_range ln_ldo_ranges[] = {
75 VOLTAGE_RANGE( 690000, 1110000, 60000),
76 VOLTAGE_RANGE(1380000, 2220000, 120000),
77};
78
David Collins5779cea2012-01-05 15:09:21 -080079static struct vreg_range smps_ranges[] = {
80 VOLTAGE_RANGE( 375000, 737500, 12500),
81 VOLTAGE_RANGE( 750000, 1487500, 12500),
82 VOLTAGE_RANGE(1500000, 3075000, 25000),
83};
84
85static struct vreg_range ftsmps_ranges[] = {
86 VOLTAGE_RANGE( 350000, 650000, 50000),
87 VOLTAGE_RANGE( 700000, 1400000, 12500),
88 VOLTAGE_RANGE(1500000, 3300000, 50000),
89};
90
David Collins49177a72012-02-06 17:01:19 -080091static struct vreg_range corner_ranges[] = {
92 VOLTAGE_RANGE(RPM_VREG_CORNER_NONE, RPM_VREG_CORNER_HIGH, 1),
93};
94
David Collins5779cea2012-01-05 15:09:21 -080095static struct vreg_set_points pldo_set_points = SET_POINTS(pldo_ranges);
96static struct vreg_set_points nldo_set_points = SET_POINTS(nldo_ranges);
97static struct vreg_set_points nldo1200_set_points = SET_POINTS(nldo1200_ranges);
David Collins18a54422012-08-09 14:41:06 -070098static struct vreg_set_points ln_ldo_set_points = SET_POINTS(ln_ldo_ranges);
David Collins5779cea2012-01-05 15:09:21 -080099static struct vreg_set_points smps_set_points = SET_POINTS(smps_ranges);
100static struct vreg_set_points ftsmps_set_points = SET_POINTS(ftsmps_ranges);
David Collins49177a72012-02-06 17:01:19 -0800101static struct vreg_set_points corner_set_points = SET_POINTS(corner_ranges);
David Collins5779cea2012-01-05 15:09:21 -0800102
103static struct vreg_set_points *all_set_points[] = {
104 &pldo_set_points,
105 &nldo_set_points,
106 &nldo1200_set_points,
David Collins18a54422012-08-09 14:41:06 -0700107 &ln_ldo_set_points,
David Collins5779cea2012-01-05 15:09:21 -0800108 &smps_set_points,
109 &ftsmps_set_points,
David Collins49177a72012-02-06 17:01:19 -0800110 &corner_set_points,
David Collins5779cea2012-01-05 15:09:21 -0800111};
112
David Collins62ae8d92012-07-31 16:29:43 -0700113#define LDO(_id, _name, _name_pc, _ranges, _hpm_min_load, _requires_cxo) \
David Collinsd2a4fef2012-08-13 12:31:04 -0700114 [RPM_VREG_ID_PM##_id] = { \
David Collins5779cea2012-01-05 15:09:21 -0800115 .req = { \
David Collinsd2a4fef2012-08-13 12:31:04 -0700116 [0] = { .id = MSM_RPM_ID_PM##_id##_0, }, \
117 [1] = { .id = MSM_RPM_ID_PM##_id##_1, }, \
David Collins5779cea2012-01-05 15:09:21 -0800118 }, \
119 .hpm_min_load = RPM_VREG_8930_##_hpm_min_load##_HPM_MIN_LOAD, \
120 .type = RPM_REGULATOR_TYPE_LDO, \
121 .set_points = &_ranges##_set_points, \
122 .part = &ldo_parts, \
David Collinsd2a4fef2012-08-13 12:31:04 -0700123 .id = RPM_VREG_ID_PM##_id, \
David Collins5779cea2012-01-05 15:09:21 -0800124 .rdesc.name = _name, \
125 .rdesc_pc.name = _name_pc, \
David Collins62ae8d92012-07-31 16:29:43 -0700126 .requires_cxo = _requires_cxo, \
David Collins5779cea2012-01-05 15:09:21 -0800127 }
128
129#define SMPS(_id, _name, _name_pc, _ranges, _hpm_min_load) \
David Collinsd2a4fef2012-08-13 12:31:04 -0700130 [RPM_VREG_ID_PM##_id] = { \
David Collins5779cea2012-01-05 15:09:21 -0800131 .req = { \
David Collinsd2a4fef2012-08-13 12:31:04 -0700132 [0] = { .id = MSM_RPM_ID_PM##_id##_0, }, \
133 [1] = { .id = MSM_RPM_ID_PM##_id##_1, }, \
David Collins5779cea2012-01-05 15:09:21 -0800134 }, \
135 .hpm_min_load = RPM_VREG_8930_##_hpm_min_load##_HPM_MIN_LOAD, \
136 .type = RPM_REGULATOR_TYPE_SMPS, \
137 .set_points = &_ranges##_set_points, \
138 .part = &smps_parts, \
David Collinsd2a4fef2012-08-13 12:31:04 -0700139 .id = RPM_VREG_ID_PM##_id, \
David Collins5779cea2012-01-05 15:09:21 -0800140 .rdesc.name = _name, \
141 .rdesc_pc.name = _name_pc, \
142 }
143
144#define LVS(_id, _name, _name_pc) \
David Collinsd2a4fef2012-08-13 12:31:04 -0700145 [RPM_VREG_ID_PM##_id] = { \
David Collins5779cea2012-01-05 15:09:21 -0800146 .req = { \
David Collinsd2a4fef2012-08-13 12:31:04 -0700147 [0] = { .id = MSM_RPM_ID_PM##_id, }, \
David Collins5779cea2012-01-05 15:09:21 -0800148 [1] = { .id = -1, }, \
149 }, \
150 .type = RPM_REGULATOR_TYPE_VS, \
151 .part = &switch_parts, \
David Collinsd2a4fef2012-08-13 12:31:04 -0700152 .id = RPM_VREG_ID_PM##_id, \
153 .rdesc.name = _name, \
154 .rdesc_pc.name = _name_pc, \
155 }
156
157#define MVS(_vreg_id, _name, _name_pc, _rpm_id) \
158 [RPM_VREG_ID_PM##_vreg_id] = { \
159 .req = { \
160 [0] = { .id = MSM_RPM_ID_##_rpm_id, }, \
161 [1] = { .id = -1, }, \
162 }, \
163 .type = RPM_REGULATOR_TYPE_VS, \
164 .part = &switch_parts, \
165 .id = RPM_VREG_ID_PM##_vreg_id, \
David Collins5779cea2012-01-05 15:09:21 -0800166 .rdesc.name = _name, \
167 .rdesc_pc.name = _name_pc, \
168 }
169
David Collins49177a72012-02-06 17:01:19 -0800170#define CORNER(_id, _rpm_id, _name, _ranges) \
David Collinsd2a4fef2012-08-13 12:31:04 -0700171 [RPM_VREG_ID_PM##_id] = { \
David Collins49177a72012-02-06 17:01:19 -0800172 .req = { \
173 [0] = { .id = MSM_RPM_ID_##_rpm_id, }, \
174 [1] = { .id = -1, }, \
175 }, \
176 .type = RPM_REGULATOR_TYPE_CORNER, \
177 .set_points = &_ranges##_set_points, \
178 .part = &corner_parts, \
David Collinsd2a4fef2012-08-13 12:31:04 -0700179 .id = RPM_VREG_ID_PM##_id, \
David Collins49177a72012-02-06 17:01:19 -0800180 .rdesc.name = _name, \
181 }
182
David Collinsd2a4fef2012-08-13 12:31:04 -0700183static struct vreg vregs_msm8930_pm8038[] = {
184 LDO(8038_L1, "8038_l1", NULL, nldo1200, LDO_1200, 1),
185 LDO(8038_L2, "8038_l2", "8038_l2_pc", nldo, LDO_150, 1),
186 LDO(8038_L3, "8038_l3", "8038_l3_pc", pldo, LDO_50, 0),
187 LDO(8038_L4, "8038_l4", "8038_l4_pc", pldo, LDO_50, 0),
188 LDO(8038_L5, "8038_l5", "8038_l5_pc", pldo, LDO_600, 0),
189 LDO(8038_L6, "8038_l6", "8038_l6_pc", pldo, LDO_600, 0),
190 LDO(8038_L7, "8038_l7", "8038_l7_pc", pldo, LDO_600, 0),
191 LDO(8038_L8, "8038_l8", "8038_l8_pc", pldo, LDO_300, 0),
192 LDO(8038_L9, "8038_l9", "8038_l9_pc", pldo, LDO_300, 0),
193 LDO(8038_L10, "8038_l10", "8038_l10_pc", pldo, LDO_600, 0),
194 LDO(8038_L11, "8038_l11", "8038_l11_pc", pldo, LDO_600, 0),
195 LDO(8038_L12, "8038_l12", "8038_l12_pc", nldo, LDO_300, 1),
196 LDO(8038_L13, "8038_l13", NULL, ln_ldo, LDO_5, 0),
197 LDO(8038_L14, "8038_l14", "8038_l14_pc", pldo, LDO_50, 0),
198 LDO(8038_L15, "8038_l15", "8038_l15_pc", pldo, LDO_150, 0),
199 LDO(8038_L16, "8038_l16", NULL, nldo1200, LDO_1200, 1),
200 LDO(8038_L17, "8038_l17", "8038_l17_pc", pldo, LDO_150, 0),
201 LDO(8038_L18, "8038_l18", "8038_l18_pc", pldo, LDO_50, 0),
202 LDO(8038_L19, "8038_l19", NULL, nldo1200, LDO_1200, 1),
203 LDO(8038_L20, "8038_l20", NULL, nldo1200, LDO_1200, 1),
204 LDO(8038_L21, "8038_l21", "8038_l21_pc", pldo, LDO_150, 0),
205 LDO(8038_L22, "8038_l22", "8038_l22_pc", pldo, LDO_50, 0),
206 LDO(8038_L23, "8038_l23", "8038_l23_pc", pldo, LDO_50, 0),
207 LDO(8038_L24, "8038_l24", NULL, nldo1200, LDO_1200, 1),
208 LDO(8038_L25, "8038_l25", NULL, ln_ldo, LDO_5, 0),
209 LDO(8038_L26, "8038_l26", "8038_l26_pc", nldo, LDO_150, 1),
210 LDO(8038_L27, "8038_l27", NULL, nldo1200, LDO_1200, 1),
David Collins5779cea2012-01-05 15:09:21 -0800211
David Collinsd2a4fef2012-08-13 12:31:04 -0700212 SMPS(8038_S1, "8038_s1", "8038_s1_pc", smps, SMPS_1500),
213 SMPS(8038_S2, "8038_s2", "8038_s2_pc", smps, SMPS_1500),
214 SMPS(8038_S3, "8038_s3", "8038_s3_pc", smps, SMPS_1500),
215 SMPS(8038_S4, "8038_s4", "8038_s4_pc", smps, SMPS_1500),
216 SMPS(8038_S5, "8038_s5", NULL, ftsmps, SMPS_2000),
217 SMPS(8038_S6, "8038_s6", NULL, ftsmps, SMPS_2000),
David Collins5779cea2012-01-05 15:09:21 -0800218
David Collinsd2a4fef2012-08-13 12:31:04 -0700219 LVS(8038_LVS1, "8038_lvs1", "8038_lvs1_pc"),
220 LVS(8038_LVS2, "8038_lvs2", "8038_lvs2_pc"),
David Collins49177a72012-02-06 17:01:19 -0800221
David Collinsd2a4fef2012-08-13 12:31:04 -0700222 CORNER(8038_VDD_DIG_CORNER, VOLTAGE_CORNER, "vdd_dig_corner", corner),
223};
224
225static struct vreg vregs_msm8930_pm8917[] = {
226 LDO(8917_L1, "8917_l1", "8917_l1_pc", nldo, LDO_150, 1),
227 LDO(8917_L2, "8917_l2", "8917_l2_pc", nldo, LDO_150, 1),
228 LDO(8917_L3, "8917_l3", "8917_l3_pc", pldo, LDO_150, 0),
229 LDO(8917_L4, "8917_l4", "8917_l4_pc", pldo, LDO_50, 0),
230 LDO(8917_L5, "8917_l5", "8917_l5_pc", pldo, LDO_300, 0),
231 LDO(8917_L6, "8917_l6", "8917_l6_pc", pldo, LDO_600, 0),
232 LDO(8917_L7, "8917_l7", "8917_l7_pc", pldo, LDO_150, 0),
233 LDO(8917_L8, "8917_l8", "8917_l8_pc", pldo, LDO_300, 0),
234 LDO(8917_L9, "8917_l9", "8917_l9_pc", pldo, LDO_300, 0),
235 LDO(8917_L10, "8917_l10", "8917_l10_pc", pldo, LDO_600, 0),
236 LDO(8917_L11, "8917_l11", "8917_l11_pc", pldo, LDO_150, 0),
237 LDO(8917_L12, "8917_l12", "8917_l12_pc", nldo, LDO_150, 1),
238 LDO(8917_L14, "8917_l14", "8917_l14_pc", pldo, LDO_50, 0),
239 LDO(8917_L15, "8917_l15", "8917_l15_pc", pldo, LDO_150, 0),
240 LDO(8917_L16, "8917_l16", "8917_l16_pc", pldo, LDO_300, 0),
241 LDO(8917_L17, "8917_l17", "8917_l17_pc", pldo, LDO_150, 0),
242 LDO(8917_L18, "8917_l18", "8917_l18_pc", nldo, LDO_150, 1),
243 LDO(8917_L21, "8917_l21", "8917_l21_pc", pldo, LDO_150, 0),
244 LDO(8917_L22, "8917_l22", "8917_l22_pc", pldo, LDO_150, 0),
245 LDO(8917_L23, "8917_l23", "8917_l23_pc", pldo, LDO_150, 0),
246 LDO(8917_L24, "8917_l24", NULL, nldo1200, LDO_1200, 0),
247 LDO(8917_L25, "8917_l25", NULL, nldo1200, LDO_1200, 0),
248 LDO(8917_L26, "8917_l26", NULL, nldo1200, LDO_1200, 0),
249 LDO(8917_L27, "8917_l27", NULL, nldo1200, LDO_1200, 0),
250 LDO(8917_L28, "8917_l28", NULL, nldo1200, LDO_1200, 0),
251 LDO(8917_L29, "8917_l29", "8917_l29_pc", pldo, LDO_150, 0),
252 LDO(8917_L30, "8917_l30", "8917_l30_pc", pldo, LDO_150, 0),
253 LDO(8917_L31, "8917_l31", "8917_l31_pc", pldo, LDO_150, 0),
254 LDO(8917_L32, "8917_l32", "8917_l32_pc", pldo, LDO_150, 0),
255 LDO(8917_L33, "8917_l33", "8917_l33_pc", pldo, LDO_150, 0),
256 LDO(8917_L34, "8917_l34", "8917_l34_pc", pldo, LDO_150, 0),
257 LDO(8917_L35, "8917_l35", "8917_l35_pc", pldo, LDO_300, 0),
258 LDO(8917_L36, "8917_l36", "8917_l36_pc", pldo, LDO_50, 0),
259
260 SMPS(8917_S1, "8917_s1", "8917_s1_pc", smps, SMPS_1500),
261 SMPS(8917_S2, "8917_s2", "8917_s2_pc", smps, SMPS_1500),
262 SMPS(8917_S3, "8917_s3", "8917_s3_pc", smps, SMPS_1500),
263 SMPS(8917_S4, "8917_s4", "8917_s4_pc", smps, SMPS_1500),
264 SMPS(8917_S5, "8917_s5", NULL, ftsmps, SMPS_2000),
265 SMPS(8917_S6, "8917_s6", NULL, ftsmps, SMPS_2000),
266 SMPS(8917_S7, "8917_s7", "8917_s7_pc", smps, SMPS_1500),
267 SMPS(8917_S8, "8917_s8", "8917_s8_pc", smps, SMPS_1500),
268
269 LVS(8917_LVS1, "8917_lvs1", "8917_lvs1_pc"),
270 LVS(8917_LVS3, "8917_lvs3", "8917_lvs3_pc"),
271 LVS(8917_LVS4, "8917_lvs4", "8917_lvs4_pc"),
272 LVS(8917_LVS5, "8917_lvs5", "8917_lvs5_pc"),
273 LVS(8917_LVS6, "8917_lvs6", "8917_lvs6_pc"),
274 LVS(8917_LVS7, "8917_lvs7", "8917_lvs7_pc"),
275 MVS(8917_USB_OTG, "8917_usb_otg", NULL, USB_OTG_SWITCH),
276
277 CORNER(8917_VDD_DIG_CORNER, VOLTAGE_CORNER, "vdd_dig_corner", corner),
David Collins5779cea2012-01-05 15:09:21 -0800278};
279
280static const char *pin_func_label[] = {
281 [RPM_VREG_PIN_FN_8930_DONT_CARE] = "don't care",
282 [RPM_VREG_PIN_FN_8930_ENABLE] = "on/off",
283 [RPM_VREG_PIN_FN_8930_MODE] = "HPM/LPM",
284 [RPM_VREG_PIN_FN_8930_SLEEP_B] = "sleep_b",
285 [RPM_VREG_PIN_FN_8930_NONE] = "none",
286};
287
288static const char *force_mode_label[] = {
289 [RPM_VREG_FORCE_MODE_8930_NONE] = "none",
290 [RPM_VREG_FORCE_MODE_8930_LPM] = "LPM",
291 [RPM_VREG_FORCE_MODE_8930_AUTO] = "auto",
292 [RPM_VREG_FORCE_MODE_8930_HPM] = "HPM",
293 [RPM_VREG_FORCE_MODE_8930_BYPASS] = "BYP",
294};
295
296static const char *power_mode_label[] = {
297 [RPM_VREG_POWER_MODE_8930_HYSTERETIC] = "HYS",
298 [RPM_VREG_POWER_MODE_8930_PWM] = "PWM",
299};
300
301static const char *pin_control_label[] = {
302 " D1",
303 " A0",
304 " A1",
305 " A2",
306};
307
David Collinsd2a4fef2012-08-13 12:31:04 -0700308static int is_real_id_msm8930_pm8038(int id)
David Collins5779cea2012-01-05 15:09:21 -0800309{
310 return (id >= 0) && (id <= RPM_VREG_ID_PM8038_MAX_REAL);
311}
312
David Collinsd2a4fef2012-08-13 12:31:04 -0700313static int pc_id_to_real_id_msm8930_pm8038(int id)
David Collins5779cea2012-01-05 15:09:21 -0800314{
315 int real_id = 0;
316
David Collins18a54422012-08-09 14:41:06 -0700317 if (id >= RPM_VREG_ID_PM8038_L2_PC && id <= RPM_VREG_ID_PM8038_L12_PC)
David Collinsd2a4fef2012-08-13 12:31:04 -0700318 real_id = id - RPM_VREG_ID_PM8038_L2_PC
319 + RPM_VREG_ID_PM8038_L2;
David Collins18a54422012-08-09 14:41:06 -0700320 else if (id >= RPM_VREG_ID_PM8038_L14_PC
321 && id <= RPM_VREG_ID_PM8038_L15_PC)
322 real_id = id - RPM_VREG_ID_PM8038_L14_PC
323 + RPM_VREG_ID_PM8038_L14;
David Collins5779cea2012-01-05 15:09:21 -0800324 else if (id >= RPM_VREG_ID_PM8038_L17_PC
325 && id <= RPM_VREG_ID_PM8038_L18_PC)
326 real_id = id - RPM_VREG_ID_PM8038_L17_PC
327 + RPM_VREG_ID_PM8038_L17;
328 else if (id >= RPM_VREG_ID_PM8038_L21_PC
329 && id <= RPM_VREG_ID_PM8038_L23_PC)
330 real_id = id - RPM_VREG_ID_PM8038_L21_PC
331 + RPM_VREG_ID_PM8038_L21;
332 else if (id == RPM_VREG_ID_PM8038_L26_PC)
333 real_id = RPM_VREG_ID_PM8038_L26;
334 else if (id >= RPM_VREG_ID_PM8038_S1_PC
335 && id <= RPM_VREG_ID_PM8038_S4_PC)
336 real_id = id - RPM_VREG_ID_PM8038_S1_PC
337 + RPM_VREG_ID_PM8038_S1;
338 else if (id >= RPM_VREG_ID_PM8038_LVS1_PC
339 && id <= RPM_VREG_ID_PM8038_LVS2_PC)
340 real_id = id - RPM_VREG_ID_PM8038_LVS1_PC
341 + RPM_VREG_ID_PM8038_LVS1;
342
343 return real_id;
344}
345
David Collinsd2a4fef2012-08-13 12:31:04 -0700346static int is_real_id_msm8930_pm8917(int id)
347{
348 return (id >= 0) && (id <= RPM_VREG_ID_PM8917_MAX_REAL);
349}
350
351static int pc_id_to_real_id_msm8930_pm8917(int id)
352{
353 int real_id = 0;
354
355 if (id >= RPM_VREG_ID_PM8917_L1_PC && id <= RPM_VREG_ID_PM8917_L23_PC)
356 real_id = id - RPM_VREG_ID_PM8917_L1_PC
357 + RPM_VREG_ID_PM8917_L1;
358 else if (id >= RPM_VREG_ID_PM8917_L29_PC
359 && id <= RPM_VREG_ID_PM8917_S4_PC)
360 real_id = id - RPM_VREG_ID_PM8917_L29_PC
361 + RPM_VREG_ID_PM8917_L29;
362 else if (id >= RPM_VREG_ID_PM8917_S7_PC
363 && id <= RPM_VREG_ID_PM8917_LVS7_PC)
364 real_id = id - RPM_VREG_ID_PM8917_S7_PC
365 + RPM_VREG_ID_PM8917_S7;
366
367 return real_id;
368}
369
370static struct vreg_config config_msm8930_pm8038 = {
371 .vregs = vregs_msm8930_pm8038,
372 .vregs_len = ARRAY_SIZE(vregs_msm8930_pm8038),
David Collins5779cea2012-01-05 15:09:21 -0800373
374 .vreg_id_min = RPM_VREG_ID_PM8038_L1,
375 .vreg_id_max = RPM_VREG_ID_PM8038_MAX,
376
377 .pin_func_none = RPM_VREG_PIN_FN_8930_NONE,
378 .pin_func_sleep_b = RPM_VREG_PIN_FN_8930_SLEEP_B,
379
380 .mode_lpm = REGULATOR_MODE_IDLE,
381 .mode_hpm = REGULATOR_MODE_NORMAL,
382
383 .set_points = all_set_points,
384 .set_points_len = ARRAY_SIZE(all_set_points),
385
386 .label_pin_ctrl = pin_control_label,
387 .label_pin_ctrl_len = ARRAY_SIZE(pin_control_label),
388 .label_pin_func = pin_func_label,
389 .label_pin_func_len = ARRAY_SIZE(pin_func_label),
390 .label_force_mode = force_mode_label,
391 .label_force_mode_len = ARRAY_SIZE(force_mode_label),
392 .label_power_mode = power_mode_label,
393 .label_power_mode_len = ARRAY_SIZE(power_mode_label),
394
David Collinsd2a4fef2012-08-13 12:31:04 -0700395 .is_real_id = is_real_id_msm8930_pm8038,
396 .pc_id_to_real_id = pc_id_to_real_id_msm8930_pm8038,
397};
398
399static struct vreg_config config_msm8930_pm8917 = {
400 .vregs = vregs_msm8930_pm8917,
401 .vregs_len = ARRAY_SIZE(vregs_msm8930_pm8917),
402
403 .vreg_id_min = RPM_VREG_ID_PM8917_L1,
404 .vreg_id_max = RPM_VREG_ID_PM8917_MAX,
405
406 .pin_func_none = RPM_VREG_PIN_FN_8930_NONE,
407 .pin_func_sleep_b = RPM_VREG_PIN_FN_8930_SLEEP_B,
408
409 .mode_lpm = REGULATOR_MODE_IDLE,
410 .mode_hpm = REGULATOR_MODE_NORMAL,
411
412 .set_points = all_set_points,
413 .set_points_len = ARRAY_SIZE(all_set_points),
414
415 .label_pin_ctrl = pin_control_label,
416 .label_pin_ctrl_len = ARRAY_SIZE(pin_control_label),
417 .label_pin_func = pin_func_label,
418 .label_pin_func_len = ARRAY_SIZE(pin_func_label),
419 .label_force_mode = force_mode_label,
420 .label_force_mode_len = ARRAY_SIZE(force_mode_label),
421 .label_power_mode = power_mode_label,
422 .label_power_mode_len = ARRAY_SIZE(power_mode_label),
423
424 .is_real_id = is_real_id_msm8930_pm8917,
425 .pc_id_to_real_id = pc_id_to_real_id_msm8930_pm8917,
David Collins5779cea2012-01-05 15:09:21 -0800426};
427
428struct vreg_config *get_config_8930(void)
429{
David Collinsd2a4fef2012-08-13 12:31:04 -0700430 return &config_msm8930_pm8038;
431}
432
433struct vreg_config *get_config_8930_pm8917(void)
434{
435 return &config_msm8930_pm8917;
David Collins5779cea2012-01-05 15:09:21 -0800436}