PageRenderTime 96ms CodeModel.GetById 29ms app.highlight 60ms RepoModel.GetById 1ms app.codeStats 1ms

/arch/arm/mach-msm/board-8930-regulator-pm8917.c

https://github.com/AICP/kernel_google_msm
C | 657 lines | 578 code | 40 blank | 39 comment | 0 complexity | 274d811bcd7e712aaafc849aa41dac96 MD5 | raw file
  1/*
  2 * Copyright (c) 2012, The Linux Foundation. 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/*
 15 * This file contains regulator configuration and mappings for targets
 16 * consisting of MSM8930 and PM8917.
 17 */
 18
 19#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("8917_l1",		NULL),
 32};
 33VREG_CONSUMERS(L2) = {
 34	REGULATOR_SUPPLY("8917_l2",		NULL),
 35	REGULATOR_SUPPLY("iris_vdddig",		"wcnss_wlan.0"),
 36	REGULATOR_SUPPLY("dsi_vdda",		"mipi_dsi.1"),
 37	REGULATOR_SUPPLY("dsi_pll_vdda",	"mdp.0"),
 38	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csid.0"),
 39	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csid.1"),
 40	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csid.2"),
 41};
 42VREG_CONSUMERS(L3) = {
 43	REGULATOR_SUPPLY("8917_l3",		NULL),
 44	REGULATOR_SUPPLY("HSUSB_3p3",		"msm_otg"),
 45};
 46VREG_CONSUMERS(L4) = {
 47	REGULATOR_SUPPLY("8917_l4",		NULL),
 48	REGULATOR_SUPPLY("HSUSB_1p8",		"msm_otg"),
 49	REGULATOR_SUPPLY("iris_vddxo",		"wcnss_wlan.0"),
 50};
 51VREG_CONSUMERS(L5) = {
 52	REGULATOR_SUPPLY("8917_l5",		NULL),
 53	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.1"),
 54};
 55VREG_CONSUMERS(L6) = {
 56	REGULATOR_SUPPLY("8917_l6",		NULL),
 57	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.3"),
 58};
 59VREG_CONSUMERS(L7) = {
 60	REGULATOR_SUPPLY("8917_l7",		NULL),
 61	REGULATOR_SUPPLY("sdc_vdd_io",		"msm_sdcc.3"),
 62};
 63VREG_CONSUMERS(L8) = {
 64	REGULATOR_SUPPLY("8917_l8",		NULL),
 65	REGULATOR_SUPPLY("dsi_vdc",		"mipi_dsi.1"),
 66};
 67VREG_CONSUMERS(L9) = {
 68	REGULATOR_SUPPLY("8917_l9",		NULL),
 69	REGULATOR_SUPPLY("vdd_ana",		"3-004a"),
 70	REGULATOR_SUPPLY("vdd",			"3-0024"),
 71	REGULATOR_SUPPLY("vdd",			"12-0018"),
 72	REGULATOR_SUPPLY("vdd",			"12-0068"),
 73};
 74VREG_CONSUMERS(L10) = {
 75	REGULATOR_SUPPLY("8917_l10",		NULL),
 76	REGULATOR_SUPPLY("iris_vddpa",		"wcnss_wlan.0"),
 77};
 78VREG_CONSUMERS(L11) = {
 79	REGULATOR_SUPPLY("8917_l11",		NULL),
 80	REGULATOR_SUPPLY("cam_vana",		"4-001a"),
 81	REGULATOR_SUPPLY("cam_vana",		"4-006c"),
 82	REGULATOR_SUPPLY("cam_vana",		"4-0048"),
 83	REGULATOR_SUPPLY("cam_vana",            "4-0020"),
 84};
 85VREG_CONSUMERS(L12) = {
 86	REGULATOR_SUPPLY("8917_l12",		NULL),
 87	REGULATOR_SUPPLY("cam_vdig",		"4-001a"),
 88	REGULATOR_SUPPLY("cam_vdig",		"4-006c"),
 89	REGULATOR_SUPPLY("cam_vdig",		"4-0048"),
 90	REGULATOR_SUPPLY("cam_vdig",            "4-0020"),
 91};
 92VREG_CONSUMERS(L14) = {
 93	REGULATOR_SUPPLY("8917_l14",		NULL),
 94	REGULATOR_SUPPLY("pa_therm",		"pm8xxx-adc"),
 95};
 96VREG_CONSUMERS(L15) = {
 97	REGULATOR_SUPPLY("8917_l15",		NULL),
 98};
 99VREG_CONSUMERS(L16) = {
100	REGULATOR_SUPPLY("8917_l16",		NULL),
101	REGULATOR_SUPPLY("cam_vaf",		"4-001a"),
102	REGULATOR_SUPPLY("cam_vaf",		"4-006c"),
103	REGULATOR_SUPPLY("cam_vaf",		"4-0048"),
104	REGULATOR_SUPPLY("cam_vaf",             "4-0020"),
105};
106VREG_CONSUMERS(L17) = {
107	REGULATOR_SUPPLY("8917_l17",		NULL),
108};
109VREG_CONSUMERS(L18) = {
110	REGULATOR_SUPPLY("8917_l18",		NULL),
111};
112VREG_CONSUMERS(L21) = {
113	REGULATOR_SUPPLY("8917_l21",		NULL),
114};
115VREG_CONSUMERS(L22) = {
116	REGULATOR_SUPPLY("8917_l22",		NULL),
117};
118VREG_CONSUMERS(L23) = {
119	REGULATOR_SUPPLY("8917_l23",		NULL),
120	REGULATOR_SUPPLY("dsi_vddio",		"mipi_dsi.1"),
121	REGULATOR_SUPPLY("dsi_pll_vddio",	"mdp.0"),
122	REGULATOR_SUPPLY("hdmi_avdd",		"hdmi_msm.0"),
123	REGULATOR_SUPPLY("hdmi_vcc",		"hdmi_msm.0"),
124	REGULATOR_SUPPLY("pll_vdd",		"pil_riva"),
125	REGULATOR_SUPPLY("pll_vdd",		"pil_qdsp6v4.1"),
126	REGULATOR_SUPPLY("pll_vdd",		"pil_qdsp6v4.2"),
127};
128VREG_CONSUMERS(L24) = {
129	REGULATOR_SUPPLY("8917_l24",		NULL),
130	REGULATOR_SUPPLY("riva_vddmx",		"wcnss_wlan.0"),
131};
132VREG_CONSUMERS(L25) = {
133	REGULATOR_SUPPLY("8917_l25",		NULL),
134	REGULATOR_SUPPLY("VDDD_CDC_D",		"sitar-slim"),
135	REGULATOR_SUPPLY("CDC_VDDA_A_1P2V",	"sitar-slim"),
136	REGULATOR_SUPPLY("VDDD_CDC_D",		"sitar1p1-slim"),
137	REGULATOR_SUPPLY("CDC_VDDA_A_1P2V",	"sitar1p1-slim"),
138	REGULATOR_SUPPLY("mhl_avcc12",		"0-0039"),
139};
140VREG_CONSUMERS(L26) = {
141	REGULATOR_SUPPLY("8921_l26",		NULL),
142	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.0"),
143};
144VREG_CONSUMERS(L27) = {
145	REGULATOR_SUPPLY("8921_l27",		NULL),
146	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.2"),
147};
148VREG_CONSUMERS(L28) = {
149	REGULATOR_SUPPLY("8921_l28",		NULL),
150	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.1"),
151};
152VREG_CONSUMERS(L29) = {
153	REGULATOR_SUPPLY("8921_l29",		NULL),
154};
155VREG_CONSUMERS(L30) = {
156	REGULATOR_SUPPLY("8917_l30",		NULL),
157};
158VREG_CONSUMERS(L31) = {
159	REGULATOR_SUPPLY("8917_l31",		NULL),
160};
161VREG_CONSUMERS(L32) = {
162	REGULATOR_SUPPLY("8917_l32",		NULL),
163};
164VREG_CONSUMERS(L33) = {
165	REGULATOR_SUPPLY("8917_l33",		NULL),
166};
167VREG_CONSUMERS(L34) = {
168	REGULATOR_SUPPLY("8917_l34",		NULL),
169};
170VREG_CONSUMERS(L35) = {
171	REGULATOR_SUPPLY("8917_l35",		NULL),
172};
173VREG_CONSUMERS(L36) = {
174	REGULATOR_SUPPLY("8917_l36",		NULL),
175};
176VREG_CONSUMERS(S1) = {
177	REGULATOR_SUPPLY("8917_s1",		NULL),
178};
179VREG_CONSUMERS(S2) = {
180	REGULATOR_SUPPLY("8917_s2",		NULL),
181	REGULATOR_SUPPLY("iris_vddrfa",		"wcnss_wlan.0"),
182};
183VREG_CONSUMERS(S3) = {
184	REGULATOR_SUPPLY("8917_s3",		NULL),
185	REGULATOR_SUPPLY("riva_vddcx",		"wcnss_wlan.0"),
186};
187VREG_CONSUMERS(S4) = {
188	REGULATOR_SUPPLY("8917_s4",		NULL),
189	REGULATOR_SUPPLY("vdd_dig",		"3-004a"),
190	REGULATOR_SUPPLY("sdc_vdd_io",		"msm_sdcc.1"),
191	REGULATOR_SUPPLY("VDDIO_CDC",		"sitar-slim"),
192	REGULATOR_SUPPLY("CDC_VDDA_TX",		"sitar-slim"),
193	REGULATOR_SUPPLY("CDC_VDDA_RX",		"sitar-slim"),
194	REGULATOR_SUPPLY("VDDIO_CDC",		"sitar1p1-slim"),
195	REGULATOR_SUPPLY("CDC_VDDA_TX",		"sitar1p1-slim"),
196	REGULATOR_SUPPLY("CDC_VDDA_RX",		"sitar1p1-slim"),
197	REGULATOR_SUPPLY("vddp",		"0-0048"),
198	REGULATOR_SUPPLY("mhl_iovcc18",		"0-0039"),
199	REGULATOR_SUPPLY("CDC_VDD_CP",		"sitar-slim"),
200	REGULATOR_SUPPLY("CDC_VDD_CP",		"sitar1p1-slim"),
201};
202VREG_CONSUMERS(S5) = {
203	REGULATOR_SUPPLY("8917_s5",		NULL),
204	REGULATOR_SUPPLY("krait0",		"acpuclk-8627"),
205	REGULATOR_SUPPLY("krait0",		"acpuclk-8930"),
206	REGULATOR_SUPPLY("krait0",		"acpuclk-8930aa"),
207	REGULATOR_SUPPLY("krait0",		"acpuclk-8930ab"),
208};
209VREG_CONSUMERS(S6) = {
210	REGULATOR_SUPPLY("8917_s6",		NULL),
211	REGULATOR_SUPPLY("krait1",		"acpuclk-8627"),
212	REGULATOR_SUPPLY("krait1",		"acpuclk-8930"),
213	REGULATOR_SUPPLY("krait1",		"acpuclk-8930aa"),
214	REGULATOR_SUPPLY("krait1",		"acpuclk-8930ab"),
215};
216VREG_CONSUMERS(S7) = {
217	REGULATOR_SUPPLY("8917_s7",		NULL),
218};
219VREG_CONSUMERS(S8) = {
220	REGULATOR_SUPPLY("8917_s8",		NULL),
221};
222VREG_CONSUMERS(LVS1) = {
223	REGULATOR_SUPPLY("8917_lvs1",		NULL),
224	REGULATOR_SUPPLY("iris_vddio",		"wcnss_wlan.0"),
225	REGULATOR_SUPPLY("riva_vddpx",		"wcnss_wlan.0"),
226};
227VREG_CONSUMERS(LVS3) = {
228	REGULATOR_SUPPLY("8917_lvs3",		NULL),
229};
230VREG_CONSUMERS(LVS4) = {
231	REGULATOR_SUPPLY("8917_lvs4",		NULL),
232	REGULATOR_SUPPLY("vcc_i2c",		"3-004a"),
233	REGULATOR_SUPPLY("vcc_i2c",		"3-0024"),
234	REGULATOR_SUPPLY("vcc_i2c",		"0-0048"),
235	REGULATOR_SUPPLY("vddio",		"12-0018"),
236	REGULATOR_SUPPLY("vlogic",		"12-0068"),
237};
238VREG_CONSUMERS(LVS5) = {
239	REGULATOR_SUPPLY("8917_lvs5",		NULL),
240	REGULATOR_SUPPLY("cam_vio",		"4-001a"),
241	REGULATOR_SUPPLY("cam_vio",		"4-006c"),
242	REGULATOR_SUPPLY("cam_vio",		"4-0048"),
243	REGULATOR_SUPPLY("cam_vio",             "4-0020"),
244};
245VREG_CONSUMERS(LVS6) = {
246	REGULATOR_SUPPLY("8917_lvs6",		NULL),
247};
248VREG_CONSUMERS(LVS7) = {
249	REGULATOR_SUPPLY("8917_lvs7",		NULL),
250};
251VREG_CONSUMERS(USB_OTG) = {
252	REGULATOR_SUPPLY("8921_usb_otg",	NULL),
253	REGULATOR_SUPPLY("vbus_otg",		"msm_otg"),
254};
255VREG_CONSUMERS(BOOST) = {
256	REGULATOR_SUPPLY("8917_boost",		NULL),
257	REGULATOR_SUPPLY("hdmi_mvs",		"hdmi_msm.0"),
258	REGULATOR_SUPPLY("mhl_usb_hs_switch",	"msm_otg"),
259};
260VREG_CONSUMERS(VDD_DIG_CORNER) = {
261	REGULATOR_SUPPLY("vdd_dig_corner",	NULL),
262	REGULATOR_SUPPLY("hsusb_vdd_dig",	"msm_otg"),
263};
264
265
266#define PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
267			 _apply_uV, _pull_down, _always_on, _supply_regulator, \
268			 _system_uA, _enable_time, _reg_id) \
269	{ \
270		.init_data = { \
271			.constraints = { \
272				.valid_modes_mask	= _modes, \
273				.valid_ops_mask		= _ops, \
274				.min_uV			= _min_uV, \
275				.max_uV			= _max_uV, \
276				.input_uV		= _max_uV, \
277				.apply_uV		= _apply_uV, \
278				.always_on		= _always_on, \
279				.name			= _name, \
280			}, \
281			.num_consumer_supplies	= \
282					ARRAY_SIZE(vreg_consumers_##_id), \
283			.consumer_supplies	= vreg_consumers_##_id, \
284			.supply_regulator	= _supply_regulator, \
285		}, \
286		.id			= _reg_id, \
287		.pull_down_enable	= _pull_down, \
288		.system_uA		= _system_uA, \
289		.enable_time		= _enable_time, \
290	}
291
292#define PM8XXX_LDO(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
293		_enable_time, _supply_regulator, _system_uA, _reg_id) \
294	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
295		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
296		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
297		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
298		_supply_regulator, _system_uA, _enable_time, _reg_id)
299
300#define PM8XXX_NLDO1200(_id, _name, _always_on, _pull_down, _min_uV, \
301		_max_uV, _enable_time, _supply_regulator, _system_uA, _reg_id) \
302	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
303		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
304		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
305		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
306		_supply_regulator, _system_uA, _enable_time, _reg_id)
307
308#define PM8XXX_SMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
309		_enable_time, _supply_regulator, _system_uA, _reg_id) \
310	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
311		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
312		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
313		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
314		_supply_regulator, _system_uA, _enable_time, _reg_id)
315
316#define PM8XXX_FTSMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
317		_enable_time, _supply_regulator, _system_uA, _reg_id) \
318	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
319		REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
320		| REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
321		_supply_regulator, _system_uA, _enable_time, _reg_id)
322
323#define PM8XXX_VS(_id, _name, _always_on, _pull_down, _enable_time, \
324		_supply_regulator, _reg_id) \
325	PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
326		_pull_down, _always_on, _supply_regulator, 0, _enable_time, \
327		_reg_id)
328
329#define PM8XXX_VS300(_id, _name, _always_on, _pull_down, _enable_time, \
330		_supply_regulator, _reg_id) \
331	PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
332		_pull_down, _always_on, _supply_regulator, 0, _enable_time, \
333		_reg_id)
334
335#define PM8XXX_BOOST(_id, _name, _always_on, _min_uV, _max_uV, _enable_time, \
336		_supply_regulator, _reg_id) \
337	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, 0, \
338		REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, 0, 0, \
339		_always_on, _supply_regulator, 0, _enable_time, _reg_id)
340
341/* Pin control initialization */
342#define PM8XXX_PC(_id, _name, _always_on, _pin_fn, _pin_ctrl, \
343		  _supply_regulator, _reg_id) \
344	{ \
345		.init_data = { \
346			.constraints = { \
347				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
348				.always_on	= _always_on, \
349				.name		= _name, \
350			}, \
351			.num_consumer_supplies	= \
352					ARRAY_SIZE(vreg_consumers_##_id##_PC), \
353			.consumer_supplies	= vreg_consumers_##_id##_PC, \
354			.supply_regulator  = _supply_regulator, \
355		}, \
356		.id		= _reg_id, \
357		.pin_fn		= PM8XXX_VREG_PIN_FN_##_pin_fn, \
358		.pin_ctrl	= _pin_ctrl, \
359	}
360
361#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, _sleep_set_force_mode, _power_mode, _state, \
364		 _sleep_selectable, _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_PM8917_##_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		.sleep_set_force_mode	= _sleep_set_force_mode, \
391		.power_mode		= _power_mode, \
392		.state			= _state, \
393		.sleep_selectable	= _sleep_selectable, \
394		.system_uA		= _system_uA, \
395	}
396
397#define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
398		_supply_regulator, _system_uA, _init_peak_uA) \
399	RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
400		 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
401		 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
402		 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _init_peak_uA, 0, _pd, \
403		 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8930_NONE, \
404		 RPM_VREG_FORCE_MODE_8930_NONE, \
405		 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
406		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
407		 _supply_regulator, _system_uA)
408
409#define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
410		 _supply_regulator, _system_uA, _freq, _force_mode, \
411		 _sleep_set_force_mode) \
412	RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
413		 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
414		 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
415		 | REGULATOR_CHANGE_DRMS, 0, _min_uV, _system_uA, 0, _pd, \
416		 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8930_NONE, \
417		 RPM_VREG_FORCE_MODE_8930_##_force_mode, \
418		 RPM_VREG_FORCE_MODE_8930_##_sleep_set_force_mode, \
419		 RPM_VREG_POWER_MODE_8930_PWM, RPM_VREG_STATE_OFF, \
420		 _sleep_selectable, _always_on, _supply_regulator, _system_uA)
421
422#define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \
423	RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \
424		 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8930_NONE, \
425		 RPM_VREG_FORCE_MODE_8930_NONE, \
426		 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
427		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
428		 _supply_regulator, 0)
429
430#define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
431		_supply_regulator, _freq) \
432	RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
433		 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \
434		 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8930_NONE, \
435		 RPM_VREG_FORCE_MODE_8930_NONE, \
436		 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
437		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
438		 _supply_regulator, 0)
439
440#define RPM_CORNER(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
441		_supply_regulator) \
442	RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
443		 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 0, 0, 0, \
444		 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8930_NONE, \
445		 RPM_VREG_FORCE_MODE_8930_NONE, \
446		 RPM_VREG_FORCE_MODE_8930_NONE, RPM_VREG_POWER_MODE_8930_PWM, \
447		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
448		 _supply_regulator, 0)
449
450/* Pin control initialization */
451#define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
452	{ \
453		.init_data = { \
454			.constraints = { \
455				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
456				.always_on	= _always_on, \
457			}, \
458			.num_consumer_supplies	= \
459					ARRAY_SIZE(vreg_consumers_##_id##_PC), \
460			.consumer_supplies	= vreg_consumers_##_id##_PC, \
461			.supply_regulator	= _supply_regulator, \
462		}, \
463		.id	  = RPM_VREG_ID_PM8917_##_id##_PC, \
464		.pin_fn	  = RPM_VREG_PIN_FN_8930_##_pin_fn, \
465		.pin_ctrl = _pin_ctrl, \
466	}
467
468#define GPIO_VREG(_id, _reg_name, _gpio_label, _gpio, _supply_regulator) \
469	[MSM8930_GPIO_VREG_ID_##_id] = { \
470		.init_data = { \
471			.constraints = { \
472				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
473			}, \
474			.num_consumer_supplies	= \
475					ARRAY_SIZE(vreg_consumers_##_id), \
476			.consumer_supplies	= vreg_consumers_##_id, \
477			.supply_regulator	= _supply_regulator, \
478		}, \
479		.regulator_name = _reg_name, \
480		.gpio_label	= _gpio_label, \
481		.gpio		= _gpio, \
482	}
483
484#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
485	{ \
486		.constraints = { \
487			.name		= _name, \
488			.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE, \
489			.min_uV		= _min_uV, \
490			.max_uV		= _max_uV, \
491		}, \
492		.num_consumer_supplies	= ARRAY_SIZE(vreg_consumers_##_id), \
493		.consumer_supplies	= vreg_consumers_##_id, \
494	}
495
496/* GPIO regulator constraints */
497struct gpio_regulator_platform_data
498msm8930_pm8917_gpio_regulator_pdata[] __devinitdata = {
499	/*        ID          vreg_name     gpio_label     gpio  supply */
500};
501
502/* SAW regulator constraints */
503struct regulator_init_data msm8930_pm8917_saw_regulator_core0_pdata =
504	/*	      ID  vreg_name	       min_uV   max_uV */
505	SAW_VREG_INIT(S5, "8917_s5",	       850000, 1300000);
506struct regulator_init_data msm8930_pm8917_saw_regulator_core1_pdata =
507	SAW_VREG_INIT(S6, "8917_s6",	       850000, 1300000);
508
509/* PM8917 regulator constraints */
510struct pm8xxx_regulator_platform_data
511msm8930_pm8917_regulator_pdata[] __devinitdata = {
512	/*
513	 *               ID  name always_on pd min_uV   max_uV   en_t supply
514	 *	system_uA reg_ID
515	 */
516	PM8XXX_NLDO1200(L26, "8921_l26", 0, 1,  375000, 1050000, 200, "8917_s7",
517		0, 0),
518	PM8XXX_NLDO1200(L27, "8921_l27", 0, 1,  375000, 1050000, 200, "8917_s7",
519		0, 1),
520	PM8XXX_NLDO1200(L28, "8921_l28", 0, 1,  375000, 1050000, 200, "8917_s7",
521		0, 2),
522	PM8XXX_LDO(L29,      "8921_l29", 0, 1, 1800000, 1800000, 200, "8917_s8",
523		0, 3),
524	PM8XXX_LDO(L30,      "8917_l30", 0, 1, 1800000, 1800000, 200, NULL,
525		0, 4),
526	PM8XXX_LDO(L31,      "8917_l31", 0, 1, 1800000, 1800000, 200, NULL,
527		0, 5),
528	PM8XXX_LDO(L32,      "8917_l32", 0, 1, 2800000, 2800000, 200, NULL,
529		0, 6),
530	PM8XXX_LDO(L33,      "8917_l33", 0, 1, 2800000, 2800000, 200, NULL,
531		0, 7),
532	PM8XXX_LDO(L34,      "8917_l34", 0, 1, 1800000, 1800000, 200, NULL,
533		0, 8),
534	PM8XXX_LDO(L35,      "8917_l35", 0, 1, 3000000, 3000000, 200, NULL,
535		0, 9),
536	PM8XXX_LDO(L36,      "8917_l36", 0, 1, 1800000, 1800000, 200, NULL,
537		0, 10),
538	/*
539	 *           ID     name  always_on   min_uV   max_uV en_t supply reg_ID
540	 */
541	PM8XXX_BOOST(BOOST, "8917_boost", 0,  5000000, 5000000, 500, NULL, 11),
542
543	/*	     ID        name      always_on pd en_t supply    reg_ID */
544	PM8XXX_VS300(USB_OTG,  "8921_usb_otg",  0, 1, 0,   "8917_boost", 12),
545};
546
547static struct rpm_regulator_init_data
548msm8930_rpm_regulator_init_data[] __devinitdata = {
549	/*	ID a_on pd ss min_uV   max_uV  supply sys_uA  freq  fm  ss_fm */
550	RPM_SMPS(S1, 1, 1, 0, 1300000, 1300000, NULL, 100000, 3p20, NONE, NONE),
551	RPM_SMPS(S2, 0, 1, 0, 1300000, 1300000, NULL,      0, 1p60, NONE, NONE),
552	RPM_SMPS(S3, 0, 1, 1,  500000, 1150000, NULL, 100000, 4p80, NONE, NONE),
553	RPM_SMPS(S4, 1, 1, 0, 1800000, 1800000, NULL, 100000, 1p60, NONE, NONE),
554	RPM_SMPS(S7, 0, 1, 0, 1150000, 1150000, NULL, 100000, 3p20, AUTO, AUTO),
555	RPM_SMPS(S8, 1, 1, 1, 2050000, 2050000, NULL, 100000, 1p60, NONE, NONE),
556
557	/*	ID     a_on pd ss min_uV   max_uV  supply  sys_uA init_ip */
558	RPM_LDO(L1,	 0, 1, 0, 1050000, 1050000, "8917_s4", 0, 10000),
559	RPM_LDO(L2,	 0, 1, 0, 1200000, 1200000, "8917_s4", 0, 0),
560	RPM_LDO(L3,	 0, 1, 0, 3075000, 3075000, NULL,      0, 0),
561	RPM_LDO(L4,	 1, 1, 0, 1800000, 1800000, NULL,      10000, 10000),
562	RPM_LDO(L5,	 0, 1, 0, 2950000, 2950000, NULL,      0, 0),
563	RPM_LDO(L6,	 0, 1, 0, 2950000, 2950000, NULL,      0, 0),
564	RPM_LDO(L7,	 1, 1, 0, 1850000, 2950000, NULL,      10000, 10000),
565	RPM_LDO(L8,	 0, 1, 0, 2800000, 2800000, NULL,      0, 0),
566	RPM_LDO(L9,	 0, 1, 0, 2850000, 2850000, NULL,      0, 0),
567	RPM_LDO(L10,	 0, 1, 0, 2900000, 2900000, NULL,      0, 0),
568	RPM_LDO(L11,	 0, 1, 0, 2850000, 2850000, NULL,      0, 0),
569	RPM_LDO(L12,	 0, 1, 0, 1200000, 1200000, "8917_s4", 0, 0),
570	RPM_LDO(L14,	 0, 1, 0, 1800000, 1800000, NULL,      0, 0),
571	RPM_LDO(L15,	 0, 1, 0, 1800000, 2950000, NULL,      0, 0),
572	RPM_LDO(L16,	 0, 1, 0, 2850000, 2850000, NULL,      0, 0),
573	RPM_LDO(L17,	 0, 1, 0, 1800000, 2950000, NULL,      0, 0),
574	RPM_LDO(L18,	 0, 1, 0, 1200000, 1200000, "8917_s4", 0, 0),
575	RPM_LDO(L21,	 0, 1, 0, 1900000, 1900000, "8917_s8", 0, 0),
576	RPM_LDO(L22,	 0, 1, 0, 2750000, 2750000, NULL,      0, 0),
577	RPM_LDO(L23,	 1, 1, 1, 1800000, 1800000, "8917_s8", 10000, 10000),
578	RPM_LDO(L24,	 0, 1, 1,  500000, 1150000, "8917_s1", 10000, 10000),
579	RPM_LDO(L25,	 1, 1, 0, 1250000, 1250000, "8917_s1", 10000, 10000),
580
581	/*	ID     a_on pd ss		    supply */
582	RPM_VS(LVS1,	 0, 1, 0,		    "8917_s4"),
583	RPM_VS(LVS3,	 0, 1, 0,		    "8917_s4"),
584	RPM_VS(LVS4,	 0, 1, 0,		    "8917_s4"),
585	RPM_VS(LVS5,	 0, 1, 0,		    "8917_s4"),
586	RPM_VS(LVS6,	 0, 1, 0,		    "8917_s4"),
587	RPM_VS(LVS7,	 0, 1, 0,		    "8917_s4"),
588
589	/*	   ID            a_on ss min_corner  max_corner  supply */
590	RPM_CORNER(VDD_DIG_CORNER, 0, 1, RPM_VREG_CORNER_NONE,
591		RPM_VREG_CORNER_HIGH, NULL),
592};
593
594int msm8930_pm8917_regulator_pdata_len __devinitdata =
595	ARRAY_SIZE(msm8930_pm8917_regulator_pdata);
596
597#define RPM_REG_MAP(_id, _sleep_also, _voter, _supply, _dev_name) \
598	{ \
599		.vreg_id = RPM_VREG_ID_PM8917_##_id, \
600		.sleep_also = _sleep_also, \
601		.voter = _voter, \
602		.supply = _supply, \
603		.dev_name = _dev_name, \
604	}
605
606static struct rpm_regulator_consumer_mapping
607	      msm_rpm_regulator_consumer_mapping[] __devinitdata = {
608	RPM_REG_MAP(L23,            0, 1, "krait0_l23",   "acpuclk-8930"),
609	RPM_REG_MAP(S8,             0, 1, "krait0_s8",    "acpuclk-8930"),
610	RPM_REG_MAP(L23,            0, 2, "krait1_l23",   "acpuclk-8930"),
611	RPM_REG_MAP(S8,             0, 2, "krait1_s8",    "acpuclk-8930"),
612	RPM_REG_MAP(L23,            0, 6, "l2_l23",       "acpuclk-8930"),
613	RPM_REG_MAP(S8,             0, 6, "l2_s8",        "acpuclk-8930"),
614	RPM_REG_MAP(L24,            0, 1, "krait0_mem",   "acpuclk-8930"),
615	RPM_REG_MAP(L24,            0, 2, "krait1_mem",   "acpuclk-8930"),
616	RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig",   "acpuclk-8930"),
617	RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig",   "acpuclk-8930"),
618
619	RPM_REG_MAP(L23,            0, 1, "krait0_hfpll", "acpuclk-8627"),
620	RPM_REG_MAP(L23,            0, 2, "krait1_hfpll", "acpuclk-8627"),
621	RPM_REG_MAP(L23,            0, 6, "l2_hfpll",     "acpuclk-8627"),
622	RPM_REG_MAP(L24,            0, 1, "krait0_mem",   "acpuclk-8627"),
623	RPM_REG_MAP(L24,            0, 2, "krait1_mem",   "acpuclk-8627"),
624	RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig",   "acpuclk-8627"),
625	RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig",   "acpuclk-8627"),
626
627	RPM_REG_MAP(L23,            0, 1, "krait0_hfpll", "acpuclk-8930aa"),
628	RPM_REG_MAP(L23,            0, 2, "krait1_hfpll", "acpuclk-8930aa"),
629	RPM_REG_MAP(L23,            0, 6, "l2_hfpll",     "acpuclk-8930aa"),
630	RPM_REG_MAP(L24,            0, 1, "krait0_mem",   "acpuclk-8930aa"),
631	RPM_REG_MAP(L24,            0, 2, "krait1_mem",   "acpuclk-8930aa"),
632	RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig",   "acpuclk-8930aa"),
633	RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig",   "acpuclk-8930aa"),
634
635	RPM_REG_MAP(L23,            0, 1, "krait0_l23",   "acpuclk-8930ab"),
636	RPM_REG_MAP(S8,             0, 1, "krait0_s8",    "acpuclk-8930ab"),
637	RPM_REG_MAP(L23,            0, 2, "krait1_l23",   "acpuclk-8930ab"),
638	RPM_REG_MAP(S8,             0, 2, "krait1_s8",    "acpuclk-8930ab"),
639	RPM_REG_MAP(L23,            0, 6, "l2_l23",       "acpuclk-8930ab"),
640	RPM_REG_MAP(S8,             0, 6, "l2_s8",        "acpuclk-8930ab"),
641	RPM_REG_MAP(L24,            0, 1, "krait0_mem",   "acpuclk-8930ab"),
642	RPM_REG_MAP(L24,            0, 2, "krait1_mem",   "acpuclk-8930ab"),
643	RPM_REG_MAP(VDD_DIG_CORNER, 0, 1, "krait0_dig",   "acpuclk-8930ab"),
644	RPM_REG_MAP(VDD_DIG_CORNER, 0, 2, "krait1_dig",   "acpuclk-8930ab"),
645
646};
647
648struct rpm_regulator_platform_data
649msm8930_pm8917_rpm_regulator_pdata __devinitdata = {
650	.init_data		= msm8930_rpm_regulator_init_data,
651	.num_regulators		= ARRAY_SIZE(msm8930_rpm_regulator_init_data),
652	.version		= RPM_VREG_VERSION_8930_PM8917,
653	.vreg_id_vdd_mem	= RPM_VREG_ID_PM8917_L24,
654	.vreg_id_vdd_dig	= RPM_VREG_ID_PM8917_VDD_DIG_CORNER,
655	.consumer_map		= msm_rpm_regulator_consumer_mapping,
656	.consumer_map_len = ARRAY_SIZE(msm_rpm_regulator_consumer_mapping),
657};