Full support for Ginger Console
[linux-ginger.git] / arch / arm / mach-omap2 / board-omap35x-pmic.h
blob096ca531df116cdca6bc53741ec5331ae89954b0
1 /*
2 * board-omap35x-pmic.h
4 * Macros to create regulator supplies and regulator init data, along with the
5 * default wrappers for various TI PMICs like TWL4030/TPS65950, TPS65023 etc.
7 * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
14 * whether express or implied; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
19 #include <linux/regulator/driver.h>
20 #include <linux/regulator/machine.h>
21 #include <linux/platform_device.h>
22 #include <plat/common.h>
24 /* Create supplies for a specific regulator */
25 #define REGULATOR_COMSUMER_START(regulator) \
26 static struct regulator_consumer_supply regulator##_consumers[]
27 /* Add/define supplies to the specific regulator */
28 #define REGULATOR_COMSUMER_DEFINE(s, device) \
29 { \
30 .supply = #s, \
31 .dev = device, \
34 /* Define regulator with no supplies attached to it */
35 #define REGULATOR_CONSUMER_NO_SUPPLY(regulator) \
36 REGULATOR_COMSUMER_START(regulator) = {}
38 /* Define regulator with a single supply attached to it */
39 #define REGULATOR_CONSUMER_SINGLE_SUPPLY(regulator, s, device) \
40 REGULATOR_COMSUMER_START(regulator) = { \
41 REGULATOR_COMSUMER_DEFINE(s, device), \
44 /* Define regulator with multiple supplies attached to it like */
46 REGULATOR_COMSUMER_START(name) = {
47 REGULATOR_COMSUMER_DEFINE(supply, device),
48 REGULATOR_COMSUMER_DEFINE(supply, device),
49 REGULATOR_COMSUMER_DEFINE(supply, device),
53 /* Define constraints flags */
54 #define REGULATOR_CONSTRAINTS_FLAGS(reg_always_on, reg_boot_on, reg_apply_uV) \
55 .always_on = reg_always_on, \
56 .boot_on = reg_boot_on, \
57 .apply_uV = reg_apply_uV,
59 /* Define regulation constraints */
60 #define REGULATOR_CONSTRAINTS(n, min, max, modes, ops, reg_on, apply_uv) \
61 { \
62 .name = #n, \
63 .min_uV = min, \
64 .max_uV = max, \
65 .valid_modes_mask = modes, \
66 .valid_ops_mask = ops, \
67 .always_on = reg_on, \
68 .apply_uV = apply_uv, \
71 /* Declare the regulator initialization data */
72 #define REGULATOR_INIT_DATA_START(regulator) \
73 static struct regulator_init_data regulator##_data[]
75 /* Populate various fields in the regulator initialization data */
76 #define REGULATOR_INIT_DATA_DEFINE(regulator, n, min, max, modes, ops, \
77 reg_on, apply_uv) \
78 { \
79 .constraints = REGULATOR_CONSTRAINTS(n, min, max, modes, ops, \
80 reg_on, apply_uv) \
81 .num_consumer_supplies = ARRAY_SIZE(regulator##_consumers), \
82 .consumer_supplies = regulator##_consumers, \
85 /* Define regulator initialization data */
86 #define REGULATOR_INIT_DATA(regulator,n,min,max,modes,ops,reg_on,apply_uv) \
87 REGULATOR_INIT_DATA_START(regulator) = { \
88 REGULATOR_INIT_DATA_DEFINE(regulator, n, min, max, modes, ops, \
89 reg_on, apply_uv), \
93 * Default wrappers specific to TWL4030/TPS65950 PMIC
95 #if defined(CONFIG_PMIC_TWL4030) || defined(CONFIG_TWL4030_CORE)
96 #define TWL_REGULATOR_MODES_DEFAULT (REGULATOR_MODE_NORMAL | \
97 REGULATOR_MODE_STANDBY)
98 #define TWL_REGULATOR_OPS_DEFAULT (REGULATOR_CHANGE_MODE | \
99 REGULATOR_CHANGE_STATUS)
101 /* Default supplies for TWL4030 regulators */
102 #define TWL_VAUX1_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vaux1, \
103 vaux1, NULL)
104 #define TWL_VAUX2_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vaux2, \
105 vaux2, NULL)
106 #define TWL_VAUX3_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vaux3, \
107 vaux3, NULL)
108 #define TWL_VAUX4_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vaux4, \
109 vaux4, NULL)
111 #define TWL_VMMC1_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vmmc1, \
112 vmmc, NULL)
113 #define TWL_VMMC2_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vmmc2, \
114 vmmc, NULL)
116 #define TWL_VPLL1_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vpll1, \
117 vpll1, NULL)
118 #define TWL_VPLL2_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vpll2, \
119 vdvi, NULL)
121 #define TWL_VSIM_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vsim, \
122 vmmc_aux, NULL)
123 #define TWL_VDAC_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vdac, \
124 vdac, NULL)
126 #define TWL_VUSB1V5_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vusb1v5, \
127 vusb1v5, NULL)
128 #define TWL_VUSB1V8_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vusb1v8, \
129 vusb1v8, NULL)
130 #define TWL_VUSB3V1_SUPPLY REGULATOR_CONSUMER_SINGLE_SUPPLY(vusb3v1, \
131 vusb3v1, NULL)
133 /* Default initialization data for TWL4030 regulators */
134 /* VAUX1 */
135 #define TWL_VAUX1_DATA REGULATOR_INIT_DATA(vaux1, VAUX1, 2800000, 2800000, \
136 TWL_REGULATOR_MODES_DEFAULT, \
137 TWL_REGULATOR_OPS_DEFAULT, \
138 false, true)
140 /* VAUX2 */
141 #define TWL_VAUX2_DATA REGULATOR_INIT_DATA(vaux2, VAUX2, 2800000, 2800000, \
142 TWL_REGULATOR_MODES_DEFAULT, \
143 TWL_REGULATOR_OPS_DEFAULT, \
144 false, true)
146 /* VAUX3 */
147 #define TWL_VAUX3_DATA REGULATOR_INIT_DATA(vaux3, VAUX3, 2800000, 2800000, \
148 TWL_REGULATOR_MODES_DEFAULT, \
149 TWL_REGULATOR_OPS_DEFAULT, \
150 false, true)
152 /* VAUX4 */
153 #define TWL_VAUX4_DATA REGULATOR_INIT_DATA(vaux4, VAUX4, 1800000, 1800000, \
154 TWL_REGULATOR_MODES_DEFAULT, \
155 TWL_REGULATOR_OPS_DEFAULT, \
156 false, true)
158 /* VMMC1 */
159 #define TWL_VMMC1_DATA REGULATOR_INIT_DATA(vmmc1, VMMC1, 1850000, 3150000, \
160 TWL_REGULATOR_MODES_DEFAULT, \
161 TWL_REGULATOR_OPS_DEFAULT, \
162 false, true)
164 /* VMMC2 */
165 #define TWL_VMMC2_DATA REGULATOR_INIT_DATA(vmmc2, VMMC2, 1850000, 1850000, \
166 TWL_REGULATOR_MODES_DEFAULT, \
167 TWL_REGULATOR_OPS_DEFAULT, \
168 false, true)
170 /* VPLL1 */
171 #define TWL_VPLL1_DATA REGULATOR_INIT_DATA(vpll1, VPLL1, 1300000, 1300000, \
172 TWL_REGULATOR_MODES_DEFAULT, \
173 TWL_REGULATOR_OPS_DEFAULT, \
174 false, true)
176 /* VPLL2 */
177 #define TWL_VPLL2_DATA REGULATOR_INIT_DATA(vpll2, VDVI, 1800000, 1800000, \
178 TWL_REGULATOR_MODES_DEFAULT, \
179 TWL_REGULATOR_OPS_DEFAULT, \
180 false, true)
182 /* VSIM */
183 #define TWL_VSIM_DATA REGULATOR_INIT_DATA(vsim, VSIM, 1800000, 3000000, \
184 TWL_REGULATOR_MODES_DEFAULT, \
185 TWL_REGULATOR_OPS_DEFAULT, \
186 false, true)
188 /* VDAC */
189 #define TWL_VDAC_DATA REGULATOR_INIT_DATA(vdac, VDAC, 1800000, 1800000, \
190 TWL_REGULATOR_MODES_DEFAULT, \
191 TWL_REGULATOR_OPS_DEFAULT, \
192 false, true)
194 /* VUSB1V5 */
195 #define TWL_VUSB1V5_DATA REGULATOR_INIT_DATA(vusb1v5, VUSB1V5, \
196 1500000, 1500000, \
197 TWL_REGULATOR_MODES_DEFAULT, \
198 TWL_REGULATOR_OPS_DEFAULT, \
199 false, true)
201 /* VUSB1V8 */
202 #define TWL_VUSB1V8_DATA REGULATOR_INIT_DATA(vusb1v8, VUSB1V8, \
203 1800000, 1800000, \
204 TWL_REGULATOR_MODES_DEFAULT, \
205 TWL_REGULATOR_OPS_DEFAULT, \
206 false, true)
208 /* VUSB3V1 */
209 #define TWL_VUSB3V1_DATA REGULATOR_INIT_DATA(vusb3v1, VUSB3V1, \
210 3100000, 3100000, \
211 TWL_REGULATOR_MODES_DEFAULT, \
212 TWL_REGULATOR_OPS_DEFAULT, \
213 false, true)
215 #endif /* CONFIG_PMIC_TWL4030 || CONFIG_TWL4030_CORE */
218 * Definitions specific to TPS65023
220 #if defined(CONFIG_PMIC_TPS65023)
221 #endif /* CONFIG_PMIC_TPS65023 */
224 * Definitions specific to TPS65073
226 #if defined(CONFIG_PMIC_TPS65073)
227 #endif /* CONFIG_PMIC_TPS65073 */