alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: utils - Add support for a dummy codec driver.
@ 2012-01-09 12:36 Liam Girdwood
  2012-01-10  4:41 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Liam Girdwood @ 2012-01-09 12:36 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Liam Girdwood

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>
---
 sound/soc/soc-utils.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index 4220bb0..329122d 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;
 }
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: utils - Add support for a dummy codec driver.
  2012-01-09 12:36 [PATCH] ASoC: utils - Add support for a dummy codec driver Liam Girdwood
@ 2012-01-10  4:41 ` Mark Brown
  2012-01-10 10:53   ` Liam Girdwood
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2012-01-10  4:41 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel

On Mon, Jan 09, 2012 at 12:36:24PM +0000, Liam Girdwood wrote:
> 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

I've applied this but I think we should move it into the CODECs
directory - I stubbed the platform out in here mostly because there
isn't a natural place to put a platform driver that's not associated
with a particular platform.  Does that sound sensible?

> +static struct snd_soc_dai_driver dummy_dai = {
> +		.name = "snd-soc-dummy-dai",
> +};

Also fixed the indentation here while applying.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: utils - Add support for a dummy codec driver.
  2012-01-10  4:41 ` Mark Brown
@ 2012-01-10 10:53   ` Liam Girdwood
  0 siblings, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2012-01-10 10:53 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel

On Tue, 2012-01-10 at 04:41 +0000, Mark Brown wrote:
> On Mon, Jan 09, 2012 at 12:36:24PM +0000, Liam Girdwood wrote:
> > 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
> 
> I've applied this but I think we should move it into the CODECs
> directory - I stubbed the platform out in here mostly because there
> isn't a natural place to put a platform driver that's not associated
> with a particular platform.  Does that sound sensible?

yeah, I was 50/50 about this since we do have codecs/ and utils.c. I
don't really mind where it goes.

Liam

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-10 10:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-09 12:36 [PATCH] ASoC: utils - Add support for a dummy codec driver Liam Girdwood
2012-01-10  4:41 ` Mark Brown
2012-01-10 10:53   ` Liam Girdwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).