diff options
49 files changed, 69 insertions, 450 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index b1245e3acdfc..7f3a4c5028da 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -226,7 +226,6 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, | |||
226 | /* pcm <-> DAI connect */ | 226 | /* pcm <-> DAI connect */ |
227 | void snd_soc_free_pcms(struct snd_soc_device *socdev); | 227 | void snd_soc_free_pcms(struct snd_soc_device *socdev); |
228 | int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid); | 228 | int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid); |
229 | int snd_soc_init_card(struct snd_soc_device *socdev); | ||
230 | 229 | ||
231 | /* set runtime hw params */ | 230 | /* set runtime hw params */ |
232 | int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, | 231 | int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, |
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index 932299bb5d1e..69bd0acc81c8 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c | |||
@@ -117,9 +117,6 @@ static int ac97_soc_probe(struct platform_device *pdev) | |||
117 | if (ret < 0) | 117 | if (ret < 0) |
118 | goto bus_err; | 118 | goto bus_err; |
119 | 119 | ||
120 | ret = snd_soc_init_card(socdev); | ||
121 | if (ret < 0) | ||
122 | goto bus_err; | ||
123 | return 0; | 120 | return 0; |
124 | 121 | ||
125 | bus_err: | 122 | bus_err: |
diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c index c48485f2c55d..2e360c243075 100644 --- a/sound/soc/codecs/ad1836.c +++ b/sound/soc/codecs/ad1836.c | |||
@@ -387,12 +387,6 @@ static int ad1836_probe(struct platform_device *pdev) | |||
387 | snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); | 387 | snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); |
388 | snd_soc_dapm_new_widgets(codec); | 388 | snd_soc_dapm_new_widgets(codec); |
389 | 389 | ||
390 | ret = snd_soc_init_card(socdev); | ||
391 | if (ret < 0) { | ||
392 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
393 | goto card_err; | ||
394 | } | ||
395 | |||
396 | return ret; | 390 | return ret; |
397 | 391 | ||
398 | card_err: | 392 | card_err: |
diff --git a/sound/soc/codecs/ad1938.c b/sound/soc/codecs/ad1938.c index 34b30efc3cb0..09c008ad1476 100644 --- a/sound/soc/codecs/ad1938.c +++ b/sound/soc/codecs/ad1938.c | |||
@@ -596,12 +596,6 @@ static int ad1938_probe(struct platform_device *pdev) | |||
596 | 596 | ||
597 | ad1938_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 597 | ad1938_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
598 | 598 | ||
599 | ret = snd_soc_init_card(socdev); | ||
600 | if (ret < 0) { | ||
601 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
602 | goto card_err; | ||
603 | } | ||
604 | |||
605 | return ret; | 599 | return ret; |
606 | 600 | ||
607 | card_err: | 601 | card_err: |
diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index d7440a982d22..39c0f7584e65 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c | |||
@@ -257,11 +257,6 @@ static int ad1980_soc_probe(struct platform_device *pdev) | |||
257 | 257 | ||
258 | snd_soc_add_controls(codec, ad1980_snd_ac97_controls, | 258 | snd_soc_add_controls(codec, ad1980_snd_ac97_controls, |
259 | ARRAY_SIZE(ad1980_snd_ac97_controls)); | 259 | ARRAY_SIZE(ad1980_snd_ac97_controls)); |
260 | ret = snd_soc_init_card(socdev); | ||
261 | if (ret < 0) { | ||
262 | printk(KERN_ERR "ad1980: failed to register card\n"); | ||
263 | goto reset_err; | ||
264 | } | ||
265 | 260 | ||
266 | return 0; | 261 | return 0; |
267 | 262 | ||
diff --git a/sound/soc/codecs/ad73311.c b/sound/soc/codecs/ad73311.c index e61dac5e7b8f..d2fcc601722c 100644 --- a/sound/soc/codecs/ad73311.c +++ b/sound/soc/codecs/ad73311.c | |||
@@ -64,16 +64,8 @@ static int ad73311_soc_probe(struct platform_device *pdev) | |||
64 | goto pcm_err; | 64 | goto pcm_err; |
65 | } | 65 | } |
66 | 66 | ||
67 | ret = snd_soc_init_card(socdev); | ||
68 | if (ret < 0) { | ||
69 | printk(KERN_ERR "ad73311: failed to register card\n"); | ||
70 | goto register_err; | ||
71 | } | ||
72 | |||
73 | return ret; | 67 | return ret; |
74 | 68 | ||
75 | register_err: | ||
76 | snd_soc_free_pcms(socdev); | ||
77 | pcm_err: | 69 | pcm_err: |
78 | kfree(socdev->card->codec); | 70 | kfree(socdev->card->codec); |
79 | socdev->card->codec = NULL; | 71 | socdev->card->codec = NULL; |
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c index 4d47bc4f7428..3a14c6fc4f5e 100644 --- a/sound/soc/codecs/ak4104.c +++ b/sound/soc/codecs/ak4104.c | |||
@@ -313,14 +313,6 @@ static int ak4104_probe(struct platform_device *pdev) | |||
313 | return ret; | 313 | return ret; |
314 | } | 314 | } |
315 | 315 | ||
316 | /* Register the socdev */ | ||
317 | ret = snd_soc_init_card(socdev); | ||
318 | if (ret < 0) { | ||
319 | dev_err(codec->dev, "failed to register card\n"); | ||
320 | snd_soc_free_pcms(socdev); | ||
321 | return ret; | ||
322 | } | ||
323 | |||
324 | return 0; | 316 | return 0; |
325 | } | 317 | } |
326 | 318 | ||
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c index 0abec0d29a96..57a6846a9a1f 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c | |||
@@ -485,17 +485,9 @@ static int ak4535_init(struct snd_soc_device *socdev) | |||
485 | snd_soc_add_controls(codec, ak4535_snd_controls, | 485 | snd_soc_add_controls(codec, ak4535_snd_controls, |
486 | ARRAY_SIZE(ak4535_snd_controls)); | 486 | ARRAY_SIZE(ak4535_snd_controls)); |
487 | ak4535_add_widgets(codec); | 487 | ak4535_add_widgets(codec); |
488 | ret = snd_soc_init_card(socdev); | ||
489 | if (ret < 0) { | ||
490 | printk(KERN_ERR "ak4535: failed to register card\n"); | ||
491 | goto card_err; | ||
492 | } | ||
493 | 488 | ||
494 | return ret; | 489 | return ret; |
495 | 490 | ||
496 | card_err: | ||
497 | snd_soc_free_pcms(socdev); | ||
498 | snd_soc_dapm_free(socdev); | ||
499 | pcm_err: | 491 | pcm_err: |
500 | kfree(codec->reg_cache); | 492 | kfree(codec->reg_cache); |
501 | 493 | ||
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index e057c7b578df..b69861d52161 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c | |||
@@ -442,18 +442,9 @@ static int ak4642_probe(struct platform_device *pdev) | |||
442 | goto pcm_err; | 442 | goto pcm_err; |
443 | } | 443 | } |
444 | 444 | ||
445 | ret = snd_soc_init_card(socdev); | ||
446 | if (ret < 0) { | ||
447 | printk(KERN_ERR "ak4642: failed to register card\n"); | ||
448 | goto card_err; | ||
449 | } | ||
450 | |||
451 | dev_info(&pdev->dev, "AK4642 Audio Codec %s", AK4642_VERSION); | 445 | dev_info(&pdev->dev, "AK4642 Audio Codec %s", AK4642_VERSION); |
452 | return ret; | 446 | return ret; |
453 | 447 | ||
454 | card_err: | ||
455 | snd_soc_free_pcms(socdev); | ||
456 | snd_soc_dapm_free(socdev); | ||
457 | pcm_err: | 448 | pcm_err: |
458 | return ret; | 449 | return ret; |
459 | 450 | ||
diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c index b61214d1c5de..364832ccd748 100644 --- a/sound/soc/codecs/ak4671.c +++ b/sound/soc/codecs/ak4671.c | |||
@@ -662,19 +662,10 @@ static int ak4671_probe(struct platform_device *pdev) | |||
662 | ARRAY_SIZE(ak4671_snd_controls)); | 662 | ARRAY_SIZE(ak4671_snd_controls)); |
663 | ak4671_add_widgets(codec); | 663 | ak4671_add_widgets(codec); |
664 | 664 | ||
665 | ret = snd_soc_init_card(socdev); | ||
666 | if (ret < 0) { | ||
667 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
668 | goto card_err; | ||
669 | } | ||
670 | |||
671 | ak4671_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 665 | ak4671_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
672 | 666 | ||
673 | return ret; | 667 | return ret; |
674 | 668 | ||
675 | card_err: | ||
676 | snd_soc_free_pcms(socdev); | ||
677 | snd_soc_dapm_free(socdev); | ||
678 | pcm_err: | 669 | pcm_err: |
679 | return ret; | 670 | return ret; |
680 | } | 671 | } |
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index 565842dcfc65..ffe122d1cd76 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c | |||
@@ -599,13 +599,6 @@ static int cs4270_probe(struct platform_device *pdev) | |||
599 | goto error_free_pcms; | 599 | goto error_free_pcms; |
600 | } | 600 | } |
601 | 601 | ||
602 | /* And finally, register the socdev */ | ||
603 | ret = snd_soc_init_card(socdev); | ||
604 | if (ret < 0) { | ||
605 | dev_err(codec->dev, "failed to register card\n"); | ||
606 | goto error_free_pcms; | ||
607 | } | ||
608 | |||
609 | return 0; | 602 | return 0; |
610 | 603 | ||
611 | error_free_pcms: | 604 | error_free_pcms: |
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index 38eac9c866e1..d7f9bf18b72e 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c | |||
@@ -355,12 +355,6 @@ static int cx20442_codec_probe(struct platform_device *pdev) | |||
355 | 355 | ||
356 | cx20442_add_widgets(codec); | 356 | cx20442_add_widgets(codec); |
357 | 357 | ||
358 | ret = snd_soc_init_card(socdev); | ||
359 | if (ret < 0) { | ||
360 | dev_err(&pdev->dev, "failed to register card\n"); | ||
361 | goto card_err; | ||
362 | } | ||
363 | |||
364 | return ret; | 358 | return ret; |
365 | 359 | ||
366 | card_err: | 360 | card_err: |
diff --git a/sound/soc/codecs/pcm3008.c b/sound/soc/codecs/pcm3008.c index 5cda9e6b5a74..2afcd0a8669d 100644 --- a/sound/soc/codecs/pcm3008.c +++ b/sound/soc/codecs/pcm3008.c | |||
@@ -90,13 +90,6 @@ static int pcm3008_soc_probe(struct platform_device *pdev) | |||
90 | goto pcm_err; | 90 | goto pcm_err; |
91 | } | 91 | } |
92 | 92 | ||
93 | /* Register Card. */ | ||
94 | ret = snd_soc_init_card(socdev); | ||
95 | if (ret < 0) { | ||
96 | printk(KERN_ERR "pcm3008: failed to register card\n"); | ||
97 | goto card_err; | ||
98 | } | ||
99 | |||
100 | /* DEM1 DEM0 DE-EMPHASIS_MODE | 93 | /* DEM1 DEM0 DE-EMPHASIS_MODE |
101 | * Low Low De-emphasis 44.1 kHz ON | 94 | * Low Low De-emphasis 44.1 kHz ON |
102 | * Low High De-emphasis OFF | 95 | * Low High De-emphasis OFF |
@@ -136,8 +129,6 @@ static int pcm3008_soc_probe(struct platform_device *pdev) | |||
136 | 129 | ||
137 | gpio_err: | 130 | gpio_err: |
138 | pcm3008_gpio_free(setup); | 131 | pcm3008_gpio_free(setup); |
139 | card_err: | ||
140 | snd_soc_free_pcms(socdev); | ||
141 | pcm_err: | 132 | pcm_err: |
142 | kfree(socdev->card->codec); | 133 | kfree(socdev->card->codec); |
143 | 134 | ||
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index c550750c79c0..b3130339d29a 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c | |||
@@ -613,17 +613,9 @@ static int ssm2602_init(struct snd_soc_device *socdev) | |||
613 | snd_soc_add_controls(codec, ssm2602_snd_controls, | 613 | snd_soc_add_controls(codec, ssm2602_snd_controls, |
614 | ARRAY_SIZE(ssm2602_snd_controls)); | 614 | ARRAY_SIZE(ssm2602_snd_controls)); |
615 | ssm2602_add_widgets(codec); | 615 | ssm2602_add_widgets(codec); |
616 | ret = snd_soc_init_card(socdev); | ||
617 | if (ret < 0) { | ||
618 | pr_err("ssm2602: failed to register card\n"); | ||
619 | goto card_err; | ||
620 | } | ||
621 | 616 | ||
622 | return ret; | 617 | return ret; |
623 | 618 | ||
624 | card_err: | ||
625 | snd_soc_free_pcms(socdev); | ||
626 | snd_soc_dapm_free(socdev); | ||
627 | pcm_err: | 619 | pcm_err: |
628 | kfree(codec->reg_cache); | 620 | kfree(codec->reg_cache); |
629 | return ret; | 621 | return ret; |
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c index befc6488c39a..bbc72c2ddfca 100644 --- a/sound/soc/codecs/stac9766.c +++ b/sound/soc/codecs/stac9766.c | |||
@@ -418,9 +418,6 @@ static int stac9766_codec_probe(struct platform_device *pdev) | |||
418 | snd_soc_add_controls(codec, stac9766_snd_ac97_controls, | 418 | snd_soc_add_controls(codec, stac9766_snd_ac97_controls, |
419 | ARRAY_SIZE(stac9766_snd_ac97_controls)); | 419 | ARRAY_SIZE(stac9766_snd_ac97_controls)); |
420 | 420 | ||
421 | ret = snd_soc_init_card(socdev); | ||
422 | if (ret < 0) | ||
423 | goto reset_err; | ||
424 | return 0; | 421 | return 0; |
425 | 422 | ||
426 | reset_err: | 423 | reset_err: |
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index 0b8dcb5cd729..ee8cb2c08b87 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c | |||
@@ -707,17 +707,9 @@ static int tlv320aic23_init(struct snd_soc_device *socdev) | |||
707 | snd_soc_add_controls(codec, tlv320aic23_snd_controls, | 707 | snd_soc_add_controls(codec, tlv320aic23_snd_controls, |
708 | ARRAY_SIZE(tlv320aic23_snd_controls)); | 708 | ARRAY_SIZE(tlv320aic23_snd_controls)); |
709 | tlv320aic23_add_widgets(codec); | 709 | tlv320aic23_add_widgets(codec); |
710 | ret = snd_soc_init_card(socdev); | ||
711 | if (ret < 0) { | ||
712 | printk(KERN_ERR "tlv320aic23: failed to register card\n"); | ||
713 | goto card_err; | ||
714 | } | ||
715 | 710 | ||
716 | return ret; | 711 | return ret; |
717 | 712 | ||
718 | card_err: | ||
719 | snd_soc_free_pcms(socdev); | ||
720 | snd_soc_dapm_free(socdev); | ||
721 | pcm_err: | 713 | pcm_err: |
722 | kfree(codec->reg_cache); | 714 | kfree(codec->reg_cache); |
723 | return ret; | 715 | return ret; |
diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c index 3387d9e736ea..357b609196e3 100644 --- a/sound/soc/codecs/tlv320aic26.c +++ b/sound/soc/codecs/tlv320aic26.c | |||
@@ -356,18 +356,7 @@ static int aic26_probe(struct platform_device *pdev) | |||
356 | ARRAY_SIZE(aic26_snd_controls)); | 356 | ARRAY_SIZE(aic26_snd_controls)); |
357 | WARN_ON(err < 0); | 357 | WARN_ON(err < 0); |
358 | 358 | ||
359 | /* CODEC is setup, we can register the card now */ | ||
360 | dev_dbg(&pdev->dev, "Registering card\n"); | ||
361 | ret = snd_soc_init_card(socdev); | ||
362 | if (ret < 0) { | ||
363 | dev_err(&pdev->dev, "aic26: failed to register card\n"); | ||
364 | goto card_err; | ||
365 | } | ||
366 | return 0; | 359 | return 0; |
367 | |||
368 | card_err: | ||
369 | snd_soc_free_pcms(socdev); | ||
370 | return ret; | ||
371 | } | 360 | } |
372 | 361 | ||
373 | static int aic26_remove(struct platform_device *pdev) | 362 | static int aic26_remove(struct platform_device *pdev) |
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 3395cf945d56..03cad250f58d 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -1405,18 +1405,8 @@ static int aic3x_probe(struct platform_device *pdev) | |||
1405 | 1405 | ||
1406 | aic3x_add_widgets(codec); | 1406 | aic3x_add_widgets(codec); |
1407 | 1407 | ||
1408 | ret = snd_soc_init_card(socdev); | ||
1409 | if (ret < 0) { | ||
1410 | printk(KERN_ERR "aic3x: failed to register card\n"); | ||
1411 | goto card_err; | ||
1412 | } | ||
1413 | |||
1414 | return ret; | 1408 | return ret; |
1415 | 1409 | ||
1416 | card_err: | ||
1417 | snd_soc_free_pcms(socdev); | ||
1418 | snd_soc_dapm_free(socdev); | ||
1419 | |||
1420 | pcm_err: | 1410 | pcm_err: |
1421 | kfree(codec->reg_cache); | 1411 | kfree(codec->reg_cache); |
1422 | return ret; | 1412 | return ret; |
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index 3ca8934fc26c..bff476d65d05 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
@@ -960,16 +960,8 @@ static int dac33_soc_probe(struct platform_device *pdev) | |||
960 | /* power on device */ | 960 | /* power on device */ |
961 | dac33_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 961 | dac33_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
962 | 962 | ||
963 | ret = snd_soc_init_card(socdev); | ||
964 | if (ret < 0) { | ||
965 | dev_err(codec->dev, "failed to register card\n"); | ||
966 | goto card_err; | ||
967 | } | ||
968 | |||
969 | return 0; | 963 | return 0; |
970 | card_err: | 964 | |
971 | snd_soc_free_pcms(socdev); | ||
972 | snd_soc_dapm_free(socdev); | ||
973 | pcm_err: | 965 | pcm_err: |
974 | dac33_hard_power(codec, 0); | 966 | dac33_hard_power(codec, 0); |
975 | return ret; | 967 | return ret; |
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index c0b47dfc3328..928257b25111 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -2155,19 +2155,7 @@ static int twl4030_soc_probe(struct platform_device *pdev) | |||
2155 | ARRAY_SIZE(twl4030_snd_controls)); | 2155 | ARRAY_SIZE(twl4030_snd_controls)); |
2156 | twl4030_add_widgets(codec); | 2156 | twl4030_add_widgets(codec); |
2157 | 2157 | ||
2158 | ret = snd_soc_init_card(socdev); | ||
2159 | if (ret < 0) { | ||
2160 | dev_err(&pdev->dev, "failed to register card\n"); | ||
2161 | goto card_err; | ||
2162 | } | ||
2163 | |||
2164 | return 0; | 2158 | return 0; |
2165 | |||
2166 | card_err: | ||
2167 | snd_soc_free_pcms(socdev); | ||
2168 | snd_soc_dapm_free(socdev); | ||
2169 | |||
2170 | return ret; | ||
2171 | } | 2159 | } |
2172 | 2160 | ||
2173 | static int twl4030_soc_remove(struct platform_device *pdev) | 2161 | static int twl4030_soc_remove(struct platform_device *pdev) |
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index c33b92edbded..aa40d985138f 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c | |||
@@ -562,17 +562,8 @@ static int uda134x_soc_probe(struct platform_device *pdev) | |||
562 | goto pcm_err; | 562 | goto pcm_err; |
563 | } | 563 | } |
564 | 564 | ||
565 | ret = snd_soc_init_card(socdev); | ||
566 | if (ret < 0) { | ||
567 | printk(KERN_ERR "UDA134X: failed to register card\n"); | ||
568 | goto card_err; | ||
569 | } | ||
570 | |||
571 | return 0; | 565 | return 0; |
572 | 566 | ||
573 | card_err: | ||
574 | snd_soc_free_pcms(socdev); | ||
575 | snd_soc_dapm_free(socdev); | ||
576 | pcm_err: | 567 | pcm_err: |
577 | kfree(codec->reg_cache); | 568 | kfree(codec->reg_cache); |
578 | reg_err: | 569 | reg_err: |
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index 92ec03442154..a42e47d94630 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c | |||
@@ -713,17 +713,9 @@ static int uda1380_probe(struct platform_device *pdev) | |||
713 | snd_soc_add_controls(codec, uda1380_snd_controls, | 713 | snd_soc_add_controls(codec, uda1380_snd_controls, |
714 | ARRAY_SIZE(uda1380_snd_controls)); | 714 | ARRAY_SIZE(uda1380_snd_controls)); |
715 | uda1380_add_widgets(codec); | 715 | uda1380_add_widgets(codec); |
716 | ret = snd_soc_init_card(socdev); | ||
717 | if (ret < 0) { | ||
718 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
719 | goto card_err; | ||
720 | } | ||
721 | 716 | ||
722 | return ret; | 717 | return ret; |
723 | 718 | ||
724 | card_err: | ||
725 | snd_soc_free_pcms(socdev); | ||
726 | snd_soc_dapm_free(socdev); | ||
727 | pcm_err: | 719 | pcm_err: |
728 | return ret; | 720 | return ret; |
729 | } | 721 | } |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 714114b50d18..2e35a354b166 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -1501,18 +1501,7 @@ static int wm8350_probe(struct platform_device *pdev) | |||
1501 | 1501 | ||
1502 | wm8350_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1502 | wm8350_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1503 | 1503 | ||
1504 | ret = snd_soc_init_card(socdev); | ||
1505 | if (ret < 0) { | ||
1506 | dev_err(&pdev->dev, "failed to register card\n"); | ||
1507 | goto card_err; | ||
1508 | } | ||
1509 | |||
1510 | return 0; | 1504 | return 0; |
1511 | |||
1512 | card_err: | ||
1513 | snd_soc_free_pcms(socdev); | ||
1514 | snd_soc_dapm_free(socdev); | ||
1515 | return ret; | ||
1516 | } | 1505 | } |
1517 | 1506 | ||
1518 | static int wm8350_remove(struct platform_device *pdev) | 1507 | static int wm8350_remove(struct platform_device *pdev) |
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index bd7eecba20fe..0e30997c8db0 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c | |||
@@ -1400,12 +1400,6 @@ static int wm8400_probe(struct platform_device *pdev) | |||
1400 | wm8400_add_controls(codec); | 1400 | wm8400_add_controls(codec); |
1401 | wm8400_add_widgets(codec); | 1401 | wm8400_add_widgets(codec); |
1402 | 1402 | ||
1403 | ret = snd_soc_init_card(socdev); | ||
1404 | if (ret < 0) { | ||
1405 | dev_err(&pdev->dev, "failed to register card\n"); | ||
1406 | goto card_err; | ||
1407 | } | ||
1408 | |||
1409 | return ret; | 1403 | return ret; |
1410 | 1404 | ||
1411 | card_err: | 1405 | card_err: |
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 5702435af81b..e3c21ebcc08e 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c | |||
@@ -604,16 +604,9 @@ static int wm8510_init(struct snd_soc_device *socdev, | |||
604 | snd_soc_add_controls(codec, wm8510_snd_controls, | 604 | snd_soc_add_controls(codec, wm8510_snd_controls, |
605 | ARRAY_SIZE(wm8510_snd_controls)); | 605 | ARRAY_SIZE(wm8510_snd_controls)); |
606 | wm8510_add_widgets(codec); | 606 | wm8510_add_widgets(codec); |
607 | ret = snd_soc_init_card(socdev); | 607 | |
608 | if (ret < 0) { | ||
609 | printk(KERN_ERR "wm8510: failed to register card\n"); | ||
610 | goto card_err; | ||
611 | } | ||
612 | return ret; | 608 | return ret; |
613 | 609 | ||
614 | card_err: | ||
615 | snd_soc_free_pcms(socdev); | ||
616 | snd_soc_dapm_free(socdev); | ||
617 | err: | 610 | err: |
618 | kfree(codec->reg_cache); | 611 | kfree(codec->reg_cache); |
619 | return ret; | 612 | return ret; |
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c index 268cab21c2cc..2e2b01d6c82b 100644 --- a/sound/soc/codecs/wm8523.c +++ b/sound/soc/codecs/wm8523.c | |||
@@ -448,17 +448,9 @@ static int wm8523_probe(struct platform_device *pdev) | |||
448 | snd_soc_add_controls(codec, wm8523_snd_controls, | 448 | snd_soc_add_controls(codec, wm8523_snd_controls, |
449 | ARRAY_SIZE(wm8523_snd_controls)); | 449 | ARRAY_SIZE(wm8523_snd_controls)); |
450 | wm8523_add_widgets(codec); | 450 | wm8523_add_widgets(codec); |
451 | ret = snd_soc_init_card(socdev); | ||
452 | if (ret < 0) { | ||
453 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
454 | goto card_err; | ||
455 | } | ||
456 | 451 | ||
457 | return ret; | 452 | return ret; |
458 | 453 | ||
459 | card_err: | ||
460 | snd_soc_free_pcms(socdev); | ||
461 | snd_soc_dapm_free(socdev); | ||
462 | pcm_err: | 454 | pcm_err: |
463 | return ret; | 455 | return ret; |
464 | } | 456 | } |
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index a09b23e03664..dde50d118181 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c | |||
@@ -800,17 +800,9 @@ static int wm8580_probe(struct platform_device *pdev) | |||
800 | snd_soc_add_controls(codec, wm8580_snd_controls, | 800 | snd_soc_add_controls(codec, wm8580_snd_controls, |
801 | ARRAY_SIZE(wm8580_snd_controls)); | 801 | ARRAY_SIZE(wm8580_snd_controls)); |
802 | wm8580_add_widgets(codec); | 802 | wm8580_add_widgets(codec); |
803 | ret = snd_soc_init_card(socdev); | ||
804 | if (ret < 0) { | ||
805 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
806 | goto card_err; | ||
807 | } | ||
808 | 803 | ||
809 | return ret; | 804 | return ret; |
810 | 805 | ||
811 | card_err: | ||
812 | snd_soc_free_pcms(socdev); | ||
813 | snd_soc_dapm_free(socdev); | ||
814 | pcm_err: | 806 | pcm_err: |
815 | return ret; | 807 | return ret; |
816 | } | 808 | } |
diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c index 54189fbf9e93..70e0675b5d4a 100644 --- a/sound/soc/codecs/wm8711.c +++ b/sound/soc/codecs/wm8711.c | |||
@@ -404,17 +404,9 @@ static int wm8711_probe(struct platform_device *pdev) | |||
404 | snd_soc_add_controls(codec, wm8711_snd_controls, | 404 | snd_soc_add_controls(codec, wm8711_snd_controls, |
405 | ARRAY_SIZE(wm8711_snd_controls)); | 405 | ARRAY_SIZE(wm8711_snd_controls)); |
406 | wm8711_add_widgets(codec); | 406 | wm8711_add_widgets(codec); |
407 | ret = snd_soc_init_card(socdev); | ||
408 | if (ret < 0) { | ||
409 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
410 | goto card_err; | ||
411 | } | ||
412 | 407 | ||
413 | return ret; | 408 | return ret; |
414 | 409 | ||
415 | card_err: | ||
416 | snd_soc_free_pcms(socdev); | ||
417 | snd_soc_dapm_free(socdev); | ||
418 | pcm_err: | 410 | pcm_err: |
419 | return ret; | 411 | return ret; |
420 | } | 412 | } |
diff --git a/sound/soc/codecs/wm8727.c b/sound/soc/codecs/wm8727.c index 7df5a17eb733..d8ffbd641d71 100644 --- a/sound/soc/codecs/wm8727.c +++ b/sound/soc/codecs/wm8727.c | |||
@@ -68,17 +68,9 @@ static int wm8727_soc_probe(struct platform_device *pdev) | |||
68 | printk(KERN_ERR "wm8727: failed to create pcms\n"); | 68 | printk(KERN_ERR "wm8727: failed to create pcms\n"); |
69 | goto pcm_err; | 69 | goto pcm_err; |
70 | } | 70 | } |
71 | /* register card */ | ||
72 | ret = snd_soc_init_card(socdev); | ||
73 | if (ret < 0) { | ||
74 | printk(KERN_ERR "wm8727: failed to register card\n"); | ||
75 | goto register_err; | ||
76 | } | ||
77 | 71 | ||
78 | return ret; | 72 | return ret; |
79 | 73 | ||
80 | register_err: | ||
81 | snd_soc_free_pcms(socdev); | ||
82 | pcm_err: | 74 | pcm_err: |
83 | kfree(socdev->card->codec); | 75 | kfree(socdev->card->codec); |
84 | socdev->card->codec = NULL; | 76 | socdev->card->codec = NULL; |
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c index 16e969a762c3..1252a8a486a6 100644 --- a/sound/soc/codecs/wm8728.c +++ b/sound/soc/codecs/wm8728.c | |||
@@ -287,17 +287,9 @@ static int wm8728_init(struct snd_soc_device *socdev, | |||
287 | snd_soc_add_controls(codec, wm8728_snd_controls, | 287 | snd_soc_add_controls(codec, wm8728_snd_controls, |
288 | ARRAY_SIZE(wm8728_snd_controls)); | 288 | ARRAY_SIZE(wm8728_snd_controls)); |
289 | wm8728_add_widgets(codec); | 289 | wm8728_add_widgets(codec); |
290 | ret = snd_soc_init_card(socdev); | ||
291 | if (ret < 0) { | ||
292 | printk(KERN_ERR "wm8728: failed to register card\n"); | ||
293 | goto card_err; | ||
294 | } | ||
295 | 290 | ||
296 | return ret; | 291 | return ret; |
297 | 292 | ||
298 | card_err: | ||
299 | snd_soc_free_pcms(socdev); | ||
300 | snd_soc_dapm_free(socdev); | ||
301 | err: | 293 | err: |
302 | kfree(codec->reg_cache); | 294 | kfree(codec->reg_cache); |
303 | return ret; | 295 | return ret; |
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index bb95af950971..e3675e7a9813 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
@@ -495,17 +495,9 @@ static int wm8731_probe(struct platform_device *pdev) | |||
495 | snd_soc_add_controls(codec, wm8731_snd_controls, | 495 | snd_soc_add_controls(codec, wm8731_snd_controls, |
496 | ARRAY_SIZE(wm8731_snd_controls)); | 496 | ARRAY_SIZE(wm8731_snd_controls)); |
497 | wm8731_add_widgets(codec); | 497 | wm8731_add_widgets(codec); |
498 | ret = snd_soc_init_card(socdev); | ||
499 | if (ret < 0) { | ||
500 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
501 | goto card_err; | ||
502 | } | ||
503 | 498 | ||
504 | return ret; | 499 | return ret; |
505 | 500 | ||
506 | card_err: | ||
507 | snd_soc_free_pcms(socdev); | ||
508 | snd_soc_dapm_free(socdev); | ||
509 | pcm_err: | 501 | pcm_err: |
510 | return ret; | 502 | return ret; |
511 | } | 503 | } |
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index 4ba1e7e93fb4..50a3d6590588 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c | |||
@@ -772,16 +772,8 @@ static int wm8750_init(struct snd_soc_device *socdev, | |||
772 | snd_soc_add_controls(codec, wm8750_snd_controls, | 772 | snd_soc_add_controls(codec, wm8750_snd_controls, |
773 | ARRAY_SIZE(wm8750_snd_controls)); | 773 | ARRAY_SIZE(wm8750_snd_controls)); |
774 | wm8750_add_widgets(codec); | 774 | wm8750_add_widgets(codec); |
775 | ret = snd_soc_init_card(socdev); | ||
776 | if (ret < 0) { | ||
777 | printk(KERN_ERR "wm8750: failed to register card\n"); | ||
778 | goto card_err; | ||
779 | } | ||
780 | return ret; | 775 | return ret; |
781 | 776 | ||
782 | card_err: | ||
783 | snd_soc_free_pcms(socdev); | ||
784 | snd_soc_dapm_free(socdev); | ||
785 | err: | 777 | err: |
786 | kfree(codec->reg_cache); | 778 | kfree(codec->reg_cache); |
787 | return ret; | 779 | return ret; |
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index 8f7305257d29..c652bc04cc81 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -1583,18 +1583,9 @@ static int wm8753_probe(struct platform_device *pdev) | |||
1583 | snd_soc_add_controls(codec, wm8753_snd_controls, | 1583 | snd_soc_add_controls(codec, wm8753_snd_controls, |
1584 | ARRAY_SIZE(wm8753_snd_controls)); | 1584 | ARRAY_SIZE(wm8753_snd_controls)); |
1585 | wm8753_add_widgets(codec); | 1585 | wm8753_add_widgets(codec); |
1586 | ret = snd_soc_init_card(socdev); | ||
1587 | if (ret < 0) { | ||
1588 | printk(KERN_ERR "wm8753: failed to register card\n"); | ||
1589 | goto card_err; | ||
1590 | } | ||
1591 | 1586 | ||
1592 | return 0; | 1587 | return 0; |
1593 | 1588 | ||
1594 | card_err: | ||
1595 | snd_soc_free_pcms(socdev); | ||
1596 | snd_soc_dapm_free(socdev); | ||
1597 | |||
1598 | pcm_err: | 1589 | pcm_err: |
1599 | return ret; | 1590 | return ret; |
1600 | } | 1591 | } |
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index a0bbb28eed75..ab2c0da18091 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c | |||
@@ -447,17 +447,8 @@ static int wm8776_probe(struct platform_device *pdev) | |||
447 | ARRAY_SIZE(wm8776_dapm_widgets)); | 447 | ARRAY_SIZE(wm8776_dapm_widgets)); |
448 | snd_soc_dapm_add_routes(codec, routes, ARRAY_SIZE(routes)); | 448 | snd_soc_dapm_add_routes(codec, routes, ARRAY_SIZE(routes)); |
449 | 449 | ||
450 | ret = snd_soc_init_card(socdev); | ||
451 | if (ret < 0) { | ||
452 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
453 | goto card_err; | ||
454 | } | ||
455 | |||
456 | return ret; | 450 | return ret; |
457 | 451 | ||
458 | card_err: | ||
459 | snd_soc_free_pcms(socdev); | ||
460 | snd_soc_dapm_free(socdev); | ||
461 | pcm_err: | 452 | pcm_err: |
462 | return ret; | 453 | return ret; |
463 | } | 454 | } |
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index b48804b5cacd..0d185cb6418d 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c | |||
@@ -1353,12 +1353,6 @@ static int wm8900_probe(struct platform_device *pdev) | |||
1353 | ARRAY_SIZE(wm8900_snd_controls)); | 1353 | ARRAY_SIZE(wm8900_snd_controls)); |
1354 | wm8900_add_widgets(codec); | 1354 | wm8900_add_widgets(codec); |
1355 | 1355 | ||
1356 | ret = snd_soc_init_card(socdev); | ||
1357 | if (ret < 0) { | ||
1358 | dev_err(&pdev->dev, "Failed to register card\n"); | ||
1359 | goto card_err; | ||
1360 | } | ||
1361 | |||
1362 | return ret; | 1356 | return ret; |
1363 | 1357 | ||
1364 | card_err: | 1358 | card_err: |
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 94cdb8130415..bfeff4ee5de9 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -1695,17 +1695,8 @@ static int wm8903_probe(struct platform_device *pdev) | |||
1695 | ARRAY_SIZE(wm8903_snd_controls)); | 1695 | ARRAY_SIZE(wm8903_snd_controls)); |
1696 | wm8903_add_widgets(socdev->card->codec); | 1696 | wm8903_add_widgets(socdev->card->codec); |
1697 | 1697 | ||
1698 | ret = snd_soc_init_card(socdev); | ||
1699 | if (ret < 0) { | ||
1700 | dev_err(&pdev->dev, "wm8903: failed to register card\n"); | ||
1701 | goto card_err; | ||
1702 | } | ||
1703 | |||
1704 | return ret; | 1698 | return ret; |
1705 | 1699 | ||
1706 | card_err: | ||
1707 | snd_soc_free_pcms(socdev); | ||
1708 | snd_soc_dapm_free(socdev); | ||
1709 | err: | 1700 | err: |
1710 | return ret; | 1701 | return ret; |
1711 | } | 1702 | } |
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index 8d4fd3c08c09..fc80aa6c913c 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c | |||
@@ -731,12 +731,6 @@ static int wm8940_probe(struct platform_device *pdev) | |||
731 | if (ret) | 731 | if (ret) |
732 | goto error_free_pcms; | 732 | goto error_free_pcms; |
733 | 733 | ||
734 | ret = snd_soc_init_card(socdev); | ||
735 | if (ret < 0) { | ||
736 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
737 | goto error_free_pcms; | ||
738 | } | ||
739 | |||
740 | return ret; | 734 | return ret; |
741 | 735 | ||
742 | error_free_pcms: | 736 | error_free_pcms: |
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index b9b096a85396..40390afa75f3 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c | |||
@@ -713,17 +713,9 @@ static int wm8960_probe(struct platform_device *pdev) | |||
713 | snd_soc_add_controls(codec, wm8960_snd_controls, | 713 | snd_soc_add_controls(codec, wm8960_snd_controls, |
714 | ARRAY_SIZE(wm8960_snd_controls)); | 714 | ARRAY_SIZE(wm8960_snd_controls)); |
715 | wm8960_add_widgets(codec); | 715 | wm8960_add_widgets(codec); |
716 | ret = snd_soc_init_card(socdev); | ||
717 | if (ret < 0) { | ||
718 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
719 | goto card_err; | ||
720 | } | ||
721 | 716 | ||
722 | return ret; | 717 | return ret; |
723 | 718 | ||
724 | card_err: | ||
725 | snd_soc_free_pcms(socdev); | ||
726 | snd_soc_dapm_free(socdev); | ||
727 | pcm_err: | 719 | pcm_err: |
728 | return ret; | 720 | return ret; |
729 | } | 721 | } |
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index b5c6f2cd5ae2..07e389574db1 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c | |||
@@ -988,17 +988,8 @@ static int wm8961_probe(struct platform_device *pdev) | |||
988 | snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); | 988 | snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); |
989 | snd_soc_dapm_new_widgets(codec); | 989 | snd_soc_dapm_new_widgets(codec); |
990 | 990 | ||
991 | ret = snd_soc_init_card(socdev); | ||
992 | if (ret < 0) { | ||
993 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
994 | goto card_err; | ||
995 | } | ||
996 | |||
997 | return ret; | 991 | return ret; |
998 | 992 | ||
999 | card_err: | ||
1000 | snd_soc_free_pcms(socdev); | ||
1001 | snd_soc_dapm_free(socdev); | ||
1002 | pcm_err: | 993 | pcm_err: |
1003 | return ret; | 994 | return ret; |
1004 | } | 995 | } |
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index d66efb0546ea..56a66e89ab91 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c | |||
@@ -703,16 +703,9 @@ static int wm8971_init(struct snd_soc_device *socdev, | |||
703 | snd_soc_add_controls(codec, wm8971_snd_controls, | 703 | snd_soc_add_controls(codec, wm8971_snd_controls, |
704 | ARRAY_SIZE(wm8971_snd_controls)); | 704 | ARRAY_SIZE(wm8971_snd_controls)); |
705 | wm8971_add_widgets(codec); | 705 | wm8971_add_widgets(codec); |
706 | ret = snd_soc_init_card(socdev); | 706 | |
707 | if (ret < 0) { | ||
708 | printk(KERN_ERR "wm8971: failed to register card\n"); | ||
709 | goto card_err; | ||
710 | } | ||
711 | return ret; | 707 | return ret; |
712 | 708 | ||
713 | card_err: | ||
714 | snd_soc_free_pcms(socdev); | ||
715 | snd_soc_dapm_free(socdev); | ||
716 | err: | 709 | err: |
717 | kfree(codec->reg_cache); | 710 | kfree(codec->reg_cache); |
718 | return ret; | 711 | return ret; |
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index eff29331235b..c245f0ee0ec2 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c | |||
@@ -641,17 +641,9 @@ static int wm8974_probe(struct platform_device *pdev) | |||
641 | snd_soc_add_controls(codec, wm8974_snd_controls, | 641 | snd_soc_add_controls(codec, wm8974_snd_controls, |
642 | ARRAY_SIZE(wm8974_snd_controls)); | 642 | ARRAY_SIZE(wm8974_snd_controls)); |
643 | wm8974_add_widgets(codec); | 643 | wm8974_add_widgets(codec); |
644 | ret = snd_soc_init_card(socdev); | ||
645 | if (ret < 0) { | ||
646 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
647 | goto card_err; | ||
648 | } | ||
649 | 644 | ||
650 | return ret; | 645 | return ret; |
651 | 646 | ||
652 | card_err: | ||
653 | snd_soc_free_pcms(socdev); | ||
654 | snd_soc_dapm_free(socdev); | ||
655 | pcm_err: | 647 | pcm_err: |
656 | return ret; | 648 | return ret; |
657 | } | 649 | } |
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index d8d8f68b81ea..bee292e37d1b 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c | |||
@@ -792,17 +792,8 @@ static int wm8988_probe(struct platform_device *pdev) | |||
792 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 792 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); |
793 | snd_soc_dapm_new_widgets(codec); | 793 | snd_soc_dapm_new_widgets(codec); |
794 | 794 | ||
795 | ret = snd_soc_init_card(socdev); | ||
796 | if (ret < 0) { | ||
797 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
798 | goto card_err; | ||
799 | } | ||
800 | |||
801 | return ret; | 795 | return ret; |
802 | 796 | ||
803 | card_err: | ||
804 | snd_soc_free_pcms(socdev); | ||
805 | snd_soc_dapm_free(socdev); | ||
806 | pcm_err: | 797 | pcm_err: |
807 | return ret; | 798 | return ret; |
808 | } | 799 | } |
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index f657e9a5fe26..e43cb2c8b915 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
@@ -1409,16 +1409,9 @@ static int wm8990_init(struct snd_soc_device *socdev) | |||
1409 | snd_soc_add_controls(codec, wm8990_snd_controls, | 1409 | snd_soc_add_controls(codec, wm8990_snd_controls, |
1410 | ARRAY_SIZE(wm8990_snd_controls)); | 1410 | ARRAY_SIZE(wm8990_snd_controls)); |
1411 | wm8990_add_widgets(codec); | 1411 | wm8990_add_widgets(codec); |
1412 | ret = snd_soc_init_card(socdev); | 1412 | |
1413 | if (ret < 0) { | ||
1414 | printk(KERN_ERR "wm8990: failed to register card\n"); | ||
1415 | goto card_err; | ||
1416 | } | ||
1417 | return ret; | 1413 | return ret; |
1418 | 1414 | ||
1419 | card_err: | ||
1420 | snd_soc_free_pcms(socdev); | ||
1421 | snd_soc_dapm_free(socdev); | ||
1422 | pcm_err: | 1415 | pcm_err: |
1423 | kfree(codec->reg_cache); | 1416 | kfree(codec->reg_cache); |
1424 | return ret; | 1417 | return ret; |
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index dac397712147..0d4d2be92b64 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c | |||
@@ -1466,17 +1466,8 @@ static int wm8993_probe(struct platform_device *pdev) | |||
1466 | 1466 | ||
1467 | snd_soc_dapm_new_widgets(codec); | 1467 | snd_soc_dapm_new_widgets(codec); |
1468 | 1468 | ||
1469 | ret = snd_soc_init_card(socdev); | ||
1470 | if (ret < 0) { | ||
1471 | dev_err(codec->dev, "failed to register card\n"); | ||
1472 | goto card_err; | ||
1473 | } | ||
1474 | |||
1475 | return ret; | 1469 | return ret; |
1476 | 1470 | ||
1477 | card_err: | ||
1478 | snd_soc_free_pcms(socdev); | ||
1479 | snd_soc_dapm_free(socdev); | ||
1480 | err: | 1471 | err: |
1481 | return ret; | 1472 | return ret; |
1482 | } | 1473 | } |
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 4cb6b104b729..3f1f84421312 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
@@ -1264,17 +1264,8 @@ static int wm9081_probe(struct platform_device *pdev) | |||
1264 | snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); | 1264 | snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); |
1265 | snd_soc_dapm_new_widgets(codec); | 1265 | snd_soc_dapm_new_widgets(codec); |
1266 | 1266 | ||
1267 | ret = snd_soc_init_card(socdev); | ||
1268 | if (ret < 0) { | ||
1269 | dev_err(codec->dev, "failed to register card: %d\n", ret); | ||
1270 | goto card_err; | ||
1271 | } | ||
1272 | |||
1273 | return ret; | 1267 | return ret; |
1274 | 1268 | ||
1275 | card_err: | ||
1276 | snd_soc_free_pcms(socdev); | ||
1277 | snd_soc_dapm_free(socdev); | ||
1278 | pcm_err: | 1269 | pcm_err: |
1279 | return ret; | 1270 | return ret; |
1280 | } | 1271 | } |
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index e7d2840d9e59..0e817b8705cd 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c | |||
@@ -403,16 +403,8 @@ static int wm9705_soc_probe(struct platform_device *pdev) | |||
403 | ARRAY_SIZE(wm9705_snd_ac97_controls)); | 403 | ARRAY_SIZE(wm9705_snd_ac97_controls)); |
404 | wm9705_add_widgets(codec); | 404 | wm9705_add_widgets(codec); |
405 | 405 | ||
406 | ret = snd_soc_init_card(socdev); | ||
407 | if (ret < 0) { | ||
408 | printk(KERN_ERR "wm9705: failed to register card\n"); | ||
409 | goto reset_err; | ||
410 | } | ||
411 | |||
412 | return 0; | 406 | return 0; |
413 | 407 | ||
414 | reset_err: | ||
415 | snd_soc_free_pcms(socdev); | ||
416 | pcm_err: | 408 | pcm_err: |
417 | snd_soc_free_ac97_codec(codec); | 409 | snd_soc_free_ac97_codec(codec); |
418 | codec_err: | 410 | codec_err: |
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 1fd4e88f50cf..155cacf124ea 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c | |||
@@ -695,17 +695,9 @@ static int wm9712_soc_probe(struct platform_device *pdev) | |||
695 | snd_soc_add_controls(codec, wm9712_snd_ac97_controls, | 695 | snd_soc_add_controls(codec, wm9712_snd_ac97_controls, |
696 | ARRAY_SIZE(wm9712_snd_ac97_controls)); | 696 | ARRAY_SIZE(wm9712_snd_ac97_controls)); |
697 | wm9712_add_widgets(codec); | 697 | wm9712_add_widgets(codec); |
698 | ret = snd_soc_init_card(socdev); | ||
699 | if (ret < 0) { | ||
700 | printk(KERN_ERR "wm9712: failed to register card\n"); | ||
701 | goto reset_err; | ||
702 | } | ||
703 | 698 | ||
704 | return 0; | 699 | return 0; |
705 | 700 | ||
706 | reset_err: | ||
707 | snd_soc_free_pcms(socdev); | ||
708 | |||
709 | pcm_err: | 701 | pcm_err: |
710 | snd_soc_free_ac97_codec(codec); | 702 | snd_soc_free_ac97_codec(codec); |
711 | 703 | ||
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index ca3d449ed89e..5f81ecd20a81 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -1247,13 +1247,8 @@ static int wm9713_soc_probe(struct platform_device *pdev) | |||
1247 | snd_soc_add_controls(codec, wm9713_snd_ac97_controls, | 1247 | snd_soc_add_controls(codec, wm9713_snd_ac97_controls, |
1248 | ARRAY_SIZE(wm9713_snd_ac97_controls)); | 1248 | ARRAY_SIZE(wm9713_snd_ac97_controls)); |
1249 | wm9713_add_widgets(codec); | 1249 | wm9713_add_widgets(codec); |
1250 | ret = snd_soc_init_card(socdev); | ||
1251 | if (ret < 0) | ||
1252 | goto reset_err; | ||
1253 | return 0; | ||
1254 | 1250 | ||
1255 | reset_err: | 1251 | return 0; |
1256 | snd_soc_free_pcms(socdev); | ||
1257 | 1252 | ||
1258 | pcm_err: | 1253 | pcm_err: |
1259 | snd_soc_free_ac97_codec(codec); | 1254 | snd_soc_free_ac97_codec(codec); |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index d81a16187769..e2b6d75f16e3 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -970,6 +970,7 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) | |||
970 | struct platform_device, | 970 | struct platform_device, |
971 | dev); | 971 | dev); |
972 | struct snd_soc_codec_device *codec_dev = card->socdev->codec_dev; | 972 | struct snd_soc_codec_device *codec_dev = card->socdev->codec_dev; |
973 | struct snd_soc_codec *codec; | ||
973 | struct snd_soc_platform *platform; | 974 | struct snd_soc_platform *platform; |
974 | struct snd_soc_dai *dai; | 975 | struct snd_soc_dai *dai; |
975 | int i, found, ret, ac97; | 976 | int i, found, ret, ac97; |
@@ -1058,6 +1059,7 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) | |||
1058 | if (ret < 0) | 1059 | if (ret < 0) |
1059 | goto cpu_dai_err; | 1060 | goto cpu_dai_err; |
1060 | } | 1061 | } |
1062 | codec = card->codec; | ||
1061 | 1063 | ||
1062 | if (platform->probe) { | 1064 | if (platform->probe) { |
1063 | ret = platform->probe(pdev); | 1065 | ret = platform->probe(pdev); |
@@ -1072,10 +1074,72 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) | |||
1072 | INIT_WORK(&card->deferred_resume_work, soc_resume_deferred); | 1074 | INIT_WORK(&card->deferred_resume_work, soc_resume_deferred); |
1073 | #endif | 1075 | #endif |
1074 | 1076 | ||
1077 | for (i = 0; i < card->num_links; i++) { | ||
1078 | if (card->dai_link[i].init) { | ||
1079 | ret = card->dai_link[i].init(codec); | ||
1080 | if (ret < 0) { | ||
1081 | printk(KERN_ERR "asoc: failed to init %s\n", | ||
1082 | card->dai_link[i].stream_name); | ||
1083 | continue; | ||
1084 | } | ||
1085 | } | ||
1086 | if (card->dai_link[i].codec_dai->ac97_control) { | ||
1087 | ac97 = 1; | ||
1088 | snd_ac97_dev_add_pdata(codec->ac97, | ||
1089 | card->dai_link[i].cpu_dai->ac97_pdata); | ||
1090 | } | ||
1091 | } | ||
1092 | |||
1093 | snprintf(codec->card->shortname, sizeof(codec->card->shortname), | ||
1094 | "%s", card->name); | ||
1095 | snprintf(codec->card->longname, sizeof(codec->card->longname), | ||
1096 | "%s (%s)", card->name, codec->name); | ||
1097 | |||
1098 | /* Make sure all DAPM widgets are instantiated */ | ||
1099 | snd_soc_dapm_new_widgets(codec); | ||
1100 | |||
1101 | ret = snd_card_register(codec->card); | ||
1102 | if (ret < 0) { | ||
1103 | printk(KERN_ERR "asoc: failed to register soundcard for %s\n", | ||
1104 | codec->name); | ||
1105 | goto card_err; | ||
1106 | } | ||
1107 | |||
1108 | mutex_lock(&codec->mutex); | ||
1109 | #ifdef CONFIG_SND_SOC_AC97_BUS | ||
1110 | /* Only instantiate AC97 if not already done by the adaptor | ||
1111 | * for the generic AC97 subsystem. | ||
1112 | */ | ||
1113 | if (ac97 && strcmp(codec->name, "AC97") != 0) { | ||
1114 | ret = soc_ac97_dev_register(codec); | ||
1115 | if (ret < 0) { | ||
1116 | printk(KERN_ERR "asoc: AC97 device register failed\n"); | ||
1117 | snd_card_free(codec->card); | ||
1118 | mutex_unlock(&codec->mutex); | ||
1119 | goto card_err; | ||
1120 | } | ||
1121 | } | ||
1122 | #endif | ||
1123 | |||
1124 | ret = snd_soc_dapm_sys_add(card->socdev->dev); | ||
1125 | if (ret < 0) | ||
1126 | printk(KERN_WARNING "asoc: failed to add dapm sysfs entries\n"); | ||
1127 | |||
1128 | ret = device_create_file(card->socdev->dev, &dev_attr_codec_reg); | ||
1129 | if (ret < 0) | ||
1130 | printk(KERN_WARNING "asoc: failed to add codec sysfs files\n"); | ||
1131 | |||
1132 | soc_init_codec_debugfs(codec); | ||
1133 | mutex_unlock(&codec->mutex); | ||
1134 | |||
1075 | card->instantiated = 1; | 1135 | card->instantiated = 1; |
1076 | 1136 | ||
1077 | return; | 1137 | return; |
1078 | 1138 | ||
1139 | card_err: | ||
1140 | if (platform->remove) | ||
1141 | platform->remove(pdev); | ||
1142 | |||
1079 | platform_err: | 1143 | platform_err: |
1080 | if (codec_dev->remove) | 1144 | if (codec_dev->remove) |
1081 | codec_dev->remove(pdev); | 1145 | codec_dev->remove(pdev); |
@@ -1454,83 +1518,6 @@ int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid) | |||
1454 | EXPORT_SYMBOL_GPL(snd_soc_new_pcms); | 1518 | EXPORT_SYMBOL_GPL(snd_soc_new_pcms); |
1455 | 1519 | ||
1456 | /** | 1520 | /** |
1457 | * snd_soc_init_card - register sound card | ||
1458 | * @socdev: the SoC audio device | ||
1459 | * | ||
1460 | * Register a SoC sound card. Also registers an AC97 device if the | ||
1461 | * codec is AC97 for ad hoc devices. | ||
1462 | * | ||
1463 | * Returns 0 for success, else error. | ||
1464 | */ | ||
1465 | int snd_soc_init_card(struct snd_soc_device *socdev) | ||
1466 | { | ||
1467 | struct snd_soc_card *card = socdev->card; | ||
1468 | struct snd_soc_codec *codec = card->codec; | ||
1469 | int ret = 0, i, ac97 = 0, err = 0; | ||
1470 | |||
1471 | for (i = 0; i < card->num_links; i++) { | ||
1472 | if (card->dai_link[i].init) { | ||
1473 | err = card->dai_link[i].init(codec); | ||
1474 | if (err < 0) { | ||
1475 | printk(KERN_ERR "asoc: failed to init %s\n", | ||
1476 | card->dai_link[i].stream_name); | ||
1477 | continue; | ||
1478 | } | ||
1479 | } | ||
1480 | if (card->dai_link[i].codec_dai->ac97_control) { | ||
1481 | ac97 = 1; | ||
1482 | snd_ac97_dev_add_pdata(codec->ac97, | ||
1483 | card->dai_link[i].cpu_dai->ac97_pdata); | ||
1484 | } | ||
1485 | } | ||
1486 | snprintf(codec->card->shortname, sizeof(codec->card->shortname), | ||
1487 | "%s", card->name); | ||
1488 | snprintf(codec->card->longname, sizeof(codec->card->longname), | ||
1489 | "%s (%s)", card->name, codec->name); | ||
1490 | |||
1491 | /* Make sure all DAPM widgets are instantiated */ | ||
1492 | snd_soc_dapm_new_widgets(codec); | ||
1493 | |||
1494 | ret = snd_card_register(codec->card); | ||
1495 | if (ret < 0) { | ||
1496 | printk(KERN_ERR "asoc: failed to register soundcard for %s\n", | ||
1497 | codec->name); | ||
1498 | goto out; | ||
1499 | } | ||
1500 | |||
1501 | mutex_lock(&codec->mutex); | ||
1502 | #ifdef CONFIG_SND_SOC_AC97_BUS | ||
1503 | /* Only instantiate AC97 if not already done by the adaptor | ||
1504 | * for the generic AC97 subsystem. | ||
1505 | */ | ||
1506 | if (ac97 && strcmp(codec->name, "AC97") != 0) { | ||
1507 | ret = soc_ac97_dev_register(codec); | ||
1508 | if (ret < 0) { | ||
1509 | printk(KERN_ERR "asoc: AC97 device register failed\n"); | ||
1510 | snd_card_free(codec->card); | ||
1511 | mutex_unlock(&codec->mutex); | ||
1512 | goto out; | ||
1513 | } | ||
1514 | } | ||
1515 | #endif | ||
1516 | |||
1517 | err = snd_soc_dapm_sys_add(socdev->dev); | ||
1518 | if (err < 0) | ||
1519 | printk(KERN_WARNING "asoc: failed to add dapm sysfs entries\n"); | ||
1520 | |||
1521 | err = device_create_file(socdev->dev, &dev_attr_codec_reg); | ||
1522 | if (err < 0) | ||
1523 | printk(KERN_WARNING "asoc: failed to add codec sysfs files\n"); | ||
1524 | |||
1525 | soc_init_codec_debugfs(codec); | ||
1526 | mutex_unlock(&codec->mutex); | ||
1527 | |||
1528 | out: | ||
1529 | return ret; | ||
1530 | } | ||
1531 | EXPORT_SYMBOL_GPL(snd_soc_init_card); | ||
1532 | |||
1533 | /** | ||
1534 | * snd_soc_free_pcms - free sound card and pcms | 1521 | * snd_soc_free_pcms - free sound card and pcms |
1535 | * @socdev: the SoC audio device | 1522 | * @socdev: the SoC audio device |
1536 | * | 1523 | * |