devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: Fabio Estevam
	<fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Mark Brown
	<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Sascha Hauer <kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	Timur Tabi <timur-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Subject: [PATCH 06/10] ARM: soc-audio phycore-ac97: fix driver init order
Date: Sun, 10 Mar 2013 19:33:07 +0100	[thread overview]
Message-ID: <1362940391-8338-7-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1362940391-8338-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 sound/soc/fsl/phycore-ac97.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

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;
 }
 
-- 
1.8.1.5

  parent reply	other threads:[~2013-03-10 18:33 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-10 18:33 [PATCH 00/10] ASoC: imx sound: Add DT support Markus Pargmann
     [not found] ` <1362940391-8338-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-10 18:33   ` [PATCH 01/10] imx-ssi: Fix AC97 rates Markus Pargmann
     [not found]     ` <1362940391-8338-2-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-10 18:47       ` Fabio Estevam
     [not found]         ` <CAOMZO5A8F81PzCjKHrkZ_AtGMr341d6OmYHMQvdzgunmGFDVsw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-11 19:51           ` Markus Pargmann
2013-03-13 22:55             ` Timur Tabi
     [not found]               ` <CAOZdJXXm=jJv3zyD4j11t3BgNGyKz6V9jzShQLTk-BTiwDjvMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-14 12:44                 ` Markus Pargmann
2013-03-12 18:52       ` Mark Brown
2013-03-10 18:33   ` [PATCH 02/10] imx-ssi: Fix occasional AC97 reset failure Markus Pargmann
2013-03-12 18:53     ` Mark Brown
2013-03-10 18:33   ` [PATCH 03/10] mx-ssi: flush fifos Markus Pargmann
     [not found]     ` <1362940391-8338-4-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-12 18:54       ` Mark Brown
2013-03-10 18:33   ` [PATCH 04/10] ASoC: Kconfig: imx-ssi needs imx-fiq and imx-dma Markus Pargmann
     [not found]     ` <1362940391-8338-5-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-12 18:55       ` Mark Brown
     [not found]         ` <20130312185510.GV19942-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2013-03-14 12:42           ` Markus Pargmann
2013-03-10 18:33   ` [PATCH 05/10] ASoC: pcm030 audio fabric: remove __init from probe Markus Pargmann
     [not found]     ` <1362940391-8338-6-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-12 18:55       ` Mark Brown
2013-03-10 18:33   ` Markus Pargmann [this message]
2013-03-11 11:10     ` [PATCH 06/10] ARM: soc-audio phycore-ac97: fix driver init order Mark Brown
     [not found]       ` <20130311111011.GA10617-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2013-03-11 19:56         ` Markus Pargmann
2013-03-10 18:33   ` [PATCH 07/10] ASoC: phycore-ac97: Add DT support Markus Pargmann
     [not found]     ` <1362940391-8338-8-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-12 18:59       ` Mark Brown
     [not found]         ` <20130312185921.GX19942-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2013-03-14 12:55           ` Markus Pargmann
2013-03-10 18:33   ` [PATCH 08/10] ASoC: dmaengine_pcm: Add open function for DT DMA request Markus Pargmann
2013-03-12 19:02     ` Mark Brown
     [not found]       ` <20130312190206.GY19942-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2013-03-13  2:18         ` Shawn Guo
2013-03-13 10:49           ` Mark Brown
     [not found]             ` <20130313104945.GI25610-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2013-03-14  6:04               ` Shawn Guo
2013-03-15  1:12                 ` Mark Brown
     [not found]           ` <20130313021712.GD27461-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2013-03-14 13:08             ` Markus Pargmann
2013-03-15  3:42               ` Shawn Guo
2013-03-15  9:07                 ` Markus Pargmann
2013-03-10 18:33   ` [PATCH 09/10] ASoC: imx-pcm-dma: Add support for DMA init by device node Markus Pargmann
2013-03-10 18:33   ` [PATCH 10/10] ASoC: imx-ssi: Add imx27 and pca100 DT support Markus Pargmann
2013-03-10 18:55     ` Alexander Shiyan
2013-03-13 22:53 ` [PATCH 00/10] ASoC: imx sound: Add " Timur Tabi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362940391-8338-7-git-send-email-mpa@pengutronix.de \
    --to=mpa-bicnvbalz9megne8c9+irq@public.gmane.org \
    --cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
    --cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=timur-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).