diff options
Diffstat (limited to 'sound/soc/omap/zoom2.c')
-rw-r--r-- | sound/soc/omap/zoom2.c | 64 |
1 files changed, 23 insertions, 41 deletions
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c index 50a94ee7..338dc95 100644 --- a/sound/soc/omap/zoom2.c +++ b/sound/soc/omap/zoom2.c @@ -29,21 +29,23 @@ #include <asm/mach-types.h> #include <mach/hardware.h> #include <mach/gpio.h> +#include <mach/board-zoom.h> #include <plat/mcbsp.h> +/* Register descriptions for twl4030 codec part */ +#include <linux/mfd/twl4030-codec.h> + #include "omap-mcbsp.h" #include "omap-pcm.h" -#include "../codecs/twl4030.h" #define ZOOM2_HEADSET_MUX_GPIO (OMAP_MAX_GPIO_LINES + 15) -#define ZOOM2_HEADSET_EXTMUTE_GPIO 153 static int zoom2_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; - struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; int ret; /* Set codec DAI configuration */ @@ -85,8 +87,8 @@ static int zoom2_hw_voice_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; - struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; int ret; /* Set codec DAI configuration */ @@ -157,8 +159,9 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Aux In", NULL, "AUXR"}, }; -static int zoom2_twl4030_init(struct snd_soc_codec *codec) +static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd) { + struct snd_soc_codec *codec = rtd->codec; int ret; /* Add Zoom2 specific widgets */ @@ -192,14 +195,15 @@ static int zoom2_twl4030_init(struct snd_soc_codec *codec) return ret; } -static int zoom2_twl4030_voice_init(struct snd_soc_codec *codec) +static int zoom2_twl4030_voice_init(struct snd_soc_pcm_runtime *rtd) { + struct snd_soc_codec *codec = rtd->codec; unsigned short reg; /* Enable voice interface */ - reg = codec->read(codec, TWL4030_REG_VOICE_IF); + reg = codec->driver->read(codec, TWL4030_REG_VOICE_IF); reg |= TWL4030_VIF_DIN_EN | TWL4030_VIF_DOUT_EN | TWL4030_VIF_EN; - codec->write(codec, TWL4030_REG_VOICE_IF, reg); + codec->driver->write(codec, TWL4030_REG_VOICE_IF, reg); return 0; } @@ -209,16 +213,20 @@ static struct snd_soc_dai_link zoom2_dai[] = { { .name = "TWL4030 I2S", .stream_name = "TWL4030 Audio", - .cpu_dai = &omap_mcbsp_dai[0], - .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], + .cpu_dai_name = "omap-mcbsp-dai.1", + .codec_dai_name = "twl4030-hifi", + .platform_name = "omap-pcm-audio", + .codec_name = "twl4030-codec", .init = zoom2_twl4030_init, .ops = &zoom2_ops, }, { .name = "TWL4030 PCM", .stream_name = "TWL4030 Voice", - .cpu_dai = &omap_mcbsp_dai[1], - .codec_dai = &twl4030_dai[TWL4030_DAI_VOICE], + .cpu_dai_name = "omap-mcbsp-dai.2", + .codec_dai_name = "twl4030-voice", + .platform_name = "omap-pcm-audio", + .codec_name = "twl4030-codec", .init = zoom2_twl4030_voice_init, .ops = &zoom2_voice_ops, }, @@ -227,32 +235,10 @@ static struct snd_soc_dai_link zoom2_dai[] = { /* Audio machine driver */ static struct snd_soc_card snd_soc_zoom2 = { .name = "Zoom2", - .platform = &omap_soc_platform, .dai_link = zoom2_dai, .num_links = ARRAY_SIZE(zoom2_dai), }; -/* EXTMUTE callback function */ -void zoom2_set_hs_extmute(int mute) -{ - gpio_set_value(ZOOM2_HEADSET_EXTMUTE_GPIO, mute); -} - -/* twl4030 setup */ -static struct twl4030_setup_data twl4030_setup = { - .ramp_delay_value = 3, /* 161 ms */ - .sysclk = 26000, - .hs_extmute = 1, - .set_hs_extmute = zoom2_set_hs_extmute, -}; - -/* Audio subsystem */ -static struct snd_soc_device zoom2_snd_devdata = { - .card = &snd_soc_zoom2, - .codec_dev = &soc_codec_dev_twl4030, - .codec_data = &twl4030_setup, -}; - static struct platform_device *zoom2_snd_device; static int __init zoom2_soc_init(void) @@ -271,11 +257,7 @@ static int __init zoom2_soc_init(void) return -ENOMEM; } - platform_set_drvdata(zoom2_snd_device, &zoom2_snd_devdata); - zoom2_snd_devdata.dev = &zoom2_snd_device->dev; - *(unsigned int *)zoom2_dai[0].cpu_dai->private_data = 1; /* McBSP2 */ - *(unsigned int *)zoom2_dai[1].cpu_dai->private_data = 2; /* McBSP3 */ - + platform_set_drvdata(zoom2_snd_device, &snd_soc_zoom2); ret = platform_device_add(zoom2_snd_device); if (ret) goto err1; |