
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. :)