blob: a256135d8e48f59c0a6a103b2d449682caac9be2 [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
29#include <plat/i2c.h>
Peter Ujfalusib22f9542011-06-07 10:26:46 +030030#include <plat/usb.h>
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030031
Tony Lindgrendbc04162012-08-31 10:59:07 -070032#include "soc.h"
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030033#include "twl-common.h"
Kevin Hilman46232a32011-11-23 14:43:01 -080034#include "pm.h"
Tero Kristo49c008e2012-02-20 12:26:08 +020035#include "voltage.h"
Kevin Hilman5941b812012-06-28 10:01:32 -070036#include "mux.h"
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030037
38static struct i2c_board_info __initdata pmic_i2c_board_info = {
39 .addr = 0x48,
40 .flags = I2C_CLIENT_WAKE,
41};
42
Peter Ujfalusida0085f2012-06-21 01:36:02 -070043#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
Tero Kristo49c008e2012-02-20 12:26:08 +020044static int twl_set_voltage(void *data, int target_uV)
45{
46 struct voltagedomain *voltdm = (struct voltagedomain *)data;
47 return voltdm_scale(voltdm, target_uV);
48}
49
50static int twl_get_voltage(void *data)
51{
52 struct voltagedomain *voltdm = (struct voltagedomain *)data;
53 return voltdm_get_voltage(voltdm);
54}
Peter Ujfalusida0085f2012-06-21 01:36:02 -070055#endif
Tero Kristo49c008e2012-02-20 12:26:08 +020056
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030057void __init omap_pmic_init(int bus, u32 clkrate,
58 const char *pmic_type, int pmic_irq,
59 struct twl4030_platform_data *pmic_data)
60{
Kevin Hilman265a2bc2012-07-16 16:56:15 -070061 omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030062 strncpy(pmic_i2c_board_info.type, pmic_type,
63 sizeof(pmic_i2c_board_info.type));
64 pmic_i2c_board_info.irq = pmic_irq;
65 pmic_i2c_board_info.platform_data = pmic_data;
66
67 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
68}
Peter Ujfalusib22f9542011-06-07 10:26:46 +030069
Peter Ujfalusi8eaeb932012-04-03 11:56:51 +030070void __init omap4_pmic_init(const char *pmic_type,
71 struct twl4030_platform_data *pmic_data,
Peter Ujfalusi9495d1e2012-09-24 12:24:48 +030072 struct i2c_board_info *devices, int nr_devices)
Peter Ujfalusi8eaeb932012-04-03 11:56:51 +030073{
74 /* PMIC part*/
Kevin Hilman5941b812012-06-28 10:01:32 -070075 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
Kevin Hilman1ef43362012-11-08 11:08:50 -080076 omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
Peter Ujfalusi9495d1e2012-09-24 12:24:48 +030077 omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data);
Peter Ujfalusi8eaeb932012-04-03 11:56:51 +030078
Peter Ujfalusi9495d1e2012-09-24 12:24:48 +030079 /* Register additional devices on i2c1 bus if needed */
80 if (devices)
81 i2c_register_board_info(1, devices, nr_devices);
Peter Ujfalusi8eaeb932012-04-03 11:56:51 +030082}
83
Kevin Hilman46232a32011-11-23 14:43:01 -080084void __init omap_pmic_late_init(void)
85{
Peter Ujfalusi9495d1e2012-09-24 12:24:48 +030086 /* Init the OMAP TWL parameters (if PMIC has been registerd) */
87 if (!pmic_i2c_board_info.irq)
88 return;
89
90 omap3_twl_init();
91 omap4_twl_init();
Kevin Hilman46232a32011-11-23 14:43:01 -080092}
93
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +030094#if defined(CONFIG_ARCH_OMAP3)
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +030095static struct twl4030_usb_data omap3_usb_pdata = {
96 .usb_mode = T2_USB_MODE_ULPI,
97};
98
99static int omap3_batt_table[] = {
100/* 0 C */
10130800, 29500, 28300, 27100,
10226000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
10317200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
10411600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
1058020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
1065640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
1074040, 3910, 3790, 3670, 3550
108};
109
110static struct twl4030_bci_platform_data omap3_bci_pdata = {
111 .battery_tmp_tbl = omap3_batt_table,
112 .tblsize = ARRAY_SIZE(omap3_batt_table),
113};
114
115static struct twl4030_madc_platform_data omap3_madc_pdata = {
116 .irq_line = 1,
117};
118
Peter Ujfalusi4ae6df52011-05-31 15:21:13 +0300119static struct twl4030_codec_data omap3_codec;
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +0300120
Peter Ujfalusi4ae6df52011-05-31 15:21:13 +0300121static struct twl4030_audio_data omap3_audio_pdata = {
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +0300122 .audio_mclk = 26000000,
Peter Ujfalusi4ae6df52011-05-31 15:21:13 +0300123 .codec = &omap3_codec,
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +0300124};
125
Peter Ujfalusib252b0e2011-06-07 11:38:24 +0300126static struct regulator_consumer_supply omap3_vdda_dac_supplies[] = {
127 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
128};
129
130static struct regulator_init_data omap3_vdac_idata = {
131 .constraints = {
132 .min_uV = 1800000,
133 .max_uV = 1800000,
134 .valid_modes_mask = REGULATOR_MODE_NORMAL
135 | REGULATOR_MODE_STANDBY,
136 .valid_ops_mask = REGULATOR_CHANGE_MODE
137 | REGULATOR_CHANGE_STATUS,
138 },
139 .num_consumer_supplies = ARRAY_SIZE(omap3_vdda_dac_supplies),
140 .consumer_supplies = omap3_vdda_dac_supplies,
141};
142
143static struct regulator_consumer_supply omap3_vpll2_supplies[] = {
144 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
Tomi Valkeinen7c68dd92011-08-03 14:00:57 +0300145 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
Peter Ujfalusib252b0e2011-06-07 11:38:24 +0300146};
147
148static struct regulator_init_data omap3_vpll2_idata = {
149 .constraints = {
150 .min_uV = 1800000,
151 .max_uV = 1800000,
152 .valid_modes_mask = REGULATOR_MODE_NORMAL
153 | REGULATOR_MODE_STANDBY,
154 .valid_ops_mask = REGULATOR_CHANGE_MODE
155 | REGULATOR_CHANGE_STATUS,
156 },
157 .num_consumer_supplies = ARRAY_SIZE(omap3_vpll2_supplies),
158 .consumer_supplies = omap3_vpll2_supplies,
159};
160
Tero Kristo23e22a52012-02-20 12:26:07 +0200161static struct regulator_consumer_supply omap3_vdd1_supply[] = {
Kevin Hilman24d7b402012-09-06 14:03:08 -0700162 REGULATOR_SUPPLY("vcc", "cpu0"),
Tero Kristo23e22a52012-02-20 12:26:07 +0200163};
164
165static struct regulator_consumer_supply omap3_vdd2_supply[] = {
166 REGULATOR_SUPPLY("vcc", "l3_main.0"),
167};
168
169static struct regulator_init_data omap3_vdd1 = {
170 .constraints = {
171 .name = "vdd_mpu_iva",
172 .min_uV = 600000,
173 .max_uV = 1450000,
174 .valid_modes_mask = REGULATOR_MODE_NORMAL,
175 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
176 },
177 .num_consumer_supplies = ARRAY_SIZE(omap3_vdd1_supply),
178 .consumer_supplies = omap3_vdd1_supply,
179};
180
181static struct regulator_init_data omap3_vdd2 = {
182 .constraints = {
183 .name = "vdd_core",
184 .min_uV = 600000,
185 .max_uV = 1450000,
186 .valid_modes_mask = REGULATOR_MODE_NORMAL,
187 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
188 },
189 .num_consumer_supplies = ARRAY_SIZE(omap3_vdd2_supply),
190 .consumer_supplies = omap3_vdd2_supply,
191};
192
Tero Kristo49c008e2012-02-20 12:26:08 +0200193static struct twl_regulator_driver_data omap3_vdd1_drvdata = {
194 .get_voltage = twl_get_voltage,
195 .set_voltage = twl_set_voltage,
196};
197
198static struct twl_regulator_driver_data omap3_vdd2_drvdata = {
199 .get_voltage = twl_get_voltage,
200 .set_voltage = twl_set_voltage,
201};
202
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +0300203void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
204 u32 pdata_flags, u32 regulators_flags)
205{
Tero Kristo49c008e2012-02-20 12:26:08 +0200206 if (!pmic_data->vdd1) {
207 omap3_vdd1.driver_data = &omap3_vdd1_drvdata;
208 omap3_vdd1_drvdata.data = voltdm_lookup("mpu_iva");
Tero Kristo23e22a52012-02-20 12:26:07 +0200209 pmic_data->vdd1 = &omap3_vdd1;
Tero Kristo49c008e2012-02-20 12:26:08 +0200210 }
211 if (!pmic_data->vdd2) {
212 omap3_vdd2.driver_data = &omap3_vdd2_drvdata;
213 omap3_vdd2_drvdata.data = voltdm_lookup("core");
Tero Kristo23e22a52012-02-20 12:26:07 +0200214 pmic_data->vdd2 = &omap3_vdd2;
Tero Kristo49c008e2012-02-20 12:26:08 +0200215 }
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +0300216
217 /* Common platform data configurations */
218 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
219 pmic_data->usb = &omap3_usb_pdata;
220
221 if (pdata_flags & TWL_COMMON_PDATA_BCI && !pmic_data->bci)
222 pmic_data->bci = &omap3_bci_pdata;
223
224 if (pdata_flags & TWL_COMMON_PDATA_MADC && !pmic_data->madc)
225 pmic_data->madc = &omap3_madc_pdata;
226
227 if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->audio)
228 pmic_data->audio = &omap3_audio_pdata;
229
230 /* Common regulator configurations */
231 if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
232 pmic_data->vdac = &omap3_vdac_idata;
233
234 if (regulators_flags & TWL_COMMON_REGULATOR_VPLL2 && !pmic_data->vpll2)
235 pmic_data->vpll2 = &omap3_vpll2_idata;
236}
237#endif /* CONFIG_ARCH_OMAP3 */
238
239#if defined(CONFIG_ARCH_OMAP4)
240static struct twl4030_usb_data omap4_usb_pdata = {
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +0300241};
242
Tomi Valkeinen8a3d8952012-08-15 15:54:53 +0300243static struct regulator_consumer_supply omap4_vdda_hdmi_dac_supplies[] = {
244 REGULATOR_SUPPLY("vdda_hdmi_dac", "omapdss_hdmi"),
245};
246
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300247static struct regulator_init_data omap4_vdac_idata = {
248 .constraints = {
249 .min_uV = 1800000,
250 .max_uV = 1800000,
251 .valid_modes_mask = REGULATOR_MODE_NORMAL
252 | REGULATOR_MODE_STANDBY,
253 .valid_ops_mask = REGULATOR_CHANGE_MODE
254 | REGULATOR_CHANGE_STATUS,
255 },
Tomi Valkeinen8a3d8952012-08-15 15:54:53 +0300256 .num_consumer_supplies = ARRAY_SIZE(omap4_vdda_hdmi_dac_supplies),
257 .consumer_supplies = omap4_vdda_hdmi_dac_supplies,
Peter Ujfalusifde01902012-05-09 14:19:16 -0700258 .supply_regulator = "V2V1",
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300259};
260
261static struct regulator_init_data omap4_vaux2_idata = {
262 .constraints = {
263 .min_uV = 1200000,
264 .max_uV = 2800000,
265 .apply_uV = true,
266 .valid_modes_mask = REGULATOR_MODE_NORMAL
267 | REGULATOR_MODE_STANDBY,
268 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
269 | REGULATOR_CHANGE_MODE
270 | REGULATOR_CHANGE_STATUS,
271 },
272};
273
274static struct regulator_init_data omap4_vaux3_idata = {
275 .constraints = {
276 .min_uV = 1000000,
277 .max_uV = 3000000,
278 .apply_uV = true,
279 .valid_modes_mask = REGULATOR_MODE_NORMAL
280 | REGULATOR_MODE_STANDBY,
281 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
282 | REGULATOR_CHANGE_MODE
283 | REGULATOR_CHANGE_STATUS,
284 },
285};
286
287static struct regulator_consumer_supply omap4_vmmc_supply[] = {
288 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
289};
290
291/* VMMC1 for MMC1 card */
292static struct regulator_init_data omap4_vmmc_idata = {
293 .constraints = {
294 .min_uV = 1200000,
295 .max_uV = 3000000,
296 .apply_uV = true,
297 .valid_modes_mask = REGULATOR_MODE_NORMAL
298 | REGULATOR_MODE_STANDBY,
299 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
300 | REGULATOR_CHANGE_MODE
301 | REGULATOR_CHANGE_STATUS,
302 },
303 .num_consumer_supplies = ARRAY_SIZE(omap4_vmmc_supply),
304 .consumer_supplies = omap4_vmmc_supply,
305};
306
307static struct regulator_init_data omap4_vpp_idata = {
308 .constraints = {
309 .min_uV = 1800000,
310 .max_uV = 2500000,
311 .apply_uV = true,
312 .valid_modes_mask = REGULATOR_MODE_NORMAL
313 | REGULATOR_MODE_STANDBY,
314 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
315 | REGULATOR_CHANGE_MODE
316 | REGULATOR_CHANGE_STATUS,
317 },
318};
319
320static struct regulator_init_data omap4_vana_idata = {
321 .constraints = {
322 .min_uV = 2100000,
323 .max_uV = 2100000,
324 .valid_modes_mask = REGULATOR_MODE_NORMAL
325 | REGULATOR_MODE_STANDBY,
326 .valid_ops_mask = REGULATOR_CHANGE_MODE
327 | REGULATOR_CHANGE_STATUS,
328 },
329};
330
Tomi Valkeinen4e6a0ab2011-08-03 14:13:52 +0300331static struct regulator_consumer_supply omap4_vcxio_supply[] = {
332 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dss"),
333 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
334 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.1"),
335};
336
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300337static struct regulator_init_data omap4_vcxio_idata = {
338 .constraints = {
339 .min_uV = 1800000,
340 .max_uV = 1800000,
341 .valid_modes_mask = REGULATOR_MODE_NORMAL
342 | REGULATOR_MODE_STANDBY,
343 .valid_ops_mask = REGULATOR_CHANGE_MODE
344 | REGULATOR_CHANGE_STATUS,
Tomi Valkeinen4e6a0ab2011-08-03 14:13:52 +0300345 .always_on = true,
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300346 },
Tomi Valkeinen4e6a0ab2011-08-03 14:13:52 +0300347 .num_consumer_supplies = ARRAY_SIZE(omap4_vcxio_supply),
348 .consumer_supplies = omap4_vcxio_supply,
Peter Ujfalusifde01902012-05-09 14:19:16 -0700349 .supply_regulator = "V2V1",
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300350};
351
352static struct regulator_init_data omap4_vusb_idata = {
353 .constraints = {
354 .min_uV = 3300000,
355 .max_uV = 3300000,
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300356 .valid_modes_mask = REGULATOR_MODE_NORMAL
357 | REGULATOR_MODE_STANDBY,
358 .valid_ops_mask = REGULATOR_CHANGE_MODE
359 | REGULATOR_CHANGE_STATUS,
360 },
361};
362
363static struct regulator_init_data omap4_clk32kg_idata = {
364 .constraints = {
365 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
366 },
367};
368
Tero Kristoe160dda2012-02-22 12:40:40 +0200369static struct regulator_consumer_supply omap4_vdd1_supply[] = {
Kevin Hilman73c503c2012-11-05 15:46:36 -0800370 REGULATOR_SUPPLY("vcc", "cpu0"),
Tero Kristoe160dda2012-02-22 12:40:40 +0200371};
372
373static struct regulator_consumer_supply omap4_vdd2_supply[] = {
374 REGULATOR_SUPPLY("vcc", "iva.0"),
375};
376
377static struct regulator_consumer_supply omap4_vdd3_supply[] = {
378 REGULATOR_SUPPLY("vcc", "l3_main.0"),
379};
380
381static struct regulator_init_data omap4_vdd1 = {
382 .constraints = {
383 .name = "vdd_mpu",
384 .min_uV = 500000,
385 .max_uV = 1500000,
386 .valid_modes_mask = REGULATOR_MODE_NORMAL,
387 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
388 },
389 .num_consumer_supplies = ARRAY_SIZE(omap4_vdd1_supply),
390 .consumer_supplies = omap4_vdd1_supply,
391};
392
393static struct regulator_init_data omap4_vdd2 = {
394 .constraints = {
395 .name = "vdd_iva",
396 .min_uV = 500000,
397 .max_uV = 1500000,
398 .valid_modes_mask = REGULATOR_MODE_NORMAL,
399 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
400 },
401 .num_consumer_supplies = ARRAY_SIZE(omap4_vdd2_supply),
402 .consumer_supplies = omap4_vdd2_supply,
403};
404
405static struct regulator_init_data omap4_vdd3 = {
406 .constraints = {
407 .name = "vdd_core",
408 .min_uV = 500000,
409 .max_uV = 1500000,
410 .valid_modes_mask = REGULATOR_MODE_NORMAL,
411 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
412 },
413 .num_consumer_supplies = ARRAY_SIZE(omap4_vdd3_supply),
414 .consumer_supplies = omap4_vdd3_supply,
415};
416
417
418static struct twl_regulator_driver_data omap4_vdd1_drvdata = {
419 .get_voltage = twl_get_voltage,
420 .set_voltage = twl_set_voltage,
421};
422
423static struct twl_regulator_driver_data omap4_vdd2_drvdata = {
424 .get_voltage = twl_get_voltage,
425 .set_voltage = twl_set_voltage,
426};
427
428static struct twl_regulator_driver_data omap4_vdd3_drvdata = {
429 .get_voltage = twl_get_voltage,
430 .set_voltage = twl_set_voltage,
431};
432
Peter Ujfalusifde01902012-05-09 14:19:16 -0700433static struct regulator_consumer_supply omap4_v1v8_supply[] = {
434 REGULATOR_SUPPLY("vio", "1-004b"),
435};
436
437static struct regulator_init_data omap4_v1v8_idata = {
438 .constraints = {
439 .min_uV = 1800000,
440 .max_uV = 1800000,
441 .valid_modes_mask = REGULATOR_MODE_NORMAL
442 | REGULATOR_MODE_STANDBY,
443 .valid_ops_mask = REGULATOR_CHANGE_MODE
444 | REGULATOR_CHANGE_STATUS,
445 .always_on = true,
446 },
447 .num_consumer_supplies = ARRAY_SIZE(omap4_v1v8_supply),
448 .consumer_supplies = omap4_v1v8_supply,
449};
450
451static struct regulator_consumer_supply omap4_v2v1_supply[] = {
452 REGULATOR_SUPPLY("v2v1", "1-004b"),
453};
454
455static struct regulator_init_data omap4_v2v1_idata = {
456 .constraints = {
457 .min_uV = 2100000,
458 .max_uV = 2100000,
459 .valid_modes_mask = REGULATOR_MODE_NORMAL
460 | REGULATOR_MODE_STANDBY,
461 .valid_ops_mask = REGULATOR_CHANGE_MODE
462 | REGULATOR_CHANGE_STATUS,
463 },
464 .num_consumer_supplies = ARRAY_SIZE(omap4_v2v1_supply),
465 .consumer_supplies = omap4_v2v1_supply,
466};
467
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300468void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
469 u32 pdata_flags, u32 regulators_flags)
470{
Tero Kristoe160dda2012-02-22 12:40:40 +0200471 if (!pmic_data->vdd1) {
472 omap4_vdd1.driver_data = &omap4_vdd1_drvdata;
473 omap4_vdd1_drvdata.data = voltdm_lookup("mpu");
474 pmic_data->vdd1 = &omap4_vdd1;
475 }
476
477 if (!pmic_data->vdd2) {
478 omap4_vdd2.driver_data = &omap4_vdd2_drvdata;
479 omap4_vdd2_drvdata.data = voltdm_lookup("iva");
480 pmic_data->vdd2 = &omap4_vdd2;
481 }
482
483 if (!pmic_data->vdd3) {
484 omap4_vdd3.driver_data = &omap4_vdd3_drvdata;
485 omap4_vdd3_drvdata.data = voltdm_lookup("core");
486 pmic_data->vdd3 = &omap4_vdd3;
487 }
488
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300489 /* Common platform data configurations */
490 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
491 pmic_data->usb = &omap4_usb_pdata;
492
493 /* Common regulator configurations */
494 if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
495 pmic_data->vdac = &omap4_vdac_idata;
496
497 if (regulators_flags & TWL_COMMON_REGULATOR_VAUX2 && !pmic_data->vaux2)
498 pmic_data->vaux2 = &omap4_vaux2_idata;
499
500 if (regulators_flags & TWL_COMMON_REGULATOR_VAUX3 && !pmic_data->vaux3)
501 pmic_data->vaux3 = &omap4_vaux3_idata;
502
503 if (regulators_flags & TWL_COMMON_REGULATOR_VMMC && !pmic_data->vmmc)
504 pmic_data->vmmc = &omap4_vmmc_idata;
505
506 if (regulators_flags & TWL_COMMON_REGULATOR_VPP && !pmic_data->vpp)
507 pmic_data->vpp = &omap4_vpp_idata;
508
509 if (regulators_flags & TWL_COMMON_REGULATOR_VANA && !pmic_data->vana)
510 pmic_data->vana = &omap4_vana_idata;
511
512 if (regulators_flags & TWL_COMMON_REGULATOR_VCXIO && !pmic_data->vcxio)
513 pmic_data->vcxio = &omap4_vcxio_idata;
514
515 if (regulators_flags & TWL_COMMON_REGULATOR_VUSB && !pmic_data->vusb)
516 pmic_data->vusb = &omap4_vusb_idata;
517
518 if (regulators_flags & TWL_COMMON_REGULATOR_CLK32KG &&
519 !pmic_data->clk32kg)
520 pmic_data->clk32kg = &omap4_clk32kg_idata;
Peter Ujfalusifde01902012-05-09 14:19:16 -0700521
522 if (regulators_flags & TWL_COMMON_REGULATOR_V1V8 && !pmic_data->v1v8)
523 pmic_data->v1v8 = &omap4_v1v8_idata;
524
525 if (regulators_flags & TWL_COMMON_REGULATOR_V2V1 && !pmic_data->v2v1)
526 pmic_data->v2v1 = &omap4_v2v1_idata;
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300527}
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +0300528#endif /* CONFIG_ARCH_OMAP4 */
Peter Ujfalusi552d9dc2012-08-14 12:07:57 +0300529
530#if defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030) || \
531 defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030_MODULE)
532#include <linux/platform_data/omap-twl4030.h>
533
534static struct omap_tw4030_pdata omap_twl4030_audio_data;
535
536static struct platform_device audio_device = {
537 .name = "omap-twl4030",
538 .id = -1,
539 .dev = {
540 .platform_data = &omap_twl4030_audio_data,
541 },
542};
543
544void __init omap_twl4030_audio_init(char *card_name)
545{
546 omap_twl4030_audio_data.card_name = card_name;
547 platform_device_register(&audio_device);
548}
549
550#else /* SOC_OMAP_TWL4030 */
Peter Ujfalusieda21d32012-08-23 09:35:01 +0300551void __init omap_twl4030_audio_init(char *card_name)
Peter Ujfalusi552d9dc2012-08-14 12:07:57 +0300552{
553 return;
554}
555#endif /* SOC_OMAP_TWL4030 */