diff options
Diffstat (limited to 'sound/soc/blackfin')
-rw-r--r-- | sound/soc/blackfin/bf5xx-ac97-pcm.c | 43 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-ac97-pcm.h | 3 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-ac97.c | 41 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-ac97.h | 2 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-ad1836.c | 23 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-ad193x.c | 23 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-ad1980.c | 19 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-ad73311.c | 22 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-i2s-pcm.c | 44 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-i2s-pcm.h | 3 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-i2s.c | 45 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-i2s.h | 14 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-ssm2602.c | 38 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-tdm-pcm.c | 43 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-tdm-pcm.h | 3 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-tdm.c | 15 | ||||
-rw-r--r-- | sound/soc/blackfin/bf5xx-tdm.h | 2 |
17 files changed, 202 insertions, 181 deletions
diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c index 5e7aacf3bb5a..5a2fd8abaefa 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c | |||
@@ -422,14 +422,14 @@ int bf5xx_pcm_ac97_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
422 | if (!card->dev->coherent_dma_mask) | 422 | if (!card->dev->coherent_dma_mask) |
423 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); | 423 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); |
424 | 424 | ||
425 | if (dai->playback.channels_min) { | 425 | if (dai->driver->playback.channels_min) { |
426 | ret = bf5xx_pcm_preallocate_dma_buffer(pcm, | 426 | ret = bf5xx_pcm_preallocate_dma_buffer(pcm, |
427 | SNDRV_PCM_STREAM_PLAYBACK); | 427 | SNDRV_PCM_STREAM_PLAYBACK); |
428 | if (ret) | 428 | if (ret) |
429 | goto out; | 429 | goto out; |
430 | } | 430 | } |
431 | 431 | ||
432 | if (dai->capture.channels_min) { | 432 | if (dai->driver->capture.channels_min) { |
433 | ret = bf5xx_pcm_preallocate_dma_buffer(pcm, | 433 | ret = bf5xx_pcm_preallocate_dma_buffer(pcm, |
434 | SNDRV_PCM_STREAM_CAPTURE); | 434 | SNDRV_PCM_STREAM_CAPTURE); |
435 | if (ret) | 435 | if (ret) |
@@ -439,25 +439,44 @@ int bf5xx_pcm_ac97_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
439 | return ret; | 439 | return ret; |
440 | } | 440 | } |
441 | 441 | ||
442 | struct snd_soc_platform bf5xx_ac97_soc_platform = { | 442 | static struct snd_soc_platform_driver bf5xx_ac97_soc_platform = { |
443 | .name = "bf5xx-audio", | 443 | .ops = &bf5xx_pcm_ac97_ops, |
444 | .pcm_ops = &bf5xx_pcm_ac97_ops, | ||
445 | .pcm_new = bf5xx_pcm_ac97_new, | 444 | .pcm_new = bf5xx_pcm_ac97_new, |
446 | .pcm_free = bf5xx_pcm_free_dma_buffers, | 445 | .pcm_free = bf5xx_pcm_free_dma_buffers, |
447 | }; | 446 | }; |
448 | EXPORT_SYMBOL_GPL(bf5xx_ac97_soc_platform); | ||
449 | 447 | ||
450 | static int __init bfin_ac97_init(void) | 448 | static int __devinit bf5xx_soc_platform_probe(struct platform_device *pdev) |
451 | { | 449 | { |
452 | return snd_soc_register_platform(&bf5xx_ac97_soc_platform); | 450 | return snd_soc_register_platform(&pdev->dev, &bf5xx_ac97_soc_platform); |
453 | } | 451 | } |
454 | module_init(bfin_ac97_init); | ||
455 | 452 | ||
456 | static void __exit bfin_ac97_exit(void) | 453 | static int __devexit bf5xx_soc_platform_remove(struct platform_device *pdev) |
457 | { | 454 | { |
458 | snd_soc_unregister_platform(&bf5xx_ac97_soc_platform); | 455 | snd_soc_unregister_platform(&pdev->dev); |
456 | return 0; | ||
457 | } | ||
458 | |||
459 | static struct platform_driver bf5xx_pcm_driver = { | ||
460 | .driver = { | ||
461 | .name = "bf5xx-pcm-audio", | ||
462 | .owner = THIS_MODULE, | ||
463 | }, | ||
464 | |||
465 | .probe = bf5xx_soc_platform_probe, | ||
466 | .remove = __devexit_p(bf5xx_soc_platform_remove), | ||
467 | }; | ||
468 | |||
469 | static int __init snd_bf5xx_pcm_init(void) | ||
470 | { | ||
471 | return platform_driver_register(&bf5xx_pcm_driver); | ||
472 | } | ||
473 | module_init(snd_bf5xx_pcm_init); | ||
474 | |||
475 | static void __exit snd_bf5xx_pcm_exit(void) | ||
476 | { | ||
477 | platform_driver_unregister(&bf5xx_pcm_driver); | ||
459 | } | 478 | } |
460 | module_exit(bfin_ac97_exit); | 479 | module_exit(snd_bf5xx_pcm_exit); |
461 | 480 | ||
462 | MODULE_AUTHOR("Cliff Cai"); | 481 | MODULE_AUTHOR("Cliff Cai"); |
463 | MODULE_DESCRIPTION("ADI Blackfin AC97 PCM DMA module"); | 482 | MODULE_DESCRIPTION("ADI Blackfin AC97 PCM DMA module"); |
diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.h b/sound/soc/blackfin/bf5xx-ac97-pcm.h index 350125a0ae21..d324d5826a9b 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.h +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.h | |||
@@ -23,7 +23,4 @@ struct bf5xx_gpio { | |||
23 | u32 frm; | 23 | u32 frm; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | /* platform data */ | ||
27 | extern struct snd_soc_platform bf5xx_ac97_soc_platform; | ||
28 | |||
29 | #endif | 26 | #endif |
diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index c0eba5109980..c5f856ec27ca 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c | |||
@@ -255,7 +255,7 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops); | |||
255 | #ifdef CONFIG_PM | 255 | #ifdef CONFIG_PM |
256 | static int bf5xx_ac97_suspend(struct snd_soc_dai *dai) | 256 | static int bf5xx_ac97_suspend(struct snd_soc_dai *dai) |
257 | { | 257 | { |
258 | struct sport_device *sport = dai->private_data; | 258 | struct sport_device *sport = snd_soc_dai_get_drvdata(dai); |
259 | 259 | ||
260 | pr_debug("%s : sport %d\n", __func__, dai->id); | 260 | pr_debug("%s : sport %d\n", __func__, dai->id); |
261 | if (!dai->active) | 261 | if (!dai->active) |
@@ -270,7 +270,7 @@ static int bf5xx_ac97_suspend(struct snd_soc_dai *dai) | |||
270 | static int bf5xx_ac97_resume(struct snd_soc_dai *dai) | 270 | static int bf5xx_ac97_resume(struct snd_soc_dai *dai) |
271 | { | 271 | { |
272 | int ret; | 272 | int ret; |
273 | struct sport_device *sport = dai->private_data; | 273 | struct sport_device *sport = snd_soc_dai_get_drvdata(dai); |
274 | 274 | ||
275 | pr_debug("%s : sport %d\n", __func__, dai->id); | 275 | pr_debug("%s : sport %d\n", __func__, dai->id); |
276 | if (!dai->active) | 276 | if (!dai->active) |
@@ -306,8 +306,7 @@ static int bf5xx_ac97_resume(struct snd_soc_dai *dai) | |||
306 | #define bf5xx_ac97_resume NULL | 306 | #define bf5xx_ac97_resume NULL |
307 | #endif | 307 | #endif |
308 | 308 | ||
309 | static int bf5xx_ac97_probe(struct platform_device *pdev, | 309 | static int bf5xx_ac97_probe(struct snd_soc_dai *dai) |
310 | struct snd_soc_dai *dai) | ||
311 | { | 310 | { |
312 | int ret = 0; | 311 | int ret = 0; |
313 | cmd_count = (int *)get_zeroed_page(GFP_KERNEL); | 312 | cmd_count = (int *)get_zeroed_page(GFP_KERNEL); |
@@ -379,8 +378,7 @@ peripheral_err: | |||
379 | return ret; | 378 | return ret; |
380 | } | 379 | } |
381 | 380 | ||
382 | static void bf5xx_ac97_remove(struct platform_device *pdev, | 381 | static int bf5xx_ac97_remove(struct snd_soc_dai *dai) |
383 | struct snd_soc_dai *dai) | ||
384 | { | 382 | { |
385 | free_page((unsigned long)cmd_count); | 383 | free_page((unsigned long)cmd_count); |
386 | cmd_count = NULL; | 384 | cmd_count = NULL; |
@@ -388,11 +386,10 @@ static void bf5xx_ac97_remove(struct platform_device *pdev, | |||
388 | #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET | 386 | #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET |
389 | gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); | 387 | gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); |
390 | #endif | 388 | #endif |
389 | return 0; | ||
391 | } | 390 | } |
392 | 391 | ||
393 | struct snd_soc_dai bfin_ac97_dai = { | 392 | struct snd_soc_dai_driver bfin_ac97_dai = { |
394 | .name = "bf5xx-ac97", | ||
395 | .id = 0, | ||
396 | .ac97_control = 1, | 393 | .ac97_control = 1, |
397 | .probe = bf5xx_ac97_probe, | 394 | .probe = bf5xx_ac97_probe, |
398 | .remove = bf5xx_ac97_remove, | 395 | .remove = bf5xx_ac97_remove, |
@@ -417,18 +414,40 @@ struct snd_soc_dai bfin_ac97_dai = { | |||
417 | }; | 414 | }; |
418 | EXPORT_SYMBOL_GPL(bfin_ac97_dai); | 415 | EXPORT_SYMBOL_GPL(bfin_ac97_dai); |
419 | 416 | ||
417 | static __devinit int asoc_bfin_ac97_probe(struct platform_device *pdev) | ||
418 | { | ||
419 | return snd_soc_register_dai(&pdev->dev, &bfin_ac97_dai); | ||
420 | } | ||
421 | |||
422 | static int __devexit asoc_bfin_ac97_remove(struct platform_device *pdev) | ||
423 | { | ||
424 | snd_soc_unregister_dai(&pdev->dev); | ||
425 | return 0; | ||
426 | } | ||
427 | |||
428 | static struct platform_driver asoc_bfin_ac97_driver = { | ||
429 | .driver = { | ||
430 | .name = "bfin-ac97", | ||
431 | .owner = THIS_MODULE, | ||
432 | }, | ||
433 | |||
434 | .probe = asoc_bfin_ac97_probe, | ||
435 | .remove = __devexit_p(asoc_bfin_ac97_remove), | ||
436 | }; | ||
437 | |||
420 | static int __init bfin_ac97_init(void) | 438 | static int __init bfin_ac97_init(void) |
421 | { | 439 | { |
422 | return snd_soc_register_dai(&bfin_ac97_dai); | 440 | return platform_driver_register(&asoc_bfin_ac97_driver); |
423 | } | 441 | } |
424 | module_init(bfin_ac97_init); | 442 | module_init(bfin_ac97_init); |
425 | 443 | ||
426 | static void __exit bfin_ac97_exit(void) | 444 | static void __exit bfin_ac97_exit(void) |
427 | { | 445 | { |
428 | snd_soc_unregister_dai(&bfin_ac97_dai); | 446 | platform_driver_unregister(&asoc_bfin_ac97_driver); |
429 | } | 447 | } |
430 | module_exit(bfin_ac97_exit); | 448 | module_exit(bfin_ac97_exit); |
431 | 449 | ||
450 | |||
432 | MODULE_AUTHOR("Roy Huang"); | 451 | MODULE_AUTHOR("Roy Huang"); |
433 | MODULE_DESCRIPTION("AC97 driver for ADI Blackfin"); | 452 | MODULE_DESCRIPTION("AC97 driver for ADI Blackfin"); |
434 | MODULE_LICENSE("GPL"); | 453 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/blackfin/bf5xx-ac97.h b/sound/soc/blackfin/bf5xx-ac97.h index a1f97dd809d6..15c635e33f4d 100644 --- a/sound/soc/blackfin/bf5xx-ac97.h +++ b/sound/soc/blackfin/bf5xx-ac97.h | |||
@@ -50,8 +50,6 @@ struct ac97_frame { | |||
50 | #define TAG_PCM_SR 0x0080 | 50 | #define TAG_PCM_SR 0x0080 |
51 | #define TAG_PCM_LFE 0x0040 | 51 | #define TAG_PCM_LFE 0x0040 |
52 | 52 | ||
53 | extern struct snd_soc_dai bfin_ac97_dai; | ||
54 | |||
55 | void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u16 *src, \ | 53 | void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u16 *src, \ |
56 | size_t count, unsigned int chan_mask); | 54 | size_t count, unsigned int chan_mask); |
57 | 55 | ||
diff --git a/sound/soc/blackfin/bf5xx-ad1836.c b/sound/soc/blackfin/bf5xx-ad1836.c index 0f45a3f56be8..2394bff2b655 100644 --- a/sound/soc/blackfin/bf5xx-ad1836.c +++ b/sound/soc/blackfin/bf5xx-ad1836.c | |||
@@ -40,9 +40,9 @@ static struct snd_soc_card bf5xx_ad1836; | |||
40 | static int bf5xx_ad1836_startup(struct snd_pcm_substream *substream) | 40 | static int bf5xx_ad1836_startup(struct snd_pcm_substream *substream) |
41 | { | 41 | { |
42 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 42 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
43 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 43 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
44 | 44 | ||
45 | cpu_dai->private_data = sport_handle; | 45 | snd_soc_dai_set_drvdata(cpu_dai, sport_handle); |
46 | return 0; | 46 | return 0; |
47 | } | 47 | } |
48 | 48 | ||
@@ -50,8 +50,8 @@ static int bf5xx_ad1836_hw_params(struct snd_pcm_substream *substream, | |||
50 | struct snd_pcm_hw_params *params) | 50 | struct snd_pcm_hw_params *params) |
51 | { | 51 | { |
52 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 52 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
53 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 53 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
54 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 54 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
55 | unsigned int channel_map[] = {0, 4, 1, 5, 2, 6, 3, 7}; | 55 | unsigned int channel_map[] = {0, 4, 1, 5, 2, 6, 3, 7}; |
56 | int ret = 0; | 56 | int ret = 0; |
57 | /* set cpu DAI configuration */ | 57 | /* set cpu DAI configuration */ |
@@ -83,23 +83,19 @@ static struct snd_soc_ops bf5xx_ad1836_ops = { | |||
83 | static struct snd_soc_dai_link bf5xx_ad1836_dai = { | 83 | static struct snd_soc_dai_link bf5xx_ad1836_dai = { |
84 | .name = "ad1836", | 84 | .name = "ad1836", |
85 | .stream_name = "AD1836", | 85 | .stream_name = "AD1836", |
86 | .cpu_dai = &bf5xx_tdm_dai, | 86 | .cpu_dai_name = "bf5xx-tdm", |
87 | .codec_dai = &ad1836_dai, | 87 | .codec_dai_name = "ad1836-hifi", |
88 | .platform_name = "bf5xx-tdm-pcm-audio", | ||
89 | .codec_name = "ad1836-codec.0", | ||
88 | .ops = &bf5xx_ad1836_ops, | 90 | .ops = &bf5xx_ad1836_ops, |
89 | }; | 91 | }; |
90 | 92 | ||
91 | static struct snd_soc_card bf5xx_ad1836 = { | 93 | static struct snd_soc_card bf5xx_ad1836 = { |
92 | .name = "bf5xx_ad1836", | 94 | .name = "bf5xx_ad1836", |
93 | .platform = &bf5xx_tdm_soc_platform, | ||
94 | .dai_link = &bf5xx_ad1836_dai, | 95 | .dai_link = &bf5xx_ad1836_dai, |
95 | .num_links = 1, | 96 | .num_links = 1, |
96 | }; | 97 | }; |
97 | 98 | ||
98 | static struct snd_soc_device bf5xx_ad1836_snd_devdata = { | ||
99 | .card = &bf5xx_ad1836, | ||
100 | .codec_dev = &soc_codec_dev_ad1836, | ||
101 | }; | ||
102 | |||
103 | static struct platform_device *bfxx_ad1836_snd_device; | 99 | static struct platform_device *bfxx_ad1836_snd_device; |
104 | 100 | ||
105 | static int __init bf5xx_ad1836_init(void) | 101 | static int __init bf5xx_ad1836_init(void) |
@@ -110,8 +106,7 @@ static int __init bf5xx_ad1836_init(void) | |||
110 | if (!bfxx_ad1836_snd_device) | 106 | if (!bfxx_ad1836_snd_device) |
111 | return -ENOMEM; | 107 | return -ENOMEM; |
112 | 108 | ||
113 | platform_set_drvdata(bfxx_ad1836_snd_device, &bf5xx_ad1836_snd_devdata); | 109 | platform_set_drvdata(bfxx_ad1836_snd_device, &bf5xx_ad1836); |
114 | bf5xx_ad1836_snd_devdata.dev = &bfxx_ad1836_snd_device->dev; | ||
115 | ret = platform_device_add(bfxx_ad1836_snd_device); | 110 | ret = platform_device_add(bfxx_ad1836_snd_device); |
116 | 111 | ||
117 | if (ret) | 112 | if (ret) |
diff --git a/sound/soc/blackfin/bf5xx-ad193x.c b/sound/soc/blackfin/bf5xx-ad193x.c index b8c9060cfd8e..e4a625317a1a 100644 --- a/sound/soc/blackfin/bf5xx-ad193x.c +++ b/sound/soc/blackfin/bf5xx-ad193x.c | |||
@@ -49,9 +49,9 @@ static struct snd_soc_card bf5xx_ad193x; | |||
49 | static int bf5xx_ad193x_startup(struct snd_pcm_substream *substream) | 49 | static int bf5xx_ad193x_startup(struct snd_pcm_substream *substream) |
50 | { | 50 | { |
51 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 51 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
52 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 52 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
53 | 53 | ||
54 | cpu_dai->private_data = sport_handle; | 54 | snd_soc_dai_set_drvdata(cpu_dai, sport_handle); |
55 | return 0; | 55 | return 0; |
56 | } | 56 | } |
57 | 57 | ||
@@ -59,8 +59,8 @@ static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream, | |||
59 | struct snd_pcm_hw_params *params) | 59 | struct snd_pcm_hw_params *params) |
60 | { | 60 | { |
61 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 61 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
62 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 62 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
63 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 63 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
64 | unsigned int channel_map[] = {0, 1, 2, 3, 4, 5, 6, 7}; | 64 | unsigned int channel_map[] = {0, 1, 2, 3, 4, 5, 6, 7}; |
65 | int ret = 0; | 65 | int ret = 0; |
66 | /* set cpu DAI configuration */ | 66 | /* set cpu DAI configuration */ |
@@ -97,23 +97,19 @@ static struct snd_soc_ops bf5xx_ad193x_ops = { | |||
97 | static struct snd_soc_dai_link bf5xx_ad193x_dai = { | 97 | static struct snd_soc_dai_link bf5xx_ad193x_dai = { |
98 | .name = "ad193x", | 98 | .name = "ad193x", |
99 | .stream_name = "AD193X", | 99 | .stream_name = "AD193X", |
100 | .cpu_dai = &bf5xx_tdm_dai, | 100 | .cpu_dai_name = "bf5xx-tdm", |
101 | .codec_dai = &ad193x_dai, | 101 | .codec_dai_name ="ad193x-hifi", |
102 | .platform_name = "bf5xx-tdm-pcm-audio", | ||
103 | .codec_name = "ad193x-codec.5", | ||
102 | .ops = &bf5xx_ad193x_ops, | 104 | .ops = &bf5xx_ad193x_ops, |
103 | }; | 105 | }; |
104 | 106 | ||
105 | static struct snd_soc_card bf5xx_ad193x = { | 107 | static struct snd_soc_card bf5xx_ad193x = { |
106 | .name = "bf5xx_ad193x", | 108 | .name = "bf5xx_ad193x", |
107 | .platform = &bf5xx_tdm_soc_platform, | ||
108 | .dai_link = &bf5xx_ad193x_dai, | 109 | .dai_link = &bf5xx_ad193x_dai, |
109 | .num_links = 1, | 110 | .num_links = 1, |
110 | }; | 111 | }; |
111 | 112 | ||
112 | static struct snd_soc_device bf5xx_ad193x_snd_devdata = { | ||
113 | .card = &bf5xx_ad193x, | ||
114 | .codec_dev = &soc_codec_dev_ad193x, | ||
115 | }; | ||
116 | |||
117 | static struct platform_device *bfxx_ad193x_snd_device; | 113 | static struct platform_device *bfxx_ad193x_snd_device; |
118 | 114 | ||
119 | static int __init bf5xx_ad193x_init(void) | 115 | static int __init bf5xx_ad193x_init(void) |
@@ -124,8 +120,7 @@ static int __init bf5xx_ad193x_init(void) | |||
124 | if (!bfxx_ad193x_snd_device) | 120 | if (!bfxx_ad193x_snd_device) |
125 | return -ENOMEM; | 121 | return -ENOMEM; |
126 | 122 | ||
127 | platform_set_drvdata(bfxx_ad193x_snd_device, &bf5xx_ad193x_snd_devdata); | 123 | platform_set_drvdata(bfxx_ad193x_snd_device, &bf5xx_ad193x); |
128 | bf5xx_ad193x_snd_devdata.dev = &bfxx_ad193x_snd_device->dev; | ||
129 | ret = platform_device_add(bfxx_ad193x_snd_device); | 124 | ret = platform_device_add(bfxx_ad193x_snd_device); |
130 | 125 | ||
131 | if (ret) | 126 | if (ret) |
diff --git a/sound/soc/blackfin/bf5xx-ad1980.c b/sound/soc/blackfin/bf5xx-ad1980.c index 92f7c327bb7a..d57c9c9c9883 100644 --- a/sound/soc/blackfin/bf5xx-ad1980.c +++ b/sound/soc/blackfin/bf5xx-ad1980.c | |||
@@ -56,10 +56,10 @@ static struct snd_soc_card bf5xx_board; | |||
56 | static int bf5xx_board_startup(struct snd_pcm_substream *substream) | 56 | static int bf5xx_board_startup(struct snd_pcm_substream *substream) |
57 | { | 57 | { |
58 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 58 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
59 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 59 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
60 | 60 | ||
61 | pr_debug("%s enter\n", __func__); | 61 | pr_debug("%s enter\n", __func__); |
62 | cpu_dai->private_data = sport_handle; | 62 | snd_soc_dai_set_drvdata(cpu_dai, sport_handle); |
63 | return 0; | 63 | return 0; |
64 | } | 64 | } |
65 | 65 | ||
@@ -70,23 +70,19 @@ static struct snd_soc_ops bf5xx_board_ops = { | |||
70 | static struct snd_soc_dai_link bf5xx_board_dai = { | 70 | static struct snd_soc_dai_link bf5xx_board_dai = { |
71 | .name = "AC97", | 71 | .name = "AC97", |
72 | .stream_name = "AC97 HiFi", | 72 | .stream_name = "AC97 HiFi", |
73 | .cpu_dai = &bfin_ac97_dai, | 73 | .cpu_dai_name = "bfin-ac97", |
74 | .codec_dai = &ad1980_dai, | 74 | .codec_dai_name = "ad1980-hifi", |
75 | .platform_name = "bfin-pcm-audio", | ||
76 | .codec_name = "ad1980-codec", | ||
75 | .ops = &bf5xx_board_ops, | 77 | .ops = &bf5xx_board_ops, |
76 | }; | 78 | }; |
77 | 79 | ||
78 | static struct snd_soc_card bf5xx_board = { | 80 | static struct snd_soc_card bf5xx_board = { |
79 | .name = "bf5xx-board", | 81 | .name = "bf5xx-board", |
80 | .platform = &bf5xx_ac97_soc_platform, | ||
81 | .dai_link = &bf5xx_board_dai, | 82 | .dai_link = &bf5xx_board_dai, |
82 | .num_links = 1, | 83 | .num_links = 1, |
83 | }; | 84 | }; |
84 | 85 | ||
85 | static struct snd_soc_device bf5xx_board_snd_devdata = { | ||
86 | .card = &bf5xx_board, | ||
87 | .codec_dev = &soc_codec_dev_ad1980, | ||
88 | }; | ||
89 | |||
90 | static struct platform_device *bf5xx_board_snd_device; | 86 | static struct platform_device *bf5xx_board_snd_device; |
91 | 87 | ||
92 | static int __init bf5xx_board_init(void) | 88 | static int __init bf5xx_board_init(void) |
@@ -97,8 +93,7 @@ static int __init bf5xx_board_init(void) | |||
97 | if (!bf5xx_board_snd_device) | 93 | if (!bf5xx_board_snd_device) |
98 | return -ENOMEM; | 94 | return -ENOMEM; |
99 | 95 | ||
100 | platform_set_drvdata(bf5xx_board_snd_device, &bf5xx_board_snd_devdata); | 96 | platform_set_drvdata(bf5xx_board_snd_device, &bf5xx_board); |
101 | bf5xx_board_snd_devdata.dev = &bf5xx_board_snd_device->dev; | ||
102 | ret = platform_device_add(bf5xx_board_snd_device); | 97 | ret = platform_device_add(bf5xx_board_snd_device); |
103 | 98 | ||
104 | if (ret) | 99 | if (ret) |
diff --git a/sound/soc/blackfin/bf5xx-ad73311.c b/sound/soc/blackfin/bf5xx-ad73311.c index 9825b71d0e28..900ced54ac79 100644 --- a/sound/soc/blackfin/bf5xx-ad73311.c +++ b/sound/soc/blackfin/bf5xx-ad73311.c | |||
@@ -47,7 +47,6 @@ | |||
47 | #include "../codecs/ad73311.h" | 47 | #include "../codecs/ad73311.h" |
48 | #include "bf5xx-sport.h" | 48 | #include "bf5xx-sport.h" |
49 | #include "bf5xx-i2s-pcm.h" | 49 | #include "bf5xx-i2s-pcm.h" |
50 | #include "bf5xx-i2s.h" | ||
51 | 50 | ||
52 | #if CONFIG_SND_BF5XX_SPORT_NUM == 0 | 51 | #if CONFIG_SND_BF5XX_SPORT_NUM == 0 |
53 | #define bfin_write_SPORT_TCR1 bfin_write_SPORT0_TCR1 | 52 | #define bfin_write_SPORT_TCR1 bfin_write_SPORT0_TCR1 |
@@ -150,10 +149,10 @@ static int bf5xx_probe(struct platform_device *pdev) | |||
150 | static int bf5xx_ad73311_startup(struct snd_pcm_substream *substream) | 149 | static int bf5xx_ad73311_startup(struct snd_pcm_substream *substream) |
151 | { | 150 | { |
152 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 151 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
153 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 152 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
154 | 153 | ||
155 | pr_debug("%s enter\n", __func__); | 154 | pr_debug("%s enter\n", __func__); |
156 | cpu_dai->private_data = sport_handle; | 155 | snd_soc_dai_set_drvdata(cpu_dai, sport_handle); |
157 | return 0; | 156 | return 0; |
158 | } | 157 | } |
159 | 158 | ||
@@ -161,7 +160,7 @@ static int bf5xx_ad73311_hw_params(struct snd_pcm_substream *substream, | |||
161 | struct snd_pcm_hw_params *params) | 160 | struct snd_pcm_hw_params *params) |
162 | { | 161 | { |
163 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 162 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
164 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 163 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
165 | int ret = 0; | 164 | int ret = 0; |
166 | 165 | ||
167 | pr_debug("%s rate %d format %x\n", __func__, params_rate(params), | 166 | pr_debug("%s rate %d format %x\n", __func__, params_rate(params), |
@@ -185,24 +184,20 @@ static struct snd_soc_ops bf5xx_ad73311_ops = { | |||
185 | static struct snd_soc_dai_link bf5xx_ad73311_dai = { | 184 | static struct snd_soc_dai_link bf5xx_ad73311_dai = { |
186 | .name = "ad73311", | 185 | .name = "ad73311", |
187 | .stream_name = "AD73311", | 186 | .stream_name = "AD73311", |
188 | .cpu_dai = &bf5xx_i2s_dai, | 187 | .cpu_dai_name = "bf5xx-i2s", |
189 | .codec_dai = &ad73311_dai, | 188 | .codec_dai_name = "ad73311-hifi", |
189 | .platform_name = "bfin-pcm-audio", | ||
190 | .codec_name = "ad73311-codec", | ||
190 | .ops = &bf5xx_ad73311_ops, | 191 | .ops = &bf5xx_ad73311_ops, |
191 | }; | 192 | }; |
192 | 193 | ||
193 | static struct snd_soc_card bf5xx_ad73311 = { | 194 | static struct snd_soc_card bf5xx_ad73311 = { |
194 | .name = "bf5xx_ad73311", | 195 | .name = "bf5xx_ad73311", |
195 | .platform = &bf5xx_i2s_soc_platform, | ||
196 | .probe = bf5xx_probe, | 196 | .probe = bf5xx_probe, |
197 | .dai_link = &bf5xx_ad73311_dai, | 197 | .dai_link = &bf5xx_ad73311_dai, |
198 | .num_links = 1, | 198 | .num_links = 1, |
199 | }; | 199 | }; |
200 | 200 | ||
201 | static struct snd_soc_device bf5xx_ad73311_snd_devdata = { | ||
202 | .card = &bf5xx_ad73311, | ||
203 | .codec_dev = &soc_codec_dev_ad73311, | ||
204 | }; | ||
205 | |||
206 | static struct platform_device *bf5xx_ad73311_snd_device; | 201 | static struct platform_device *bf5xx_ad73311_snd_device; |
207 | 202 | ||
208 | static int __init bf5xx_ad73311_init(void) | 203 | static int __init bf5xx_ad73311_init(void) |
@@ -214,8 +209,7 @@ static int __init bf5xx_ad73311_init(void) | |||
214 | if (!bf5xx_ad73311_snd_device) | 209 | if (!bf5xx_ad73311_snd_device) |
215 | return -ENOMEM; | 210 | return -ENOMEM; |
216 | 211 | ||
217 | platform_set_drvdata(bf5xx_ad73311_snd_device, &bf5xx_ad73311_snd_devdata); | 212 | platform_set_drvdata(bf5xx_ad73311_snd_device, &bf5xx_ad73311); |
218 | bf5xx_ad73311_snd_devdata.dev = &bf5xx_ad73311_snd_device->dev; | ||
219 | ret = platform_device_add(bf5xx_ad73311_snd_device); | 213 | ret = platform_device_add(bf5xx_ad73311_snd_device); |
220 | 214 | ||
221 | if (ret) | 215 | if (ret) |
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c index 1d2a1adf2575..890a0dccf902 100644 --- a/sound/soc/blackfin/bf5xx-i2s-pcm.c +++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <asm/dma.h> | 40 | #include <asm/dma.h> |
41 | 41 | ||
42 | #include "bf5xx-i2s-pcm.h" | 42 | #include "bf5xx-i2s-pcm.h" |
43 | #include "bf5xx-i2s.h" | ||
44 | #include "bf5xx-sport.h" | 43 | #include "bf5xx-sport.h" |
45 | 44 | ||
46 | static void bf5xx_dma_irq(void *data) | 45 | static void bf5xx_dma_irq(void *data) |
@@ -257,14 +256,14 @@ int bf5xx_pcm_i2s_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
257 | if (!card->dev->coherent_dma_mask) | 256 | if (!card->dev->coherent_dma_mask) |
258 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); | 257 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); |
259 | 258 | ||
260 | if (dai->playback.channels_min) { | 259 | if (dai->driver->playback.channels_min) { |
261 | ret = bf5xx_pcm_preallocate_dma_buffer(pcm, | 260 | ret = bf5xx_pcm_preallocate_dma_buffer(pcm, |
262 | SNDRV_PCM_STREAM_PLAYBACK); | 261 | SNDRV_PCM_STREAM_PLAYBACK); |
263 | if (ret) | 262 | if (ret) |
264 | goto out; | 263 | goto out; |
265 | } | 264 | } |
266 | 265 | ||
267 | if (dai->capture.channels_min) { | 266 | if (dai->driver->capture.channels_min) { |
268 | ret = bf5xx_pcm_preallocate_dma_buffer(pcm, | 267 | ret = bf5xx_pcm_preallocate_dma_buffer(pcm, |
269 | SNDRV_PCM_STREAM_CAPTURE); | 268 | SNDRV_PCM_STREAM_CAPTURE); |
270 | if (ret) | 269 | if (ret) |
@@ -274,25 +273,44 @@ int bf5xx_pcm_i2s_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
274 | return ret; | 273 | return ret; |
275 | } | 274 | } |
276 | 275 | ||
277 | struct snd_soc_platform bf5xx_i2s_soc_platform = { | 276 | static struct snd_soc_platform_driver bf5xx_i2s_soc_platform = { |
278 | .name = "bf5xx-audio", | 277 | .ops = &bf5xx_pcm_i2s_ops, |
279 | .pcm_ops = &bf5xx_pcm_i2s_ops, | ||
280 | .pcm_new = bf5xx_pcm_i2s_new, | 278 | .pcm_new = bf5xx_pcm_i2s_new, |
281 | .pcm_free = bf5xx_pcm_free_dma_buffers, | 279 | .pcm_free = bf5xx_pcm_free_dma_buffers, |
282 | }; | 280 | }; |
283 | EXPORT_SYMBOL_GPL(bf5xx_i2s_soc_platform); | ||
284 | 281 | ||
285 | static int __init bfin_i2s_init(void) | 282 | static int __devinit bfin_i2s_soc_platform_probe(struct platform_device *pdev) |
286 | { | 283 | { |
287 | return snd_soc_register_platform(&bf5xx_i2s_soc_platform); | 284 | return snd_soc_register_platform(&pdev->dev, &bf5xx_i2s_soc_platform); |
288 | } | 285 | } |
289 | module_init(bfin_i2s_init); | ||
290 | 286 | ||
291 | static void __exit bfin_i2s_exit(void) | 287 | static int __devexit bfin_i2s_soc_platform_remove(struct platform_device *pdev) |
292 | { | 288 | { |
293 | snd_soc_unregister_platform(&bf5xx_i2s_soc_platform); | 289 | snd_soc_unregister_platform(&pdev->dev); |
290 | return 0; | ||
291 | } | ||
292 | |||
293 | static struct platform_driver bfin_i2s_pcm_driver = { | ||
294 | .driver = { | ||
295 | .name = "bfin-pcm-audio", | ||
296 | .owner = THIS_MODULE, | ||
297 | }, | ||
298 | |||
299 | .probe = bfin_i2s_soc_platform_probe, | ||
300 | .remove = __devexit_p(bfin_i2s_soc_platform_remove), | ||
301 | }; | ||
302 | |||
303 | static int __init snd_bfin_i2s_pcm_init(void) | ||
304 | { | ||
305 | return platform_driver_register(&bfin_i2s_pcm_driver); | ||
306 | } | ||
307 | module_init(snd_bfin_i2s_pcm_init); | ||
308 | |||
309 | static void __exit snd_bfin_i2s_pcm_exit(void) | ||
310 | { | ||
311 | platform_driver_unregister(&bfin_i2s_pcm_driver); | ||
294 | } | 312 | } |
295 | module_exit(bfin_i2s_exit); | 313 | module_exit(snd_bfin_i2s_pcm_exit); |
296 | 314 | ||
297 | MODULE_AUTHOR("Cliff Cai"); | 315 | MODULE_AUTHOR("Cliff Cai"); |
298 | MODULE_DESCRIPTION("ADI Blackfin I2S PCM DMA module"); | 316 | MODULE_DESCRIPTION("ADI Blackfin I2S PCM DMA module"); |
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.h b/sound/soc/blackfin/bf5xx-i2s-pcm.h index 4d4609a97c59..0c2c5a68d4ff 100644 --- a/sound/soc/blackfin/bf5xx-i2s-pcm.h +++ b/sound/soc/blackfin/bf5xx-i2s-pcm.h | |||
@@ -23,7 +23,4 @@ struct bf5xx_gpio { | |||
23 | u32 frm; | 23 | u32 frm; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | /* platform data */ | ||
27 | extern struct snd_soc_platform bf5xx_i2s_soc_platform; | ||
28 | |||
29 | #endif | 26 | #endif |
diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c index 3e6ada0dd1c4..d453b1e9d607 100644 --- a/sound/soc/blackfin/bf5xx-i2s.c +++ b/sound/soc/blackfin/bf5xx-i2s.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/gpio.h> | 42 | #include <linux/gpio.h> |
43 | 43 | ||
44 | #include "bf5xx-sport.h" | 44 | #include "bf5xx-sport.h" |
45 | #include "bf5xx-i2s.h" | ||
46 | 45 | ||
47 | struct bf5xx_i2s_port { | 46 | struct bf5xx_i2s_port { |
48 | u16 tcr1; | 47 | u16 tcr1; |
@@ -195,8 +194,7 @@ static void bf5xx_i2s_shutdown(struct snd_pcm_substream *substream, | |||
195 | bf5xx_i2s.configured = 0; | 194 | bf5xx_i2s.configured = 0; |
196 | } | 195 | } |
197 | 196 | ||
198 | static int bf5xx_i2s_probe(struct platform_device *pdev, | 197 | static int bf5xx_i2s_probe(struct snd_soc_dai *dai) |
199 | struct snd_soc_dai *dai) | ||
200 | { | 198 | { |
201 | pr_debug("%s enter\n", __func__); | 199 | pr_debug("%s enter\n", __func__); |
202 | if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) { | 200 | if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) { |
@@ -215,11 +213,11 @@ static int bf5xx_i2s_probe(struct platform_device *pdev, | |||
215 | return 0; | 213 | return 0; |
216 | } | 214 | } |
217 | 215 | ||
218 | static void bf5xx_i2s_remove(struct platform_device *pdev, | 216 | static int bf5xx_i2s_remove(struct snd_soc_dai *dai) |
219 | struct snd_soc_dai *dai) | ||
220 | { | 217 | { |
221 | pr_debug("%s enter\n", __func__); | 218 | pr_debug("%s enter\n", __func__); |
222 | peripheral_free_list(&sport_req[sport_num][0]); | 219 | peripheral_free_list(&sport_req[sport_num][0]); |
220 | return 0; | ||
223 | } | 221 | } |
224 | 222 | ||
225 | #ifdef CONFIG_PM | 223 | #ifdef CONFIG_PM |
@@ -228,9 +226,9 @@ static int bf5xx_i2s_suspend(struct snd_soc_dai *dai) | |||
228 | 226 | ||
229 | pr_debug("%s : sport %d\n", __func__, dai->id); | 227 | pr_debug("%s : sport %d\n", __func__, dai->id); |
230 | 228 | ||
231 | if (dai->capture.active) | 229 | if (dai->capture_active) |
232 | sport_rx_stop(sport_handle); | 230 | sport_rx_stop(sport_handle); |
233 | if (dai->playback.active) | 231 | if (dai->playback_active) |
234 | sport_tx_stop(sport_handle); | 232 | sport_tx_stop(sport_handle); |
235 | return 0; | 233 | return 0; |
236 | } | 234 | } |
@@ -277,9 +275,7 @@ static struct snd_soc_dai_ops bf5xx_i2s_dai_ops = { | |||
277 | .set_fmt = bf5xx_i2s_set_dai_fmt, | 275 | .set_fmt = bf5xx_i2s_set_dai_fmt, |
278 | }; | 276 | }; |
279 | 277 | ||
280 | struct snd_soc_dai bf5xx_i2s_dai = { | 278 | static struct snd_soc_dai_driver bf5xx_i2s_dai = { |
281 | .name = "bf5xx-i2s", | ||
282 | .id = 0, | ||
283 | .probe = bf5xx_i2s_probe, | 279 | .probe = bf5xx_i2s_probe, |
284 | .remove = bf5xx_i2s_remove, | 280 | .remove = bf5xx_i2s_remove, |
285 | .suspend = bf5xx_i2s_suspend, | 281 | .suspend = bf5xx_i2s_suspend, |
@@ -296,18 +292,39 @@ struct snd_soc_dai bf5xx_i2s_dai = { | |||
296 | .formats = BF5XX_I2S_FORMATS,}, | 292 | .formats = BF5XX_I2S_FORMATS,}, |
297 | .ops = &bf5xx_i2s_dai_ops, | 293 | .ops = &bf5xx_i2s_dai_ops, |
298 | }; | 294 | }; |
299 | EXPORT_SYMBOL_GPL(bf5xx_i2s_dai); | 295 | |
296 | static int bfin_i2s_drv_probe(struct platform_device *pdev) | ||
297 | { | ||
298 | return snd_soc_register_dai(&pdev->dev, &bf5xx_i2s_dai); | ||
299 | } | ||
300 | |||
301 | static int __devexit bfin_i2s_drv_remove(struct platform_device *pdev) | ||
302 | { | ||
303 | snd_soc_unregister_dai(&pdev->dev); | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | static struct platform_driver bfin_i2s_driver = { | ||
308 | .probe = bfin_i2s_drv_probe, | ||
309 | .remove = __devexit_p(bfin_i2s_drv_remove), | ||
310 | |||
311 | .driver = { | ||
312 | .name = "bf5xx-i2s", | ||
313 | .owner = THIS_MODULE, | ||
314 | }, | ||
315 | }; | ||
300 | 316 | ||
301 | static int __init bfin_i2s_init(void) | 317 | static int __init bfin_i2s_init(void) |
302 | { | 318 | { |
303 | return snd_soc_register_dai(&bf5xx_i2s_dai); | 319 | return platform_driver_register(&bfin_i2s_driver); |
304 | } | 320 | } |
305 | module_init(bfin_i2s_init); | ||
306 | 321 | ||
307 | static void __exit bfin_i2s_exit(void) | 322 | static void __exit bfin_i2s_exit(void) |
308 | { | 323 | { |
309 | snd_soc_unregister_dai(&bf5xx_i2s_dai); | 324 | platform_driver_unregister(&bfin_i2s_driver); |
310 | } | 325 | } |
326 | |||
327 | module_init(bfin_i2s_init); | ||
311 | module_exit(bfin_i2s_exit); | 328 | module_exit(bfin_i2s_exit); |
312 | 329 | ||
313 | /* Module information */ | 330 | /* Module information */ |
diff --git a/sound/soc/blackfin/bf5xx-i2s.h b/sound/soc/blackfin/bf5xx-i2s.h deleted file mode 100644 index 264ecdcba35a..000000000000 --- a/sound/soc/blackfin/bf5xx-i2s.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* | ||
2 | * sound/soc/blackfin/bf5xx-i2s.h | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef _BF5XX_I2S_H | ||
10 | #define _BF5XX_I2S_H | ||
11 | |||
12 | extern struct snd_soc_dai bf5xx_i2s_dai; | ||
13 | |||
14 | #endif | ||
diff --git a/sound/soc/blackfin/bf5xx-ssm2602.c b/sound/soc/blackfin/bf5xx-ssm2602.c index 3a00fa4dbe6d..36f2769eb912 100644 --- a/sound/soc/blackfin/bf5xx-ssm2602.c +++ b/sound/soc/blackfin/bf5xx-ssm2602.c | |||
@@ -42,17 +42,16 @@ | |||
42 | #include "../codecs/ssm2602.h" | 42 | #include "../codecs/ssm2602.h" |
43 | #include "bf5xx-sport.h" | 43 | #include "bf5xx-sport.h" |
44 | #include "bf5xx-i2s-pcm.h" | 44 | #include "bf5xx-i2s-pcm.h" |
45 | #include "bf5xx-i2s.h" | ||
46 | 45 | ||
47 | static struct snd_soc_card bf5xx_ssm2602; | 46 | static struct snd_soc_card bf5xx_ssm2602; |
48 | 47 | ||
49 | static int bf5xx_ssm2602_startup(struct snd_pcm_substream *substream) | 48 | static int bf5xx_ssm2602_startup(struct snd_pcm_substream *substream) |
50 | { | 49 | { |
51 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 50 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
52 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 51 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
53 | 52 | ||
54 | pr_debug("%s enter\n", __func__); | 53 | pr_debug("%s enter\n", __func__); |
55 | cpu_dai->private_data = sport_handle; | 54 | snd_soc_dai_set_drvdata(cpu_dai, sport_handle); |
56 | return 0; | 55 | return 0; |
57 | } | 56 | } |
58 | 57 | ||
@@ -60,8 +59,8 @@ static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream, | |||
60 | struct snd_pcm_hw_params *params) | 59 | struct snd_pcm_hw_params *params) |
61 | { | 60 | { |
62 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 61 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
63 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 62 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
64 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 63 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
65 | unsigned int clk = 0; | 64 | unsigned int clk = 0; |
66 | int ret = 0; | 65 | int ret = 0; |
67 | 66 | ||
@@ -118,36 +117,19 @@ static struct snd_soc_ops bf5xx_ssm2602_ops = { | |||
118 | static struct snd_soc_dai_link bf5xx_ssm2602_dai = { | 117 | static struct snd_soc_dai_link bf5xx_ssm2602_dai = { |
119 | .name = "ssm2602", | 118 | .name = "ssm2602", |
120 | .stream_name = "SSM2602", | 119 | .stream_name = "SSM2602", |
121 | .cpu_dai = &bf5xx_i2s_dai, | 120 | .cpu_dai_name = "bf5xx-i2s", |
122 | .codec_dai = &ssm2602_dai, | 121 | .codec_dai_name = "ssm2602-hifi", |
122 | .platform_name = "bf5xx-pcm-audio", | ||
123 | .codec_name = "ssm2602-codec.0-0x1b", | ||
123 | .ops = &bf5xx_ssm2602_ops, | 124 | .ops = &bf5xx_ssm2602_ops, |
124 | }; | 125 | }; |
125 | 126 | ||
126 | /* | ||
127 | * SSM2602 2 wire address is determined by CSB | ||
128 | * state during powerup. | ||
129 | * low = 0x1a | ||
130 | * high = 0x1b | ||
131 | */ | ||
132 | |||
133 | static struct ssm2602_setup_data bf5xx_ssm2602_setup = { | ||
134 | .i2c_bus = 0, | ||
135 | .i2c_address = 0x1b, | ||
136 | }; | ||
137 | |||
138 | static struct snd_soc_card bf5xx_ssm2602 = { | 127 | static struct snd_soc_card bf5xx_ssm2602 = { |
139 | .name = "bf5xx_ssm2602", | 128 | .name = "bf5xx_ssm2602", |
140 | .platform = &bf5xx_i2s_soc_platform, | ||
141 | .dai_link = &bf5xx_ssm2602_dai, | 129 | .dai_link = &bf5xx_ssm2602_dai, |
142 | .num_links = 1, | 130 | .num_links = 1, |
143 | }; | 131 | }; |
144 | 132 | ||
145 | static struct snd_soc_device bf5xx_ssm2602_snd_devdata = { | ||
146 | .card = &bf5xx_ssm2602, | ||
147 | .codec_dev = &soc_codec_dev_ssm2602, | ||
148 | .codec_data = &bf5xx_ssm2602_setup, | ||
149 | }; | ||
150 | |||
151 | static struct platform_device *bf5xx_ssm2602_snd_device; | 133 | static struct platform_device *bf5xx_ssm2602_snd_device; |
152 | 134 | ||
153 | static int __init bf5xx_ssm2602_init(void) | 135 | static int __init bf5xx_ssm2602_init(void) |
@@ -159,9 +141,7 @@ static int __init bf5xx_ssm2602_init(void) | |||
159 | if (!bf5xx_ssm2602_snd_device) | 141 | if (!bf5xx_ssm2602_snd_device) |
160 | return -ENOMEM; | 142 | return -ENOMEM; |
161 | 143 | ||
162 | platform_set_drvdata(bf5xx_ssm2602_snd_device, | 144 | platform_set_drvdata(bf5xx_ssm2602_snd_device, &bf5xx_ssm2602); |
163 | &bf5xx_ssm2602_snd_devdata); | ||
164 | bf5xx_ssm2602_snd_devdata.dev = &bf5xx_ssm2602_snd_device->dev; | ||
165 | ret = platform_device_add(bf5xx_ssm2602_snd_device); | 145 | ret = platform_device_add(bf5xx_ssm2602_snd_device); |
166 | 146 | ||
167 | if (ret) | 147 | if (ret) |
diff --git a/sound/soc/blackfin/bf5xx-tdm-pcm.c b/sound/soc/blackfin/bf5xx-tdm-pcm.c index 6bac1ac1a315..74cf759b78a6 100644 --- a/sound/soc/blackfin/bf5xx-tdm-pcm.c +++ b/sound/soc/blackfin/bf5xx-tdm-pcm.c | |||
@@ -290,14 +290,14 @@ static int bf5xx_pcm_tdm_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
290 | if (!card->dev->coherent_dma_mask) | 290 | if (!card->dev->coherent_dma_mask) |
291 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); | 291 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); |
292 | 292 | ||
293 | if (dai->playback.channels_min) { | 293 | if (dai->driver->playback.channels_min) { |
294 | ret = bf5xx_pcm_preallocate_dma_buffer(pcm, | 294 | ret = bf5xx_pcm_preallocate_dma_buffer(pcm, |
295 | SNDRV_PCM_STREAM_PLAYBACK); | 295 | SNDRV_PCM_STREAM_PLAYBACK); |
296 | if (ret) | 296 | if (ret) |
297 | goto out; | 297 | goto out; |
298 | } | 298 | } |
299 | 299 | ||
300 | if (dai->capture.channels_min) { | 300 | if (dai->driver->capture.channels_min) { |
301 | ret = bf5xx_pcm_preallocate_dma_buffer(pcm, | 301 | ret = bf5xx_pcm_preallocate_dma_buffer(pcm, |
302 | SNDRV_PCM_STREAM_CAPTURE); | 302 | SNDRV_PCM_STREAM_CAPTURE); |
303 | if (ret) | 303 | if (ret) |
@@ -307,25 +307,44 @@ out: | |||
307 | return ret; | 307 | return ret; |
308 | } | 308 | } |
309 | 309 | ||
310 | struct snd_soc_platform bf5xx_tdm_soc_platform = { | 310 | static struct snd_soc_platform_driver bf5xx_tdm_soc_platform = { |
311 | .name = "bf5xx-audio", | 311 | .ops = &bf5xx_pcm_tdm_ops, |
312 | .pcm_ops = &bf5xx_pcm_tdm_ops, | ||
313 | .pcm_new = bf5xx_pcm_tdm_new, | 312 | .pcm_new = bf5xx_pcm_tdm_new, |
314 | .pcm_free = bf5xx_pcm_free_dma_buffers, | 313 | .pcm_free = bf5xx_pcm_free_dma_buffers, |
315 | }; | 314 | }; |
316 | EXPORT_SYMBOL_GPL(bf5xx_tdm_soc_platform); | ||
317 | 315 | ||
318 | static int __init bfin_pcm_tdm_init(void) | 316 | static int __devinit bf5xx_soc_platform_probe(struct platform_device *pdev) |
319 | { | 317 | { |
320 | return snd_soc_register_platform(&bf5xx_tdm_soc_platform); | 318 | return snd_soc_register_platform(&pdev->dev, &bf5xx_tdm_soc_platform); |
321 | } | 319 | } |
322 | module_init(bfin_pcm_tdm_init); | ||
323 | 320 | ||
324 | static void __exit bfin_pcm_tdm_exit(void) | 321 | static int __devexit bf5xx_soc_platform_remove(struct platform_device *pdev) |
325 | { | 322 | { |
326 | snd_soc_unregister_platform(&bf5xx_tdm_soc_platform); | 323 | snd_soc_unregister_platform(&pdev->dev); |
324 | return 0; | ||
325 | } | ||
326 | |||
327 | static struct platform_driver bfin_tdm_driver = { | ||
328 | .driver = { | ||
329 | .name = "bf5xx-tdm-pcm-audio", | ||
330 | .owner = THIS_MODULE, | ||
331 | }, | ||
332 | |||
333 | .probe = bf5xx_soc_platform_probe, | ||
334 | .remove = __devexit_p(bf5xx_soc_platform_remove), | ||
335 | }; | ||
336 | |||
337 | static int __init snd_bfin_tdm_init(void) | ||
338 | { | ||
339 | return platform_driver_register(&bfin_tdm_driver); | ||
340 | } | ||
341 | module_init(snd_bfin_tdm_init); | ||
342 | |||
343 | static void __exit snd_bfin_tdm_exit(void) | ||
344 | { | ||
345 | platform_driver_unregister(&bfin_tdm_driver); | ||
327 | } | 346 | } |
328 | module_exit(bfin_pcm_tdm_exit); | 347 | module_exit(snd_bfin_tdm_exit); |
329 | 348 | ||
330 | MODULE_AUTHOR("Barry Song"); | 349 | MODULE_AUTHOR("Barry Song"); |
331 | MODULE_DESCRIPTION("ADI Blackfin TDM PCM DMA module"); | 350 | MODULE_DESCRIPTION("ADI Blackfin TDM PCM DMA module"); |
diff --git a/sound/soc/blackfin/bf5xx-tdm-pcm.h b/sound/soc/blackfin/bf5xx-tdm-pcm.h index ddc5047df88c..7f8cc01c4477 100644 --- a/sound/soc/blackfin/bf5xx-tdm-pcm.h +++ b/sound/soc/blackfin/bf5xx-tdm-pcm.h | |||
@@ -15,7 +15,4 @@ struct bf5xx_pcm_dma_params { | |||
15 | char *name; /* stream identifier */ | 15 | char *name; /* stream identifier */ |
16 | }; | 16 | }; |
17 | 17 | ||
18 | /* platform data */ | ||
19 | extern struct snd_soc_platform bf5xx_tdm_soc_platform; | ||
20 | |||
21 | #endif | 18 | #endif |
diff --git a/sound/soc/blackfin/bf5xx-tdm.c b/sound/soc/blackfin/bf5xx-tdm.c index 24c14269f4bc..125123929f16 100644 --- a/sound/soc/blackfin/bf5xx-tdm.c +++ b/sound/soc/blackfin/bf5xx-tdm.c | |||
@@ -214,9 +214,9 @@ static int bf5xx_tdm_suspend(struct snd_soc_dai *dai) | |||
214 | 214 | ||
215 | if (!dai->active) | 215 | if (!dai->active) |
216 | return 0; | 216 | return 0; |
217 | if (dai->capture.active) | 217 | if (dai->capture_active) |
218 | sport_rx_stop(sport); | 218 | sport_rx_stop(sport); |
219 | if (dai->playback.active) | 219 | if (dai->playback_active) |
220 | sport_tx_stop(sport); | 220 | sport_tx_stop(sport); |
221 | return 0; | 221 | return 0; |
222 | } | 222 | } |
@@ -224,7 +224,7 @@ static int bf5xx_tdm_suspend(struct snd_soc_dai *dai) | |||
224 | static int bf5xx_tdm_resume(struct snd_soc_dai *dai) | 224 | static int bf5xx_tdm_resume(struct snd_soc_dai *dai) |
225 | { | 225 | { |
226 | int ret; | 226 | int ret; |
227 | struct sport_device *sport = dai->private_data; | 227 | struct sport_device *sport = snd_soc_dai_get_drvdata(dai); |
228 | 228 | ||
229 | if (!dai->active) | 229 | if (!dai->active) |
230 | return 0; | 230 | return 0; |
@@ -262,9 +262,7 @@ static struct snd_soc_dai_ops bf5xx_tdm_dai_ops = { | |||
262 | .set_channel_map = bf5xx_tdm_set_channel_map, | 262 | .set_channel_map = bf5xx_tdm_set_channel_map, |
263 | }; | 263 | }; |
264 | 264 | ||
265 | struct snd_soc_dai bf5xx_tdm_dai = { | 265 | static struct snd_soc_dai_driver bf5xx_tdm_dai = { |
266 | .name = "bf5xx-tdm", | ||
267 | .id = 0, | ||
268 | .suspend = bf5xx_tdm_suspend, | 266 | .suspend = bf5xx_tdm_suspend, |
269 | .resume = bf5xx_tdm_resume, | 267 | .resume = bf5xx_tdm_resume, |
270 | .playback = { | 268 | .playback = { |
@@ -279,7 +277,6 @@ struct snd_soc_dai bf5xx_tdm_dai = { | |||
279 | .formats = SNDRV_PCM_FMTBIT_S32_LE,}, | 277 | .formats = SNDRV_PCM_FMTBIT_S32_LE,}, |
280 | .ops = &bf5xx_tdm_dai_ops, | 278 | .ops = &bf5xx_tdm_dai_ops, |
281 | }; | 279 | }; |
282 | EXPORT_SYMBOL_GPL(bf5xx_tdm_dai); | ||
283 | 280 | ||
284 | static int __devinit bfin_tdm_probe(struct platform_device *pdev) | 281 | static int __devinit bfin_tdm_probe(struct platform_device *pdev) |
285 | { | 282 | { |
@@ -320,7 +317,7 @@ static int __devinit bfin_tdm_probe(struct platform_device *pdev) | |||
320 | goto sport_config_err; | 317 | goto sport_config_err; |
321 | } | 318 | } |
322 | 319 | ||
323 | ret = snd_soc_register_dai(&bf5xx_tdm_dai); | 320 | ret = snd_soc_register_dai(&pdev->dev, &bf5xx_tdm_dai); |
324 | if (ret) { | 321 | if (ret) { |
325 | pr_err("Failed to register DAI: %d\n", ret); | 322 | pr_err("Failed to register DAI: %d\n", ret); |
326 | goto sport_config_err; | 323 | goto sport_config_err; |
@@ -337,7 +334,7 @@ sport_config_err: | |||
337 | static int __devexit bfin_tdm_remove(struct platform_device *pdev) | 334 | static int __devexit bfin_tdm_remove(struct platform_device *pdev) |
338 | { | 335 | { |
339 | peripheral_free_list(&sport_req[sport_num][0]); | 336 | peripheral_free_list(&sport_req[sport_num][0]); |
340 | snd_soc_unregister_dai(&bf5xx_tdm_dai); | 337 | snd_soc_unregister_dai(&pdev->dev); |
341 | 338 | ||
342 | return 0; | 339 | return 0; |
343 | } | 340 | } |
diff --git a/sound/soc/blackfin/bf5xx-tdm.h b/sound/soc/blackfin/bf5xx-tdm.h index 04189a18c1ba..e986a3ea3315 100644 --- a/sound/soc/blackfin/bf5xx-tdm.h +++ b/sound/soc/blackfin/bf5xx-tdm.h | |||
@@ -20,6 +20,4 @@ struct bf5xx_tdm_port { | |||
20 | int configured; | 20 | int configured; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | extern struct snd_soc_dai bf5xx_tdm_dai; | ||
24 | |||
25 | #endif | 23 | #endif |