Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@list.ru>
To: "Gabriel M. Beddingfield" <gabrbedd@gmail.com>
Cc: ALSA devel <alsa-devel@alsa-project.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Steve Chen <schen@mvista.com>
Subject: Re: [PATCH] asoc: add dummy codec
Date: Thu, 11 Apr 2013 20:03:08 +0400	[thread overview]
Message-ID: <5166DEBC.8070702@list.ru> (raw)
In-Reply-To: <5166DB38.1010706@gmail.com>

11.04.2013 19:48, Gabriel M. Beddingfield пишет:
> On 04/11/2013 08:11 AM, Stas Sergeev wrote:
>>> There is already a dummy codec driver.
>>>
>>> Please take a look at sound/soc/soc-utils.c
>>>
>>> - Lars
>> Lars, indeed, this codec is present in a git kernel and
>> it wasn't in mine android kernel.
>> But, that driver is too dummy to even work at all.
>>
>> The attached patch adds a playback stream for the dummy
>> codec. Would it be possible to apply this?
> No... not like that.
>
> Instead, wouldn't it be better to extend it by defining some platform data?  Maybe something like:
>
> diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
> index fe4541d..9d22718 100644
> --- a/sound/soc/soc-utils.c
> +++ b/sound/soc/soc-utils.c
> @@ -96,9 +96,14 @@ static struct snd_soc_dai_driver dummy_dai = {
>  
>  static int snd_soc_dummy_probe(struct platform_device *pdev)
>  {
> +       struct snd_soc_dummy_dai_pdata *pdata = dev_get_platdata(&pdev->dev);
>         int ret;
>  
> -       ret = snd_soc_register_codec(&pdev->dev, &dummy_codec, &dummy_dai, 1);
> +       if (pdata->n_dai > 0)
> +               ret = snd_soc_register_codec(&pdev->dev, &dummy_codec,
> +                                            &pdata->dai, &pdata->n_dai);
> +       else
> +               ret = snd_soc_register_codec(&pdev->dev, &dummy_codec, &dummy_dai, 1);
>         if (ret < 0)
>                 return ret;
>  
>
> ...then you can define whatever kind of DAI you want in the machine driver.
But that's a _dummy_ codec, it simply does this:
---
soc_dummy_dev = platform_device_alloc("snd-soc-dummy", -1);
if (!soc_dummy_dev)
return -ENOMEM;
ret = platform_device_add(soc_dummy_dev);
---
in the very same source file.
What is the reason of adding platform data for a dummy driver?
The code snippet I propose, is copied from the spdif_receiver.c,
so its not something I invented myself. :)
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2013-04-11 16:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-11 10:36 [PATCH] asoc: add dummy codec Stas Sergeev
2013-04-11 10:41 ` Lars-Peter Clausen
2013-04-11 13:57   ` Stas Sergeev
2013-04-11 14:21     ` Lars-Peter Clausen
2013-04-11 14:33       ` Stas Sergeev
2013-04-11 15:11   ` Stas Sergeev
2013-04-11 15:48     ` Gabriel M. Beddingfield
2013-04-11 16:03       ` Stas Sergeev [this message]
2013-04-11 16:13         ` Gabriel M. Beddingfield
2013-04-11 16:44           ` Stas Sergeev
2013-04-11 18:02       ` Lars-Peter Clausen
2013-04-12  2:58         ` Gabriel M. Beddingfield
2013-04-12  2:50       ` Gabriel M. Beddingfield
2013-04-12  9:09         ` Stas Sergeev
2013-04-11 17:58     ` Lars-Peter Clausen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5166DEBC.8070702@list.ru \
    --to=stsp@list.ru \
    --cc=alsa-devel@alsa-project.org \
    --cc=gabrbedd@gmail.com \
    --cc=lars@metafoo.de \
    --cc=schen@mvista.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox