aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/samsung
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-06-28 07:36:22 -0400
committerTakashi Iwai <tiwai@suse.de>2013-06-28 07:36:22 -0400
commitaccaf69da1d1e64bd77ac0caad77e4cfc3b654c7 (patch)
tree0402e4fad9cecd428c8c3c228a08f9e31eb63470 /sound/soc/samsung
parent975cc02a904ae385721f1bdb65eb1bcf707dfaf1 (diff)
parent27516080b21cbcb936440d2a3171867860b9a881 (diff)
Merge tag 'asoc-v3.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: More updates for v3.11 Some more fixes and enhancements, and also a bunch of refectoring for AC'97 support which enables more than one AC'97 controller driver to be built in.
Diffstat (limited to 'sound/soc/samsung')
-rw-r--r--sound/soc/samsung/ac97.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index cb88ead98917..2dd623fa3882 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -214,13 +214,12 @@ static irqreturn_t s3c_ac97_irq(int irq, void *dev_id)
214 return IRQ_HANDLED; 214 return IRQ_HANDLED;
215} 215}
216 216
217struct snd_ac97_bus_ops soc_ac97_ops = { 217static struct snd_ac97_bus_ops s3c_ac97_ops = {
218 .read = s3c_ac97_read, 218 .read = s3c_ac97_read,
219 .write = s3c_ac97_write, 219 .write = s3c_ac97_write,
220 .warm_reset = s3c_ac97_warm_reset, 220 .warm_reset = s3c_ac97_warm_reset,
221 .reset = s3c_ac97_cold_reset, 221 .reset = s3c_ac97_cold_reset,
222}; 222};
223EXPORT_SYMBOL_GPL(soc_ac97_ops);
224 223
225static int s3c_ac97_hw_params(struct snd_pcm_substream *substream, 224static int s3c_ac97_hw_params(struct snd_pcm_substream *substream,
226 struct snd_pcm_hw_params *params, 225 struct snd_pcm_hw_params *params,
@@ -417,11 +416,9 @@ static int s3c_ac97_probe(struct platform_device *pdev)
417 return -ENXIO; 416 return -ENXIO;
418 } 417 }
419 418
420 if (!request_mem_region(mem_res->start, 419 s3c_ac97.regs = devm_ioremap_resource(&pdev->dev, mem_res);
421 resource_size(mem_res), "ac97")) { 420 if (IS_ERR(s3c_ac97.regs))
422 dev_err(&pdev->dev, "Unable to request register region\n"); 421 return PTR_ERR(s3c_ac97.regs);
423 return -EBUSY;
424 }
425 422
426 s3c_ac97_pcm_out.channel = dmatx_res->start; 423 s3c_ac97_pcm_out.channel = dmatx_res->start;
427 s3c_ac97_pcm_out.dma_addr = mem_res->start + S3C_AC97_PCM_DATA; 424 s3c_ac97_pcm_out.dma_addr = mem_res->start + S3C_AC97_PCM_DATA;
@@ -433,14 +430,7 @@ static int s3c_ac97_probe(struct platform_device *pdev)
433 init_completion(&s3c_ac97.done); 430 init_completion(&s3c_ac97.done);
434 mutex_init(&s3c_ac97.lock); 431 mutex_init(&s3c_ac97.lock);
435 432
436 s3c_ac97.regs = ioremap(mem_res->start, resource_size(mem_res)); 433 s3c_ac97.ac97_clk = devm_clk_get(&pdev->dev, "ac97");
437 if (s3c_ac97.regs == NULL) {
438 dev_err(&pdev->dev, "Unable to ioremap register region\n");
439 ret = -ENXIO;
440 goto err1;
441 }
442
443 s3c_ac97.ac97_clk = clk_get(&pdev->dev, "ac97");
444 if (IS_ERR(s3c_ac97.ac97_clk)) { 434 if (IS_ERR(s3c_ac97.ac97_clk)) {
445 dev_err(&pdev->dev, "ac97 failed to get ac97_clock\n"); 435 dev_err(&pdev->dev, "ac97 failed to get ac97_clock\n");
446 ret = -ENODEV; 436 ret = -ENODEV;
@@ -461,6 +451,12 @@ static int s3c_ac97_probe(struct platform_device *pdev)
461 goto err4; 451 goto err4;
462 } 452 }
463 453
454 ret = snd_soc_set_ac97_ops(&s3c_ac97_ops);
455 if (ret != 0) {
456 dev_err(&pdev->dev, "Failed to set AC'97 ops: %d\n", ret);
457 goto err4;
458 }
459
464 ret = snd_soc_register_component(&pdev->dev, &s3c_ac97_component, 460 ret = snd_soc_register_component(&pdev->dev, &s3c_ac97_component,
465 s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai)); 461 s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai));
466 if (ret) 462 if (ret)
@@ -480,18 +476,14 @@ err5:
480err4: 476err4:
481err3: 477err3:
482 clk_disable_unprepare(s3c_ac97.ac97_clk); 478 clk_disable_unprepare(s3c_ac97.ac97_clk);
483 clk_put(s3c_ac97.ac97_clk);
484err2: 479err2:
485 iounmap(s3c_ac97.regs); 480 snd_soc_set_ac97_ops(NULL);
486err1:
487 release_mem_region(mem_res->start, resource_size(mem_res));
488
489 return ret; 481 return ret;
490} 482}
491 483
492static int s3c_ac97_remove(struct platform_device *pdev) 484static int s3c_ac97_remove(struct platform_device *pdev)
493{ 485{
494 struct resource *mem_res, *irq_res; 486 struct resource *irq_res;
495 487
496 asoc_dma_platform_unregister(&pdev->dev); 488 asoc_dma_platform_unregister(&pdev->dev);
497 snd_soc_unregister_component(&pdev->dev); 489 snd_soc_unregister_component(&pdev->dev);
@@ -501,13 +493,7 @@ static int s3c_ac97_remove(struct platform_device *pdev)
501 free_irq(irq_res->start, NULL); 493 free_irq(irq_res->start, NULL);
502 494
503 clk_disable_unprepare(s3c_ac97.ac97_clk); 495 clk_disable_unprepare(s3c_ac97.ac97_clk);
504 clk_put(s3c_ac97.ac97_clk); 496 snd_soc_set_ac97_ops(NULL);
505
506 iounmap(s3c_ac97.regs);
507
508 mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
509 if (mem_res)
510 release_mem_region(mem_res->start, resource_size(mem_res));
511 497
512 return 0; 498 return 0;
513} 499}