diff options
Diffstat (limited to 'sound/soc/s3c24xx/s3c-ac97.c')
-rw-r--r-- | sound/soc/s3c24xx/s3c-ac97.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/sound/soc/s3c24xx/s3c-ac97.c b/sound/soc/s3c24xx/s3c-ac97.c index 31f6d45b6384..f891eb79b575 100644 --- a/sound/soc/s3c24xx/s3c-ac97.c +++ b/sound/soc/s3c24xx/s3c-ac97.c | |||
@@ -89,7 +89,7 @@ static void s3c_ac97_activate(struct snd_ac97 *ac97) | |||
89 | writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL); | 89 | writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL); |
90 | 90 | ||
91 | if (!wait_for_completion_timeout(&s3c_ac97.done, HZ)) | 91 | if (!wait_for_completion_timeout(&s3c_ac97.done, HZ)) |
92 | printk(KERN_ERR "AC97: Unable to activate!"); | 92 | pr_err("AC97: Unable to activate!"); |
93 | } | 93 | } |
94 | 94 | ||
95 | static unsigned short s3c_ac97_read(struct snd_ac97 *ac97, | 95 | static unsigned short s3c_ac97_read(struct snd_ac97 *ac97, |
@@ -115,14 +115,15 @@ static unsigned short s3c_ac97_read(struct snd_ac97 *ac97, | |||
115 | writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL); | 115 | writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL); |
116 | 116 | ||
117 | if (!wait_for_completion_timeout(&s3c_ac97.done, HZ)) | 117 | if (!wait_for_completion_timeout(&s3c_ac97.done, HZ)) |
118 | printk(KERN_ERR "AC97: Unable to read!"); | 118 | pr_err("AC97: Unable to read!"); |
119 | 119 | ||
120 | stat = readl(s3c_ac97.regs + S3C_AC97_STAT); | 120 | stat = readl(s3c_ac97.regs + S3C_AC97_STAT); |
121 | addr = (stat >> 16) & 0x7f; | 121 | addr = (stat >> 16) & 0x7f; |
122 | data = (stat & 0xffff); | 122 | data = (stat & 0xffff); |
123 | 123 | ||
124 | if (addr != reg) | 124 | if (addr != reg) |
125 | printk(KERN_ERR "s3c-ac97: req addr = %02x, rep addr = %02x\n", reg, addr); | 125 | pr_err("s3c-ac97: req addr = %02x, rep addr = %02x\n", |
126 | reg, addr); | ||
126 | 127 | ||
127 | mutex_unlock(&s3c_ac97.lock); | 128 | mutex_unlock(&s3c_ac97.lock); |
128 | 129 | ||
@@ -151,7 +152,7 @@ static void s3c_ac97_write(struct snd_ac97 *ac97, unsigned short reg, | |||
151 | writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL); | 152 | writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL); |
152 | 153 | ||
153 | if (!wait_for_completion_timeout(&s3c_ac97.done, HZ)) | 154 | if (!wait_for_completion_timeout(&s3c_ac97.done, HZ)) |
154 | printk(KERN_ERR "AC97: Unable to write!"); | 155 | pr_err("AC97: Unable to write!"); |
155 | 156 | ||
156 | ac_codec_cmd = readl(s3c_ac97.regs + S3C_AC97_CODEC_CMD); | 157 | ac_codec_cmd = readl(s3c_ac97.regs + S3C_AC97_CODEC_CMD); |
157 | ac_codec_cmd |= S3C_AC97_CODEC_CMD_READ; | 158 | ac_codec_cmd |= S3C_AC97_CODEC_CMD_READ; |
@@ -162,6 +163,7 @@ static void s3c_ac97_write(struct snd_ac97 *ac97, unsigned short reg, | |||
162 | 163 | ||
163 | static void s3c_ac97_cold_reset(struct snd_ac97 *ac97) | 164 | static void s3c_ac97_cold_reset(struct snd_ac97 *ac97) |
164 | { | 165 | { |
166 | pr_debug("AC97: Cold reset\n"); | ||
165 | writel(S3C_AC97_GLBCTRL_COLDRESET, | 167 | writel(S3C_AC97_GLBCTRL_COLDRESET, |
166 | s3c_ac97.regs + S3C_AC97_GLBCTRL); | 168 | s3c_ac97.regs + S3C_AC97_GLBCTRL); |
167 | msleep(1); | 169 | msleep(1); |
@@ -178,6 +180,8 @@ static void s3c_ac97_warm_reset(struct snd_ac97 *ac97) | |||
178 | if (stat == S3C_AC97_GLBSTAT_MAINSTATE_ACTIVE) | 180 | if (stat == S3C_AC97_GLBSTAT_MAINSTATE_ACTIVE) |
179 | return; /* Return if already active */ | 181 | return; /* Return if already active */ |
180 | 182 | ||
183 | pr_debug("AC97: Warm reset\n"); | ||
184 | |||
181 | writel(S3C_AC97_GLBCTRL_WARMRESET, s3c_ac97.regs + S3C_AC97_GLBCTRL); | 185 | writel(S3C_AC97_GLBCTRL_WARMRESET, s3c_ac97.regs + S3C_AC97_GLBCTRL); |
182 | msleep(1); | 186 | msleep(1); |
183 | 187 | ||
@@ -222,7 +226,7 @@ static int s3c_ac97_hw_params(struct snd_pcm_substream *substream, | |||
222 | struct snd_soc_dai *dai) | 226 | struct snd_soc_dai *dai) |
223 | { | 227 | { |
224 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 228 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
225 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 229 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
226 | struct s3c_dma_params *dma_data; | 230 | struct s3c_dma_params *dma_data; |
227 | 231 | ||
228 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 232 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -241,7 +245,7 @@ static int s3c_ac97_trigger(struct snd_pcm_substream *substream, int cmd, | |||
241 | u32 ac_glbctrl; | 245 | u32 ac_glbctrl; |
242 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 246 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
243 | struct s3c_dma_params *dma_data = | 247 | struct s3c_dma_params *dma_data = |
244 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 248 | snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
245 | 249 | ||
246 | ac_glbctrl = readl(s3c_ac97.regs + S3C_AC97_GLBCTRL); | 250 | ac_glbctrl = readl(s3c_ac97.regs + S3C_AC97_GLBCTRL); |
247 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) | 251 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) |
@@ -277,7 +281,7 @@ static int s3c_ac97_hw_mic_params(struct snd_pcm_substream *substream, | |||
277 | struct snd_soc_dai *dai) | 281 | struct snd_soc_dai *dai) |
278 | { | 282 | { |
279 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 283 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
280 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 284 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
281 | 285 | ||
282 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 286 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
283 | return -ENODEV; | 287 | return -ENODEV; |
@@ -293,7 +297,7 @@ static int s3c_ac97_mic_trigger(struct snd_pcm_substream *substream, | |||
293 | u32 ac_glbctrl; | 297 | u32 ac_glbctrl; |
294 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 298 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
295 | struct s3c_dma_params *dma_data = | 299 | struct s3c_dma_params *dma_data = |
296 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 300 | snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
297 | 301 | ||
298 | ac_glbctrl = readl(s3c_ac97.regs + S3C_AC97_GLBCTRL); | 302 | ac_glbctrl = readl(s3c_ac97.regs + S3C_AC97_GLBCTRL); |
299 | ac_glbctrl &= ~S3C_AC97_GLBCTRL_MICINTM_MASK; | 303 | ac_glbctrl &= ~S3C_AC97_GLBCTRL_MICINTM_MASK; |
@@ -328,10 +332,9 @@ static struct snd_soc_dai_ops s3c_ac97_mic_dai_ops = { | |||
328 | .trigger = s3c_ac97_mic_trigger, | 332 | .trigger = s3c_ac97_mic_trigger, |
329 | }; | 333 | }; |
330 | 334 | ||
331 | struct snd_soc_dai s3c_ac97_dai[] = { | 335 | static struct snd_soc_dai_driver s3c_ac97_dai[] = { |
332 | [S3C_AC97_DAI_PCM] = { | 336 | [S3C_AC97_DAI_PCM] = { |
333 | .name = "s3c-ac97", | 337 | .name = "s3c-ac97", |
334 | .id = S3C_AC97_DAI_PCM, | ||
335 | .ac97_control = 1, | 338 | .ac97_control = 1, |
336 | .playback = { | 339 | .playback = { |
337 | .stream_name = "AC97 Playback", | 340 | .stream_name = "AC97 Playback", |
@@ -349,7 +352,6 @@ struct snd_soc_dai s3c_ac97_dai[] = { | |||
349 | }, | 352 | }, |
350 | [S3C_AC97_DAI_MIC] = { | 353 | [S3C_AC97_DAI_MIC] = { |
351 | .name = "s3c-ac97-mic", | 354 | .name = "s3c-ac97-mic", |
352 | .id = S3C_AC97_DAI_MIC, | ||
353 | .ac97_control = 1, | 355 | .ac97_control = 1, |
354 | .capture = { | 356 | .capture = { |
355 | .stream_name = "AC97 Mic Capture", | 357 | .stream_name = "AC97 Mic Capture", |
@@ -360,7 +362,6 @@ struct snd_soc_dai s3c_ac97_dai[] = { | |||
360 | .ops = &s3c_ac97_mic_dai_ops, | 362 | .ops = &s3c_ac97_mic_dai_ops, |
361 | }, | 363 | }, |
362 | }; | 364 | }; |
363 | EXPORT_SYMBOL_GPL(s3c_ac97_dai); | ||
364 | 365 | ||
365 | static __devinit int s3c_ac97_probe(struct platform_device *pdev) | 366 | static __devinit int s3c_ac97_probe(struct platform_device *pdev) |
366 | { | 367 | { |
@@ -445,14 +446,12 @@ static __devinit int s3c_ac97_probe(struct platform_device *pdev) | |||
445 | ret = request_irq(irq_res->start, s3c_ac97_irq, | 446 | ret = request_irq(irq_res->start, s3c_ac97_irq, |
446 | IRQF_DISABLED, "AC97", NULL); | 447 | IRQF_DISABLED, "AC97", NULL); |
447 | if (ret < 0) { | 448 | if (ret < 0) { |
448 | printk(KERN_ERR "s3c-ac97: interrupt request failed.\n"); | 449 | dev_err(&pdev->dev, "s3c-ac97: interrupt request failed.\n"); |
449 | goto err4; | 450 | goto err4; |
450 | } | 451 | } |
451 | 452 | ||
452 | s3c_ac97_dai[S3C_AC97_DAI_PCM].dev = &pdev->dev; | 453 | ret = snd_soc_register_dais(&pdev->dev, s3c_ac97_dai, |
453 | s3c_ac97_dai[S3C_AC97_DAI_MIC].dev = &pdev->dev; | 454 | ARRAY_SIZE(s3c_ac97_dai)); |
454 | |||
455 | ret = snd_soc_register_dais(s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai)); | ||
456 | if (ret) | 455 | if (ret) |
457 | goto err5; | 456 | goto err5; |
458 | 457 | ||
@@ -476,7 +475,7 @@ static __devexit int s3c_ac97_remove(struct platform_device *pdev) | |||
476 | { | 475 | { |
477 | struct resource *mem_res, *irq_res; | 476 | struct resource *mem_res, *irq_res; |
478 | 477 | ||
479 | snd_soc_unregister_dais(s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai)); | 478 | snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(s3c_ac97_dai)); |
480 | 479 | ||
481 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 480 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
482 | if (irq_res) | 481 | if (irq_res) |
@@ -518,3 +517,4 @@ module_exit(s3c_ac97_exit); | |||
518 | MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>"); | 517 | MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>"); |
519 | MODULE_DESCRIPTION("AC97 driver for the Samsung SoC"); | 518 | MODULE_DESCRIPTION("AC97 driver for the Samsung SoC"); |
520 | MODULE_LICENSE("GPL"); | 519 | MODULE_LICENSE("GPL"); |
520 | MODULE_ALIAS("platform:s3c-ac97"); | ||