aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/tegra
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/tegra
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/tegra')
-rw-r--r--sound/soc/tegra/tegra20_ac97.c66
1 files changed, 32 insertions, 34 deletions
diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c
index 2f70ea7f6618..f52eab6d2231 100644
--- a/sound/soc/tegra/tegra20_ac97.c
+++ b/sound/soc/tegra/tegra20_ac97.c
@@ -142,13 +142,12 @@ static void tegra20_ac97_codec_write(struct snd_ac97 *ac97_snd,
142 } while (!time_after(jiffies, timeout)); 142 } while (!time_after(jiffies, timeout));
143} 143}
144 144
145struct snd_ac97_bus_ops soc_ac97_ops = { 145static struct snd_ac97_bus_ops tegra20_ac97_ops = {
146 .read = tegra20_ac97_codec_read, 146 .read = tegra20_ac97_codec_read,
147 .write = tegra20_ac97_codec_write, 147 .write = tegra20_ac97_codec_write,
148 .reset = tegra20_ac97_codec_reset, 148 .reset = tegra20_ac97_codec_reset,
149 .warm_reset = tegra20_ac97_codec_warm_reset, 149 .warm_reset = tegra20_ac97_codec_warm_reset,
150}; 150};
151EXPORT_SYMBOL_GPL(soc_ac97_ops);
152 151
153static inline void tegra20_ac97_start_playback(struct tegra20_ac97 *ac97) 152static inline void tegra20_ac97_start_playback(struct tegra20_ac97 *ac97)
154{ 153{
@@ -327,7 +326,7 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
327 } 326 }
328 dev_set_drvdata(&pdev->dev, ac97); 327 dev_set_drvdata(&pdev->dev, ac97);
329 328
330 ac97->clk_ac97 = clk_get(&pdev->dev, NULL); 329 ac97->clk_ac97 = devm_clk_get(&pdev->dev, NULL);
331 if (IS_ERR(ac97->clk_ac97)) { 330 if (IS_ERR(ac97->clk_ac97)) {
332 dev_err(&pdev->dev, "Can't retrieve ac97 clock\n"); 331 dev_err(&pdev->dev, "Can't retrieve ac97 clock\n");
333 ret = PTR_ERR(ac97->clk_ac97); 332 ret = PTR_ERR(ac97->clk_ac97);
@@ -341,18 +340,10 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
341 goto err_clk_put; 340 goto err_clk_put;
342 } 341 }
343 342
344 memregion = devm_request_mem_region(&pdev->dev, mem->start, 343 regs = devm_ioremap_resource(&pdev->dev, mem);
345 resource_size(mem), DRV_NAME); 344 if (IS_ERR(regs)) {
346 if (!memregion) { 345 ret = PTR_ERR(regs);
347 dev_err(&pdev->dev, "Memory region already claimed\n"); 346 dev_err(&pdev->dev, "ioremap failed: %d\n", ret);
348 ret = -EBUSY;
349 goto err_clk_put;
350 }
351
352 regs = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
353 if (!regs) {
354 dev_err(&pdev->dev, "ioremap failed\n");
355 ret = -ENOMEM;
356 goto err_clk_put; 347 goto err_clk_put;
357 } 348 }
358 349
@@ -403,23 +394,9 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
403 ac97->capture_dma_data.maxburst = 4; 394 ac97->capture_dma_data.maxburst = 4;
404 ac97->capture_dma_data.slave_id = of_dma[0]; 395 ac97->capture_dma_data.slave_id = of_dma[0];
405 396
406 ret = snd_soc_register_component(&pdev->dev, &tegra20_ac97_component,
407 &tegra20_ac97_dai, 1);
408 if (ret) {
409 dev_err(&pdev->dev, "Could not register DAI: %d\n", ret);
410 ret = -ENOMEM;
411 goto err_clk_put;
412 }
413
414 ret = tegra_pcm_platform_register(&pdev->dev);
415 if (ret) {
416 dev_err(&pdev->dev, "Could not register PCM: %d\n", ret);
417 goto err_unregister_component;
418 }
419
420 ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev); 397 ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev);
421 if (ret) 398 if (ret)
422 goto err_unregister_pcm; 399 goto err_clk_put;
423 400
424 ret = tegra_asoc_utils_set_ac97_rate(&ac97->util_data); 401 ret = tegra_asoc_utils_set_ac97_rate(&ac97->util_data);
425 if (ret) 402 if (ret)
@@ -431,20 +408,40 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
431 goto err_asoc_utils_fini; 408 goto err_asoc_utils_fini;
432 } 409 }
433 410
411 ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops);
412 if (ret) {
413 dev_err(&pdev->dev, "Failed to set AC'97 ops: %d\n", ret);
414 goto err_asoc_utils_fini;
415 }
416
417 ret = snd_soc_register_component(&pdev->dev, &tegra20_ac97_component,
418 &tegra20_ac97_dai, 1);
419 if (ret) {
420 dev_err(&pdev->dev, "Could not register DAI: %d\n", ret);
421 ret = -ENOMEM;
422 goto err_asoc_utils_fini;
423 }
424
425 ret = tegra_pcm_platform_register(&pdev->dev);
426 if (ret) {
427 dev_err(&pdev->dev, "Could not register PCM: %d\n", ret);
428 goto err_unregister_component;
429 }
430
434 /* XXX: crufty ASoC AC97 API - only one AC97 codec allowed */ 431 /* XXX: crufty ASoC AC97 API - only one AC97 codec allowed */
435 workdata = ac97; 432 workdata = ac97;
436 433
437 return 0; 434 return 0;
438 435
439err_asoc_utils_fini:
440 tegra_asoc_utils_fini(&ac97->util_data);
441err_unregister_pcm: 436err_unregister_pcm:
442 tegra_pcm_platform_unregister(&pdev->dev); 437 tegra_pcm_platform_unregister(&pdev->dev);
443err_unregister_component: 438err_unregister_component:
444 snd_soc_unregister_component(&pdev->dev); 439 snd_soc_unregister_component(&pdev->dev);
440err_asoc_utils_fini:
441 tegra_asoc_utils_fini(&ac97->util_data);
445err_clk_put: 442err_clk_put:
446 clk_put(ac97->clk_ac97);
447err: 443err:
444 snd_soc_set_ac97_ops(NULL);
448 return ret; 445 return ret;
449} 446}
450 447
@@ -458,7 +455,8 @@ static int tegra20_ac97_platform_remove(struct platform_device *pdev)
458 tegra_asoc_utils_fini(&ac97->util_data); 455 tegra_asoc_utils_fini(&ac97->util_data);
459 456
460 clk_disable_unprepare(ac97->clk_ac97); 457 clk_disable_unprepare(ac97->clk_ac97);
461 clk_put(ac97->clk_ac97); 458
459 snd_soc_set_ac97_ops(NULL);
462 460
463 return 0; 461 return 0;
464} 462}