OMAP4: PMIC: Add support for twl6030 codec

In order to have TWL6030 CODEC driver as a platform driver, codec data
should be passed through twl_platform_data structure.

For twl6030 audio codec, the following data may be passed:
- audpwron_gpio: gpio line used to power-up/down the codec. A low-to-high
transition powers codec up. Setting audpwron_gpio to a negative value
means that codec will use manual power sequence instead of automatic
sequence
- naudint_irq: irq line for audio interrupt. twl6030 drives NAUDINT line
to low when an interrupt (codec ready, plug insertion/removal, etc) is
detected

However, codec driver can operate if any or none of them are passed.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Signed-off-by: Margarita Olaya Cabrera <magi.olaya@ti.com>
Signed-off-by: Jorge Eduardo Candelaria <jorge.candelaria@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

authored by Misael Lopez Cruz and committed by Mark Brown d62abe56 47fc9a0a

+19 -3
+15 -3
drivers/mfd/twl-core.c
··· 115 115 #define twl_has_watchdog() false 116 116 #endif 117 117 118 - #if defined(CONFIG_TWL4030_CODEC) || defined(CONFIG_TWL4030_CODEC_MODULE) 118 + #if defined(CONFIG_TWL4030_CODEC) || defined(CONFIG_TWL4030_CODEC_MODULE) ||\ 119 + defined(CONFIG_SND_SOC_TWL6030) || defined(CONFIG_SND_SOC_TWL6030_MODULE) 119 120 #define twl_has_codec() true 120 121 #else 121 122 #define twl_has_codec() false ··· 712 711 return PTR_ERR(child); 713 712 } 714 713 715 - if (twl_has_codec() && pdata->codec) { 716 - child = add_child(1, "twl4030_codec", 714 + if (twl_has_codec() && pdata->codec && twl_class_is_4030()) { 715 + sub_chip_id = twl_map[TWL_MODULE_AUDIO_VOICE].sid; 716 + child = add_child(sub_chip_id, "twl4030_codec", 717 + pdata->codec, sizeof(*pdata->codec), 718 + false, 0, 0); 719 + if (IS_ERR(child)) 720 + return PTR_ERR(child); 721 + } 722 + 723 + /* Phoenix*/ 724 + if (twl_has_codec() && pdata->codec && twl_class_is_6030()) { 725 + sub_chip_id = twl_map[TWL_MODULE_AUDIO_VOICE].sid; 726 + child = add_child(sub_chip_id, "twl6030_codec", 717 727 pdata->codec, sizeof(*pdata->codec), 718 728 false, 0, 0); 719 729 if (IS_ERR(child))
+4
include/linux/i2c/twl.h
··· 547 547 unsigned int audio_mclk; 548 548 struct twl4030_codec_audio_data *audio; 549 549 struct twl4030_codec_vibra_data *vibra; 550 + 551 + /* twl6030 */ 552 + int audpwron_gpio; /* audio power-on gpio */ 553 + int naudint_irq; /* audio interrupt */ 550 554 }; 551 555 552 556 struct twl4030_platform_data {