blob: c05898fbd634a813542ab0c0b6e8b86586a6a0ee [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>
Chen Gangc8d4baf2013-01-30 19:46:49 +080026#include <linux/string.h>
Peter Ujfalusib22f9542011-06-07 10:26:46 +030027#include <linux/regulator/machine.h>
28#include <linux/regulator/fixed.h>
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030029
Tony Lindgrendbc04162012-08-31 10:59:07 -070030#include "soc.h"
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030031#include "twl-common.h"
Kevin Hilman46232a32011-11-23 14:43:01 -080032#include "pm.h"
Tero Kristo49c008e2012-02-20 12:26:08 +020033#include "voltage.h"
Kevin Hilman5941b812012-06-28 10:01:32 -070034#include "mux.h"
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030035
36static struct i2c_board_info __initdata pmic_i2c_board_info = {
37 .addr = 0x48,
38 .flags = I2C_CLIENT_WAKE,
39};
40
Peter Ujfalusida0085f2012-06-21 01:36:02 -070041#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
Tero Kristo49c008e2012-02-20 12:26:08 +020042static int twl_set_voltage(void *data, int target_uV)
43{
44 struct voltagedomain *voltdm = (struct voltagedomain *)data;
45 return voltdm_scale(voltdm, target_uV);
46}
47
48static int twl_get_voltage(void *data)
49{
50 struct voltagedomain *voltdm = (struct voltagedomain *)data;
51 return voltdm_get_voltage(voltdm);
52}
Peter Ujfalusida0085f2012-06-21 01:36:02 -070053#endif
Tero Kristo49c008e2012-02-20 12:26:08 +020054
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030055void __init omap_pmic_init(int bus, u32 clkrate,
56 const char *pmic_type, int pmic_irq,
57 struct twl4030_platform_data *pmic_data)
58{
Kevin Hilman265a2bc2012-07-16 16:56:15 -070059 omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
Chen Gangc8d4baf2013-01-30 19:46:49 +080060 strlcpy(pmic_i2c_board_info.type, pmic_type,
Peter Ujfalusia53b8e32011-06-04 08:16:41 +030061 sizeof(pmic_i2c_board_info.type));
62 pmic_i2c_board_info.irq = pmic_irq;
63 pmic_i2c_board_info.platform_data = pmic_data;
64
65 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
66}
Peter Ujfalusib22f9542011-06-07 10:26:46 +030067
Peter Ujfalusi8eaeb932012-04-03 11:56:51 +030068void __init omap4_pmic_init(const char *pmic_type,
69 struct twl4030_platform_data *pmic_data,
Peter Ujfalusi9495d1e2012-09-24 12:24:48 +030070 struct i2c_board_info *devices, int nr_devices)
Peter Ujfalusi8eaeb932012-04-03 11:56:51 +030071{
72 /* PMIC part*/
Kevin Hilman5941b812012-06-28 10:01:32 -070073 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
Kevin Hilman1ef43362012-11-08 11:08:50 -080074 omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
Peter Ujfalusi9495d1e2012-09-24 12:24:48 +030075 omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data);
Peter Ujfalusi8eaeb932012-04-03 11:56:51 +030076
Peter Ujfalusi9495d1e2012-09-24 12:24:48 +030077 /* Register additional devices on i2c1 bus if needed */
78 if (devices)
79 i2c_register_board_info(1, devices, nr_devices);
Peter Ujfalusi8eaeb932012-04-03 11:56:51 +030080}
81
Kevin Hilman46232a32011-11-23 14:43:01 -080082void __init omap_pmic_late_init(void)
83{
Peter Ujfalusi9495d1e2012-09-24 12:24:48 +030084 /* Init the OMAP TWL parameters (if PMIC has been registerd) */
85 if (!pmic_i2c_board_info.irq)
86 return;
87
88 omap3_twl_init();
89 omap4_twl_init();
Kevin Hilman46232a32011-11-23 14:43:01 -080090}
91
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +030092#if defined(CONFIG_ARCH_OMAP3)
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +030093static struct twl4030_usb_data omap3_usb_pdata = {
94 .usb_mode = T2_USB_MODE_ULPI,
95};
96
97static int omap3_batt_table[] = {
98/* 0 C */
9930800, 29500, 28300, 27100,
10026000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
10117200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
10211600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
1038020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
1045640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
1054040, 3910, 3790, 3670, 3550
106};
107
108static struct twl4030_bci_platform_data omap3_bci_pdata = {
109 .battery_tmp_tbl = omap3_batt_table,
110 .tblsize = ARRAY_SIZE(omap3_batt_table),
111};
112
113static struct twl4030_madc_platform_data omap3_madc_pdata = {
114 .irq_line = 1,
115};
116
Peter Ujfalusi4ae6df52011-05-31 15:21:13 +0300117static struct twl4030_codec_data omap3_codec;
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +0300118
Peter Ujfalusi4ae6df52011-05-31 15:21:13 +0300119static struct twl4030_audio_data omap3_audio_pdata = {
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +0300120 .audio_mclk = 26000000,
Peter Ujfalusi4ae6df52011-05-31 15:21:13 +0300121 .codec = &omap3_codec,
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +0300122};
123
Peter Ujfalusib252b0e2011-06-07 11:38:24 +0300124static struct regulator_consumer_supply omap3_vdda_dac_supplies[] = {
125 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
126};
127
128static struct regulator_init_data omap3_vdac_idata = {
129 .constraints = {
130 .min_uV = 1800000,
131 .max_uV = 1800000,
132 .valid_modes_mask = REGULATOR_MODE_NORMAL
133 | REGULATOR_MODE_STANDBY,
134 .valid_ops_mask = REGULATOR_CHANGE_MODE
135 | REGULATOR_CHANGE_STATUS,
136 },
137 .num_consumer_supplies = ARRAY_SIZE(omap3_vdda_dac_supplies),
138 .consumer_supplies = omap3_vdda_dac_supplies,
139};
140
141static struct regulator_consumer_supply omap3_vpll2_supplies[] = {
142 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
Tomi Valkeinen1f92a1a2013-05-31 10:37:53 +0300143 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dpi.0"),
Tomi Valkeinen7c68dd92011-08-03 14:00:57 +0300144 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
Peter Ujfalusib252b0e2011-06-07 11:38:24 +0300145};
146
147static struct regulator_init_data omap3_vpll2_idata = {
148 .constraints = {
149 .min_uV = 1800000,
150 .max_uV = 1800000,
151 .valid_modes_mask = REGULATOR_MODE_NORMAL
152 | REGULATOR_MODE_STANDBY,
153 .valid_ops_mask = REGULATOR_CHANGE_MODE
154 | REGULATOR_CHANGE_STATUS,
155 },
156 .num_consumer_supplies = ARRAY_SIZE(omap3_vpll2_supplies),
157 .consumer_supplies = omap3_vpll2_supplies,
158};
159
Tero Kristo23e22a52012-02-20 12:26:07 +0200160static struct regulator_consumer_supply omap3_vdd1_supply[] = {
Kevin Hilman24d7b402012-09-06 14:03:08 -0700161 REGULATOR_SUPPLY("vcc", "cpu0"),
Tero Kristo23e22a52012-02-20 12:26:07 +0200162};
163
164static struct regulator_consumer_supply omap3_vdd2_supply[] = {
165 REGULATOR_SUPPLY("vcc", "l3_main.0"),
166};
167
168static struct regulator_init_data omap3_vdd1 = {
169 .constraints = {
170 .name = "vdd_mpu_iva",
171 .min_uV = 600000,
172 .max_uV = 1450000,
173 .valid_modes_mask = REGULATOR_MODE_NORMAL,
174 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
175 },
176 .num_consumer_supplies = ARRAY_SIZE(omap3_vdd1_supply),
177 .consumer_supplies = omap3_vdd1_supply,
178};
179
180static struct regulator_init_data omap3_vdd2 = {
181 .constraints = {
182 .name = "vdd_core",
183 .min_uV = 600000,
184 .max_uV = 1450000,
185 .valid_modes_mask = REGULATOR_MODE_NORMAL,
186 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
187 },
188 .num_consumer_supplies = ARRAY_SIZE(omap3_vdd2_supply),
189 .consumer_supplies = omap3_vdd2_supply,
190};
191
Tero Kristo49c008e2012-02-20 12:26:08 +0200192static struct twl_regulator_driver_data omap3_vdd1_drvdata = {
193 .get_voltage = twl_get_voltage,
194 .set_voltage = twl_set_voltage,
195};
196
197static struct twl_regulator_driver_data omap3_vdd2_drvdata = {
198 .get_voltage = twl_get_voltage,
199 .set_voltage = twl_set_voltage,
200};
201
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +0300202void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
203 u32 pdata_flags, u32 regulators_flags)
204{
Tero Kristo49c008e2012-02-20 12:26:08 +0200205 if (!pmic_data->vdd1) {
206 omap3_vdd1.driver_data = &omap3_vdd1_drvdata;
207 omap3_vdd1_drvdata.data = voltdm_lookup("mpu_iva");
Tero Kristo23e22a52012-02-20 12:26:07 +0200208 pmic_data->vdd1 = &omap3_vdd1;
Tero Kristo49c008e2012-02-20 12:26:08 +0200209 }
210 if (!pmic_data->vdd2) {
211 omap3_vdd2.driver_data = &omap3_vdd2_drvdata;
212 omap3_vdd2_drvdata.data = voltdm_lookup("core");
Tero Kristo23e22a52012-02-20 12:26:07 +0200213 pmic_data->vdd2 = &omap3_vdd2;
Tero Kristo49c008e2012-02-20 12:26:08 +0200214 }
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +0300215
216 /* Common platform data configurations */
217 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
218 pmic_data->usb = &omap3_usb_pdata;
219
220 if (pdata_flags & TWL_COMMON_PDATA_BCI && !pmic_data->bci)
221 pmic_data->bci = &omap3_bci_pdata;
222
223 if (pdata_flags & TWL_COMMON_PDATA_MADC && !pmic_data->madc)
224 pmic_data->madc = &omap3_madc_pdata;
225
226 if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->audio)
227 pmic_data->audio = &omap3_audio_pdata;
228
229 /* Common regulator configurations */
230 if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
231 pmic_data->vdac = &omap3_vdac_idata;
232
233 if (regulators_flags & TWL_COMMON_REGULATOR_VPLL2 && !pmic_data->vpll2)
234 pmic_data->vpll2 = &omap3_vpll2_idata;
235}
236#endif /* CONFIG_ARCH_OMAP3 */
237
238#if defined(CONFIG_ARCH_OMAP4)
239static struct twl4030_usb_data omap4_usb_pdata = {
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +0300240};
241
Tomi Valkeinen8a3d8952012-08-15 15:54:53 +0300242static struct regulator_consumer_supply omap4_vdda_hdmi_dac_supplies[] = {
243 REGULATOR_SUPPLY("vdda_hdmi_dac", "omapdss_hdmi"),
244};
245
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300246static struct regulator_init_data omap4_vdac_idata = {
247 .constraints = {
248 .min_uV = 1800000,
249 .max_uV = 1800000,
250 .valid_modes_mask = REGULATOR_MODE_NORMAL
251 | REGULATOR_MODE_STANDBY,
252 .valid_ops_mask = REGULATOR_CHANGE_MODE
253 | REGULATOR_CHANGE_STATUS,
254 },
Tomi Valkeinen8a3d8952012-08-15 15:54:53 +0300255 .num_consumer_supplies = ARRAY_SIZE(omap4_vdda_hdmi_dac_supplies),
256 .consumer_supplies = omap4_vdda_hdmi_dac_supplies,
Peter Ujfalusifde01902012-05-09 14:19:16 -0700257 .supply_regulator = "V2V1",
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300258};
259
260static struct regulator_init_data omap4_vaux2_idata = {
261 .constraints = {
262 .min_uV = 1200000,
263 .max_uV = 2800000,
264 .apply_uV = true,
265 .valid_modes_mask = REGULATOR_MODE_NORMAL
266 | REGULATOR_MODE_STANDBY,
267 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
268 | REGULATOR_CHANGE_MODE
269 | REGULATOR_CHANGE_STATUS,
270 },
271};
272
273static struct regulator_init_data omap4_vaux3_idata = {
274 .constraints = {
275 .min_uV = 1000000,
276 .max_uV = 3000000,
277 .apply_uV = true,
278 .valid_modes_mask = REGULATOR_MODE_NORMAL
279 | REGULATOR_MODE_STANDBY,
280 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
281 | REGULATOR_CHANGE_MODE
282 | REGULATOR_CHANGE_STATUS,
283 },
284};
285
286static struct regulator_consumer_supply omap4_vmmc_supply[] = {
287 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
288};
289
290/* VMMC1 for MMC1 card */
291static struct regulator_init_data omap4_vmmc_idata = {
292 .constraints = {
293 .min_uV = 1200000,
294 .max_uV = 3000000,
295 .apply_uV = true,
296 .valid_modes_mask = REGULATOR_MODE_NORMAL
297 | REGULATOR_MODE_STANDBY,
298 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
299 | REGULATOR_CHANGE_MODE
300 | REGULATOR_CHANGE_STATUS,
301 },
302 .num_consumer_supplies = ARRAY_SIZE(omap4_vmmc_supply),
303 .consumer_supplies = omap4_vmmc_supply,
304};
305
306static struct regulator_init_data omap4_vpp_idata = {
307 .constraints = {
308 .min_uV = 1800000,
309 .max_uV = 2500000,
310 .apply_uV = true,
311 .valid_modes_mask = REGULATOR_MODE_NORMAL
312 | REGULATOR_MODE_STANDBY,
313 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
314 | REGULATOR_CHANGE_MODE
315 | REGULATOR_CHANGE_STATUS,
316 },
317};
318
319static struct regulator_init_data omap4_vana_idata = {
320 .constraints = {
321 .min_uV = 2100000,
322 .max_uV = 2100000,
323 .valid_modes_mask = REGULATOR_MODE_NORMAL
324 | REGULATOR_MODE_STANDBY,
325 .valid_ops_mask = REGULATOR_CHANGE_MODE
326 | REGULATOR_CHANGE_STATUS,
327 },
328};
329
Tomi Valkeinen4e6a0ab2011-08-03 14:13:52 +0300330static struct regulator_consumer_supply omap4_vcxio_supply[] = {
331 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dss"),
332 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
333 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.1"),
334};
335
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300336static struct regulator_init_data omap4_vcxio_idata = {
337 .constraints = {
338 .min_uV = 1800000,
339 .max_uV = 1800000,
340 .valid_modes_mask = REGULATOR_MODE_NORMAL
341 | REGULATOR_MODE_STANDBY,
342 .valid_ops_mask = REGULATOR_CHANGE_MODE
343 | REGULATOR_CHANGE_STATUS,
Tomi Valkeinen4e6a0ab2011-08-03 14:13:52 +0300344 .always_on = true,
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300345 },
Tomi Valkeinen4e6a0ab2011-08-03 14:13:52 +0300346 .num_consumer_supplies = ARRAY_SIZE(omap4_vcxio_supply),
347 .consumer_supplies = omap4_vcxio_supply,
Peter Ujfalusifde01902012-05-09 14:19:16 -0700348 .supply_regulator = "V2V1",
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300349};
350
351static struct regulator_init_data omap4_vusb_idata = {
352 .constraints = {
353 .min_uV = 3300000,
354 .max_uV = 3300000,
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300355 .valid_modes_mask = REGULATOR_MODE_NORMAL
356 | REGULATOR_MODE_STANDBY,
357 .valid_ops_mask = REGULATOR_CHANGE_MODE
358 | REGULATOR_CHANGE_STATUS,
359 },
360};
361
362static struct regulator_init_data omap4_clk32kg_idata = {
363 .constraints = {
364 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
365 },
366};
367
Tero Kristoe160dda2012-02-22 12:40:40 +0200368static struct regulator_consumer_supply omap4_vdd1_supply[] = {
Kevin Hilman73c503c2012-11-05 15:46:36 -0800369 REGULATOR_SUPPLY("vcc", "cpu0"),
Tero Kristoe160dda2012-02-22 12:40:40 +0200370};
371
372static struct regulator_consumer_supply omap4_vdd2_supply[] = {
373 REGULATOR_SUPPLY("vcc", "iva.0"),
374};
375
376static struct regulator_consumer_supply omap4_vdd3_supply[] = {
377 REGULATOR_SUPPLY("vcc", "l3_main.0"),
378};
379
380static struct regulator_init_data omap4_vdd1 = {
381 .constraints = {
382 .name = "vdd_mpu",
383 .min_uV = 500000,
384 .max_uV = 1500000,
385 .valid_modes_mask = REGULATOR_MODE_NORMAL,
386 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
387 },
388 .num_consumer_supplies = ARRAY_SIZE(omap4_vdd1_supply),
389 .consumer_supplies = omap4_vdd1_supply,
390};
391
392static struct regulator_init_data omap4_vdd2 = {
393 .constraints = {
394 .name = "vdd_iva",
395 .min_uV = 500000,
396 .max_uV = 1500000,
397 .valid_modes_mask = REGULATOR_MODE_NORMAL,
398 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
399 },
400 .num_consumer_supplies = ARRAY_SIZE(omap4_vdd2_supply),
401 .consumer_supplies = omap4_vdd2_supply,
402};
403
404static struct regulator_init_data omap4_vdd3 = {
405 .constraints = {
406 .name = "vdd_core",
407 .min_uV = 500000,
408 .max_uV = 1500000,
409 .valid_modes_mask = REGULATOR_MODE_NORMAL,
410 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
411 },
412 .num_consumer_supplies = ARRAY_SIZE(omap4_vdd3_supply),
413 .consumer_supplies = omap4_vdd3_supply,
414};
415
416
417static struct twl_regulator_driver_data omap4_vdd1_drvdata = {
418 .get_voltage = twl_get_voltage,
419 .set_voltage = twl_set_voltage,
420};
421
422static struct twl_regulator_driver_data omap4_vdd2_drvdata = {
423 .get_voltage = twl_get_voltage,
424 .set_voltage = twl_set_voltage,
425};
426
427static struct twl_regulator_driver_data omap4_vdd3_drvdata = {
428 .get_voltage = twl_get_voltage,
429 .set_voltage = twl_set_voltage,
430};
431
Peter Ujfalusifde01902012-05-09 14:19:16 -0700432static struct regulator_consumer_supply omap4_v1v8_supply[] = {
433 REGULATOR_SUPPLY("vio", "1-004b"),
434};
435
436static struct regulator_init_data omap4_v1v8_idata = {
437 .constraints = {
438 .min_uV = 1800000,
439 .max_uV = 1800000,
440 .valid_modes_mask = REGULATOR_MODE_NORMAL
441 | REGULATOR_MODE_STANDBY,
442 .valid_ops_mask = REGULATOR_CHANGE_MODE
443 | REGULATOR_CHANGE_STATUS,
444 .always_on = true,
445 },
446 .num_consumer_supplies = ARRAY_SIZE(omap4_v1v8_supply),
447 .consumer_supplies = omap4_v1v8_supply,
448};
449
450static struct regulator_consumer_supply omap4_v2v1_supply[] = {
451 REGULATOR_SUPPLY("v2v1", "1-004b"),
452};
453
454static struct regulator_init_data omap4_v2v1_idata = {
455 .constraints = {
456 .min_uV = 2100000,
457 .max_uV = 2100000,
458 .valid_modes_mask = REGULATOR_MODE_NORMAL
459 | REGULATOR_MODE_STANDBY,
460 .valid_ops_mask = REGULATOR_CHANGE_MODE
461 | REGULATOR_CHANGE_STATUS,
462 },
463 .num_consumer_supplies = ARRAY_SIZE(omap4_v2v1_supply),
464 .consumer_supplies = omap4_v2v1_supply,
465};
466
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300467void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
468 u32 pdata_flags, u32 regulators_flags)
469{
Tero Kristoe160dda2012-02-22 12:40:40 +0200470 if (!pmic_data->vdd1) {
471 omap4_vdd1.driver_data = &omap4_vdd1_drvdata;
472 omap4_vdd1_drvdata.data = voltdm_lookup("mpu");
473 pmic_data->vdd1 = &omap4_vdd1;
474 }
475
476 if (!pmic_data->vdd2) {
477 omap4_vdd2.driver_data = &omap4_vdd2_drvdata;
478 omap4_vdd2_drvdata.data = voltdm_lookup("iva");
479 pmic_data->vdd2 = &omap4_vdd2;
480 }
481
482 if (!pmic_data->vdd3) {
483 omap4_vdd3.driver_data = &omap4_vdd3_drvdata;
484 omap4_vdd3_drvdata.data = voltdm_lookup("core");
485 pmic_data->vdd3 = &omap4_vdd3;
486 }
487
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300488 /* Common platform data configurations */
489 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
490 pmic_data->usb = &omap4_usb_pdata;
491
492 /* Common regulator configurations */
493 if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
494 pmic_data->vdac = &omap4_vdac_idata;
495
496 if (regulators_flags & TWL_COMMON_REGULATOR_VAUX2 && !pmic_data->vaux2)
497 pmic_data->vaux2 = &omap4_vaux2_idata;
498
499 if (regulators_flags & TWL_COMMON_REGULATOR_VAUX3 && !pmic_data->vaux3)
500 pmic_data->vaux3 = &omap4_vaux3_idata;
501
502 if (regulators_flags & TWL_COMMON_REGULATOR_VMMC && !pmic_data->vmmc)
503 pmic_data->vmmc = &omap4_vmmc_idata;
504
505 if (regulators_flags & TWL_COMMON_REGULATOR_VPP && !pmic_data->vpp)
506 pmic_data->vpp = &omap4_vpp_idata;
507
508 if (regulators_flags & TWL_COMMON_REGULATOR_VANA && !pmic_data->vana)
509 pmic_data->vana = &omap4_vana_idata;
510
511 if (regulators_flags & TWL_COMMON_REGULATOR_VCXIO && !pmic_data->vcxio)
512 pmic_data->vcxio = &omap4_vcxio_idata;
513
514 if (regulators_flags & TWL_COMMON_REGULATOR_VUSB && !pmic_data->vusb)
515 pmic_data->vusb = &omap4_vusb_idata;
516
517 if (regulators_flags & TWL_COMMON_REGULATOR_CLK32KG &&
518 !pmic_data->clk32kg)
519 pmic_data->clk32kg = &omap4_clk32kg_idata;
Peter Ujfalusifde01902012-05-09 14:19:16 -0700520
521 if (regulators_flags & TWL_COMMON_REGULATOR_V1V8 && !pmic_data->v1v8)
522 pmic_data->v1v8 = &omap4_v1v8_idata;
523
524 if (regulators_flags & TWL_COMMON_REGULATOR_V2V1 && !pmic_data->v2v1)
525 pmic_data->v2v1 = &omap4_v2v1_idata;
Peter Ujfalusib22f9542011-06-07 10:26:46 +0300526}
Peter Ujfalusid12d1fc2011-08-09 15:36:50 +0300527#endif /* CONFIG_ARCH_OMAP4 */
Peter Ujfalusi552d9dc2012-08-14 12:07:57 +0300528
529#if defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030) || \
530 defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030_MODULE)
531#include <linux/platform_data/omap-twl4030.h>
532
Peter Ujfalusi02553f52012-12-05 14:40:30 +0100533/* Commonly used configuration */
Peter Ujfalusi552d9dc2012-08-14 12:07:57 +0300534static struct omap_tw4030_pdata omap_twl4030_audio_data;
535
536static struct platform_device audio_device = {
537 .name = "omap-twl4030",
538 .id = -1,
Peter Ujfalusi552d9dc2012-08-14 12:07:57 +0300539};
540
Tony Lindgren6689c872013-02-05 10:36:21 -0800541void omap_twl4030_audio_init(char *card_name,
Peter Ujfalusi40234bf2012-12-05 14:45:23 +0100542 struct omap_tw4030_pdata *pdata)
Peter Ujfalusi552d9dc2012-08-14 12:07:57 +0300543{
Peter Ujfalusi40234bf2012-12-05 14:45:23 +0100544 if (!pdata)
545 pdata = &omap_twl4030_audio_data;
546
547 pdata->card_name = card_name;
548
549 audio_device.dev.platform_data = pdata;
Peter Ujfalusi552d9dc2012-08-14 12:07:57 +0300550 platform_device_register(&audio_device);
551}
552
553#else /* SOC_OMAP_TWL4030 */
Tony Lindgren6689c872013-02-05 10:36:21 -0800554void omap_twl4030_audio_init(char *card_name,
Peter Ujfalusi40234bf2012-12-05 14:45:23 +0100555 struct omap_tw4030_pdata *pdata)
Peter Ujfalusi552d9dc2012-08-14 12:07:57 +0300556{
557 return;
558}
559#endif /* SOC_OMAP_TWL4030 */