blob: 7c140cb43440e52cf9db5578453493ea64358617 [file] [log] [blame]
Justin Pauporeb3a33b72011-08-23 15:30:32 -07001/*
Duy Truong790f06d2013-02-13 16:38:12 -08002 * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003 *
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
Steve Mucklef132c6c2012-06-06 18:30:57 -070014#include <linux/kernel.h>
Justin Pauporeb3a33b72011-08-23 15:30:32 -070015#include "board-msm7x27a-regulator.h"
16
Pankaj Kumare8db4252012-01-04 13:06:21 +053017#define VOLTAGE_RANGE(min_uV, max_uV, step_uV) ((max_uV - min_uV) / step_uV)
18
19/* Physically available PMIC regulator voltage setpoint ranges */
20#define p_ranges VOLTAGE_RANGE(1500000, 3300000, 25000)
21
22#define n_ranges VOLTAGE_RANGE(750000, 1525000, 12500)
23
24#define s_ranges (VOLTAGE_RANGE(700000, 1500000, 12500) + \
25 VOLTAGE_RANGE(1500000, 3050000, 25000))
26
Justin Pauporeb3a33b72011-08-23 15:30:32 -070027#define PCOM_VREG_CONSUMERS(name) \
28 static struct regulator_consumer_supply __pcom_vreg_supply_##name[]
29
30#define PCOM_VREG_INIT_DATA(_name, _supply, _min_uV, _max_uV, _always_on, \
31 _boot_on, _apply_uV, _supply_uV)\
32{ \
33 .supply_regulator = _supply, \
34 .consumer_supplies = __pcom_vreg_supply_##_name, \
35 .num_consumer_supplies = ARRAY_SIZE(__pcom_vreg_supply_##_name), \
36 .constraints = { \
37 .name = #_name, \
38 .min_uV = _min_uV, \
39 .max_uV = _max_uV, \
40 .valid_modes_mask = REGULATOR_MODE_NORMAL, \
41 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | \
42 REGULATOR_CHANGE_STATUS, \
43 .input_uV = _supply_uV, \
44 .apply_uV = _apply_uV, \
45 .boot_on = _boot_on, \
46 .always_on = _always_on \
47 } \
48}
49
50#define PCOM_VREG_SMP(_name, _id, _supply, _min_uV, _max_uV, _rise_time, \
Pankaj Kumare8db4252012-01-04 13:06:21 +053051 _pulldown, _always_on, _boot_on, _apply_uV, _supply_uV, _range) \
Justin Pauporeb3a33b72011-08-23 15:30:32 -070052{ \
53 .init_data = PCOM_VREG_INIT_DATA(_name, _supply, _min_uV, _max_uV, \
54 _always_on, _boot_on, _apply_uV, _supply_uV), \
55 .id = _id, \
56 .rise_time = _rise_time, \
57 .pulldown = _pulldown, \
58 .negative = 0, \
Pankaj Kumare8db4252012-01-04 13:06:21 +053059 .n_voltages = _range##_ranges, \
Justin Pauporeb3a33b72011-08-23 15:30:32 -070060}
61
62#define PCOM_VREG_LDO PCOM_VREG_SMP
63
64#define PCOM_VREG_NCP(_name, _id, _supply, _min_uV, _max_uV, _rise_time, \
65 _always_on, _boot_on, _apply_uV, _supply_uV) \
66{ \
67 .init_data = PCOM_VREG_INIT_DATA(_name, _supply, -(_min_uV), \
68 -(_max_uV), _always_on, _boot_on, _apply_uV, _supply_uV), \
69 .id = _id, \
70 .rise_time = _rise_time, \
71 .pulldown = -1, \
72 .negative = 1, \
73}
74
75PCOM_VREG_CONSUMERS(smps1) = {
76 REGULATOR_SUPPLY("smps1", NULL),
77 REGULATOR_SUPPLY("msmc1", NULL),
78};
79
80PCOM_VREG_CONSUMERS(smps2) = {
81 REGULATOR_SUPPLY("smps2", NULL),
82 REGULATOR_SUPPLY("msmc2", NULL),
83};
84
85PCOM_VREG_CONSUMERS(smps3) = {
86 REGULATOR_SUPPLY("smps3", NULL),
87 REGULATOR_SUPPLY("msme1", NULL),
Mohan Pallaka4c5bb922011-11-23 15:54:51 +053088 REGULATOR_SUPPLY("vcc_i2c", "1-004a"),
Mohan Pallaka5afe9852012-01-12 23:12:06 +053089 REGULATOR_SUPPLY("vcc_i2c", "1-0038"),
Justin Pauporeb3a33b72011-08-23 15:30:32 -070090};
91
92PCOM_VREG_CONSUMERS(smps4) = {
93 REGULATOR_SUPPLY("smps4", NULL),
94 REGULATOR_SUPPLY("rf", NULL),
95};
96
97PCOM_VREG_CONSUMERS(ldo01) = {
98 REGULATOR_SUPPLY("ldo01", NULL),
99 REGULATOR_SUPPLY("ldo1", NULL),
100 REGULATOR_SUPPLY("rfrx1", NULL),
101};
102
103PCOM_VREG_CONSUMERS(ldo02) = {
104 REGULATOR_SUPPLY("ldo02", NULL),
105 REGULATOR_SUPPLY("ldo2", NULL),
106 REGULATOR_SUPPLY("rfrx2", NULL),
107};
108
109PCOM_VREG_CONSUMERS(ldo03) = {
110 REGULATOR_SUPPLY("ldo03", NULL),
111 REGULATOR_SUPPLY("ldo3", NULL),
112 REGULATOR_SUPPLY("mddi", NULL),
113};
114
115PCOM_VREG_CONSUMERS(ldo04) = {
116 REGULATOR_SUPPLY("ldo04", NULL),
117 REGULATOR_SUPPLY("ldo4", NULL),
118 REGULATOR_SUPPLY("pllx", NULL),
119};
120
121PCOM_VREG_CONSUMERS(ldo05) = {
122 REGULATOR_SUPPLY("ldo05", NULL),
123 REGULATOR_SUPPLY("ldo5", NULL),
124 REGULATOR_SUPPLY("wlan2", NULL),
125};
126
127PCOM_VREG_CONSUMERS(ldo06) = {
128 REGULATOR_SUPPLY("ldo06", NULL),
129 REGULATOR_SUPPLY("ldo6", NULL),
130 REGULATOR_SUPPLY("wlan3", NULL),
131};
132
133PCOM_VREG_CONSUMERS(ldo07) = {
134 REGULATOR_SUPPLY("ldo07", NULL),
135 REGULATOR_SUPPLY("ldo7", NULL),
136 REGULATOR_SUPPLY("msma", NULL),
137};
138
139PCOM_VREG_CONSUMERS(ldo08) = {
140 REGULATOR_SUPPLY("ldo08", NULL),
141 REGULATOR_SUPPLY("ldo8", NULL),
142 REGULATOR_SUPPLY("tcxo", NULL),
143};
144
145PCOM_VREG_CONSUMERS(ldo09) = {
146 REGULATOR_SUPPLY("ldo09", NULL),
147 REGULATOR_SUPPLY("ldo9", NULL),
148 REGULATOR_SUPPLY("usb2", NULL),
149};
150
151PCOM_VREG_CONSUMERS(ldo10) = {
152 REGULATOR_SUPPLY("ldo10", NULL),
153 REGULATOR_SUPPLY("emmc", NULL),
154};
155
156PCOM_VREG_CONSUMERS(ldo11) = {
157 REGULATOR_SUPPLY("ldo11", NULL),
158 REGULATOR_SUPPLY("wlan_tcx0", NULL),
159};
160
161PCOM_VREG_CONSUMERS(ldo12) = {
162 REGULATOR_SUPPLY("ldo12", NULL),
163 REGULATOR_SUPPLY("gp2", NULL),
Mohan Pallaka4c5bb922011-11-23 15:54:51 +0530164 REGULATOR_SUPPLY("vdd_ana", "1-004a"),
Mohan Pallaka5afe9852012-01-12 23:12:06 +0530165 REGULATOR_SUPPLY("vdd", "1-0038"),
Justin Pauporeb3a33b72011-08-23 15:30:32 -0700166};
167
168PCOM_VREG_CONSUMERS(ldo13) = {
169 REGULATOR_SUPPLY("ldo13", NULL),
170 REGULATOR_SUPPLY("mmc", NULL),
171};
172
173PCOM_VREG_CONSUMERS(ldo14) = {
174 REGULATOR_SUPPLY("ldo14", NULL),
175 REGULATOR_SUPPLY("usb", NULL),
176};
177
178PCOM_VREG_CONSUMERS(ldo15) = {
179 REGULATOR_SUPPLY("ldo15", NULL),
180 REGULATOR_SUPPLY("usim2", NULL),
181};
182
183PCOM_VREG_CONSUMERS(ldo16) = {
184 REGULATOR_SUPPLY("ldo16", NULL),
185 REGULATOR_SUPPLY("ruim", NULL),
186};
187
188PCOM_VREG_CONSUMERS(ldo17) = {
189 REGULATOR_SUPPLY("ldo17", NULL),
190 REGULATOR_SUPPLY("bt", NULL),
191};
192
193PCOM_VREG_CONSUMERS(ldo18) = {
194 REGULATOR_SUPPLY("ldo18", NULL),
195 REGULATOR_SUPPLY("rftx", NULL),
196};
197
198PCOM_VREG_CONSUMERS(ldo19) = {
199 REGULATOR_SUPPLY("ldo19", NULL),
200 REGULATOR_SUPPLY("wlan4", NULL),
201};
202
203PCOM_VREG_CONSUMERS(ncp) = {
204 REGULATOR_SUPPLY("ncp", NULL),
205};
206
207static struct proccomm_regulator_info msm7x27a_pcom_vreg_info[] = {
208 /* Standard regulators (SMPS and LDO)
209 * R = rise time (us)
210 * P = pulldown (1 = pull down, 0 = float, -1 = don't care)
211 * A = always on
212 * B = boot on
213 * V = automatic voltage set (meaningful for single-voltage regs only)
214 * S = supply voltage (uV)
Pankaj Kumare8db4252012-01-04 13:06:21 +0530215 * T = type of regulator (smps, pldo, nldo)
216 * name id supp min uV max uV R P A B V S T*/
217 PCOM_VREG_SMP(smps1, 3, NULL, 1100000, 1100000, 0, -1, 0, 0, 0, 0, s),
218 PCOM_VREG_SMP(smps2, 4, NULL, 1100000, 1100000, 0, -1, 0, 0, 0, 0, s),
219 PCOM_VREG_SMP(smps3, 2, NULL, 1800000, 1800000, 0, -1, 0, 0, 0, 0, s),
220 PCOM_VREG_SMP(smps4, 24, NULL, 2100000, 2100000, 0, -1, 0, 0, 0, 0, s),
Jeevan Shriram901a15f2012-03-09 11:53:23 +0530221 PCOM_VREG_LDO(ldo01, 12, NULL, 1800000, 2100000, 0, -1, 0, 0, 0, 0, p),
Pankaj Kumare8db4252012-01-04 13:06:21 +0530222 PCOM_VREG_LDO(ldo02, 13, NULL, 2850000, 2850000, 0, -1, 0, 0, 0, 0, p),
223 PCOM_VREG_LDO(ldo03, 49, NULL, 1200000, 1200000, 0, -1, 0, 0, 0, 0, n),
224 PCOM_VREG_LDO(ldo04, 50, NULL, 1100000, 1100000, 0, -1, 0, 0, 0, 0, n),
225 PCOM_VREG_LDO(ldo05, 45, NULL, 1300000, 1350000, 0, -1, 0, 0, 0, 0, n),
226 PCOM_VREG_LDO(ldo06, 51, NULL, 1200000, 1200000, 0, -1, 0, 0, 0, 0, n),
227 PCOM_VREG_LDO(ldo07, 0, NULL, 2600000, 2600000, 0, -1, 0, 0, 0, 0, p),
228 PCOM_VREG_LDO(ldo08, 9, NULL, 2850000, 2850000, 0, -1, 0, 0, 0, 0, p),
229 PCOM_VREG_LDO(ldo09, 44, NULL, 1800000, 1800000, 0, -1, 0, 0, 0, 0, p),
230 PCOM_VREG_LDO(ldo10, 52, NULL, 1800000, 3000000, 0, -1, 0, 0, 0, 0, p),
231 PCOM_VREG_LDO(ldo11, 53, NULL, 1800000, 1800000, 0, -1, 0, 0, 0, 0, p),
232 PCOM_VREG_LDO(ldo12, 21, NULL, 2850000, 2850000, 0, -1, 0, 0, 0, 0, p),
233 PCOM_VREG_LDO(ldo13, 18, NULL, 2850000, 2850000, 0, -1, 0, 0, 0, 0, p),
234 PCOM_VREG_LDO(ldo14, 16, NULL, 3300000, 3300000, 0, -1, 0, 0, 0, 0, p),
235 PCOM_VREG_LDO(ldo15, 54, NULL, 1800000, 2850000, 0, -1, 0, 0, 0, 0, p),
236 PCOM_VREG_LDO(ldo16, 19, NULL, 1800000, 2850000, 0, -1, 0, 0, 0, 0, p),
237 PCOM_VREG_LDO(ldo17, 56, NULL, 2900000, 3300000, 0, -1, 0, 0, 0, 0, p),
238 PCOM_VREG_LDO(ldo18, 11, NULL, 2700000, 2700000, 0, -1, 0, 0, 0, 0, p),
239 PCOM_VREG_LDO(ldo19, 57, NULL, 1200000, 1800000, 0, -1, 0, 0, 0, 0, p),
Justin Pauporeb3a33b72011-08-23 15:30:32 -0700240
241 PCOM_VREG_NCP(ncp, 31, NULL, -1800000, -1800000, 0, 0, 0, 0, 0),
242};
243
244struct proccomm_regulator_platform_data msm7x27a_proccomm_regulator_data = {
245 .regs = msm7x27a_pcom_vreg_info,
246 .nregs = ARRAY_SIZE(msm7x27a_pcom_vreg_info)
247};