aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/sdp3430.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/sdp3430.c')
-rw-r--r--sound/soc/omap/sdp3430.c56
1 files changed, 23 insertions, 33 deletions
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index 3c85c0f92823..76ce77b91844 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -36,9 +36,11 @@
36#include <mach/gpio.h> 36#include <mach/gpio.h>
37#include <plat/mcbsp.h> 37#include <plat/mcbsp.h>
38 38
39/* Register descriptions for twl4030 codec part */
40#include <linux/mfd/twl4030-codec.h>
41
39#include "omap-mcbsp.h" 42#include "omap-mcbsp.h"
40#include "omap-pcm.h" 43#include "omap-pcm.h"
41#include "../codecs/twl4030.h"
42 44
43/* TWL4030 PMBR1 Register */ 45/* TWL4030 PMBR1 Register */
44#define TWL4030_INTBR_PMBR1 0x0D 46#define TWL4030_INTBR_PMBR1 0x0D
@@ -51,8 +53,8 @@ static int sdp3430_hw_params(struct snd_pcm_substream *substream,
51 struct snd_pcm_hw_params *params) 53 struct snd_pcm_hw_params *params)
52{ 54{
53 struct snd_soc_pcm_runtime *rtd = substream->private_data; 55 struct snd_soc_pcm_runtime *rtd = substream->private_data;
54 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 56 struct snd_soc_dai *codec_dai = rtd->codec_dai;
55 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 57 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
56 int ret; 58 int ret;
57 59
58 /* Set codec DAI configuration */ 60 /* Set codec DAI configuration */
@@ -94,8 +96,8 @@ static int sdp3430_hw_voice_params(struct snd_pcm_substream *substream,
94 struct snd_pcm_hw_params *params) 96 struct snd_pcm_hw_params *params)
95{ 97{
96 struct snd_soc_pcm_runtime *rtd = substream->private_data; 98 struct snd_soc_pcm_runtime *rtd = substream->private_data;
97 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 99 struct snd_soc_dai *codec_dai = rtd->codec_dai;
98 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 100 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
99 int ret; 101 int ret;
100 102
101 /* Set codec DAI configuration */ 103 /* Set codec DAI configuration */
@@ -186,8 +188,9 @@ static const struct snd_soc_dapm_route audio_map[] = {
186 {"Headset Stereophone", NULL, "HSOR"}, 188 {"Headset Stereophone", NULL, "HSOR"},
187}; 189};
188 190
189static int sdp3430_twl4030_init(struct snd_soc_codec *codec) 191static int sdp3430_twl4030_init(struct snd_soc_pcm_runtime *rtd)
190{ 192{
193 struct snd_soc_codec *codec = rtd->codec;
191 int ret; 194 int ret;
192 195
193 /* Add SDP3430 specific widgets */ 196 /* Add SDP3430 specific widgets */
@@ -225,7 +228,7 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec)
225 return ret; 228 return ret;
226 229
227 /* Headset jack detection */ 230 /* Headset jack detection */
228 ret = snd_soc_jack_new(&snd_soc_sdp3430, "Headset Jack", 231 ret = snd_soc_jack_new(codec, "Headset Jack",
229 SND_JACK_HEADSET, &hs_jack); 232 SND_JACK_HEADSET, &hs_jack);
230 if (ret) 233 if (ret)
231 return ret; 234 return ret;
@@ -241,14 +244,15 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec)
241 return ret; 244 return ret;
242} 245}
243 246
244static int sdp3430_twl4030_voice_init(struct snd_soc_codec *codec) 247static int sdp3430_twl4030_voice_init(struct snd_soc_pcm_runtime *rtd)
245{ 248{
249 struct snd_soc_codec *codec = rtd->codec;
246 unsigned short reg; 250 unsigned short reg;
247 251
248 /* Enable voice interface */ 252 /* Enable voice interface */
249 reg = codec->read(codec, TWL4030_REG_VOICE_IF); 253 reg = codec->driver->read(codec, TWL4030_REG_VOICE_IF);
250 reg |= TWL4030_VIF_DIN_EN | TWL4030_VIF_DOUT_EN | TWL4030_VIF_EN; 254 reg |= TWL4030_VIF_DIN_EN | TWL4030_VIF_DOUT_EN | TWL4030_VIF_EN;
251 codec->write(codec, TWL4030_REG_VOICE_IF, reg); 255 codec->driver->write(codec, TWL4030_REG_VOICE_IF, reg);
252 256
253 return 0; 257 return 0;
254} 258}
@@ -259,16 +263,20 @@ static struct snd_soc_dai_link sdp3430_dai[] = {
259 { 263 {
260 .name = "TWL4030 I2S", 264 .name = "TWL4030 I2S",
261 .stream_name = "TWL4030 Audio", 265 .stream_name = "TWL4030 Audio",
262 .cpu_dai = &omap_mcbsp_dai[0], 266 .cpu_dai_name = "omap-mcbsp-dai.1",
263 .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], 267 .codec_dai_name = "twl4030-hifi",
268 .platform_name = "omap-pcm-audio",
269 .codec_name = "twl4030-codec",
264 .init = sdp3430_twl4030_init, 270 .init = sdp3430_twl4030_init,
265 .ops = &sdp3430_ops, 271 .ops = &sdp3430_ops,
266 }, 272 },
267 { 273 {
268 .name = "TWL4030 PCM", 274 .name = "TWL4030 PCM",
269 .stream_name = "TWL4030 Voice", 275 .stream_name = "TWL4030 Voice",
270 .cpu_dai = &omap_mcbsp_dai[1], 276 .cpu_dai_name = "omap-mcbsp-dai.2",
271 .codec_dai = &twl4030_dai[TWL4030_DAI_VOICE], 277 .codec_dai_name = "twl4030-voice",
278 .platform_name = "omap-pcm-audio",
279 .codec_name = "twl4030-codec",
272 .init = sdp3430_twl4030_voice_init, 280 .init = sdp3430_twl4030_voice_init,
273 .ops = &sdp3430_voice_ops, 281 .ops = &sdp3430_voice_ops,
274 }, 282 },
@@ -277,25 +285,10 @@ static struct snd_soc_dai_link sdp3430_dai[] = {
277/* Audio machine driver */ 285/* Audio machine driver */
278static struct snd_soc_card snd_soc_sdp3430 = { 286static struct snd_soc_card snd_soc_sdp3430 = {
279 .name = "SDP3430", 287 .name = "SDP3430",
280 .platform = &omap_soc_platform,
281 .dai_link = sdp3430_dai, 288 .dai_link = sdp3430_dai,
282 .num_links = ARRAY_SIZE(sdp3430_dai), 289 .num_links = ARRAY_SIZE(sdp3430_dai),
283}; 290};
284 291
285/* twl4030 setup */
286static struct twl4030_setup_data twl4030_setup = {
287 .ramp_delay_value = 3,
288 .sysclk = 26000,
289 .hs_extmute = 1,
290};
291
292/* Audio subsystem */
293static struct snd_soc_device sdp3430_snd_devdata = {
294 .card = &snd_soc_sdp3430,
295 .codec_dev = &soc_codec_dev_twl4030,
296 .codec_data = &twl4030_setup,
297};
298
299static struct platform_device *sdp3430_snd_device; 292static struct platform_device *sdp3430_snd_device;
300 293
301static int __init sdp3430_soc_init(void) 294static int __init sdp3430_soc_init(void)
@@ -315,10 +308,7 @@ static int __init sdp3430_soc_init(void)
315 return -ENOMEM; 308 return -ENOMEM;
316 } 309 }
317 310
318 platform_set_drvdata(sdp3430_snd_device, &sdp3430_snd_devdata); 311 platform_set_drvdata(sdp3430_snd_device, &snd_soc_sdp3430);
319 sdp3430_snd_devdata.dev = &sdp3430_snd_device->dev;
320 *(unsigned int *)sdp3430_dai[0].cpu_dai->private_data = 1; /* McBSP2 */
321 *(unsigned int *)sdp3430_dai[1].cpu_dai->private_data = 2; /* McBSP3 */
322 312
323 /* Set TWL4030 GPIO6 as EXTMUTE signal */ 313 /* Set TWL4030 GPIO6 as EXTMUTE signal */
324 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &pin_mux, 314 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &pin_mux,