Skip to content

Commit

Permalink
ASoC: utils - Add support for a dummy codec driver.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Liam Girdwood authored and Mark Brown committed Jan 20, 2012
1 parent 0865691 commit 7aca69f
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion sound/soc/soc-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7aca69f

Please sign in to comment.