diff mbox

[06/10] ARM: soc-audio phycore-ac97: fix driver init order

Message ID 1362940391-8338-7-git-send-email-mpa@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Markus Pargmann March 10, 2013, 6:33 p.m. UTC
Adding a soc-audio sound driver internally uses snd_soc_register_device,
which tries to bind it with the codec. The adding of the driver is
deferred because the codec driver is not loaded.

This patch changes the order of registration. The codec driver is there
before the ac97 driver, so the snd_soc_register_device call is
successfull.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 sound/soc/fsl/phycore-ac97.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

Comments

Mark Brown March 11, 2013, 11:10 a.m. UTC | #1
On Sun, Mar 10, 2013 at 07:33:07PM +0100, Markus Pargmann wrote:
> Adding a soc-audio sound driver internally uses snd_soc_register_device,
> which tries to bind it with the codec. The adding of the driver is
> deferred because the codec driver is not loaded.

> This patch changes the order of registration. The codec driver is there
> before the ac97 driver, so the snd_soc_register_device call is
> successfull.

You shouldn't be using soc-audio in the first place...
Markus Pargmann March 11, 2013, 7:56 p.m. UTC | #2
On Mon, Mar 11, 2013 at 11:10:11AM +0000, Mark Brown wrote:
> On Sun, Mar 10, 2013 at 07:33:07PM +0100, Markus Pargmann wrote:
> > Adding a soc-audio sound driver internally uses snd_soc_register_device,
> > which tries to bind it with the codec. The adding of the driver is
> > deferred because the codec driver is not loaded.
> 
> > This patch changes the order of registration. The codec driver is there
> > before the ac97 driver, so the snd_soc_register_device call is
> > successfull.
> 
> You shouldn't be using soc-audio in the first place...

Yes. This is just a fixup of the old "driver" part.
The new DT driver does not use soc-audio (added in patch 7)

Regards,

Markus
diff mbox

Patch

diff --git a/sound/soc/fsl/phycore-ac97.c b/sound/soc/fsl/phycore-ac97.c
index f8da6dd..d146cec 100644
--- a/sound/soc/fsl/phycore-ac97.c
+++ b/sound/soc/fsl/phycore-ac97.c
@@ -79,35 +79,40 @@  static int __init imx_phycore_init(void)
 		return 0;
 	}
 
-	imx_phycore_snd_ac97_device = platform_device_alloc("soc-audio", -1);
-	if (!imx_phycore_snd_ac97_device)
+
+	/*
+	 * First add codec driver, otherwise soc-audio may be deferred and fails
+	 * to load.
+	 */
+	imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
+	if (!imx_phycore_snd_device)
 		return -ENOMEM;
 
-	platform_set_drvdata(imx_phycore_snd_ac97_device, &imx_phycore);
-	ret = platform_device_add(imx_phycore_snd_ac97_device);
-	if (ret)
+	ret = platform_device_add(imx_phycore_snd_device);
+	if (ret) {
+		printk(KERN_ERR "ASoC: Platform device allocation failed\n");
 		goto fail1;
+	}
 
-	imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
-	if (!imx_phycore_snd_device) {
+	imx_phycore_snd_ac97_device = platform_device_alloc("soc-audio", -1);
+	if (!imx_phycore_snd_ac97_device) {
 		ret = -ENOMEM;
 		goto fail2;
 	}
-	ret = platform_device_add(imx_phycore_snd_device);
 
-	if (ret) {
-		printk(KERN_ERR "ASoC: Platform device allocation failed\n");
+	platform_set_drvdata(imx_phycore_snd_ac97_device, &imx_phycore);
+	ret = platform_device_add(imx_phycore_snd_ac97_device);
+	if (ret)
 		goto fail3;
-	}
 
 	return 0;
 
 fail3:
-	platform_device_put(imx_phycore_snd_device);
+	platform_device_put(imx_phycore_snd_ac97_device);
 fail2:
-	platform_device_del(imx_phycore_snd_ac97_device);
+	platform_device_del(imx_phycore_snd_device);
 fail1:
-	platform_device_put(imx_phycore_snd_ac97_device);
+	platform_device_put(imx_phycore_snd_device);
 	return ret;
 }