twl-common.c 16 KB

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