[alsa-devel] overrun in case of record
Hello Mark
I am testing my audio driver on spear platform.During recording I am getting two issues. 1. Overrun issue 2. pcm_read error
I am using arecord for capturing data. #arecord -f dat > t overrun!!! (at least 32.949 ms long)
Overrun issue: The issue is only reproducible if we try to record for more than 40 sec.The strange part is that Instead of overrun condition generated, it will record complete data for 10sec.(This is verified with the number of bytes recorded). So could you please let me know whether this is an error condition or just a warning.
pcm_read error: For this I have seen a bug is locked in the bugzila(*Bug 472469* <show_bug.cgi?id=472469> -arecord: input/output error ). and the status is closed saying insufficient data. Could you please let me know what is the meaning of this bug? Is it like, data is not available in the buffer and pcm_read from the user space fails? But why this situation will arise?
Best Regards Rajeev
On Tue, Sep 06, 2011 at 03:04:44PM +0530, Rajeev kumar wrote:
I am using arecord for capturing data. #arecord -f dat > t overrun!!! (at least 32.949 ms long)
Overrun issue: The issue is only reproducible if we try to record for more than 40 sec.The strange part is that Instead of overrun condition generated, it will record complete data for 10sec.(This is verified with the number of bytes recorded). So could you please let me know whether this is an error condition or just a warning.
An overrun means that your driver is producing data faster than the application is reading it and ran out of buffer space. This may mean that you're running at the wrong sample rate, or it may mean that your system is just too slow to do recordings.
pcm_read error: For this I have seen a bug is locked in the bugzila(*Bug 472469* <show_bug.cgi?id=472469> -arecord: input/output error ). and the status is closed saying insufficient data. Could you please let me know what is the meaning of this bug? Is it like, data is not available in the buffer and pcm_read from the user space fails? But why this situation will arise?
You'll need to investigate the bug.
Hello Mark
On 9/6/2011 11:31 PM, Mark Brown wrote:
pcm_read error: For this I have seen a bug is locked in the
bugzila(*Bug 472469*<show_bug.cgi?id=472469> -arecord: input/output error ). and the status is closed saying insufficient data. Could you please let me know what is the meaning of this bug? Is it like, data is not available in the buffer and pcm_read from the user space fails? But why this situation will arise?
You'll need to investigate the bug. .
I analyzed the bug and found that if I use arecord in non-blocking mode, it works fine.
#arecord -f dat --nonblock > t
Working in a non-blocking mode means there is no data available in ring buffer and returning -EAGAIN from the alsa, so application is wating for data to arrive in the ring buffer. Now it is not clear to me why this situation will arise? I have checked the clock and all the clock are intact. The calculation for number of bytes received in a sec is correct.
Best Regards Rajeev
Rajeev kumar wrote:
I analyzed the bug and found that if I use arecord in non-blocking mode, it works fine.
In theory, with a correct driver, using non-blocking mode should not make any difference.
All the symptoms indicate that the pointer callback and/or the calling of snd_pcm_period_elapsed is somehow wrong.
Regards, Clemens
Hello Mark
I have a single codec with playback and capture capability. We are using it for different i2s controller. Below are the details for that.
case 1: I2S controller-1: with playback and capture capability case 2: I2S controller-2: with playback capability only case 3: I2S controller-3: with capture capability only.
We are registering all the I2S controller with there respective capability.
In command 'aplay -l' or 'cat /proc/asound/pcm', among playback devices, capture device is also listed. This is true in case-1 but for case-2 and case-3 also it is showing the same behavior. According to my understanding it should not show the list of all devices i.e. in case of controller having playback capability it should show only playback devices not capture devices and vice versa. Please correct me if I am wrong.
So my questions are 1. How to separate playback and capture devices in case-2 and case-3. Are we need to register different codec for different i2s controller?
2. Is it codec capability only which is exported to user space ?
Best Regards Rajeev
On Thu, Nov 17, 2011 at 07:05:46PM +0530, Rajeev kumar wrote:
In command 'aplay -l' or 'cat /proc/asound/pcm', among playback devices, capture device is also listed. This is true in case-1 but
This is the intended behaviour, capture only PCMs are still PCMs.
Hello Mark
Could you please help me by answering these questions?
Best Regards Rajeev
On 11/17/2011 7:05 PM, Rajeev kumar wrote:
Hello Mark
I have a single codec with playback and capture capability. We are using it for different i2s controller. Below are the details for that.
case 1: I2S controller-1: with playback and capture capability case 2: I2S controller-2: with playback capability only case 3: I2S controller-3: with capture capability only.
We are registering all the I2S controller with there respective capability.
In command 'aplay -l' or 'cat /proc/asound/pcm', among playback devices, capture device is also listed. This is true in case-1 but for case-2 and case-3 also it is showing the same behavior. According to my understanding it should not show the list of all devices i.e. in case of controller having playback capability it should show only playback devices not capture devices and vice versa. Please correct me if I am wrong.
So my questions are
- How to separate playback and capture devices in case-2 and case-3.
Are we need to register different codec for different i2s controller?
- Is it codec capability only which is exported to user space ?
Best Regards Rajeev
On Mon, 2011-11-21 at 11:19 +0530, Rajeev kumar wrote:
Hello Mark
Could you please help me by answering these questions?
Best Regards Rajeev
Pls don't top-post!!
On 11/17/2011 7:05 PM, Rajeev kumar wrote:
Hello Mark
I have a single codec with playback and capture capability. We are using it for different i2s controller. Below are the details for that.
case 1: I2S controller-1: with playback and capture capability case 2: I2S controller-2: with playback capability only case 3: I2S controller-3: with capture capability only.
We are registering all the I2S controller with there respective capability.
In command 'aplay -l' or 'cat /proc/asound/pcm', among playback devices, capture device is also listed. This is true in case-1 but for case-2 and case-3 also it is showing the same behavior. According to my understanding it should not show the list of all devices i.e. in case of controller having playback capability it should show only playback devices not capture devices and vice versa. Please correct me if I am wrong.
So my questions are
- How to separate playback and capture devices in case-2 and case-3.
Are we need to register different codec for different i2s controller?
How asoc builds this is based on dailinks you have provided. If for the device 2 and device 3 the cpu and codec dais support both playback and capture devices, it will go ahead and register these device. The fact that for device 2 and device 3 capture is also registered suggests me that your cpu dais are not correct.
Would help if you post your code, esp the codec, cpu dais and dialinks.
Hello Vinod, Mark
On 11/21/2011 11:53 AM, Vinod Koul wrote:
On Mon, 2011-11-21 at 11:19 +0530, Rajeev kumar wrote:
Hello Mark
Could you please help me by answering these questions?
Best Regards Rajeev
Pls don't top-post!!
On 11/17/2011 7:05 PM, Rajeev kumar wrote:
Hello Mark
I have a single codec with playback and capture capability. We are using it for different i2s controller. Below are the details for that.
case 1: I2S controller-1: with playback and capture capability case 2: I2S controller-2: with playback capability only case 3: I2S controller-3: with capture capability only.
We are registering all the I2S controller with there respective capability.
In command 'aplay -l' or 'cat /proc/asound/pcm', among playback devices, capture device is also listed. This is true in case-1 but for case-2 and case-3 also it is showing the same behavior. According to my understanding it should not show the list of all devices i.e. in case of controller having playback capability it should show only playback devices not capture devices and vice versa. Please correct me if I am wrong.
So my questions are
- How to separate playback and capture devices in case-2 and case-3.
Are we need to register different codec for different i2s controller?
How asoc builds this is based on dailinks you have provided. If for the device 2 and device 3 the cpu and codec dais support both playback and capture devices, it will go ahead and register these device. The fact that for device 2 and device 3 capture is also registered suggests me that your cpu dais are not correct.
Would help if you post your code, esp the codec, cpu dais and dialinks.
Codec dai:
static struct snd_soc_dai_driver sta529_dai = { .name = "sta529-audio", .playback = { .stream_name = "Playback", .channels_min = 2, .channels_max = 2, .rates = SPEAR_PCM_RATES, .formats = SPEAR_PCM_FORMAT, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SPEAR_PCM_RATES, .formats = SPEAR_PCM_FORMAT, }, .ops = &sta529_dai_ops, };
cpu dai: In case of cpu dai, we are passing the playback and capture capability from the platform code and depending on the capability we are filling the cpu dai structure in probe function, like
if (cap & PLAY) {
/* Fill Playback capability */ }
if (cap & RECORD) { /* Fill Capture capability */ }
dai links:
static struct snd_soc_dai_link spear_evb_dai[] = { { .name = "sta529-pcm0", .stream_name = "I2S Playback", .cpu_dai_name = "designware-i2s.0", .platform_name = "spear-pcm-audio", .codec_dai_name = "sta529-audio", .codec_name = "sta529-codec.0-001a", .ops = &sta529_ops, }, { .name = "sta529-pcm1", .stream_name = "I2S Capture", .cpu_dai_name = "designware-i2s.1", .platform_name = "spear-pcm-audio", .codec_dai_name = "sta529-audio", .codec_name = "sta529-codec.0-001a", .ops = &sta529_ops, }, };
static struct snd_soc_card spear_snd_card = { .name = "spear-evb", .dai_link = spear_evb_dai, .num_links = ARRAY_SIZE(spear_evb_dai), };
Best Regards ~Rajeev
On Tue, Nov 22, 2011 at 09:57:51AM +0530, Rajeev kumar wrote:
static struct snd_soc_dai_driver sta529_dai = {
.rates = SPEAR_PCM_RATES, .formats = SPEAR_PCM_FORMAT,
This looks wrong...
cpu dai: In case of cpu dai, we are passing the playback and capture capability from the platform code and depending on the capability we are filling the cpu dai structure in probe function, like
Why are you doing this? Your driver should export the capabilities of the hardware and let the machine driver pick any specific configuration that's needed.
Hello Mark
On 11/22/2011 6:38 PM, Mark Brown wrote:
On Tue, Nov 22, 2011 at 09:57:51AM +0530, Rajeev kumar wrote:
static struct snd_soc_dai_driver sta529_dai = {
.rates = SPEAR_PCM_RATES, .formats = SPEAR_PCM_FORMAT,
This looks wrong...
Agreed, This should be STA529_RATES and STA529_FORMATS.
cpu dai: In case of cpu dai, we are passing the playback and capture capability from the platform code and depending on the capability we are filling the cpu dai structure in probe function, like
Why are you doing this? Your driver should export the capabilities of the hardware and let the machine driver pick any specific configuration that's needed.
This is needed because we have a single cpu driver for three different I2S controller having different capability(as I explained in the first mail.). So capabilities are passed from the platform code and get filled in the probe part of the i2s controller.
Best Regards ~Rajeev
Hello Vinod,
On 11/22/2011 9:57 AM, Rajeev kumar wrote:
Hello Vinod, Mark
On 11/21/2011 11:53 AM, Vinod Koul wrote:
On Mon, 2011-11-21 at 11:19 +0530, Rajeev kumar wrote:
Hello Mark
Could you please help me by answering these questions?
Best Regards Rajeev
Pls don't top-post!!
On 11/17/2011 7:05 PM, Rajeev kumar wrote:
Hello Mark
I have a single codec with playback and capture capability. We are using it for different i2s controller. Below are the details for that.
case 1: I2S controller-1: with playback and capture capability case 2: I2S controller-2: with playback capability only case 3: I2S controller-3: with capture capability only.
We are registering all the I2S controller with there respective capability.
In command 'aplay -l' or 'cat /proc/asound/pcm', among playback devices, capture device is also listed. This is true in case-1 but for case-2 and case-3 also it is showing the same behavior. According to my understanding it should not show the list of all devices i.e. in case of controller having playback capability it should show only playback devices not capture devices and vice versa. Please correct me if I am wrong.
So my questions are
- How to separate playback and capture devices in case-2 and case-3.
Are we need to register different codec for different i2s controller?
How asoc builds this is based on dailinks you have provided. If for the device 2 and device 3 the cpu and codec dais support both playback and capture devices, it will go ahead and register these device. The fact that for device 2 and device 3 capture is also registered suggests me that your cpu dais are not correct.
Would help if you post your code, esp the codec, cpu dais and dialinks.
Codec dai:
static struct snd_soc_dai_driver sta529_dai = { .name = "sta529-audio", .playback = { .stream_name = "Playback", .channels_min = 2, .channels_max = 2, .rates = SPEAR_PCM_RATES, .formats = SPEAR_PCM_FORMAT, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SPEAR_PCM_RATES, .formats = SPEAR_PCM_FORMAT, }, .ops = &sta529_dai_ops, };
cpu dai: In case of cpu dai, we are passing the playback and capture capability from the platform code and depending on the capability we are filling the cpu dai structure in probe function, like
if (cap & PLAY) {
/* Fill Playback capability */ }
if (cap & RECORD) { /* Fill Capture capability */ }
dai links:
static struct snd_soc_dai_link spear_evb_dai[] = { { .name = "sta529-pcm0", .stream_name = "I2S Playback", .cpu_dai_name = "designware-i2s.0", .platform_name = "spear-pcm-audio", .codec_dai_name = "sta529-audio", .codec_name = "sta529-codec.0-001a", .ops = &sta529_ops, }, { .name = "sta529-pcm1", .stream_name = "I2S Capture", .cpu_dai_name = "designware-i2s.1", .platform_name = "spear-pcm-audio", .codec_dai_name = "sta529-audio", .codec_name = "sta529-codec.0-001a", .ops = &sta529_ops, }, };
static struct snd_soc_card spear_snd_card = { .name = "spear-evb", .dai_link = spear_evb_dai, .num_links = ARRAY_SIZE(spear_evb_dai), };
I had actually missed the last mail by mark. I dont know why? . So sorry for replying on the top of this mail.
Vinod, have you gone through the cpu_dai, codec_dai and dailink ? Could you please make any suggestion?
Best Regards ~Rajeev
Best Regards ~Rajeev
On Fri, 2011-12-02 at 16:20 +0530, Rajeev kumar wrote:
cpu dai: In case of cpu dai, we are passing the playback and capture capability from the platform code and depending on the capability we
are
filling the cpu dai structure in probe function, like
Unless we find what is being passed, its hard to comment.
As I said previously this will happen when you are reporting cpu dai wrongly, so hack there to fix your issue
On 12/2/2011 4:20 PM, Rajeev kumar wrote:
Hello Vinod,
On 11/22/2011 9:57 AM, Rajeev kumar wrote:
Hello Vinod, Mark
On 11/21/2011 11:53 AM, Vinod Koul wrote:
On Mon, 2011-11-21 at 11:19 +0530, Rajeev kumar wrote:
Hello Mark
Could you please help me by answering these questions?
Best Regards Rajeev
Pls don't top-post!!
On 11/17/2011 7:05 PM, Rajeev kumar wrote:
Hello Mark
I have a single codec with playback and capture capability. We are using it for different i2s controller. Below are the details for that.
case 1: I2S controller-1: with playback and capture capability case 2: I2S controller-2: with playback capability only case 3: I2S controller-3: with capture capability only.
We are registering all the I2S controller with there respective capability.
In command 'aplay -l' or 'cat /proc/asound/pcm', among playback devices, capture device is also listed. This is true in case-1 but for case-2 and case-3 also it is showing the same behavior. According to my understanding it should not show the list of all devices i.e. in case of controller having playback capability it should show only playback devices not capture devices and vice versa. Please correct me if I am wrong.
So my questions are
- How to separate playback and capture devices in case-2 and case-3.
Are we need to register different codec for different i2s controller?
How asoc builds this is based on dailinks you have provided. If for the device 2 and device 3 the cpu and codec dais support both playback and capture devices, it will go ahead and register these device. The fact that for device 2 and device 3 capture is also registered suggests me that your cpu dais are not correct.
Would help if you post your code, esp the codec, cpu dais and dialinks.
Codec dai:
static struct snd_soc_dai_driver sta529_dai = { .name = "sta529-audio", .playback = { .stream_name = "Playback", .channels_min = 2, .channels_max = 2, .rates = SPEAR_PCM_RATES, .formats = SPEAR_PCM_FORMAT, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SPEAR_PCM_RATES, .formats = SPEAR_PCM_FORMAT, }, .ops = &sta529_dai_ops, };
cpu dai: In case of cpu dai, we are passing the playback and capture capability from the platform code and depending on the capability we are filling the cpu dai structure in probe function, like
if (cap & PLAY) {
/* Fill Playback capability */ }
if (cap & RECORD) { /* Fill Capture capability */ }
dai links:
static struct snd_soc_dai_link spear_evb_dai[] = { { .name = "sta529-pcm0", .stream_name = "I2S Playback", .cpu_dai_name = "designware-i2s.0", .platform_name = "spear-pcm-audio", .codec_dai_name = "sta529-audio", .codec_name = "sta529-codec.0-001a", .ops = &sta529_ops, }, { .name = "sta529-pcm1", .stream_name = "I2S Capture", .cpu_dai_name = "designware-i2s.1", .platform_name = "spear-pcm-audio", .codec_dai_name = "sta529-audio", .codec_name = "sta529-codec.0-001a", .ops = &sta529_ops, }, };
static struct snd_soc_card spear_snd_card = { .name = "spear-evb", .dai_link = spear_evb_dai, .num_links = ARRAY_SIZE(spear_evb_dai), };
I had actually missed the last mail by mark. I dont know why? . So sorry for replying on the top of this mail.
Vinod, have you gone through the cpu_dai, codec_dai and dailink ? Could you please make any suggestion?
Ping
Best Regards ~Rajeev
Best Regards ~Rajeev
Hello Mark
On 1/9/2012 12:01 PM, Rajeev kumar wrote:
On 12/2/2011 4:20 PM, Rajeev kumar wrote:
Hello Vinod,
On 11/22/2011 9:57 AM, Rajeev kumar wrote:
Hello Vinod, Mark
On 11/21/2011 11:53 AM, Vinod Koul wrote:
On Mon, 2011-11-21 at 11:19 +0530, Rajeev kumar wrote:
Hello Mark
Could you please help me by answering these questions?
Best Regards Rajeev
Pls don't top-post!!
On 11/17/2011 7:05 PM, Rajeev kumar wrote:
Hello Mark
I have a single codec with playback and capture capability. We are using it for different i2s controller. Below are the details for that.
case 1: I2S controller-1: with playback and capture capability case 2: I2S controller-2: with playback capability only case 3: I2S controller-3: with capture capability only.
We are registering all the I2S controller with there respective capability.
In command 'aplay -l' or 'cat /proc/asound/pcm', among playback devices, capture device is also listed. This is true in case-1 but for case-2 and case-3 also it is showing the same behavior. According to my understanding it should not show the list of all devices i.e. in case of controller having playback capability it should show only playback devices not capture devices and vice versa. Please correct me if I am wrong.
So my questions are
- How to separate playback and capture devices in case-2 and case-3.
Are we need to register different codec for different i2s controller?
How asoc builds this is based on dailinks you have provided. If for the device 2 and device 3 the cpu and codec dais support both playback and capture devices, it will go ahead and register these device. The fact that for device 2 and device 3 capture is also registered suggests me that your cpu dais are not correct.
Would help if you post your code, esp the codec, cpu dais and dialinks.
Codec dai:
static struct snd_soc_dai_driver sta529_dai = { .name = "sta529-audio", .playback = { .stream_name = "Playback", .channels_min = 2, .channels_max = 2, .rates = SPEAR_PCM_RATES, .formats = SPEAR_PCM_FORMAT, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SPEAR_PCM_RATES, .formats = SPEAR_PCM_FORMAT, }, .ops = &sta529_dai_ops, };
cpu dai: In case of cpu dai, we are passing the playback and capture capability from the platform code and depending on the capability we are filling the cpu dai structure in probe function, like
if (cap & PLAY) {
/* Fill Playback capability */ }
if (cap & RECORD) { /* Fill Capture capability */ }
dai links:
static struct snd_soc_dai_link spear_evb_dai[] = { { .name = "sta529-pcm0", .stream_name = "I2S Playback", .cpu_dai_name = "designware-i2s.0", .platform_name = "spear-pcm-audio", .codec_dai_name = "sta529-audio", .codec_name = "sta529-codec.0-001a", .ops = &sta529_ops, }, { .name = "sta529-pcm1", .stream_name = "I2S Capture", .cpu_dai_name = "designware-i2s.1", .platform_name = "spear-pcm-audio", .codec_dai_name = "sta529-audio", .codec_name = "sta529-codec.0-001a", .ops = &sta529_ops, }, };
static struct snd_soc_card spear_snd_card = { .name = "spear-evb", .dai_link = spear_evb_dai, .num_links = ARRAY_SIZE(spear_evb_dai), };
I had actually missed the last mail by mark. I dont know why? . So sorry for replying on the top of this mail.
Vinod, have you gone through the cpu_dai, codec_dai and dailink ? Could you please make any suggestion?
Ping
The o/p of the cat /proc/asound/pcm does not depends on the &ing of the capability of i2s controller and codec. I was going through the soc-core.c and it seems that the capability exposed to user space only depends on the codec. If codec has both playback and capture capability ,then in user space both will be exported and hence cat /proc/asound/pcm will show two different devices one for playback and other for capture. In case codec has only playback capability, the o/p of the cat /proc/asound/pcm will contain only playback device.
So in case of three different i2s controller with different capability, separate codec are required.
Please correct me if I am wrong.
Best Regards Rajeev
Best Regards ~Rajeev
Best Regards ~Rajeev
participants (4)
-
Clemens Ladisch
-
Mark Brown
-
Rajeev kumar
-
Vinod Koul