aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/s3c24xx/s3c2443-ac97.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/s3c24xx/s3c2443-ac97.c')
-rw-r--r--sound/soc/s3c24xx/s3c2443-ac97.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sound/soc/s3c24xx/s3c2443-ac97.c b/sound/soc/s3c24xx/s3c2443-ac97.c
index 3f03d5ddfacd..fc1beb0930b9 100644
--- a/sound/soc/s3c24xx/s3c2443-ac97.c
+++ b/sound/soc/s3c24xx/s3c2443-ac97.c
@@ -47,7 +47,7 @@ static struct s3c24xx_ac97_info s3c24xx_ac97;
47 47
48static DECLARE_COMPLETION(ac97_completion); 48static DECLARE_COMPLETION(ac97_completion);
49static u32 codec_ready; 49static u32 codec_ready;
50static DECLARE_MUTEX(ac97_mutex); 50static DEFINE_MUTEX(ac97_mutex);
51 51
52static unsigned short s3c2443_ac97_read(struct snd_ac97 *ac97, 52static unsigned short s3c2443_ac97_read(struct snd_ac97 *ac97,
53 unsigned short reg) 53 unsigned short reg)
@@ -56,7 +56,7 @@ static unsigned short s3c2443_ac97_read(struct snd_ac97 *ac97,
56 u32 ac_codec_cmd; 56 u32 ac_codec_cmd;
57 u32 stat, addr, data; 57 u32 stat, addr, data;
58 58
59 down(&ac97_mutex); 59 mutex_lock(&ac97_mutex);
60 60
61 codec_ready = S3C_AC97_GLBSTAT_CODECREADY; 61 codec_ready = S3C_AC97_GLBSTAT_CODECREADY;
62 ac_codec_cmd = readl(s3c24xx_ac97.regs + S3C_AC97_CODEC_CMD); 62 ac_codec_cmd = readl(s3c24xx_ac97.regs + S3C_AC97_CODEC_CMD);
@@ -79,7 +79,7 @@ static unsigned short s3c2443_ac97_read(struct snd_ac97 *ac97,
79 printk(KERN_ERR "s3c24xx-ac97: req addr = %02x," 79 printk(KERN_ERR "s3c24xx-ac97: req addr = %02x,"
80 " rep addr = %02x\n", reg, addr); 80 " rep addr = %02x\n", reg, addr);
81 81
82 up(&ac97_mutex); 82 mutex_unlock(&ac97_mutex);
83 83
84 return (unsigned short)data; 84 return (unsigned short)data;
85} 85}
@@ -90,7 +90,7 @@ static void s3c2443_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
90 u32 ac_glbctrl; 90 u32 ac_glbctrl;
91 u32 ac_codec_cmd; 91 u32 ac_codec_cmd;
92 92
93 down(&ac97_mutex); 93 mutex_lock(&ac97_mutex);
94 94
95 codec_ready = S3C_AC97_GLBSTAT_CODECREADY; 95 codec_ready = S3C_AC97_GLBSTAT_CODECREADY;
96 ac_codec_cmd = readl(s3c24xx_ac97.regs + S3C_AC97_CODEC_CMD); 96 ac_codec_cmd = readl(s3c24xx_ac97.regs + S3C_AC97_CODEC_CMD);
@@ -109,7 +109,7 @@ static void s3c2443_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
109 ac_codec_cmd |= S3C_AC97_CODEC_CMD_READ; 109 ac_codec_cmd |= S3C_AC97_CODEC_CMD_READ;
110 writel(ac_codec_cmd, s3c24xx_ac97.regs + S3C_AC97_CODEC_CMD); 110 writel(ac_codec_cmd, s3c24xx_ac97.regs + S3C_AC97_CODEC_CMD);
111 111
112 up(&ac97_mutex); 112 mutex_unlock(&ac97_mutex);
113 113
114} 114}
115 115
@@ -290,6 +290,9 @@ static int s3c2443_ac97_trigger(struct snd_pcm_substream *substream, int cmd,
290 struct snd_soc_dai *dai) 290 struct snd_soc_dai *dai)
291{ 291{
292 u32 ac_glbctrl; 292 u32 ac_glbctrl;
293 struct snd_soc_pcm_runtime *rtd = substream->private_data;
294 int channel = ((struct s3c24xx_pcm_dma_params *)
295 rtd->dai->cpu_dai->dma_data)->channel;
293 296
294 ac_glbctrl = readl(s3c24xx_ac97.regs + S3C_AC97_GLBCTRL); 297 ac_glbctrl = readl(s3c24xx_ac97.regs + S3C_AC97_GLBCTRL);
295 switch (cmd) { 298 switch (cmd) {
@@ -312,6 +315,8 @@ static int s3c2443_ac97_trigger(struct snd_pcm_substream *substream, int cmd,
312 } 315 }
313 writel(ac_glbctrl, s3c24xx_ac97.regs + S3C_AC97_GLBCTRL); 316 writel(ac_glbctrl, s3c24xx_ac97.regs + S3C_AC97_GLBCTRL);
314 317
318 s3c2410_dma_ctrl(channel, S3C2410_DMAOP_STARTED);
319
315 return 0; 320 return 0;
316} 321}
317 322
@@ -334,6 +339,9 @@ static int s3c2443_ac97_mic_trigger(struct snd_pcm_substream *substream,
334 int cmd, struct snd_soc_dai *dai) 339 int cmd, struct snd_soc_dai *dai)
335{ 340{
336 u32 ac_glbctrl; 341 u32 ac_glbctrl;
342 struct snd_soc_pcm_runtime *rtd = substream->private_data;
343 int channel = ((struct s3c24xx_pcm_dma_params *)
344 rtd->dai->cpu_dai->dma_data)->channel;
337 345
338 ac_glbctrl = readl(s3c24xx_ac97.regs + S3C_AC97_GLBCTRL); 346 ac_glbctrl = readl(s3c24xx_ac97.regs + S3C_AC97_GLBCTRL);
339 switch (cmd) { 347 switch (cmd) {
@@ -349,6 +357,8 @@ static int s3c2443_ac97_mic_trigger(struct snd_pcm_substream *substream,
349 } 357 }
350 writel(ac_glbctrl, s3c24xx_ac97.regs + S3C_AC97_GLBCTRL); 358 writel(ac_glbctrl, s3c24xx_ac97.regs + S3C_AC97_GLBCTRL);
351 359
360 s3c2410_dma_ctrl(channel, S3C2410_DMAOP_STARTED);
361
352 return 0; 362 return 0;
353} 363}
354 364