alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] ASoC: fsl: add PPC_MPC52xx dependency to SND_POWERPC_SOC
@ 2012-09-20 14:36 Eric Millbrandt
  2012-09-20 14:36 ` [PATCH 2/3] ASoC: fsl: pcm030-audio-fabric use snd_soc_register_card Eric Millbrandt
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Eric Millbrandt @ 2012-09-20 14:36 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Grant Likely
  Cc: alsa-devel, linuxppc-dev, Eric Millbrandt

mpc52xx socs do not define FSL_SOC but need SND_POWERPC_SOC defined to build
ASoC drivers.

Signed-off-by: Eric Millbrandt <emillbrandt@dekaresearch.com>
---
Changes since v1:
Patch was "powerpc/52xx: define FSL_SOC"
Changed from defining FSL_SOC for PPC_MPC52xx to adding PPC_MPC52xx as a
dependency of SND_POWERPC_SOC as per Anatolij Gustschin's comment.

 sound/soc/fsl/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index d701330..4563b28 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -6,7 +6,7 @@ config SND_SOC_FSL_UTILS
 
 menuconfig SND_POWERPC_SOC
 	tristate "SoC Audio for Freescale PowerPC CPUs"
-	depends on FSL_SOC
+	depends on FSL_SOC || PPC_MPC52xx
 	help
 	  Say Y or M if you want to add support for codecs attached to
 	  the PowerPC CPUs.
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] ASoC: fsl: pcm030-audio-fabric use snd_soc_register_card
  2012-09-20 14:36 [PATCH v2 1/3] ASoC: fsl: add PPC_MPC52xx dependency to SND_POWERPC_SOC Eric Millbrandt
@ 2012-09-20 14:36 ` Eric Millbrandt
  2012-09-22 15:01   ` Mark Brown
  2012-09-20 14:36 ` [PATCH 3/3] ASoC: fsl: register the wm9712-codec Eric Millbrandt
  2012-09-22 15:01 ` [PATCH v2 1/3] ASoC: fsl: add PPC_MPC52xx dependency to SND_POWERPC_SOC Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Eric Millbrandt @ 2012-09-20 14:36 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Grant Likely
  Cc: alsa-devel, linuxppc-dev, Eric Millbrandt

Convert pcm030-audio-fabric to use the new snd_soc_register_card api
instead of the older method of registering a separate platform device.
Create the dai_link to the mpc5200_psc_ac97 platform using the device tree.
Convert the pcm030-audio-fabric driver to a platform-driver and add a
remove function.

Signed-off-by: Eric Millbrandt <emillbrandt@dekaresearch.com>
---
 sound/soc/fsl/pcm030-audio-fabric.c |   65 +++++++++++++++++++++++++----------
 1 files changed, 47 insertions(+), 18 deletions(-)

diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
index 1353e8f..893e240 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -28,7 +28,6 @@ static struct snd_soc_dai_link pcm030_fabric_dai[] = {
 	.stream_name = "AC97 Analog",
 	.codec_dai_name = "wm9712-hifi",
 	.cpu_dai_name = "mpc5200-psc-ac97.0",
-	.platform_name = "mpc5200-pcm-audio",
 	.codec_name = "wm9712-codec",
 },
 {
@@ -36,44 +35,74 @@ static struct snd_soc_dai_link pcm030_fabric_dai[] = {
 	.stream_name = "AC97 IEC958",
 	.codec_dai_name = "wm9712-aux",
 	.cpu_dai_name = "mpc5200-psc-ac97.1",
-	.platform_name = "mpc5200-pcm-audio",
 	.codec_name = "wm9712-codec",
 },
 };
 
-static struct snd_soc_card card = {
+static struct snd_soc_card pcm030_card = {
 	.name = "pcm030",
 	.owner = THIS_MODULE,
 	.dai_link = pcm030_fabric_dai,
 	.num_links = ARRAY_SIZE(pcm030_fabric_dai),
 };
 
-static __init int pcm030_fabric_init(void)
+static int __init pcm030_fabric_probe(struct platform_device *op)
 {
-	struct platform_device *pdev;
-	int rc;
+	struct device_node *np = op->dev.of_node;
+	struct device_node *platform_np;
+	struct snd_soc_card *card = &pcm030_card;
+	int ret;
+	int i;
 
 	if (!of_machine_is_compatible("phytec,pcm030"))
 		return -ENODEV;
 
-	pdev = platform_device_alloc("soc-audio", 1);
-	if (!pdev) {
-		pr_err("pcm030_fabric_init: platform_device_alloc() failed\n");
+	card->dev = &op->dev;
+	platform_set_drvdata(op, card);
+
+	platform_np = of_parse_phandle(np, "asoc-platform", 0);
+	if (!platform_np) {
+		dev_err(&op->dev, "ac97 not registered\n");
 		return -ENODEV;
 	}
 
-	platform_set_drvdata(pdev, &card);
+	for (i = 0; i < card->num_links; i++)
+		card->dai_link[i].platform_of_node = platform_np;
 
-	rc = platform_device_add(pdev);
-	if (rc) {
-		pr_err("pcm030_fabric_init: platform_device_add() failed\n");
-		platform_device_put(pdev);
-		return -ENODEV;
-	}
-	return 0;
+	ret = snd_soc_register_card(card);
+	if (ret)
+		dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
+
+	return ret;
 }
 
-module_init(pcm030_fabric_init);
+static int __devexit pcm030_fabric_remove(struct platform_device *op)
+{
+	struct snd_soc_card *card = platform_get_drvdata(op);
+	int ret;
+
+	ret = snd_soc_unregister_card(card);
+
+	return ret;
+}
+
+static struct of_device_id pcm030_audio_match[] = {
+	{ .compatible = "phytec,pcm030-audio-fabric", },
+	{}
+};
+MODULE_DEVICE_TABLE(of, pcm030_audio_match);
+
+static struct platform_driver pcm030_fabric_driver = {
+	.probe		= pcm030_fabric_probe,
+	.remove		= __devexit_p(pcm030_fabric_remove),
+	.driver		= {
+		.name	= DRV_NAME,
+		.owner	= THIS_MODULE,
+		.of_match_table    = pcm030_audio_match,
+	},
+};
+
+module_platform_driver(pcm030_fabric_driver);
 
 
 MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] ASoC: fsl: register the wm9712-codec
  2012-09-20 14:36 [PATCH v2 1/3] ASoC: fsl: add PPC_MPC52xx dependency to SND_POWERPC_SOC Eric Millbrandt
  2012-09-20 14:36 ` [PATCH 2/3] ASoC: fsl: pcm030-audio-fabric use snd_soc_register_card Eric Millbrandt
@ 2012-09-20 14:36 ` Eric Millbrandt
  2012-09-22 15:02   ` Mark Brown
  2012-09-22 15:01 ` [PATCH v2 1/3] ASoC: fsl: add PPC_MPC52xx dependency to SND_POWERPC_SOC Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Eric Millbrandt @ 2012-09-20 14:36 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Grant Likely
  Cc: alsa-devel, linuxppc-dev, Eric Millbrandt

The mpc5200-psc-ac97 driver does not enumerate attached ac97 devices, so
register the device here.

Signed-off-by: Eric Millbrandt <emillbrandt@dekaresearch.com>
---
 sound/soc/fsl/pcm030-audio-fabric.c |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
index 893e240..4b63ec8 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -22,6 +22,11 @@
 
 #define DRV_NAME "pcm030-audio-fabric"
 
+struct pcm030_audio_data {
+	struct snd_soc_card *card;
+	struct platform_device *codec_device;
+};
+
 static struct snd_soc_dai_link pcm030_fabric_dai[] = {
 {
 	.name = "AC97",
@@ -51,14 +56,22 @@ static int __init pcm030_fabric_probe(struct platform_device *op)
 	struct device_node *np = op->dev.of_node;
 	struct device_node *platform_np;
 	struct snd_soc_card *card = &pcm030_card;
+	struct pcm030_audio_data *pdata;
 	int ret;
 	int i;
 
 	if (!of_machine_is_compatible("phytec,pcm030"))
 		return -ENODEV;
 
+	pdata = devm_kzalloc(&op->dev, sizeof(struct pcm030_audio_data),
+			     GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
+
 	card->dev = &op->dev;
-	platform_set_drvdata(op, card);
+	platform_set_drvdata(op, pdata);
+
+	pdata->card = card;
 
 	platform_np = of_parse_phandle(np, "asoc-platform", 0);
 	if (!platform_np) {
@@ -69,6 +82,18 @@ static int __init pcm030_fabric_probe(struct platform_device *op)
 	for (i = 0; i < card->num_links; i++)
 		card->dai_link[i].platform_of_node = platform_np;
 
+	ret = request_module("snd-soc-wm9712");
+	if (ret)
+		dev_err(&op->dev, "request_module returned: %d\n", ret);
+
+	pdata->codec_device = platform_device_alloc("wm9712-codec", -1);
+	if (!pdata->codec_device)
+		dev_err(&op->dev, "platform_device_alloc() failed\n");
+
+	ret = platform_device_add(pdata->codec_device);
+	if (ret)
+		dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);
+
 	ret = snd_soc_register_card(card);
 	if (ret)
 		dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
@@ -78,10 +103,11 @@ static int __init pcm030_fabric_probe(struct platform_device *op)
 
 static int __devexit pcm030_fabric_remove(struct platform_device *op)
 {
-	struct snd_soc_card *card = platform_get_drvdata(op);
+	struct pcm030_audio_data *pdata = platform_get_drvdata(op);
 	int ret;
 
-	ret = snd_soc_unregister_card(card);
+	ret = snd_soc_unregister_card(pdata->card);
+	platform_device_unregister(pdata->codec_device);
 
 	return ret;
 }
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/3] ASoC: fsl: add PPC_MPC52xx dependency to SND_POWERPC_SOC
  2012-09-20 14:36 [PATCH v2 1/3] ASoC: fsl: add PPC_MPC52xx dependency to SND_POWERPC_SOC Eric Millbrandt
  2012-09-20 14:36 ` [PATCH 2/3] ASoC: fsl: pcm030-audio-fabric use snd_soc_register_card Eric Millbrandt
  2012-09-20 14:36 ` [PATCH 3/3] ASoC: fsl: register the wm9712-codec Eric Millbrandt
@ 2012-09-22 15:01 ` Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-09-22 15:01 UTC (permalink / raw)
  To: Eric Millbrandt; +Cc: Grant Likely, alsa-devel, linuxppc-dev, Liam Girdwood

On Thu, Sep 20, 2012 at 10:36:43AM -0400, Eric Millbrandt wrote:
> mpc52xx socs do not define FSL_SOC but need SND_POWERPC_SOC defined to build
> ASoC drivers.

Applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] ASoC: fsl: pcm030-audio-fabric use snd_soc_register_card
  2012-09-20 14:36 ` [PATCH 2/3] ASoC: fsl: pcm030-audio-fabric use snd_soc_register_card Eric Millbrandt
@ 2012-09-22 15:01   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-09-22 15:01 UTC (permalink / raw)
  To: Eric Millbrandt; +Cc: Grant Likely, alsa-devel, linuxppc-dev, Liam Girdwood

On Thu, Sep 20, 2012 at 10:36:44AM -0400, Eric Millbrandt wrote:
> Convert pcm030-audio-fabric to use the new snd_soc_register_card api
> instead of the older method of registering a separate platform device.
> Create the dai_link to the mpc5200_psc_ac97 platform using the device tree.
> Convert the pcm030-audio-fabric driver to a platform-driver and add a
> remove function.

Applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] ASoC: fsl: register the wm9712-codec
  2012-09-20 14:36 ` [PATCH 3/3] ASoC: fsl: register the wm9712-codec Eric Millbrandt
@ 2012-09-22 15:02   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-09-22 15:02 UTC (permalink / raw)
  To: Eric Millbrandt; +Cc: Grant Likely, alsa-devel, linuxppc-dev, Liam Girdwood

On Thu, Sep 20, 2012 at 10:36:45AM -0400, Eric Millbrandt wrote:
> The mpc5200-psc-ac97 driver does not enumerate attached ac97 devices, so
> register the device here.

Applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-09-22 15:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-20 14:36 [PATCH v2 1/3] ASoC: fsl: add PPC_MPC52xx dependency to SND_POWERPC_SOC Eric Millbrandt
2012-09-20 14:36 ` [PATCH 2/3] ASoC: fsl: pcm030-audio-fabric use snd_soc_register_card Eric Millbrandt
2012-09-22 15:01   ` Mark Brown
2012-09-20 14:36 ` [PATCH 3/3] ASoC: fsl: register the wm9712-codec Eric Millbrandt
2012-09-22 15:02   ` Mark Brown
2012-09-22 15:01 ` [PATCH v2 1/3] ASoC: fsl: add PPC_MPC52xx dependency to SND_POWERPC_SOC Mark Brown

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).