Kyle Swenson | 8d8f654 | 2021-03-15 11:02:55 -0600 | [diff] [blame^] | 1 | /* |
| 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> |
| 26 | #include <linux/string.h> |
| 27 | #include <linux/phy/phy.h> |
| 28 | #include <linux/regulator/machine.h> |
| 29 | #include <linux/regulator/fixed.h> |
| 30 | |
| 31 | #include "soc.h" |
| 32 | #include "twl-common.h" |
| 33 | #include "pm.h" |
| 34 | #include "voltage.h" |
| 35 | #include "mux.h" |
| 36 | |
| 37 | static struct i2c_board_info __initdata pmic_i2c_board_info = { |
| 38 | .addr = 0x48, |
| 39 | .flags = I2C_CLIENT_WAKE, |
| 40 | }; |
| 41 | |
| 42 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) |
| 43 | static int twl_set_voltage(void *data, int target_uV) |
| 44 | { |
| 45 | struct voltagedomain *voltdm = (struct voltagedomain *)data; |
| 46 | return voltdm_scale(voltdm, target_uV); |
| 47 | } |
| 48 | |
| 49 | static int twl_get_voltage(void *data) |
| 50 | { |
| 51 | struct voltagedomain *voltdm = (struct voltagedomain *)data; |
| 52 | return voltdm_get_voltage(voltdm); |
| 53 | } |
| 54 | #endif |
| 55 | |
| 56 | void __init omap_pmic_init(int bus, u32 clkrate, |
| 57 | const char *pmic_type, int pmic_irq, |
| 58 | struct twl4030_platform_data *pmic_data) |
| 59 | { |
| 60 | omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); |
| 61 | strlcpy(pmic_i2c_board_info.type, pmic_type, |
| 62 | sizeof(pmic_i2c_board_info.type)); |
| 63 | pmic_i2c_board_info.irq = pmic_irq; |
| 64 | pmic_i2c_board_info.platform_data = pmic_data; |
| 65 | |
| 66 | omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); |
| 67 | } |
| 68 | |
| 69 | #ifdef CONFIG_ARCH_OMAP4 |
| 70 | void __init omap4_pmic_init(const char *pmic_type, |
| 71 | struct twl4030_platform_data *pmic_data, |
| 72 | struct i2c_board_info *devices, int nr_devices) |
| 73 | { |
| 74 | /* PMIC part*/ |
| 75 | unsigned int irq; |
| 76 | |
| 77 | omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); |
| 78 | omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT); |
| 79 | irq = omap4_xlate_irq(7 + OMAP44XX_IRQ_GIC_START); |
| 80 | omap_pmic_init(1, 400, pmic_type, irq, pmic_data); |
| 81 | |
| 82 | /* Register additional devices on i2c1 bus if needed */ |
| 83 | if (devices) |
| 84 | i2c_register_board_info(1, devices, nr_devices); |
| 85 | } |
| 86 | #endif |
| 87 | |
| 88 | void __init omap_pmic_late_init(void) |
| 89 | { |
| 90 | /* Init the OMAP TWL parameters (if PMIC has been registerd) */ |
| 91 | if (!pmic_i2c_board_info.irq) |
| 92 | return; |
| 93 | |
| 94 | omap3_twl_init(); |
| 95 | omap4_twl_init(); |
| 96 | } |
| 97 | |
| 98 | #if defined(CONFIG_ARCH_OMAP3) |
| 99 | static struct twl4030_usb_data omap3_usb_pdata = { |
| 100 | .usb_mode = T2_USB_MODE_ULPI, |
| 101 | }; |
| 102 | |
| 103 | static int omap3_batt_table[] = { |
| 104 | /* 0 C */ |
| 105 | 30800, 29500, 28300, 27100, |
| 106 | 26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900, |
| 107 | 17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100, |
| 108 | 11600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310, |
| 109 | 8020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830, |
| 110 | 5640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170, |
| 111 | 4040, 3910, 3790, 3670, 3550 |
| 112 | }; |
| 113 | |
| 114 | static struct twl4030_bci_platform_data omap3_bci_pdata = { |
| 115 | .battery_tmp_tbl = omap3_batt_table, |
| 116 | .tblsize = ARRAY_SIZE(omap3_batt_table), |
| 117 | }; |
| 118 | |
| 119 | static struct twl4030_madc_platform_data omap3_madc_pdata = { |
| 120 | .irq_line = 1, |
| 121 | }; |
| 122 | |
| 123 | static struct twl4030_codec_data omap3_codec; |
| 124 | |
| 125 | static struct twl4030_audio_data omap3_audio_pdata = { |
| 126 | .audio_mclk = 26000000, |
| 127 | .codec = &omap3_codec, |
| 128 | }; |
| 129 | |
| 130 | static struct regulator_consumer_supply omap3_vdda_dac_supplies[] = { |
| 131 | REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"), |
| 132 | }; |
| 133 | |
| 134 | static struct regulator_init_data omap3_vdac_idata = { |
| 135 | .constraints = { |
| 136 | .min_uV = 1800000, |
| 137 | .max_uV = 1800000, |
| 138 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 139 | | REGULATOR_MODE_STANDBY, |
| 140 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 141 | | REGULATOR_CHANGE_STATUS, |
| 142 | }, |
| 143 | .num_consumer_supplies = ARRAY_SIZE(omap3_vdda_dac_supplies), |
| 144 | .consumer_supplies = omap3_vdda_dac_supplies, |
| 145 | }; |
| 146 | |
| 147 | static struct regulator_consumer_supply omap3_vpll2_supplies[] = { |
| 148 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"), |
| 149 | REGULATOR_SUPPLY("vdds_dsi", "omapdss_dpi.0"), |
| 150 | REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"), |
| 151 | }; |
| 152 | |
| 153 | static struct regulator_init_data omap3_vpll2_idata = { |
| 154 | .constraints = { |
| 155 | .min_uV = 1800000, |
| 156 | .max_uV = 1800000, |
| 157 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 158 | | REGULATOR_MODE_STANDBY, |
| 159 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 160 | | REGULATOR_CHANGE_STATUS, |
| 161 | }, |
| 162 | .num_consumer_supplies = ARRAY_SIZE(omap3_vpll2_supplies), |
| 163 | .consumer_supplies = omap3_vpll2_supplies, |
| 164 | }; |
| 165 | |
| 166 | static struct regulator_consumer_supply omap3_vdd1_supply[] = { |
| 167 | REGULATOR_SUPPLY("vcc", "cpu0"), |
| 168 | }; |
| 169 | |
| 170 | static struct regulator_consumer_supply omap3_vdd2_supply[] = { |
| 171 | REGULATOR_SUPPLY("vcc", "l3_main.0"), |
| 172 | }; |
| 173 | |
| 174 | static struct regulator_init_data omap3_vdd1 = { |
| 175 | .constraints = { |
| 176 | .name = "vdd_mpu_iva", |
| 177 | .min_uV = 600000, |
| 178 | .max_uV = 1450000, |
| 179 | .valid_modes_mask = REGULATOR_MODE_NORMAL, |
| 180 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
| 181 | }, |
| 182 | .num_consumer_supplies = ARRAY_SIZE(omap3_vdd1_supply), |
| 183 | .consumer_supplies = omap3_vdd1_supply, |
| 184 | }; |
| 185 | |
| 186 | static struct regulator_init_data omap3_vdd2 = { |
| 187 | .constraints = { |
| 188 | .name = "vdd_core", |
| 189 | .min_uV = 600000, |
| 190 | .max_uV = 1450000, |
| 191 | .valid_modes_mask = REGULATOR_MODE_NORMAL, |
| 192 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
| 193 | }, |
| 194 | .num_consumer_supplies = ARRAY_SIZE(omap3_vdd2_supply), |
| 195 | .consumer_supplies = omap3_vdd2_supply, |
| 196 | }; |
| 197 | |
| 198 | static struct twl_regulator_driver_data omap3_vdd1_drvdata = { |
| 199 | .get_voltage = twl_get_voltage, |
| 200 | .set_voltage = twl_set_voltage, |
| 201 | }; |
| 202 | |
| 203 | static struct twl_regulator_driver_data omap3_vdd2_drvdata = { |
| 204 | .get_voltage = twl_get_voltage, |
| 205 | .set_voltage = twl_set_voltage, |
| 206 | }; |
| 207 | |
| 208 | void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, |
| 209 | u32 pdata_flags, u32 regulators_flags) |
| 210 | { |
| 211 | if (!pmic_data->vdd1) { |
| 212 | omap3_vdd1.driver_data = &omap3_vdd1_drvdata; |
| 213 | omap3_vdd1_drvdata.data = voltdm_lookup("mpu_iva"); |
| 214 | pmic_data->vdd1 = &omap3_vdd1; |
| 215 | } |
| 216 | if (!pmic_data->vdd2) { |
| 217 | omap3_vdd2.driver_data = &omap3_vdd2_drvdata; |
| 218 | omap3_vdd2_drvdata.data = voltdm_lookup("core"); |
| 219 | pmic_data->vdd2 = &omap3_vdd2; |
| 220 | } |
| 221 | |
| 222 | /* Common platform data configurations */ |
| 223 | if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb) |
| 224 | pmic_data->usb = &omap3_usb_pdata; |
| 225 | |
| 226 | if (pdata_flags & TWL_COMMON_PDATA_BCI && !pmic_data->bci) |
| 227 | pmic_data->bci = &omap3_bci_pdata; |
| 228 | |
| 229 | if (pdata_flags & TWL_COMMON_PDATA_MADC && !pmic_data->madc) |
| 230 | pmic_data->madc = &omap3_madc_pdata; |
| 231 | |
| 232 | if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->audio) |
| 233 | pmic_data->audio = &omap3_audio_pdata; |
| 234 | |
| 235 | /* Common regulator configurations */ |
| 236 | if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac) |
| 237 | pmic_data->vdac = &omap3_vdac_idata; |
| 238 | |
| 239 | if (regulators_flags & TWL_COMMON_REGULATOR_VPLL2 && !pmic_data->vpll2) |
| 240 | pmic_data->vpll2 = &omap3_vpll2_idata; |
| 241 | } |
| 242 | #endif /* CONFIG_ARCH_OMAP3 */ |
| 243 | |
| 244 | #if defined(CONFIG_ARCH_OMAP4) |
| 245 | static struct twl4030_usb_data omap4_usb_pdata = { |
| 246 | }; |
| 247 | |
| 248 | static struct regulator_consumer_supply omap4_vdda_hdmi_dac_supplies[] = { |
| 249 | REGULATOR_SUPPLY("vdda_hdmi_dac", "omapdss_hdmi"), |
| 250 | }; |
| 251 | |
| 252 | static struct regulator_init_data omap4_vdac_idata = { |
| 253 | .constraints = { |
| 254 | .min_uV = 1800000, |
| 255 | .max_uV = 1800000, |
| 256 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 257 | | REGULATOR_MODE_STANDBY, |
| 258 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 259 | | REGULATOR_CHANGE_STATUS, |
| 260 | }, |
| 261 | .num_consumer_supplies = ARRAY_SIZE(omap4_vdda_hdmi_dac_supplies), |
| 262 | .consumer_supplies = omap4_vdda_hdmi_dac_supplies, |
| 263 | .supply_regulator = "V2V1", |
| 264 | }; |
| 265 | |
| 266 | static struct regulator_init_data omap4_vaux2_idata = { |
| 267 | .constraints = { |
| 268 | .min_uV = 1200000, |
| 269 | .max_uV = 2800000, |
| 270 | .apply_uV = true, |
| 271 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 272 | | REGULATOR_MODE_STANDBY, |
| 273 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 274 | | REGULATOR_CHANGE_MODE |
| 275 | | REGULATOR_CHANGE_STATUS, |
| 276 | }, |
| 277 | }; |
| 278 | |
| 279 | static struct regulator_init_data omap4_vaux3_idata = { |
| 280 | .constraints = { |
| 281 | .min_uV = 1000000, |
| 282 | .max_uV = 3000000, |
| 283 | .apply_uV = true, |
| 284 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 285 | | REGULATOR_MODE_STANDBY, |
| 286 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 287 | | REGULATOR_CHANGE_MODE |
| 288 | | REGULATOR_CHANGE_STATUS, |
| 289 | }, |
| 290 | }; |
| 291 | |
| 292 | static struct regulator_consumer_supply omap4_vmmc_supply[] = { |
| 293 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), |
| 294 | }; |
| 295 | |
| 296 | /* VMMC1 for MMC1 card */ |
| 297 | static struct regulator_init_data omap4_vmmc_idata = { |
| 298 | .constraints = { |
| 299 | .min_uV = 1200000, |
| 300 | .max_uV = 3000000, |
| 301 | .apply_uV = true, |
| 302 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 303 | | REGULATOR_MODE_STANDBY, |
| 304 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 305 | | REGULATOR_CHANGE_MODE |
| 306 | | REGULATOR_CHANGE_STATUS, |
| 307 | }, |
| 308 | .num_consumer_supplies = ARRAY_SIZE(omap4_vmmc_supply), |
| 309 | .consumer_supplies = omap4_vmmc_supply, |
| 310 | }; |
| 311 | |
| 312 | static struct regulator_init_data omap4_vpp_idata = { |
| 313 | .constraints = { |
| 314 | .min_uV = 1800000, |
| 315 | .max_uV = 2500000, |
| 316 | .apply_uV = true, |
| 317 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 318 | | REGULATOR_MODE_STANDBY, |
| 319 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 320 | | REGULATOR_CHANGE_MODE |
| 321 | | REGULATOR_CHANGE_STATUS, |
| 322 | }, |
| 323 | }; |
| 324 | |
| 325 | static struct regulator_init_data omap4_vana_idata = { |
| 326 | .constraints = { |
| 327 | .min_uV = 2100000, |
| 328 | .max_uV = 2100000, |
| 329 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 330 | | REGULATOR_MODE_STANDBY, |
| 331 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 332 | | REGULATOR_CHANGE_STATUS, |
| 333 | }, |
| 334 | }; |
| 335 | |
| 336 | static struct regulator_consumer_supply omap4_vcxio_supply[] = { |
| 337 | REGULATOR_SUPPLY("vdds_dsi", "omapdss_dss"), |
| 338 | REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"), |
| 339 | REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.1"), |
| 340 | }; |
| 341 | |
| 342 | static struct regulator_init_data omap4_vcxio_idata = { |
| 343 | .constraints = { |
| 344 | .min_uV = 1800000, |
| 345 | .max_uV = 1800000, |
| 346 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 347 | | REGULATOR_MODE_STANDBY, |
| 348 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 349 | | REGULATOR_CHANGE_STATUS, |
| 350 | .always_on = true, |
| 351 | }, |
| 352 | .num_consumer_supplies = ARRAY_SIZE(omap4_vcxio_supply), |
| 353 | .consumer_supplies = omap4_vcxio_supply, |
| 354 | .supply_regulator = "V2V1", |
| 355 | }; |
| 356 | |
| 357 | static struct regulator_init_data omap4_vusb_idata = { |
| 358 | .constraints = { |
| 359 | .min_uV = 3300000, |
| 360 | .max_uV = 3300000, |
| 361 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 362 | | REGULATOR_MODE_STANDBY, |
| 363 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 364 | | REGULATOR_CHANGE_STATUS, |
| 365 | }, |
| 366 | }; |
| 367 | |
| 368 | static struct regulator_init_data omap4_clk32kg_idata = { |
| 369 | .constraints = { |
| 370 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 371 | }, |
| 372 | }; |
| 373 | |
| 374 | static struct regulator_consumer_supply omap4_vdd1_supply[] = { |
| 375 | REGULATOR_SUPPLY("vcc", "cpu0"), |
| 376 | }; |
| 377 | |
| 378 | static struct regulator_consumer_supply omap4_vdd2_supply[] = { |
| 379 | REGULATOR_SUPPLY("vcc", "iva.0"), |
| 380 | }; |
| 381 | |
| 382 | static struct regulator_consumer_supply omap4_vdd3_supply[] = { |
| 383 | REGULATOR_SUPPLY("vcc", "l3_main.0"), |
| 384 | }; |
| 385 | |
| 386 | static struct regulator_init_data omap4_vdd1 = { |
| 387 | .constraints = { |
| 388 | .name = "vdd_mpu", |
| 389 | .min_uV = 500000, |
| 390 | .max_uV = 1500000, |
| 391 | .valid_modes_mask = REGULATOR_MODE_NORMAL, |
| 392 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
| 393 | }, |
| 394 | .num_consumer_supplies = ARRAY_SIZE(omap4_vdd1_supply), |
| 395 | .consumer_supplies = omap4_vdd1_supply, |
| 396 | }; |
| 397 | |
| 398 | static struct regulator_init_data omap4_vdd2 = { |
| 399 | .constraints = { |
| 400 | .name = "vdd_iva", |
| 401 | .min_uV = 500000, |
| 402 | .max_uV = 1500000, |
| 403 | .valid_modes_mask = REGULATOR_MODE_NORMAL, |
| 404 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
| 405 | }, |
| 406 | .num_consumer_supplies = ARRAY_SIZE(omap4_vdd2_supply), |
| 407 | .consumer_supplies = omap4_vdd2_supply, |
| 408 | }; |
| 409 | |
| 410 | static struct regulator_init_data omap4_vdd3 = { |
| 411 | .constraints = { |
| 412 | .name = "vdd_core", |
| 413 | .min_uV = 500000, |
| 414 | .max_uV = 1500000, |
| 415 | .valid_modes_mask = REGULATOR_MODE_NORMAL, |
| 416 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
| 417 | }, |
| 418 | .num_consumer_supplies = ARRAY_SIZE(omap4_vdd3_supply), |
| 419 | .consumer_supplies = omap4_vdd3_supply, |
| 420 | }; |
| 421 | |
| 422 | |
| 423 | static struct twl_regulator_driver_data omap4_vdd1_drvdata = { |
| 424 | .get_voltage = twl_get_voltage, |
| 425 | .set_voltage = twl_set_voltage, |
| 426 | }; |
| 427 | |
| 428 | static struct twl_regulator_driver_data omap4_vdd2_drvdata = { |
| 429 | .get_voltage = twl_get_voltage, |
| 430 | .set_voltage = twl_set_voltage, |
| 431 | }; |
| 432 | |
| 433 | static struct twl_regulator_driver_data omap4_vdd3_drvdata = { |
| 434 | .get_voltage = twl_get_voltage, |
| 435 | .set_voltage = twl_set_voltage, |
| 436 | }; |
| 437 | |
| 438 | static struct regulator_consumer_supply omap4_v1v8_supply[] = { |
| 439 | REGULATOR_SUPPLY("vio", "1-004b"), |
| 440 | }; |
| 441 | |
| 442 | static struct regulator_init_data omap4_v1v8_idata = { |
| 443 | .constraints = { |
| 444 | .min_uV = 1800000, |
| 445 | .max_uV = 1800000, |
| 446 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 447 | | REGULATOR_MODE_STANDBY, |
| 448 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 449 | | REGULATOR_CHANGE_STATUS, |
| 450 | .always_on = true, |
| 451 | }, |
| 452 | .num_consumer_supplies = ARRAY_SIZE(omap4_v1v8_supply), |
| 453 | .consumer_supplies = omap4_v1v8_supply, |
| 454 | }; |
| 455 | |
| 456 | static struct regulator_consumer_supply omap4_v2v1_supply[] = { |
| 457 | REGULATOR_SUPPLY("v2v1", "1-004b"), |
| 458 | }; |
| 459 | |
| 460 | static struct regulator_init_data omap4_v2v1_idata = { |
| 461 | .constraints = { |
| 462 | .min_uV = 2100000, |
| 463 | .max_uV = 2100000, |
| 464 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 465 | | REGULATOR_MODE_STANDBY, |
| 466 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 467 | | REGULATOR_CHANGE_STATUS, |
| 468 | }, |
| 469 | .num_consumer_supplies = ARRAY_SIZE(omap4_v2v1_supply), |
| 470 | .consumer_supplies = omap4_v2v1_supply, |
| 471 | }; |
| 472 | |
| 473 | void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data, |
| 474 | u32 pdata_flags, u32 regulators_flags) |
| 475 | { |
| 476 | if (!pmic_data->vdd1) { |
| 477 | omap4_vdd1.driver_data = &omap4_vdd1_drvdata; |
| 478 | omap4_vdd1_drvdata.data = voltdm_lookup("mpu"); |
| 479 | pmic_data->vdd1 = &omap4_vdd1; |
| 480 | } |
| 481 | |
| 482 | if (!pmic_data->vdd2) { |
| 483 | omap4_vdd2.driver_data = &omap4_vdd2_drvdata; |
| 484 | omap4_vdd2_drvdata.data = voltdm_lookup("iva"); |
| 485 | pmic_data->vdd2 = &omap4_vdd2; |
| 486 | } |
| 487 | |
| 488 | if (!pmic_data->vdd3) { |
| 489 | omap4_vdd3.driver_data = &omap4_vdd3_drvdata; |
| 490 | omap4_vdd3_drvdata.data = voltdm_lookup("core"); |
| 491 | pmic_data->vdd3 = &omap4_vdd3; |
| 492 | } |
| 493 | |
| 494 | /* Common platform data configurations */ |
| 495 | if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb) |
| 496 | pmic_data->usb = &omap4_usb_pdata; |
| 497 | |
| 498 | /* Common regulator configurations */ |
| 499 | if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac) |
| 500 | pmic_data->vdac = &omap4_vdac_idata; |
| 501 | |
| 502 | if (regulators_flags & TWL_COMMON_REGULATOR_VAUX2 && !pmic_data->vaux2) |
| 503 | pmic_data->vaux2 = &omap4_vaux2_idata; |
| 504 | |
| 505 | if (regulators_flags & TWL_COMMON_REGULATOR_VAUX3 && !pmic_data->vaux3) |
| 506 | pmic_data->vaux3 = &omap4_vaux3_idata; |
| 507 | |
| 508 | if (regulators_flags & TWL_COMMON_REGULATOR_VMMC && !pmic_data->vmmc) |
| 509 | pmic_data->vmmc = &omap4_vmmc_idata; |
| 510 | |
| 511 | if (regulators_flags & TWL_COMMON_REGULATOR_VPP && !pmic_data->vpp) |
| 512 | pmic_data->vpp = &omap4_vpp_idata; |
| 513 | |
| 514 | if (regulators_flags & TWL_COMMON_REGULATOR_VANA && !pmic_data->vana) |
| 515 | pmic_data->vana = &omap4_vana_idata; |
| 516 | |
| 517 | if (regulators_flags & TWL_COMMON_REGULATOR_VCXIO && !pmic_data->vcxio) |
| 518 | pmic_data->vcxio = &omap4_vcxio_idata; |
| 519 | |
| 520 | if (regulators_flags & TWL_COMMON_REGULATOR_VUSB && !pmic_data->vusb) |
| 521 | pmic_data->vusb = &omap4_vusb_idata; |
| 522 | |
| 523 | if (regulators_flags & TWL_COMMON_REGULATOR_CLK32KG && |
| 524 | !pmic_data->clk32kg) |
| 525 | pmic_data->clk32kg = &omap4_clk32kg_idata; |
| 526 | |
| 527 | if (regulators_flags & TWL_COMMON_REGULATOR_V1V8 && !pmic_data->v1v8) |
| 528 | pmic_data->v1v8 = &omap4_v1v8_idata; |
| 529 | |
| 530 | if (regulators_flags & TWL_COMMON_REGULATOR_V2V1 && !pmic_data->v2v1) |
| 531 | pmic_data->v2v1 = &omap4_v2v1_idata; |
| 532 | } |
| 533 | #endif /* CONFIG_ARCH_OMAP4 */ |
| 534 | |
| 535 | #if defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030) || \ |
| 536 | defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030_MODULE) |
| 537 | #include <linux/platform_data/omap-twl4030.h> |
| 538 | |
| 539 | /* Commonly used configuration */ |
| 540 | static struct omap_tw4030_pdata omap_twl4030_audio_data; |
| 541 | |
| 542 | static struct platform_device audio_device = { |
| 543 | .name = "omap-twl4030", |
| 544 | .id = -1, |
| 545 | }; |
| 546 | |
| 547 | void omap_twl4030_audio_init(char *card_name, |
| 548 | struct omap_tw4030_pdata *pdata) |
| 549 | { |
| 550 | if (!pdata) |
| 551 | pdata = &omap_twl4030_audio_data; |
| 552 | |
| 553 | pdata->card_name = card_name; |
| 554 | |
| 555 | audio_device.dev.platform_data = pdata; |
| 556 | platform_device_register(&audio_device); |
| 557 | } |
| 558 | |
| 559 | #else /* SOC_OMAP_TWL4030 */ |
| 560 | void omap_twl4030_audio_init(char *card_name, |
| 561 | struct omap_tw4030_pdata *pdata) |
| 562 | { |
| 563 | return; |
| 564 | } |
| 565 | #endif /* SOC_OMAP_TWL4030 */ |