ASoC: SDP3430: Connect twl4030 voice DAI to McBSP3

Connect twl4030 voice DAI to McBSP3 in sdp3430 machine driver.
Voice DAI init function enables corresponding interface by
writting directly to VOICE_IF codec register.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Acked-by: Peter Ujflausi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Lopez Cruz, Misael 2009-05-18 11:53:04 -05:00 committed by Mark Brown
parent b74bd40fa4
commit 11a7281106
1 changed files with 77 additions and 10 deletions

View File

@ -84,6 +84,49 @@ static struct snd_soc_ops sdp3430_ops = {
.hw_params = sdp3430_hw_params, .hw_params = sdp3430_hw_params,
}; };
static int sdp3430_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;
int ret;
/* Set codec DAI configuration */
ret = snd_soc_dai_set_fmt(codec_dai,
SND_SOC_DAIFMT_DSP_A |
SND_SOC_DAIFMT_IB_NF |
SND_SOC_DAIFMT_CBS_CFM);
if (ret) {
printk(KERN_ERR "can't set codec DAI configuration\n");
return ret;
}
/* Set cpu DAI configuration */
ret = snd_soc_dai_set_fmt(cpu_dai,
SND_SOC_DAIFMT_DSP_A |
SND_SOC_DAIFMT_IB_NF |
SND_SOC_DAIFMT_CBM_CFM);
if (ret < 0) {
printk(KERN_ERR "can't set cpu DAI configuration\n");
return ret;
}
/* Set the codec system clock for DAC and ADC */
ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
SND_SOC_CLOCK_IN);
if (ret < 0) {
printk(KERN_ERR "can't set codec system clock\n");
return ret;
}
return 0;
}
static struct snd_soc_ops sdp3430_voice_ops = {
.hw_params = sdp3430_hw_voice_params,
};
/* Headset jack */ /* Headset jack */
static struct snd_soc_jack hs_jack; static struct snd_soc_jack hs_jack;
@ -192,22 +235,45 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec)
return ret; return ret;
} }
static int sdp3430_twl4030_voice_init(struct snd_soc_codec *codec)
{
unsigned short reg;
/* Enable voice interface */
reg = codec->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);
return 0;
}
/* Digital audio interface glue - connects codec <--> CPU */ /* Digital audio interface glue - connects codec <--> CPU */
static struct snd_soc_dai_link sdp3430_dai = { static struct snd_soc_dai_link sdp3430_dai[] = {
.name = "TWL4030", {
.stream_name = "TWL4030", .name = "TWL4030 I2S",
.cpu_dai = &omap_mcbsp_dai[0], .stream_name = "TWL4030 Audio",
.codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], .cpu_dai = &omap_mcbsp_dai[0],
.init = sdp3430_twl4030_init, .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI],
.ops = &sdp3430_ops, .init = sdp3430_twl4030_init,
.ops = &sdp3430_ops,
},
{
.name = "TWL4030 PCM",
.stream_name = "TWL4030 Voice",
.cpu_dai = &omap_mcbsp_dai[1],
.codec_dai = &twl4030_dai[TWL4030_DAI_VOICE],
.init = sdp3430_twl4030_voice_init,
.ops = &sdp3430_voice_ops,
},
}; };
/* Audio machine driver */ /* Audio machine driver */
static struct snd_soc_card snd_soc_sdp3430 = { static struct snd_soc_card snd_soc_sdp3430 = {
.name = "SDP3430", .name = "SDP3430",
.platform = &omap_soc_platform, .platform = &omap_soc_platform,
.dai_link = &sdp3430_dai, .dai_link = sdp3430_dai,
.num_links = 1, .num_links = ARRAY_SIZE(sdp3430_dai),
}; };
/* Audio subsystem */ /* Audio subsystem */
@ -236,7 +302,8 @@ static int __init sdp3430_soc_init(void)
platform_set_drvdata(sdp3430_snd_device, &sdp3430_snd_devdata); platform_set_drvdata(sdp3430_snd_device, &sdp3430_snd_devdata);
sdp3430_snd_devdata.dev = &sdp3430_snd_device->dev; sdp3430_snd_devdata.dev = &sdp3430_snd_device->dev;
*(unsigned int *)sdp3430_dai.cpu_dai->private_data = 1; /* McBSP2 */ *(unsigned int *)sdp3430_dai[0].cpu_dai->private_data = 1; /* McBSP2 */
*(unsigned int *)sdp3430_dai[1].cpu_dai->private_data = 2; /* McBSP3 */
ret = platform_device_add(sdp3430_snd_device); ret = platform_device_add(sdp3430_snd_device);
if (ret) if (ret)