From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Azizul Hakim <azizulfahim2002@gmail.com>,
Liam Girdwood <liam.r.girdwood@linux.intel.com>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>,
alsa-devel@alsa-project.org, Clemens Ladisch <clemens@ladisch.de>
Subject: Re: Audio Driver Works In Ubuntu but Crash in Debian After 2nd Run
Date: Fri, 19 Jun 2015 14:56:33 +0900 [thread overview]
Message-ID: <5583AF11.70503@sakamocchi.jp> (raw)
In-Reply-To: <CA+k7Wwb7i5n9dgGGVgkgbOpFC-+tsQnehMgkPLCnOebH5AE4oA@mail.gmail.com>
Hi,
On Jun 19 2015 13:32, Azizul Hakim wrote:
> Now during the 2nd playback, the driver initializes the buffer pointer to
> "0" again inside the *.prepare* function. And then I see it calls the
> *.pointer* function only once and afterwards stop with the error message *ALSA
> sound/core/pcm_lib.c:1910 playback write error (DMA or IRQ trouble?)*
When you see this log with playback PCM application, it means that 'the
application is running in blocking-mode (O_NONBLOCK) with
no-period-wakeup mode, and the blocking continues during 10 seconds'.
(when period-size is too large, it continues longer than 10 seconds.)
The blocking mode is released by several cues, but in this case I think
we should focus on calling 'snd_pcm_period_elapsed()'. In ALSA PCM
driver, calling this function changes PCM ringbuffer status, then
releases the blocking state in some conditions.
Therefore, we can judge that your driver may call no
'snd_pcm_period_elapsed()' because receiving no 'struct urb.complete()'
callback.
I think you should check your 'beagleaudio_audio_start()' function and
confirm whether it can set/release USB subsystem correctly.
Additionally, I reccomend you to use URB monitor in runtime to see your
driver can transmit URBs in second playbacking. (In my memory, Wireshark
has the functionality.)
> So I stopped initializing the buffer pointer to "0" during the second
> playback assuming that the buffer pointer should stay at the place it
> stopped from previous playback. But that also didn't work for me. I get the
> same error message. Note that same driver works on Ubuntu without any
> problem and as many times as I want.
The zero-reset is needed, I think.
In your driver, 'struct beagleaudio.snd_buffer_pos' and 'struct
beagleaudio.snd_period_pos' are used to count the number of PCM frames
in a period or a buffer.
They're an alternative representation of ALSA PCM rung-buffer status,
and no need to keep the state in different PCM runtimes. It's good to
reset them before PCM substream is running. (typically, done in 'struct
snd_pcm_ops.prepare()' callback).
# I note that I'm not good at USB subsystem and USB Audio Device Class.
# My comments come from general knowledgement about ALSA PCM core.
Regards
Takashi Sakamoto
next prev parent reply other threads:[~2015-06-19 5:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-14 3:18 Audio Driver Works In Ubuntu but Crash in Debian After 2nd Run Azizul Hakim
2015-06-15 14:26 ` Azizul Hakim
2015-06-16 7:50 ` Clemens Ladisch
2015-06-16 19:30 ` Azizul Hakim
2015-06-17 8:01 ` Clemens Ladisch
2015-06-17 9:05 ` Liam Girdwood
2015-06-17 14:53 ` Azizul Hakim
2015-06-19 4:32 ` Azizul Hakim
2015-06-19 5:56 ` Takashi Sakamoto [this message]
2015-06-19 6:21 ` Takashi Sakamoto
2015-06-20 2:52 ` Takashi Sakamoto
2015-06-19 8:01 ` Clemens Ladisch
2015-06-21 14:34 ` Raymond Yau
2015-06-22 6:55 ` Peter Ujfalusi
2015-06-22 15:00 ` Azizul Hakim
2015-06-26 14:20 ` Antonio Ospite
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=5583AF11.70503@sakamocchi.jp \
--to=o-takashi@sakamocchi.jp \
--cc=alsa-devel@alsa-project.org \
--cc=azizulfahim2002@gmail.com \
--cc=clemens@ladisch.de \
--cc=liam.r.girdwood@linux.intel.com \
--cc=peter.ujfalusi@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.