1
2
3
4
5
6
7
8
9
10#include <linux/kernel.h>
11#include <linux/i2c.h>
12#include <linux/mfd/abx500.h>
13#include <linux/regulator/machine.h>
14#include <linux/amba/bus.h>
15#include <mach/irqs.h>
16
17
18
19
20
21
22
23
24
25#define LDO_A_SETTING 0x16
26
27#define LDO_C_SETTING 0x10
28
29#define LDO_D_SETTING 0x10
30
31#define LDO_E_SETTING 0x10
32
33#define LDO_E_SLEEP_SETTING 0x00
34
35#define LDO_F_SETTING 0xD0
36
37#define LDO_G_SETTING 0x00
38
39#define LDO_H_SETTING 0x18
40
41#define LDO_K_SETTING 0x00
42
43#define LDO_EXT_SETTING 0x00
44
45#define BUCK_SETTING 0x7D
46
47#define BUCK_SLEEP_SETTING 0xAC
48
49#ifdef CONFIG_AB3100_CORE
50static struct regulator_consumer_supply supply_ldo_c[] = {
51 {
52 .dev_name = "ab3100-codec",
53 .supply = "vaudio",
54 },
55};
56
57
58
59
60
61static struct regulator_consumer_supply supply_ldo_d[] = {
62 {
63 .dev = NULL,
64 .supply = "vana15",
65 },
66};
67
68static struct regulator_consumer_supply supply_ldo_g[] = {
69 {
70 .dev_name = "mmci",
71 .supply = "vmmc",
72 },
73};
74
75static struct regulator_consumer_supply supply_ldo_h[] = {
76 {
77 .dev_name = "xgam_pdi",
78 .supply = "vdisp",
79 },
80};
81
82static struct regulator_consumer_supply supply_ldo_k[] = {
83 {
84 .dev_name = "irda",
85 .supply = "vir",
86 },
87};
88
89
90
91
92
93static struct regulator_consumer_supply supply_ldo_ext[] = {
94 {
95 .dev = NULL,
96 .supply = "vext",
97 },
98};
99
100
101#define LDO_A_VOLTAGE 2750000
102#define LDO_C_VOLTAGE 2650000
103#define LDO_D_VOLTAGE 2650000
104
105static struct ab3100_platform_data ab3100_plf_data = {
106 .reg_constraints = {
107
108 {
109 .constraints = {
110 .name = "vrad",
111 .min_uV = LDO_A_VOLTAGE,
112 .max_uV = LDO_A_VOLTAGE,
113 .valid_modes_mask = REGULATOR_MODE_NORMAL,
114 .always_on = 1,
115 .boot_on = 1,
116 },
117 },
118
119 {
120 .constraints = {
121 .min_uV = LDO_C_VOLTAGE,
122 .max_uV = LDO_C_VOLTAGE,
123 .valid_modes_mask = REGULATOR_MODE_NORMAL,
124 },
125 .num_consumer_supplies = ARRAY_SIZE(supply_ldo_c),
126 .consumer_supplies = supply_ldo_c,
127 },
128
129 {
130 .constraints = {
131 .min_uV = LDO_D_VOLTAGE,
132 .max_uV = LDO_D_VOLTAGE,
133 .valid_modes_mask = REGULATOR_MODE_NORMAL,
134 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
135
136
137
138
139
140 },
141 .num_consumer_supplies = ARRAY_SIZE(supply_ldo_d),
142 .consumer_supplies = supply_ldo_d,
143 },
144
145 {
146 .constraints = {
147 .name = "vio",
148 .min_uV = 1800000,
149 .max_uV = 1800000,
150 .valid_modes_mask = REGULATOR_MODE_NORMAL,
151 .valid_ops_mask =
152 REGULATOR_CHANGE_VOLTAGE |
153 REGULATOR_CHANGE_STATUS,
154 .always_on = 1,
155 .boot_on = 1,
156 },
157 },
158
159 {
160 .constraints = {
161 .name = "vana25",
162 .min_uV = 2500000,
163 .max_uV = 2500000,
164 .valid_modes_mask = REGULATOR_MODE_NORMAL,
165 .valid_ops_mask =
166 REGULATOR_CHANGE_VOLTAGE |
167 REGULATOR_CHANGE_STATUS,
168 .always_on = 1,
169 .boot_on = 1,
170 },
171 },
172
173 {
174 .constraints = {
175 .min_uV = 1500000,
176 .max_uV = 2850000,
177 .valid_modes_mask = REGULATOR_MODE_NORMAL,
178 .valid_ops_mask =
179 REGULATOR_CHANGE_VOLTAGE |
180 REGULATOR_CHANGE_STATUS,
181 },
182 .num_consumer_supplies = ARRAY_SIZE(supply_ldo_g),
183 .consumer_supplies = supply_ldo_g,
184 },
185
186 {
187 .constraints = {
188 .min_uV = 1200000,
189 .max_uV = 2750000,
190 .valid_modes_mask = REGULATOR_MODE_NORMAL,
191 .valid_ops_mask =
192 REGULATOR_CHANGE_VOLTAGE |
193 REGULATOR_CHANGE_STATUS,
194 },
195 .num_consumer_supplies = ARRAY_SIZE(supply_ldo_h),
196 .consumer_supplies = supply_ldo_h,
197 },
198
199 {
200 .constraints = {
201 .min_uV = 1800000,
202 .max_uV = 2750000,
203 .valid_modes_mask = REGULATOR_MODE_NORMAL,
204 .valid_ops_mask =
205 REGULATOR_CHANGE_VOLTAGE |
206 REGULATOR_CHANGE_STATUS,
207 },
208 .num_consumer_supplies = ARRAY_SIZE(supply_ldo_k),
209 .consumer_supplies = supply_ldo_k,
210 },
211
212
213
214
215
216 {
217 .constraints = {
218 .min_uV = 0,
219 .max_uV = 0,
220 .valid_modes_mask = REGULATOR_MODE_NORMAL,
221 .valid_ops_mask =
222 REGULATOR_CHANGE_STATUS,
223 },
224 .num_consumer_supplies = ARRAY_SIZE(supply_ldo_ext),
225 .consumer_supplies = supply_ldo_ext,
226 },
227
228 {
229 .constraints = {
230 .name = "vcore",
231 .min_uV = 1200000,
232 .max_uV = 1800000,
233 .valid_modes_mask = REGULATOR_MODE_NORMAL,
234 .valid_ops_mask =
235 REGULATOR_CHANGE_VOLTAGE |
236 REGULATOR_CHANGE_STATUS,
237 .always_on = 1,
238 .boot_on = 1,
239 },
240 },
241 },
242 .reg_initvals = {
243 LDO_A_SETTING,
244 LDO_C_SETTING,
245 LDO_E_SETTING,
246 LDO_E_SLEEP_SETTING,
247 LDO_F_SETTING,
248 LDO_G_SETTING,
249 LDO_H_SETTING,
250 LDO_K_SETTING,
251 LDO_EXT_SETTING,
252 BUCK_SETTING,
253 BUCK_SLEEP_SETTING,
254 LDO_D_SETTING,
255 },
256};
257#endif
258
259#ifdef CONFIG_AB3550_CORE
260static struct abx500_init_settings ab3550_init_settings[] = {
261 {
262 .bank = 0,
263 .reg = AB3550_IMR1,
264 .setting = 0xff
265 },
266 {
267 .bank = 0,
268 .reg = AB3550_IMR2,
269 .setting = 0xff
270 },
271 {
272 .bank = 0,
273 .reg = AB3550_IMR3,
274 .setting = 0xff
275 },
276 {
277 .bank = 0,
278 .reg = AB3550_IMR4,
279 .setting = 0xff
280 },
281 {
282 .bank = 0,
283 .reg = AB3550_IMR5,
284
285 .setting = 0x3f
286 },
287};
288
289static struct ab3550_platform_data ab3550_plf_data = {
290 .irq = {
291 .base = IRQ_AB3550_BASE,
292 .count = (IRQ_AB3550_END - IRQ_AB3550_BASE + 1),
293 },
294 .dev_data = {
295 },
296 .init_settings = ab3550_init_settings,
297 .init_settings_sz = ARRAY_SIZE(ab3550_init_settings),
298};
299#endif
300
301static struct i2c_board_info __initdata bus0_i2c_board_info[] = {
302#if defined(CONFIG_AB3550_CORE)
303 {
304 .type = "ab3550",
305 .addr = 0x4A,
306 .irq = IRQ_U300_IRQ0_EXT,
307 .platform_data = &ab3550_plf_data,
308 },
309#elif defined(CONFIG_AB3100_CORE)
310 {
311 .type = "ab3100",
312 .addr = 0x48,
313 .irq = IRQ_U300_IRQ0_EXT,
314 .platform_data = &ab3100_plf_data,
315 },
316#else
317 { },
318#endif
319};
320
321static struct i2c_board_info __initdata bus1_i2c_board_info[] = {
322#ifdef CONFIG_MACH_U300_BS335
323 {
324 .type = "fwcam",
325 .addr = 0x10,
326 },
327 {
328 .type = "fwcam",
329 .addr = 0x5d,
330 },
331#else
332 { },
333#endif
334};
335
336void __init u300_i2c_register_board_devices(void)
337{
338 i2c_register_board_info(0, bus0_i2c_board_info,
339 ARRAY_SIZE(bus0_i2c_board_info));
340
341
342
343
344 regulator_has_full_constraints();
345 i2c_register_board_info(1, bus1_i2c_board_info,
346 ARRAY_SIZE(bus1_i2c_board_info));
347}
348