summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-utils.c
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@ti.com>2012-01-09 12:36:24 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-20 13:58:27 +0000
commit7aca69f9fe8f04ca37a01e2540960c53b24e3223 (patch)
tree97e6b1f4b6be7059fb2a9d7a1b4ef4063c54ea67 /sound/soc/soc-utils.c
parent08656910bb80882aaad739faea6dac3a0818f71c (diff)
downloadlinux-stable-7aca69f9fe8f04ca37a01e2540960c53b24e3223.tar.gz
linux-stable-7aca69f9fe8f04ca37a01e2540960c53b24e3223.tar.bz2
linux-stable-7aca69f9fe8f04ca37a01e2540960c53b24e3223.zip
ASoC: utils - Add support for a dummy codec driver.
This is useful to create dummy codec devices where we need to have some DAI links without a real Codec. e.g. could be used to represent dumb FM, MODEM, etc This is also used by dynamic PCM for DAI links that have no codec. Signed-off-by: Liam Girdwood <lrg@ti.com> [Fixed the indentation -- broonie] Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-utils.c')
-rw-r--r--sound/soc/soc-utils.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index 4220bb0f2730..60053709e417 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -89,14 +89,32 @@ static struct snd_soc_platform_driver dummy_platform = {
.ops = &dummy_dma_ops,
};
+static struct snd_soc_codec_driver dummy_codec;
+static struct snd_soc_dai_driver dummy_dai = {
+ .name = "snd-soc-dummy-dai",
+};
+
static __devinit int snd_soc_dummy_probe(struct platform_device *pdev)
{
- return snd_soc_register_platform(&pdev->dev, &dummy_platform);
+ int ret;
+
+ ret = snd_soc_register_codec(&pdev->dev, &dummy_codec, &dummy_dai, 1);
+ if (ret < 0)
+ return ret;
+
+ ret = snd_soc_register_platform(&pdev->dev, &dummy_platform);
+ if (ret < 0) {
+ snd_soc_unregister_codec(&pdev->dev);
+ return ret;
+ }
+
+ return ret;
}
static __devexit int snd_soc_dummy_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
+ snd_soc_unregister_codec(&pdev->dev);
return 0;
}