ASoC: define playback and capture streams in dummy codec
PATCH 1/1 ASoC: define playback and capture streams in dummy codec
Hi.
This patch adds a playback and capture streams to the dummy codec DAI configuration. Most permissive set of sampling rates and formats is used.
From 22813b2124d81d8de5cde19a4e2f9490bd23baab Mon Sep 17 00:00:00 2001
From: Stas Sergeev <[email protected]>
Date: Thu, 11 Apr 2013 19:07:20 +0400
Subject: [PATCH] ASoC: define playback and capture streams in dummy codec
This patch adds a playback and capture streams to the dummy codec DAI configuration. Most permissive set of sampling rates and formats is used.
--- sound/soc/soc-utils.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
sound/soc/soc-utils.c +25 -0
@@ -90,8 +90,33 @@ static struct snd_soc_platform_driver dummy_platform = { };static struct snd_soc_codec_driver dummy_codec; + +#define STUB_RATES SNDRV_PCM_RATE_8000_192000 +#define STUB_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ + SNDRV_PCM_FMTBIT_U8 | \ + SNDRV_PCM_FMTBIT_S16_LE | \ + SNDRV_PCM_FMTBIT_U16_LE | \ + SNDRV_PCM_FMTBIT_S24_LE | \ + SNDRV_PCM_FMTBIT_U24_LE | \ + SNDRV_PCM_FMTBIT_S32_LE | \ + SNDRV_PCM_FMTBIT_U32_LE | \ + SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)static struct snd_soc_dai_driver dummy_dai = { .name ="snd-soc-dummy-dai" , + .playback = { + .stream_name ="Playback" , + .channels_min =1 , + .channels_max =384 , + .rates =STUB_RATES , + .formats =STUB_FORMATS , + }, + .capture = { + .stream_name ="Capture" , + .channels_min =1 , + .channels_max =384 , + .rates =STUB_RATES , + .formats =STUB_FORMATS , + }, };static int snd_soc_dummy_probe (struct platform_device *pdev)
Signature · 1 line
1.7.11.7
Quoted 4 lines · Stas Sergeev
Hi.
This patch adds a playback and capture streams to the dummy codec DAI configuration. Most permissive set of sampling rates and formats is used.
The changelog ought to explain why this is required...
Quoted 1 line
Signed-off-by Stas Sergeev <[email protected]>
Please send patches as documented in SubmittingPatches - even as an attachment this isn't coming out as plain text for me.
Quoted 3 lines · On Fri, 12 Apr 2013 11:59:44 +0100 Mark Brown…
Quoted 2 lines
This patch adds a playback and capture streams to the dummy codec DAI configuration. Most permissive set of sampling rates and formats is used.
The changelog ought to explain why this is required...
I can only tell that without this patch I am not getting any sound at all... which is probably a rather poor statement for the changelog. Could you please correct the changelog with the better knowledge of the details?
Quoted 3 lines
Quoted 1 line
Signed-off-by Stas Sergeev <[email protected]>Please send patches as documented in SubmittingPatches - even as an attachment this isn't coming out as plain text for me.
OK, now it should be as a plain text.
Quoted 1 line
From
22813b2124d81d8de5cde19a4e2f9490bd23baabMon Sep 17 00:00:00 2001
From: Stas Sergeev <[email protected]>
Date: Thu, 11 Apr 2013 19:07:20 +0400
Subject: [PATCH] ASoC: define playback and capture streams in dummy codec
This patch adds a playback and capture streams to the dummy codec DAI configuration. Most permissive set of sampling rates and formats is used.
--- sound/soc/soc-utils.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
sound/soc/soc-utils.c +25 -0
@@ -90,8 +90,33 @@ static struct snd_soc_platform_driver dummy_platform = { };static struct snd_soc_codec_driver dummy_codec; + +#define STUB_RATES SNDRV_PCM_RATE_8000_192000 +#define STUB_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ + SNDRV_PCM_FMTBIT_U8 | \ + SNDRV_PCM_FMTBIT_S16_LE | \ + SNDRV_PCM_FMTBIT_U16_LE | \ + SNDRV_PCM_FMTBIT_S24_LE | \ + SNDRV_PCM_FMTBIT_U24_LE | \ + SNDRV_PCM_FMTBIT_S32_LE | \ + SNDRV_PCM_FMTBIT_U32_LE | \ + SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)static struct snd_soc_dai_driver dummy_dai = { .name ="snd-soc-dummy-dai" , + .playback = { + .stream_name ="Playback" , + .channels_min =1 , + .channels_max =384 , + .rates =STUB_RATES , + .formats =STUB_FORMATS , + }, + .capture = { + .stream_name ="Capture" , + .channels_min =1 , + .channels_max =384 , + .rates =STUB_RATES , + .formats =STUB_FORMATS , + }, };static int snd_soc_dummy_probe (struct platform_device *pdev)
Signature · 1 line
1.7.11.7
Quoted 9 lines · Stas Sergeev
Quoted 3 lines · On Fri, 12 Apr 2013 11:59:44 +0100 Mark Brown…
Quoted 2 lines
This patch adds a playback and capture streams to the dummy codec DAI configuration. Most permissive set of sampling rates and formats is used.
The changelog ought to explain why this is required...
I can only tell that without this patch I am not getting any sound at all... which is probably a rather poor statement for the changelog. Could you please correct the changelog with the better knowledge of the details?
He means that the commit message. Your commit message says what the patch does. It does not say why the patch is needed.
-gabriel
12.04.2013 19:13, Gabriel M. Beddingfield пишет:
Quoted 6 lines · Stas Sergeev
Quoted 5 lines
Quoted 3 lines · On Fri, 12 Apr 2013 11:59:44 +0100 Mark Brown…
Quoted 3 lines
This patch adds a playback and capture streams to the dummy codec DAI configuration. Most permissive set of sampling rates and formats is used.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
The changelog ought to explain why this is required...
I can only tell that without this patch I am not getting any sound at all... which is probably a rather poor statement for the changelog. Could you please correct the changelog with the better knowledge of the details?
He means that the commit message. Your commit message says what the patch does. It does not say why the patch is needed.
Yes.
But what should I add to the commit message, if the only thing I know about this patch, is that I am not getting any sound without it? :) The reason should be obvious for whoever is familiar with that subsystem, but its not me.
_______________________________________________
Alsa-devel mailing list [email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 8 lines · Stas Sergeev
Quoted 2 lines
He means that the commit message. Your commit message says what the patch does. It does not say why the patch is needed.
Yes.
But what should I add to the commit message, if the only thing I know about this patch, is that I am not getting any sound without it? :) The reason should be obvious for whoever is familiar with that subsystem, but its not me.
Yep, just formalize the "I am not getting any sound with it" statement. :-) Maybe something like: "Because snd-soc-dummy didn't declare any DAI, it was unable to be used for any audio streams."
-gabriel
Quoted 13 lines · Stas Sergeev
12.04.2013 19:13, Gabriel M. Beddingfield пишет:
Quoted 12 lines · Stas Sergeev
Quoted 10 lines
Quoted 4 lines · On Fri, 12 Apr 2013 11:59:44 +0100 Mark Brown…
Quoted 3 lines
This patch adds a playback and capture streams to the dummy codec DAI configuration. Most permissive set of sampling rates and formats is used.
The changelog ought to explain why this is required...
I can only tell that without this patch I am not getting any sound at all... which is probably a rather poor statement for the changelog. Could you please correct the changelog with the better knowledge of the details?
Quoted 7 lines
Quoted 2 lines
He means that the commit message. Your commit message says what the patch does. It does not say why the patch is needed.
Yes.
But what should I add to the commit message, if the only thing I know about this patch, is that I am not getting any sound without it? :) The reason should be obvious for whoever is familiar with that subsystem, but its not me.
Well, if not explicitly initialized a field is set to 0. Which is kind of the most restrictive option for many of the fields. E.g. channels_max, rates, formats, etc. When the ASoC core creates a new PCM device it will take the intersection of the CPU DAI and CODEC DAI fields to initialize the fields the PCM. So if for example channels_max is 0 for the CODEC DAI, channels_max will also be 0 for the PCM, no matter what channels_max is set to for the CPU DAI. Same goes for formats and rates. So a dummy CODEC should have set its fields in a way that it is most permissive, so that the intersection of the CODEC DAI fields with the CPU DAI fields will be equal to the CPU DAI fields.
- Lars
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 9 lines · On Fri, 12 Apr 2013 17:31:19 +0200 Lars-Peter Clausen <[email protected]> wrote:
Well, if not explicitly initialized a field is set to 0. Which is kind of the most restrictive option for many of the fields. E.g.
channels_max, rates, formats, etc. When the ASoC core creates a new PCM device it will take the intersection of the CPU DAI and CODEC DAI fields to initialize the fields the PCM. So if for examplechannels_maxis 0 for the CODEC DAI,channels_maxwill also be 0 for the PCM, no matter whatchannels_maxis set to for the CPU DAI. Same goes for formats and rates. So a dummy CODEC should have set its fields in a way that it is most permissive, so that the intersection of the CODEC DAI fields with the CPU DAI fields will be equal to the CPU DAI fields.
Thanks for an explanation!
But what happens when the DAI is considered mute by the effect of such intersection?
Quoted 1 line
From what I can see, no callbacks from the DAI driver
are called in this case (this is expected), but no error is returned to userspace, and, more importantly, the playback speed is still correct, so the userspace can get a playback position as if the playback is fine. While during the normal playback, if I stop calling snd_pcm_period_elapsed(), userspace is no longer getting the right position.
That's why I am confused, I can't easily explain this "no sound but otherwise fine playback" effect, so I am a bit reluctant to try explaining this in a commit msg. Are there are some fallbacks? Such as when the DAI is considered mute, it gets somehow emulated, with the use of the system clock for correct timing etc?
Quoted 20 lines · Stas Sergeev
Quoted 9 lines · On Fri, 12 Apr 2013 17:31:19 +0200 Lars-Peter Clausen <[email protected]> wrote:
Well, if not explicitly initialized a field is set to 0. Which is kind of the most restrictive option for many of the fields. E.g.
channels_max, rates, formats, etc. When the ASoC core creates a new PCM device it will take the intersection of the CPU DAI and CODEC DAI fields to initialize the fields the PCM. So if for examplechannels_maxis 0 for the CODEC DAI,channels_maxwill also be 0 for the PCM, no matter whatchannels_maxis set to for the CPU DAI. Same goes for formats and rates. So a dummy CODEC should have set its fields in a way that it is most permissive, so that the intersection of the CODEC DAI fields with the CPU DAI fields will be equal to the CPU DAI fields.Thanks for an explanation!
But what happens when the DAI is considered mute by the effect of such intersection?
From what I can see, no callbacks from the DAI driver are called in this case (this is expected), but no error is returned to userspace, and, more importantly, the playback speed is still correct, so the userspace can get a playback position as if the playback is fine. While during the normal playback, if I stop calling
Quoted 8 lines
snd_pcm_period_elapsed(), userspace is no longer getting the right position.
That's why I am confused, I can't easily explain this "no sound but otherwise fine playback" effect, so I am a bit reluctant to try explaining this in a commit msg. Are there are some fallbacks? Such as when the DAI is considered mute, it gets somehow emulated, with the use of the system clock for correct timing etc?
That's actually a bit strange indeed, since you should get an error when you try to open the pcm device.
- Lars
12.04.2013 20:55, Lars-Peter Clausen пишет:
Quoted 18 lines · Stas Sergeev
Quoted 9 lines
Thanks for an explanation!
But what happens when the DAI is considered mute by the effect of such intersection?
From what I can see, no callbacks from the DAI driver
are called in this case (this is expected), but no error is returned to userspace, and, more importantly, the playback speed is still correct, so the userspace can get a playback position as if the playback is fine. While during the normal playback, if I stop callingQuoted 8 lines
snd_pcm_period_elapsed(), userspace is no longer getting the right position.
That's why I am confused, I can't easily explain this "no sound but otherwise fine playback" effect, so I am a bit reluctant to try explaining this in a commit msg. Are there are some fallbacks? Such as when the DAI is considered mute, it gets somehow emulated, with the use of the system clock for correct timing etc?
Quoted 2 lines
That's actually a bit strange indeed, since you should get an error when you try to open the pcm device.
Ah great!
Next week I'll double-check that the fall-back is actually in userspace (in an android media stack perhaps), and that will be enough info for the reasonable commit msg. :) Thanks for your help!
_______________________________________________
Alsa-devel mailing list [email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
12.04.2013 19:24, Gabriel M. Beddingfield пишет:
Quoted 10 lines · Stas Sergeev
Quoted 8 lines
Quoted 2 lines
He means that the commit message. Your commit message says what the patch does. It does not say why the patch is needed.
Yes.
But what should I add to the commit message, if the only thing I know about this patch, is that I am not getting any sound without it? :) The reason should be obvious for whoever is familiar with that subsystem, but its not me.
Quoted 2 lines
Yep, just formalize the "I am not getting any sound with it" statement. :-)
Hi, Would something like the attached patch be good to help formalizing this? With that patch I am getting:
---
[ 2.800190] asoc: no playback or capture streams available [ 2.805158] asoc: can't create pcm Pri_Dai [ 2.809241] asoc: failed to instantiate card I2S: -22
---
which is much better than before.
If I get any ACKs on this one, I'll submit it too.
sound/soc/soc-core.c +5 -0
@@ -2140,6 +2140,11 @@ static int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)if (codec_dai->driver->capture.channels_min) capture =1 ; +if (playback + capture ==0 ) { +pr_err ("asoc: no playback or capture streams available\n" ); +return -EINVAL ; + } +dev_dbg (rtd->card->dev,"registered pcm #%d %s\n" ,num,new_name); ret =snd_pcm_new (rtd->card->snd_card, new_name, num, playback, capture, &pcm);
PATCH 1/1 ASoC: define playback and capture streams in dummy codec
In reply to Mark BrownHello.
This patch adds a playback and capture streams to the dummy codec DAI configuration. Most permissive set of sampling rates and formats is used.
This patch is needed for playback and capturing on a codec-less systems, as otherwise the PCM device nodes are not even created.
Quoted 1 line
From
9a498275e59c2c6ef933fe7d0cff79a13ba790ffMon Sep 17 00:00:00 2001
From: Stas Sergeev <[email protected]>
Date: Thu, 11 Apr 2013 19:07:20 +0400
Subject: [PATCH] ASoC: define playback and capture streams in dummy codec
This patch adds a playback and capture streams to the dummy codec DAI configuration. Most permissive set of sampling rates and formats is used.
This patch is needed for playback and capturing on a codec-less systems, as otherwise the PCM device nodes are not even created.
--- sound/soc/soc-utils.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
sound/soc/soc-utils.c +25 -0
@@ -90,8 +90,33 @@ static struct snd_soc_platform_driver dummy_platform = { };static struct snd_soc_codec_driver dummy_codec; + +#define STUB_RATES SNDRV_PCM_RATE_8000_192000 +#define STUB_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ + SNDRV_PCM_FMTBIT_U8 | \ + SNDRV_PCM_FMTBIT_S16_LE | \ + SNDRV_PCM_FMTBIT_U16_LE | \ + SNDRV_PCM_FMTBIT_S24_LE | \ + SNDRV_PCM_FMTBIT_U24_LE | \ + SNDRV_PCM_FMTBIT_S32_LE | \ + SNDRV_PCM_FMTBIT_U32_LE | \ + SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)static struct snd_soc_dai_driver dummy_dai = { .name ="snd-soc-dummy-dai" , + .playback = { + .stream_name ="Playback" , + .channels_min =1 , + .channels_max =384 , + .rates =STUB_RATES , + .formats =STUB_FORMATS , + }, + .capture = { + .stream_name ="Capture" , + .channels_min =1 , + .channels_max =384 , + .rates =STUB_RATES , + .formats =STUB_FORMATS , + }, };static int snd_soc_dummy_probe (struct platform_device *pdev)
Signature · 1 line
1.7.11.7
Quoted 6 lines · Stas Sergeev
This patch adds a playback and capture streams to the dummy codec DAI configuration. Most permissive set of sampling rates and formats is used.
This patch is needed for playback and capturing on a codec-less systems, as otherwise the PCM device nodes are not even created.
Quoted 6 lines
Signed-off-by Stas Sergeev <[email protected]>From
9a498275e59c2c6ef933fe7d0cff79a13ba790ffMon Sep 17 00:00:00 2001
From: Stas Sergeev <[email protected]>
Date: Thu, 11 Apr 2013 19:07:20 +0400
Subject: [PATCH] ASoC: define playback and capture streams in dummy codec
Applied, but please do send patches as covered in SubmittingPatches - send patches inline, not as attachments. That makes them harder to apply.