[alsa-devel] [PATCH] asoc: add dummy codec
Gabriel M. Beddingfield
gabrbedd at gmail.com
Thu Apr 11 17:48:08 CEST 2013
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.
-gabriel
More information about the Alsa-devel
mailing list