All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, olalilja@yahoo.se,
	ola.o.lilja@stericsson.com, alsa-devel@alsa-project.org,
	lrg@ti.com, broonie@opensource.wolfsonmicro.com
Cc: STEricsson_nomadik_linux@list.st.com,
	linus.walleij@stericsson.com, arnd@arndb.de,
	Lee Jones <lee.jones@linaro.org>
Subject: [PATCH 04/19] ASoC: Ux500: Initialise PCM from MSP probe rather than as a device
Date: Tue, 31 Jul 2012 14:38:58 +0100	[thread overview]
Message-ID: <1343741953-17828-5-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1343741953-17828-1-git-send-email-lee.jones@linaro.org>

The PCM is a pseudo-device. It doesn't have any of it's own registers
or hardware. It rather acts as a layer of abstraction for DMA
transfers. Hence, instead of classifying it as a device in its own
right, we call the initialisation from the MSP driver.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 sound/soc/ux500/mop500.c        |    4 ++--
 sound/soc/ux500/ux500_msp_dai.c |   14 +++++++++++++-
 sound/soc/ux500/ux500_pcm.c     |   19 ++++---------------
 sound/soc/ux500/ux500_pcm.h     |    3 +++
 4 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c
index 821f2a9..69bd69a 100644
--- a/sound/soc/ux500/mop500.c
+++ b/sound/soc/ux500/mop500.c
@@ -33,7 +33,7 @@ struct snd_soc_dai_link mop500_dai_links[] = {
 		.stream_name = "ab8500_0",
 		.cpu_dai_name = "ux500-msp-i2s.1",
 		.codec_dai_name = "ab8500-codec-dai.0",
-		.platform_name = "ux500-pcm.0",
+		.platform_name = "ux500-msp-i2s.1",
 		.codec_name = "ab8500-codec.0",
 		.init = mop500_ab8500_machine_init,
 		.ops = mop500_ab8500_ops,
@@ -43,7 +43,7 @@ struct snd_soc_dai_link mop500_dai_links[] = {
 		.stream_name = "ab8500_1",
 		.cpu_dai_name = "ux500-msp-i2s.3",
 		.codec_dai_name = "ab8500-codec-dai.1",
-		.platform_name = "ux500-pcm.0",
+		.platform_name = "ux500-msp-i2s.3",
 		.codec_name = "ab8500-codec.0",
 		.init = NULL,
 		.ops = mop500_ab8500_ops,
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index 0f7dd49..3476d6a 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -28,6 +28,7 @@
 
 #include "ux500_msp_i2s.h"
 #include "ux500_msp_dai.h"
+#include "ux500_pcm.h"
 
 static int setup_pcm_multichan(struct snd_soc_dai *dai,
 			struct ux500_msp_config *msp_config)
@@ -806,11 +807,20 @@ static int __devinit ux500_msp_drv_probe(struct platform_device *pdev)
 		goto err_init_msp;
 	}
 
+	ret = ux500_pcm_register_platform(pdev);
+	if (ret < 0) {
+		dev_err(&pdev->dev,
+			"Error: %s: Failed to register PCM platform device!\n",
+			__func__);
+		goto err_reg_plat;
+	}
+
 	return 0;
 
+err_reg_plat:
+	snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(ux500_msp_dai_drv));
 err_init_msp:
 	clk_put(drvdata->clk);
-
 err_clk:
 	devm_regulator_put(drvdata->reg_vape);
 
@@ -821,6 +831,8 @@ static int __devexit ux500_msp_drv_remove(struct platform_device *pdev)
 {
 	struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(&pdev->dev);
 
+	ux500_pcm_unregister_platform(pdev);
+
 	snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(ux500_msp_dai_drv));
 
 	devm_regulator_put(drvdata->reg_vape);
diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c
index 1a04e24..894c9f4 100644
--- a/sound/soc/ux500/ux500_pcm.c
+++ b/sound/soc/ux500/ux500_pcm.c
@@ -282,7 +282,7 @@ static struct snd_soc_platform_driver ux500_pcm_soc_drv = {
 	.pcm_new        = ux500_pcm_new,
 };
 
-static int __devexit ux500_pcm_drv_probe(struct platform_device *pdev)
+int __devinit ux500_pcm_register_platform(struct platform_device *pdev)
 {
 	int ret;
 
@@ -296,23 +296,12 @@ static int __devexit ux500_pcm_drv_probe(struct platform_device *pdev)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(ux500_pcm_register_platform);
 
-static int __devinit ux500_pcm_drv_remove(struct platform_device *pdev)
+int __devexit ux500_pcm_unregister_platform(struct platform_device *pdev)
 {
 	snd_soc_unregister_platform(&pdev->dev);
 
 	return 0;
 }
-
-static struct platform_driver ux500_pcm_driver = {
-	.driver = {
-		.name = "ux500-pcm",
-		.owner = THIS_MODULE,
-	},
-
-	.probe = ux500_pcm_drv_probe,
-	.remove = __devexit_p(ux500_pcm_drv_remove),
-};
-module_platform_driver(ux500_pcm_driver);
-
-MODULE_LICENSE("GPL v2");
+EXPORT_SYMBOL_GPL(ux500_pcm_unregister_platform);
diff --git a/sound/soc/ux500/ux500_pcm.h b/sound/soc/ux500/ux500_pcm.h
index 77ed44d..76d3444 100644
--- a/sound/soc/ux500/ux500_pcm.h
+++ b/sound/soc/ux500/ux500_pcm.h
@@ -32,4 +32,7 @@
 #define UX500_PLATFORM_PERIODS_MAX		48
 #define UX500_PLATFORM_BUFFER_BYTES_MAX		(2048 * PAGE_SIZE)
 
+int ux500_pcm_register_platform(struct platform_device *pdev);
+int ux500_pcm_unregister_platform(struct platform_device *pdev);
+
 #endif
-- 
1.7.9.5


WARNING: multiple messages have this Message-ID (diff)
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/19] ASoC: Ux500: Initialise PCM from MSP probe rather than as a device
Date: Tue, 31 Jul 2012 14:38:58 +0100	[thread overview]
Message-ID: <1343741953-17828-5-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1343741953-17828-1-git-send-email-lee.jones@linaro.org>

The PCM is a pseudo-device. It doesn't have any of it's own registers
or hardware. It rather acts as a layer of abstraction for DMA
transfers. Hence, instead of classifying it as a device in its own
right, we call the initialisation from the MSP driver.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 sound/soc/ux500/mop500.c        |    4 ++--
 sound/soc/ux500/ux500_msp_dai.c |   14 +++++++++++++-
 sound/soc/ux500/ux500_pcm.c     |   19 ++++---------------
 sound/soc/ux500/ux500_pcm.h     |    3 +++
 4 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c
index 821f2a9..69bd69a 100644
--- a/sound/soc/ux500/mop500.c
+++ b/sound/soc/ux500/mop500.c
@@ -33,7 +33,7 @@ struct snd_soc_dai_link mop500_dai_links[] = {
 		.stream_name = "ab8500_0",
 		.cpu_dai_name = "ux500-msp-i2s.1",
 		.codec_dai_name = "ab8500-codec-dai.0",
-		.platform_name = "ux500-pcm.0",
+		.platform_name = "ux500-msp-i2s.1",
 		.codec_name = "ab8500-codec.0",
 		.init = mop500_ab8500_machine_init,
 		.ops = mop500_ab8500_ops,
@@ -43,7 +43,7 @@ struct snd_soc_dai_link mop500_dai_links[] = {
 		.stream_name = "ab8500_1",
 		.cpu_dai_name = "ux500-msp-i2s.3",
 		.codec_dai_name = "ab8500-codec-dai.1",
-		.platform_name = "ux500-pcm.0",
+		.platform_name = "ux500-msp-i2s.3",
 		.codec_name = "ab8500-codec.0",
 		.init = NULL,
 		.ops = mop500_ab8500_ops,
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index 0f7dd49..3476d6a 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -28,6 +28,7 @@
 
 #include "ux500_msp_i2s.h"
 #include "ux500_msp_dai.h"
+#include "ux500_pcm.h"
 
 static int setup_pcm_multichan(struct snd_soc_dai *dai,
 			struct ux500_msp_config *msp_config)
@@ -806,11 +807,20 @@ static int __devinit ux500_msp_drv_probe(struct platform_device *pdev)
 		goto err_init_msp;
 	}
 
+	ret = ux500_pcm_register_platform(pdev);
+	if (ret < 0) {
+		dev_err(&pdev->dev,
+			"Error: %s: Failed to register PCM platform device!\n",
+			__func__);
+		goto err_reg_plat;
+	}
+
 	return 0;
 
+err_reg_plat:
+	snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(ux500_msp_dai_drv));
 err_init_msp:
 	clk_put(drvdata->clk);
-
 err_clk:
 	devm_regulator_put(drvdata->reg_vape);
 
@@ -821,6 +831,8 @@ static int __devexit ux500_msp_drv_remove(struct platform_device *pdev)
 {
 	struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(&pdev->dev);
 
+	ux500_pcm_unregister_platform(pdev);
+
 	snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(ux500_msp_dai_drv));
 
 	devm_regulator_put(drvdata->reg_vape);
diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c
index 1a04e24..894c9f4 100644
--- a/sound/soc/ux500/ux500_pcm.c
+++ b/sound/soc/ux500/ux500_pcm.c
@@ -282,7 +282,7 @@ static struct snd_soc_platform_driver ux500_pcm_soc_drv = {
 	.pcm_new        = ux500_pcm_new,
 };
 
-static int __devexit ux500_pcm_drv_probe(struct platform_device *pdev)
+int __devinit ux500_pcm_register_platform(struct platform_device *pdev)
 {
 	int ret;
 
@@ -296,23 +296,12 @@ static int __devexit ux500_pcm_drv_probe(struct platform_device *pdev)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(ux500_pcm_register_platform);
 
-static int __devinit ux500_pcm_drv_remove(struct platform_device *pdev)
+int __devexit ux500_pcm_unregister_platform(struct platform_device *pdev)
 {
 	snd_soc_unregister_platform(&pdev->dev);
 
 	return 0;
 }
-
-static struct platform_driver ux500_pcm_driver = {
-	.driver = {
-		.name = "ux500-pcm",
-		.owner = THIS_MODULE,
-	},
-
-	.probe = ux500_pcm_drv_probe,
-	.remove = __devexit_p(ux500_pcm_drv_remove),
-};
-module_platform_driver(ux500_pcm_driver);
-
-MODULE_LICENSE("GPL v2");
+EXPORT_SYMBOL_GPL(ux500_pcm_unregister_platform);
diff --git a/sound/soc/ux500/ux500_pcm.h b/sound/soc/ux500/ux500_pcm.h
index 77ed44d..76d3444 100644
--- a/sound/soc/ux500/ux500_pcm.h
+++ b/sound/soc/ux500/ux500_pcm.h
@@ -32,4 +32,7 @@
 #define UX500_PLATFORM_PERIODS_MAX		48
 #define UX500_PLATFORM_BUFFER_BYTES_MAX		(2048 * PAGE_SIZE)
 
+int ux500_pcm_register_platform(struct platform_device *pdev);
+int ux500_pcm_unregister_platform(struct platform_device *pdev);
+
 #endif
-- 
1.7.9.5

  parent reply	other threads:[~2012-07-31 13:39 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 13:38 [PATCH 01/19] Configure ux500 Audio Drivers for Device Tree Lee Jones
2012-07-31 13:38 ` Lee Jones
2012-07-31 13:38 ` [PATCH 01/19] ASoC: Ux500: Move MSP pinctrl setup into the MSP driver Lee Jones
2012-07-31 13:38   ` Lee Jones
2012-07-31 13:38 ` [PATCH 02/19] ASoC: Ux500: Enable MOP500 driver for Device Tree Lee Jones
2012-07-31 13:38   ` Lee Jones
2012-07-31 13:38   ` Lee Jones
2012-07-31 13:38 ` [PATCH 03/19] ASoC: Ux500: Enable ux500 MSP " Lee Jones
2012-07-31 13:38   ` Lee Jones
2012-07-31 13:38   ` Lee Jones
2012-07-31 13:38 ` Lee Jones [this message]
2012-07-31 13:38   ` [PATCH 04/19] ASoC: Ux500: Initialise PCM from MSP probe rather than as a device Lee Jones
2012-07-31 13:38 ` [PATCH 05/19] ASoC: codecs: Enable AB8500 CODEC for Device Tree Lee Jones
2012-07-31 13:38   ` Lee Jones
2012-07-31 13:38   ` Lee Jones
2012-07-31 13:39 ` [PATCH 06/19] ARM: ux500: Clean-up MSP platform code Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39 ` [PATCH 07/19] ARM: ux500: Add AB8500 CODEC node to DB8500 Device Tree Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39 ` [PATCH 08/19] ARM: ux500: Fork MSP platform registration for step-by-step DT enablement Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39 ` [PATCH 09/19] ARM: ux500: Pass MSP DMA platform data though AUXDATA Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39 ` [PATCH 10/19] ARM: ux500: Stop registering the MOP500 Audio driver from platform code Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39 ` [PATCH 11/19] ARM: ux500: Stop registering the PCM " Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39 ` [PATCH 12/19] ARM: ux500: Remove platform registration of MSP devices Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39 ` [PATCH 13/19] ARM: ux500: Rename MSP board file to something more meaningful Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39 ` [PATCH 14/19] ARM: ux500: Rename db8500.dtsi to dbx5x0.dtsi to encompass the u9500, u8540 and u9540 Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39 ` [PATCH 15/19] ARM: ux500: Add nodes for the MSP into Device Tree Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39 ` [PATCH 16/19] ARM: ux500: Add all encompassing sound node to the Snowball " Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:39 ` [PATCH 17/19] Documentation: Define the MOP500 Audio Machine Driver Device Tree bindings Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:53   ` Mark Brown
2012-07-31 13:53     ` Mark Brown
2012-07-31 13:53     ` Mark Brown
2012-07-31 15:00     ` Lee Jones
2012-07-31 15:00       ` Lee Jones
2012-07-31 15:00       ` Lee Jones
2012-08-02 12:12     ` Lee Jones
2012-08-02 12:12       ` Lee Jones
2012-08-02 12:12       ` Lee Jones
2012-07-31 13:39 ` [PATCH 18/19] Documentation: Define the MSP " Lee Jones
2012-07-31 13:39   ` Lee Jones
2012-07-31 13:55   ` Mark Brown
2012-07-31 13:55     ` Mark Brown
2012-07-31 13:55     ` Mark Brown
2012-07-31 14:59     ` Lee Jones
2012-07-31 14:59       ` Lee Jones
2012-07-31 14:59       ` Lee Jones
2012-07-31 15:10       ` Mark Brown
2012-07-31 15:10         ` Mark Brown
2012-07-31 15:10         ` Mark Brown
2012-08-02 12:45         ` Lee Jones
2012-08-02 12:45           ` Lee Jones
2012-08-02 12:45           ` Lee Jones
2012-07-31 13:39 ` [PATCH 19/19] Documentation: Add the AB8500 CODEC device to the MFD AB8500 doc Lee Jones
2012-07-31 13:39   ` Lee Jones

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=1343741953-17828-5-git-send-email-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=STEricsson_nomadik_linux@list.st.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnd@arndb.de \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=ola.o.lilja@stericsson.com \
    --cc=olalilja@yahoo.se \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.