ASoC: davinci: davinci-pcm does not need to be a plaform_driver

Same as the commit 518de86 (ASoC: tegra: register 'platform' from DAIs,
get rid of pdev). It makes davinci-pcm not a platform_driver but helper
to register "platform", so that the platform_device for davinci-pcm can
be saved completely.

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Hebbar, Gururaja 2012-08-27 18:56:39 +05:30 committed by Mark Brown
parent c24fdc886f
commit f08095a408
7 changed files with 46 additions and 25 deletions

View file

@ -159,7 +159,7 @@ static struct snd_soc_dai_link dm6446_evm_dai = {
.cpu_dai_name = "davinci-mcbsp", .cpu_dai_name = "davinci-mcbsp",
.codec_dai_name = "tlv320aic3x-hifi", .codec_dai_name = "tlv320aic3x-hifi",
.codec_name = "tlv320aic3x-codec.1-001b", .codec_name = "tlv320aic3x-codec.1-001b",
.platform_name = "davinci-pcm-audio", .platform_name = "davinci-mcbsp",
.init = evm_aic3x_init, .init = evm_aic3x_init,
.ops = &evm_ops, .ops = &evm_ops,
}; };
@ -170,7 +170,7 @@ static struct snd_soc_dai_link dm355_evm_dai = {
.cpu_dai_name = "davinci-mcbsp.1", .cpu_dai_name = "davinci-mcbsp.1",
.codec_dai_name = "tlv320aic3x-hifi", .codec_dai_name = "tlv320aic3x-hifi",
.codec_name = "tlv320aic3x-codec.1-001b", .codec_name = "tlv320aic3x-codec.1-001b",
.platform_name = "davinci-pcm-audio", .platform_name = "davinci-mcbsp.1",
.init = evm_aic3x_init, .init = evm_aic3x_init,
.ops = &evm_ops, .ops = &evm_ops,
}; };
@ -184,14 +184,15 @@ static struct snd_soc_dai_link dm365_evm_dai = {
.init = evm_aic3x_init, .init = evm_aic3x_init,
.codec_name = "tlv320aic3x-codec.1-0018", .codec_name = "tlv320aic3x-codec.1-0018",
.ops = &evm_ops, .ops = &evm_ops,
.platform_name = "davinci-mcbsp",
#elif defined(CONFIG_SND_DM365_VOICE_CODEC) #elif defined(CONFIG_SND_DM365_VOICE_CODEC)
.name = "Voice Codec - CQ93VC", .name = "Voice Codec - CQ93VC",
.stream_name = "CQ93", .stream_name = "CQ93",
.cpu_dai_name = "davinci-vcif", .cpu_dai_name = "davinci-vcif",
.codec_dai_name = "cq93vc-hifi", .codec_dai_name = "cq93vc-hifi",
.codec_name = "cq93vc-codec", .codec_name = "cq93vc-codec",
.platform_name = "avinci-vcif",
#endif #endif
.platform_name = "davinci-pcm-audio",
}; };
static struct snd_soc_dai_link dm6467_evm_dai[] = { static struct snd_soc_dai_link dm6467_evm_dai[] = {
@ -200,7 +201,7 @@ static struct snd_soc_dai_link dm6467_evm_dai[] = {
.stream_name = "AIC3X", .stream_name = "AIC3X",
.cpu_dai_name= "davinci-mcasp.0", .cpu_dai_name= "davinci-mcasp.0",
.codec_dai_name = "tlv320aic3x-hifi", .codec_dai_name = "tlv320aic3x-hifi",
.platform_name ="davinci-pcm-audio", .platform_name = "davinci-mcasp.0",
.codec_name = "tlv320aic3x-codec.0-001a", .codec_name = "tlv320aic3x-codec.0-001a",
.init = evm_aic3x_init, .init = evm_aic3x_init,
.ops = &evm_ops, .ops = &evm_ops,
@ -211,7 +212,7 @@ static struct snd_soc_dai_link dm6467_evm_dai[] = {
.cpu_dai_name= "davinci-mcasp.1", .cpu_dai_name= "davinci-mcasp.1",
.codec_dai_name = "dit-hifi", .codec_dai_name = "dit-hifi",
.codec_name = "spdif_dit", .codec_name = "spdif_dit",
.platform_name = "davinci-pcm-audio", .platform_name = "davinci-mcasp.1",
.ops = &evm_spdif_ops, .ops = &evm_spdif_ops,
}, },
}; };
@ -222,7 +223,7 @@ static struct snd_soc_dai_link da830_evm_dai = {
.cpu_dai_name = "davinci-mcasp.1", .cpu_dai_name = "davinci-mcasp.1",
.codec_dai_name = "tlv320aic3x-hifi", .codec_dai_name = "tlv320aic3x-hifi",
.codec_name = "tlv320aic3x-codec.1-0018", .codec_name = "tlv320aic3x-codec.1-0018",
.platform_name = "davinci-pcm-audio", .platform_name = "davinci-mcasp.1",
.init = evm_aic3x_init, .init = evm_aic3x_init,
.ops = &evm_ops, .ops = &evm_ops,
}; };
@ -233,7 +234,7 @@ static struct snd_soc_dai_link da850_evm_dai = {
.cpu_dai_name= "davinci-mcasp.0", .cpu_dai_name= "davinci-mcasp.0",
.codec_dai_name = "tlv320aic3x-hifi", .codec_dai_name = "tlv320aic3x-hifi",
.codec_name = "tlv320aic3x-codec.1-0018", .codec_name = "tlv320aic3x-codec.1-0018",
.platform_name = "davinci-pcm-audio", .platform_name = "davinci-mcasp.0",
.init = evm_aic3x_init, .init = evm_aic3x_init,
.ops = &evm_ops, .ops = &evm_ops,
}; };

View file

@ -732,8 +732,16 @@ static int davinci_i2s_probe(struct platform_device *pdev)
if (ret != 0) if (ret != 0)
goto err_release_clk; goto err_release_clk;
ret = davinci_soc_platform_register(&pdev->dev);
if (ret) {
dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
goto err_unregister_dai;
}
return 0; return 0;
err_unregister_dai:
snd_soc_unregister_dai(&pdev->dev);
err_release_clk: err_release_clk:
clk_disable(dev->clk); clk_disable(dev->clk);
clk_put(dev->clk); clk_put(dev->clk);
@ -745,6 +753,8 @@ static int davinci_i2s_remove(struct platform_device *pdev)
struct davinci_mcbsp_dev *dev = dev_get_drvdata(&pdev->dev); struct davinci_mcbsp_dev *dev = dev_get_drvdata(&pdev->dev);
snd_soc_unregister_dai(&pdev->dev); snd_soc_unregister_dai(&pdev->dev);
davinci_soc_platform_unregister(&pdev->dev);
clk_disable(dev->clk); clk_disable(dev->clk);
clk_put(dev->clk); clk_put(dev->clk);
dev->clk = NULL; dev->clk = NULL;

View file

@ -945,8 +945,17 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
if (ret != 0) if (ret != 0)
goto err_release_clk; goto err_release_clk;
ret = davinci_soc_platform_register(&pdev->dev);
if (ret) {
dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
goto err_unregister_dai;
}
return 0; return 0;
err_unregister_dai:
snd_soc_unregister_dai(&pdev->dev);
err_release_clk: err_release_clk:
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
@ -957,6 +966,7 @@ static int davinci_mcasp_remove(struct platform_device *pdev)
{ {
snd_soc_unregister_dai(&pdev->dev); snd_soc_unregister_dai(&pdev->dev);
davinci_soc_platform_unregister(&pdev->dev);
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);

View file

@ -864,28 +864,17 @@ static struct snd_soc_platform_driver davinci_soc_platform = {
.pcm_free = davinci_pcm_free, .pcm_free = davinci_pcm_free,
}; };
static int __devinit davinci_soc_platform_probe(struct platform_device *pdev) int davinci_soc_platform_register(struct device *dev)
{ {
return snd_soc_register_platform(&pdev->dev, &davinci_soc_platform); return snd_soc_register_platform(dev, &davinci_soc_platform);
} }
EXPORT_SYMBOL_GPL(davinci_soc_platform_register);
static int __devexit davinci_soc_platform_remove(struct platform_device *pdev) void davinci_soc_platform_unregister(struct device *dev)
{ {
snd_soc_unregister_platform(&pdev->dev); snd_soc_unregister_platform(dev);
return 0;
} }
EXPORT_SYMBOL_GPL(davinci_soc_platform_unregister);
static struct platform_driver davinci_pcm_driver = {
.driver = {
.name = "davinci-pcm-audio",
.owner = THIS_MODULE,
},
.probe = davinci_soc_platform_probe,
.remove = __devexit_p(davinci_soc_platform_remove),
};
module_platform_driver(davinci_pcm_driver);
MODULE_AUTHOR("Vladimir Barinov"); MODULE_AUTHOR("Vladimir Barinov");
MODULE_DESCRIPTION("TI DAVINCI PCM DMA module"); MODULE_DESCRIPTION("TI DAVINCI PCM DMA module");

View file

@ -28,4 +28,7 @@ struct davinci_pcm_dma_params {
unsigned int fifo_level; unsigned int fifo_level;
}; };
int davinci_soc_platform_register(struct device *dev);
void davinci_soc_platform_unregister(struct device *dev);
#endif #endif

View file

@ -86,7 +86,7 @@ static struct snd_soc_dai_link sffsdr_dai = {
.cpu_dai_name = "davinci-mcbsp", .cpu_dai_name = "davinci-mcbsp",
.codec_dai_name = "pcm3008-hifi", .codec_dai_name = "pcm3008-hifi",
.codec_name = "pcm3008-codec", .codec_name = "pcm3008-codec",
.platform_name = "davinci-pcm-audio", .platform_name = "davinci-mcbsp",
.ops = &sffsdr_ops, .ops = &sffsdr_ops,
}; };

View file

@ -240,12 +240,20 @@ static int davinci_vcif_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = davinci_soc_platform_register(&pdev->dev);
if (ret) {
dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
snd_soc_unregister_dai(&pdev->dev);
return ret;
}
return 0; return 0;
} }
static int davinci_vcif_remove(struct platform_device *pdev) static int davinci_vcif_remove(struct platform_device *pdev)
{ {
snd_soc_unregister_dai(&pdev->dev); snd_soc_unregister_dai(&pdev->dev);
davinci_soc_platform_unregister(&pdev->dev);
return 0; return 0;
} }