ASoC: Ux500: Initialise PCM from MSP probe rather than as a device
authorLee Jones <lee.jones@linaro.org>
Fri, 23 Nov 2012 13:05:41 +0000 (13:05 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 23 Nov 2012 14:06:02 +0000 (23:06 +0900)
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.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Ola LILJA2 <ola.o.lilja@stericsson.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/ux500/mop500.c
sound/soc/ux500/ux500_msp_dai.c
sound/soc/ux500/ux500_pcm.c
sound/soc/ux500/ux500_pcm.h

index 356611d9654db90e1f0206995de6b7064b83bdf9..6f67e6b2582d9ec54c39ba64e8694d950169d467 100644 (file)
@@ -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,
index 74bb3c0e81f5986e8877bb587531314cdb375f41..478b4b60e0cc1a11198747502d41722c4a6e494a 100644 (file)
@@ -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)
@@ -832,8 +833,18 @@ 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:
@@ -848,6 +859,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);
index 1a04e248453c6fb743b7fb765d1ad1eeaa55cd39..894c9f4bb9f689d11e6f8e9b3ee05a1a1281519c 100644 (file)
@@ -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);
index 77ed44d371e994a244d1393f0898fbae8a7af764..76d344476afc398d6cca59943eb065b195ce734d 100644 (file)
@@ -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