aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/sdp3430.c
diff options
context:
space:
mode:
authorLopez Cruz, Misael <x0052729@ti.com>2009-05-18 12:53:04 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-05-19 05:35:11 -0400
commit11a728110633320d95935a1ba79c038db303596f (patch)
tree8b2d2f43773698c8e3a9ee037111921355e6fb8b /sound/soc/omap/sdp3430.c
parentb74bd40fa4ae018898c8a6429c2a7daf61516524 (diff)
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>
Diffstat (limited to 'sound/soc/omap/sdp3430.c')
-rw-r--r--sound/soc/omap/sdp3430.c87
1 files changed, 77 insertions, 10 deletions
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index 1c7974101a0b..19966a7c518e 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -84,6 +84,49 @@ static struct snd_soc_ops sdp3430_ops = {
84 .hw_params = sdp3430_hw_params, 84 .hw_params = sdp3430_hw_params,
85}; 85};
86 86
87static int sdp3430_hw_voice_params(struct snd_pcm_substream *substream,
88 struct snd_pcm_hw_params *params)
89{
90 struct snd_soc_pcm_runtime *rtd = substream->private_data;
91 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
92 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
93 int ret;
94
95 /* Set codec DAI configuration */
96 ret = snd_soc_dai_set_fmt(codec_dai,
97 SND_SOC_DAIFMT_DSP_A |
98 SND_SOC_DAIFMT_IB_NF |
99 SND_SOC_DAIFMT_CBS_CFM);
100 if (ret) {
101 printk(KERN_ERR "can't set codec DAI configuration\n");
102 return ret;
103 }
104
105 /* Set cpu DAI configuration */
106 ret = snd_soc_dai_set_fmt(cpu_dai,
107 SND_SOC_DAIFMT_DSP_A |
108 SND_SOC_DAIFMT_IB_NF |
109 SND_SOC_DAIFMT_CBM_CFM);
110 if (ret < 0) {
111 printk(KERN_ERR "can't set cpu DAI configuration\n");
112 return ret;
113 }
114
115 /* Set the codec system clock for DAC and ADC */
116 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
117 SND_SOC_CLOCK_IN);
118 if (ret < 0) {
119 printk(KERN_ERR "can't set codec system clock\n");
120 return ret;
121 }
122
123 return 0;
124}
125
126static struct snd_soc_ops sdp3430_voice_ops = {
127 .hw_params = sdp3430_hw_voice_params,
128};
129
87/* Headset jack */ 130/* Headset jack */
88static struct snd_soc_jack hs_jack; 131static struct snd_soc_jack hs_jack;
89 132
@@ -192,22 +235,45 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec)
192 return ret; 235 return ret;
193} 236}
194 237
238static int sdp3430_twl4030_voice_init(struct snd_soc_codec *codec)
239{
240 unsigned short reg;
241
242 /* Enable voice interface */
243 reg = codec->read(codec, TWL4030_REG_VOICE_IF);
244 reg |= TWL4030_VIF_DIN_EN | TWL4030_VIF_DOUT_EN | TWL4030_VIF_EN;
245 codec->write(codec, TWL4030_REG_VOICE_IF, reg);
246
247 return 0;
248}
249
250
195/* Digital audio interface glue - connects codec <--> CPU */ 251/* Digital audio interface glue - connects codec <--> CPU */
196static struct snd_soc_dai_link sdp3430_dai = { 252static struct snd_soc_dai_link sdp3430_dai[] = {
197 .name = "TWL4030", 253 {
198 .stream_name = "TWL4030", 254 .name = "TWL4030 I2S",
199 .cpu_dai = &omap_mcbsp_dai[0], 255 .stream_name = "TWL4030 Audio",
200 .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], 256 .cpu_dai = &omap_mcbsp_dai[0],
201 .init = sdp3430_twl4030_init, 257 .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI],
202 .ops = &sdp3430_ops, 258 .init = sdp3430_twl4030_init,
259 .ops = &sdp3430_ops,
260 },
261 {
262 .name = "TWL4030 PCM",
263 .stream_name = "TWL4030 Voice",
264 .cpu_dai = &omap_mcbsp_dai[1],
265 .codec_dai = &twl4030_dai[TWL4030_DAI_VOICE],
266 .init = sdp3430_twl4030_voice_init,
267 .ops = &sdp3430_voice_ops,
268 },
203}; 269};
204 270
205/* Audio machine driver */ 271/* Audio machine driver */
206static struct snd_soc_card snd_soc_sdp3430 = { 272static struct snd_soc_card snd_soc_sdp3430 = {
207 .name = "SDP3430", 273 .name = "SDP3430",
208 .platform = &omap_soc_platform, 274 .platform = &omap_soc_platform,
209 .dai_link = &sdp3430_dai, 275 .dai_link = sdp3430_dai,
210 .num_links = 1, 276 .num_links = ARRAY_SIZE(sdp3430_dai),
211}; 277};
212 278
213/* Audio subsystem */ 279/* Audio subsystem */
@@ -236,7 +302,8 @@ static int __init sdp3430_soc_init(void)
236 302
237 platform_set_drvdata(sdp3430_snd_device, &sdp3430_snd_devdata); 303 platform_set_drvdata(sdp3430_snd_device, &sdp3430_snd_devdata);
238 sdp3430_snd_devdata.dev = &sdp3430_snd_device->dev; 304 sdp3430_snd_devdata.dev = &sdp3430_snd_device->dev;
239 *(unsigned int *)sdp3430_dai.cpu_dai->private_data = 1; /* McBSP2 */ 305 *(unsigned int *)sdp3430_dai[0].cpu_dai->private_data = 1; /* McBSP2 */
306 *(unsigned int *)sdp3430_dai[1].cpu_dai->private_data = 2; /* McBSP3 */
240 307
241 ret = platform_device_add(sdp3430_snd_device); 308 ret = platform_device_add(sdp3430_snd_device);
242 if (ret) 309 if (ret)