blob: 827f54a1dd1d6fdb0deff2549bcd0ef65aea12d2 [file] [log] [blame]
Peter Ujfalusia53b8e32011-06-04 08:16:41 +03001/*
2 * twl-common.c
3 *
4 * Copyright (C) 2011 Texas Instruments, Inc..
5 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 */
22
23#include <linux/i2c.h>
24#include <linux/i2c/twl.h>
25#include <linux/gpio.h>
Peter Ujfalusib22f9542011-06-07 10:26:46 +030026#include <linux/regulator/machine.h>
27#include <linux/regulator/fixed.h>
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030028
Tony Lindgrendbc04162012-08-31 10:59:07 -070029#include "soc.h"
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030030#include "twl-common.h"
Kevin Hilman46232a32011-11-23 14:43:01 -080031#include "pm.h"
Tero Kristo49c008e2012-02-20 12:26:08 +020032#include "voltage.h"
Kevin Hilman5941b812012-06-28 10:01:32 -070033#include "mux.h"
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030034
35static struct i2c_board_info __initdata pmic_i2c_board_info = {
36 .addr = 0x48,
37 .flags = I2C_CLIENT_WAKE,
38};
39
Peter Ujfalusida0085f2012-06-21 01:36:02 -070040#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
Tero Kristo49c008e2012-02-20 12:26:08 +020041static int twl_set_voltage(void *data, int target_uV)
42{
43 struct voltagedomain *voltdm = (struct voltagedomain *)data;
44 return voltdm_scale(voltdm, target_uV);
45}
46
47static int twl_get_voltage(void *data)
48{
49 struct voltagedomain *voltdm = (struct voltagedomain *)data;
50 return voltdm_get_voltage(voltdm);
51}
Peter Ujfalusida0085f2012-06-21 01:36:02 -070052#endif
Tero Kristo49c008e2012-02-20 12:26:08 +020053
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030054void __init omap_pmic_init(int bus, u32 clkrate,
55 const char *pmic_type, int pmic_irq,
56 struct twl4030_platform_data *pmic_data)
57{
Kevin Hilman265a2bc2012-07-16 16:56:15 -070058 omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030059 strncpy(pmic_i2c_board_info.type, pmic_type,
60 sizeof(pmic_i2c_board_info.type));
61 pmic_i2c_board_info.irq = pmic_irq;
62 pmic_i2c_board_info.platform_data = pmic_data;
63
64 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
65}
Peter Ujfalusib22f9542011-06-07 10:26:46 +030066
Peter Ujfalusi8eaeb932012-04-03 11:56:51 +030067void __init omap4_pmic_init(const char *pmic_type,
68 struct twl4030_platform_data *pmic_data,
Peter Ujfalusi9495d1e2012-09-24 12:24:48 +030069 struct i2c_board_info *devices, int nr_devices)
Peter Ujfalusi8eaeb932012-04-03 11:56:51 +030070{
71 /* PMIC part*/
Kevin Hilman5941b812012-06-28 10:01:32 -070072 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
Peter Ujfalusi9495d1e2012-09-24 12:24:48 +030073 omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data);
Peter Ujfalusi8eaeb932012-04-03 11:56:51 +030074
Peter Ujfalusi9495d1e2012-09-24 12:24:48 +030075 /* Register additional devices on i2c1 bus if needed */
76 if (devices)
77 i2c_register_board_info(1, devices, nr_devices);
Peter Ujfalusi8eaeb932012-04-03 11:56:51 +030078}
79
Kevin Hilman46232a32011-11-23 14:43:01 -080080void __init omap_pmic_late_init(void)
81{
Peter Ujfalusi9495d1e2012-09-24 12:24:48 +030082 /* Init the OMAP TWL parameters (if PMIC has been registerd) */
83 if (!pmic_i2c_board_info.irq)
84 return;
85
86 omap3_twl_init();
87 omap4_twl_init();
Kevin Hilman46232a32011-11-23 14:43:01 -080088}
89
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +030090#if defined(CONFIG_ARCH_OMAP3)
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +030091static struct twl4030_usb_data omap3_usb_pdata = {
92 .usb_mode = T2_USB_MODE_ULPI,
93};
94
95static int omap3_batt_table[] = {
96/* 0 C */
9730800, 29500, 28300, 27100,
9826000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
9917200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
10011600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
1018020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
1025640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
1034040, 3910, 3790, 3670, 3550
104};
105
106static struct twl4030_bci_platform_data omap3_bci_pdata = {
107 .battery_tmp_tbl = omap3_batt_table,
108 .tblsize = ARRAY_SIZE(omap3_batt_table),
109};
110
111static struct twl4030_madc_platform_data omap3_madc_pdata = {
112 .irq_line = 1,
113};
114
Peter Ujfalusi4ae6df5e2011-05-31 15:21:13 +0300115static struct twl4030_codec_data omap3_codec;
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +0300116
Peter Ujfalusi4ae6df5e2011-05-31 15:21:13 +0300117static struct twl4030_audio_data omap3_audio_pdata = {
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +0300118 .audio_mclk = 26000000,
Peter Ujfalusi4ae6df5e2011-05-31 15:21:13 +0300119 .codec = &omap3_codec,
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +0300120};
121
Peter Ujfalusib252b0ef2011-06-07 11:38:24 +0300122static struct regulator_consumer_supply omap3_vdda_dac_supplies[] = {
123 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
124};
125
126static struct regulator_init_data omap3_vdac_idata = {
127 .constraints = {
128 .min_uV = 1800000,
129 .max_uV = 1800000,
130 .valid_modes_mask = REGULATOR_MODE_NORMAL
131 | REGULATOR_MODE_STANDBY,
132 .valid_ops_mask = REGULATOR_CHANGE_MODE
133 | REGULATOR_CHANGE_STATUS,
134 },
135 .num_consumer_supplies = ARRAY_SIZE(omap3_vdda_dac_supplies),
136 .consumer_supplies = omap3_vdda_dac_supplies,
137};
138
139static struct regulator_consumer_supply omap3_vpll2_supplies[] = {
140 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
Tomi Valkeinen7c68dd92011-08-03 14:00:57 +0300141 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
Peter Ujfalusib252b0ef2011-06-07 11:38:24 +0300142};
143
144static struct regulator_init_data omap3_vpll2_idata = {
145 .constraints = {
146 .min_uV = 1800000,
147 .max_uV = 1800000,
148 .valid_modes_mask = REGULATOR_MODE_NORMAL
149 | REGULATOR_MODE_STANDBY,
150 .valid_ops_mask = REGULATOR_CHANGE_MODE
151 | REGULATOR_CHANGE_STATUS,
152 },
153 .num_consumer_supplies = ARRAY_SIZE(omap3_vpll2_supplies),
154 .consumer_supplies = omap3_vpll2_supplies,
155};
156
Tero Kristo23e22a52012-02-20 12:26:07 +0200157static struct regulator_consumer_supply omap3_vdd1_supply[] = {
Kevin Hilman24d7b402012-09-06 14:03:08 -0700158 REGULATOR_SUPPLY("vcc", "cpu0"),
Tero Kristo23e22a52012-02-20 12:26:07 +0200159};
160
161static struct regulator_consumer_supply omap3_vdd2_supply[] = {
162 REGULATOR_SUPPLY("vcc", "l3_main.0"),
163};
164
165static struct regulator_init_data omap3_vdd1 = {
166 .constraints = {
167 .name = "vdd_mpu_iva",
168 .min_uV = 600000,
169 .max_uV = 1450000,
170 .valid_modes_mask = REGULATOR_MODE_NORMAL,
171 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
172 },
173 .num_consumer_supplies = ARRAY_SIZE(omap3_vdd1_supply),
174 .consumer_supplies = omap3_vdd1_supply,
175};
176
177static struct regulator_init_data omap3_vdd2 = {
178 .constraints = {
179 .name = "vdd_core",
180 .min_uV = 600000,
181 .max_uV = 1450000,
182 .valid_modes_mask = REGULATOR_MODE_NORMAL,
183 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
184 },
185 .num_consumer_supplies = ARRAY_SIZE(omap3_vdd2_supply),
186 .consumer_supplies = omap3_vdd2_supply,
187};
188
Tero Kristo49c008e2012-02-20 12:26:08 +0200189static struct twl_regulator_driver_data omap3_vdd1_drvdata = {
190 .get_voltage = twl_get_voltage,
191 .set_voltage = twl_set_voltage,
192};
193
194static struct twl_regulator_driver_data omap3_vdd2_drvdata = {
195 .get_voltage = twl_get_voltage,
196 .set_voltage = twl_set_voltage,
197};
198
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +0300199void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
200 u32 pdata_flags, u32 regulators_flags)
201{
Tero Kristo49c008e2012-02-20 12:26:08 +0200202 if (!pmic_data->vdd1) {
203 omap3_vdd1.driver_data = &omap3_vdd1_drvdata;
204 omap3_vdd1_drvdata.data = voltdm_lookup("mpu_iva");
Tero Kristo23e22a52012-02-20 12:26:07 +0200205 pmic_data->vdd1 = &omap3_vdd1;
Tero Kristo49c008e2012-02-20 12:26:08 +0200206 }
207 if (!pmic_data->vdd2) {
208 omap3_vdd2.driver_data = &omap3_vdd2_drvdata;
209 omap3_vdd2_drvdata.data = voltdm_lookup("core");
Tero Kristo23e22a52012-02-20 12:26:07 +0200210 pmic_data->vdd2 = &omap3_vdd2;
Tero Kristo49c008e2012-02-20 12:26:08 +0200211 }
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +0300212
213 /* Common platform data configurations */
214 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
215 pmic_data->usb = &omap3_usb_pdata;
216
217 if (pdata_flags & TWL_COMMON_PDATA_BCI && !pmic_data->bci)
218 pmic_data->bci = &omap3_bci_pdata;
219
220 if (pdata_flags & TWL_COMMON_PDATA_MADC && !pmic_data->madc)
221 pmic_data->madc = &omap3_madc_pdata;
222
223 if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->audio)
224 pmic_data->audio = &omap3_audio_pdata;
225
226 /* Common regulator configurations */
227 if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
228 pmic_data->vdac = &omap3_vdac_idata;
229
230 if (regulators_flags & TWL_COMMON_REGULATOR_VPLL2 && !pmic_data->vpll2)
231 pmic_data->vpll2 = &omap3_vpll2_idata;
232}
233#endif /* CONFIG_ARCH_OMAP3 */
234
235#if defined(CONFIG_ARCH_OMAP4)
236static struct twl4030_usb_data omap4_usb_pdata = {
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +0300237};
238
Tomi Valkeinen8a3d8952012-08-15 15:54:53 +0300239static struct regulator_consumer_supply omap4_vdda_hdmi_dac_supplies[] = {
240 REGULATOR_SUPPLY("vdda_hdmi_dac", "omapdss_hdmi"),
241};
242
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300243static struct regulator_init_data omap4_vdac_idata = {
244 .constraints = {
245 .min_uV = 1800000,
246 .max_uV = 1800000,
247 .valid_modes_mask = REGULATOR_MODE_NORMAL
248 | REGULATOR_MODE_STANDBY,
249 .valid_ops_mask = REGULATOR_CHANGE_MODE
250 | REGULATOR_CHANGE_STATUS,
251 },
Tomi Valkeinen8a3d8952012-08-15 15:54:53 +0300252 .num_consumer_supplies = ARRAY_SIZE(omap4_vdda_hdmi_dac_supplies),
253 .consumer_supplies = omap4_vdda_hdmi_dac_supplies,
Peter Ujfalusifde01902012-05-09 14:19:16 -0700254 .supply_regulator = "V2V1",
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300255};
256
257static struct regulator_init_data omap4_vaux2_idata = {
258 .constraints = {
259 .min_uV = 1200000,
260 .max_uV = 2800000,
261 .apply_uV = true,
262 .valid_modes_mask = REGULATOR_MODE_NORMAL
263 | REGULATOR_MODE_STANDBY,
264 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
265 | REGULATOR_CHANGE_MODE
266 | REGULATOR_CHANGE_STATUS,
267 },
268};
269
270static struct regulator_init_data omap4_vaux3_idata = {
271 .constraints = {
272 .min_uV = 1000000,
273 .max_uV = 3000000,
274 .apply_uV = true,
275 .valid_modes_mask = REGULATOR_MODE_NORMAL
276 | REGULATOR_MODE_STANDBY,
277 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
278 | REGULATOR_CHANGE_MODE
279 | REGULATOR_CHANGE_STATUS,
280 },
281};
282
283static struct regulator_consumer_supply omap4_vmmc_supply[] = {
284 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
285};
286
287/* VMMC1 for MMC1 card */
288static struct regulator_init_data omap4_vmmc_idata = {
289 .constraints = {
290 .min_uV = 1200000,
291 .max_uV = 3000000,
292 .apply_uV = true,
293 .valid_modes_mask = REGULATOR_MODE_NORMAL
294 | REGULATOR_MODE_STANDBY,
295 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
296 | REGULATOR_CHANGE_MODE
297 | REGULATOR_CHANGE_STATUS,
298 },
299 .num_consumer_supplies = ARRAY_SIZE(omap4_vmmc_supply),
300 .consumer_supplies = omap4_vmmc_supply,
301};
302
303static struct regulator_init_data omap4_vpp_idata = {
304 .constraints = {
305 .min_uV = 1800000,
306 .max_uV = 2500000,
307 .apply_uV = true,
308 .valid_modes_mask = REGULATOR_MODE_NORMAL
309 | REGULATOR_MODE_STANDBY,
310 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
311 | REGULATOR_CHANGE_MODE
312 | REGULATOR_CHANGE_STATUS,
313 },
314};
315
316static struct regulator_init_data omap4_vana_idata = {
317 .constraints = {
318 .min_uV = 2100000,
319 .max_uV = 2100000,
320 .valid_modes_mask = REGULATOR_MODE_NORMAL
321 | REGULATOR_MODE_STANDBY,
322 .valid_ops_mask = REGULATOR_CHANGE_MODE
323 | REGULATOR_CHANGE_STATUS,
324 },
325};
326
Tomi Valkeinen4e6a0ab2011-08-03 14:13:52 +0300327static struct regulator_consumer_supply omap4_vcxio_supply[] = {
328 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dss"),
329 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
330 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.1"),
331};
332
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300333static struct regulator_init_data omap4_vcxio_idata = {
334 .constraints = {
335 .min_uV = 1800000,
336 .max_uV = 1800000,
337 .valid_modes_mask = REGULATOR_MODE_NORMAL
338 | REGULATOR_MODE_STANDBY,
339 .valid_ops_mask = REGULATOR_CHANGE_MODE
340 | REGULATOR_CHANGE_STATUS,
Tomi Valkeinen4e6a0ab2011-08-03 14:13:52 +0300341 .always_on = true,
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300342 },
Tomi Valkeinen4e6a0ab2011-08-03 14:13:52 +0300343 .num_consumer_supplies = ARRAY_SIZE(omap4_vcxio_supply),
344 .consumer_supplies = omap4_vcxio_supply,
Peter Ujfalusifde01902012-05-09 14:19:16 -0700345 .supply_regulator = "V2V1",
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300346};
347
348static struct regulator_init_data omap4_vusb_idata = {
349 .constraints = {
350 .min_uV = 3300000,
351 .max_uV = 3300000,
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300352 .valid_modes_mask = REGULATOR_MODE_NORMAL
353 | REGULATOR_MODE_STANDBY,
354 .valid_ops_mask = REGULATOR_CHANGE_MODE
355 | REGULATOR_CHANGE_STATUS,
356 },
357};
358
359static struct regulator_init_data omap4_clk32kg_idata = {
360 .constraints = {
361 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
362 },
363};
364
Tero Kristoe160dda2012-02-22 12:40:40 +0200365static struct regulator_consumer_supply omap4_vdd1_supply[] = {
366 REGULATOR_SUPPLY("vcc", "mpu.0"),
367};
368
369static struct regulator_consumer_supply omap4_vdd2_supply[] = {
370 REGULATOR_SUPPLY("vcc", "iva.0"),
371};
372
373static struct regulator_consumer_supply omap4_vdd3_supply[] = {
374 REGULATOR_SUPPLY("vcc", "l3_main.0"),
375};
376
377static struct regulator_init_data omap4_vdd1 = {
378 .constraints = {
379 .name = "vdd_mpu",
380 .min_uV = 500000,
381 .max_uV = 1500000,
382 .valid_modes_mask = REGULATOR_MODE_NORMAL,
383 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
384 },
385 .num_consumer_supplies = ARRAY_SIZE(omap4_vdd1_supply),
386 .consumer_supplies = omap4_vdd1_supply,
387};
388
389static struct regulator_init_data omap4_vdd2 = {
390 .constraints = {
391 .name = "vdd_iva",
392 .min_uV = 500000,
393 .max_uV = 1500000,
394 .valid_modes_mask = REGULATOR_MODE_NORMAL,
395 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
396 },
397 .num_consumer_supplies = ARRAY_SIZE(omap4_vdd2_supply),
398 .consumer_supplies = omap4_vdd2_supply,
399};
400
401static struct regulator_init_data omap4_vdd3 = {
402 .constraints = {
403 .name = "vdd_core",
404 .min_uV = 500000,
405 .max_uV = 1500000,
406 .valid_modes_mask = REGULATOR_MODE_NORMAL,
407 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
408 },
409 .num_consumer_supplies = ARRAY_SIZE(omap4_vdd3_supply),
410 .consumer_supplies = omap4_vdd3_supply,
411};
412
413
414static struct twl_regulator_driver_data omap4_vdd1_drvdata = {
415 .get_voltage = twl_get_voltage,
416 .set_voltage = twl_set_voltage,
417};
418
419static struct twl_regulator_driver_data omap4_vdd2_drvdata = {
420 .get_voltage = twl_get_voltage,
421 .set_voltage = twl_set_voltage,
422};
423
424static struct twl_regulator_driver_data omap4_vdd3_drvdata = {
425 .get_voltage = twl_get_voltage,
426 .set_voltage = twl_set_voltage,
427};
428
Peter Ujfalusifde01902012-05-09 14:19:16 -0700429static struct regulator_consumer_supply omap4_v1v8_supply[] = {
430 REGULATOR_SUPPLY("vio", "1-004b"),
431};
432
433static struct regulator_init_data omap4_v1v8_idata = {
434 .constraints = {
435 .min_uV = 1800000,
436 .max_uV = 1800000,
437 .valid_modes_mask = REGULATOR_MODE_NORMAL
438 | REGULATOR_MODE_STANDBY,
439 .valid_ops_mask = REGULATOR_CHANGE_MODE
440 | REGULATOR_CHANGE_STATUS,
441 .always_on = true,
442 },
443 .num_consumer_supplies = ARRAY_SIZE(omap4_v1v8_supply),
444 .consumer_supplies = omap4_v1v8_supply,
445};
446
447static struct regulator_consumer_supply omap4_v2v1_supply[] = {
448 REGULATOR_SUPPLY("v2v1", "1-004b"),
449};
450
451static struct regulator_init_data omap4_v2v1_idata = {
452 .constraints = {
453 .min_uV = 2100000,
454 .max_uV = 2100000,
455 .valid_modes_mask = REGULATOR_MODE_NORMAL
456 | REGULATOR_MODE_STANDBY,
457 .valid_ops_mask = REGULATOR_CHANGE_MODE
458 | REGULATOR_CHANGE_STATUS,
459 },
460 .num_consumer_supplies = ARRAY_SIZE(omap4_v2v1_supply),
461 .consumer_supplies = omap4_v2v1_supply,
462};
463
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300464void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
465 u32 pdata_flags, u32 regulators_flags)
466{
Tero Kristoe160dda2012-02-22 12:40:40 +0200467 if (!pmic_data->vdd1) {
468 omap4_vdd1.driver_data = &omap4_vdd1_drvdata;
469 omap4_vdd1_drvdata.data = voltdm_lookup("mpu");
470 pmic_data->vdd1 = &omap4_vdd1;
471 }
472
473 if (!pmic_data->vdd2) {
474 omap4_vdd2.driver_data = &omap4_vdd2_drvdata;
475 omap4_vdd2_drvdata.data = voltdm_lookup("iva");
476 pmic_data->vdd2 = &omap4_vdd2;
477 }
478
479 if (!pmic_data->vdd3) {
480 omap4_vdd3.driver_data = &omap4_vdd3_drvdata;
481 omap4_vdd3_drvdata.data = voltdm_lookup("core");
482 pmic_data->vdd3 = &omap4_vdd3;
483 }
484
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300485 /* Common platform data configurations */
486 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
487 pmic_data->usb = &omap4_usb_pdata;
488
489 /* Common regulator configurations */
490 if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
491 pmic_data->vdac = &omap4_vdac_idata;
492
493 if (regulators_flags & TWL_COMMON_REGULATOR_VAUX2 && !pmic_data->vaux2)
494 pmic_data->vaux2 = &omap4_vaux2_idata;
495
496 if (regulators_flags & TWL_COMMON_REGULATOR_VAUX3 && !pmic_data->vaux3)
497 pmic_data->vaux3 = &omap4_vaux3_idata;
498
499 if (regulators_flags & TWL_COMMON_REGULATOR_VMMC && !pmic_data->vmmc)
500 pmic_data->vmmc = &omap4_vmmc_idata;
501
502 if (regulators_flags & TWL_COMMON_REGULATOR_VPP && !pmic_data->vpp)
503 pmic_data->vpp = &omap4_vpp_idata;
504
505 if (regulators_flags & TWL_COMMON_REGULATOR_VANA && !pmic_data->vana)
506 pmic_data->vana = &omap4_vana_idata;
507
508 if (regulators_flags & TWL_COMMON_REGULATOR_VCXIO && !pmic_data->vcxio)
509 pmic_data->vcxio = &omap4_vcxio_idata;
510
511 if (regulators_flags & TWL_COMMON_REGULATOR_VUSB && !pmic_data->vusb)
512 pmic_data->vusb = &omap4_vusb_idata;
513
514 if (regulators_flags & TWL_COMMON_REGULATOR_CLK32KG &&
515 !pmic_data->clk32kg)
516 pmic_data->clk32kg = &omap4_clk32kg_idata;
Peter Ujfalusifde01902012-05-09 14:19:16 -0700517
518 if (regulators_flags & TWL_COMMON_REGULATOR_V1V8 && !pmic_data->v1v8)
519 pmic_data->v1v8 = &omap4_v1v8_idata;
520
521 if (regulators_flags & TWL_COMMON_REGULATOR_V2V1 && !pmic_data->v2v1)
522 pmic_data->v2v1 = &omap4_v2v1_idata;
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300523}
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +0300524#endif /* CONFIG_ARCH_OMAP4 */
Peter Ujfalusi552d9dc2012-08-14 12:07:57 +0300525
526#if defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030) || \
527 defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030_MODULE)
528#include <linux/platform_data/omap-twl4030.h>
529
530static struct omap_tw4030_pdata omap_twl4030_audio_data;
531
532static struct platform_device audio_device = {
533 .name = "omap-twl4030",
534 .id = -1,
535 .dev = {
536 .platform_data = &omap_twl4030_audio_data,
537 },
538};
539
540void __init omap_twl4030_audio_init(char *card_name)
541{
542 omap_twl4030_audio_data.card_name = card_name;
543 platform_device_register(&audio_device);
544}
545
546#else /* SOC_OMAP_TWL4030 */
Peter Ujfalusieda21d32012-08-23 09:35:01 +0300547void __init omap_twl4030_audio_init(char *card_name)
Peter Ujfalusi552d9dc2012-08-14 12:07:57 +0300548{
549 return;
550}
551#endif /* SOC_OMAP_TWL4030 */