[alsa-devel] Implementing sync start

Jon Smirl jonsmirl at gmail.com
Mon Aug 10 14:24:18 CEST 2009

On Mon, Aug 10, 2009 at 7:57 AM, Clemens Ladisch<clemens at ladisch.de> wrote:
> Jon Smirl wrote:
>> On Mon, Aug 10, 2009 at 3:40 AM, Clemens Ladisch<clemens at ladisch.de> wrote:
>>> There is no common code for the two substreams.
>>> Is your hardware actually capable of starting them at exactly the same
>>> time?
>> Sync start is working. This is in the loop and starts the streams:
>>    bcom_enable(s->bcom_task);
>> s is set to two different values in the loop.
> But you are calling bcom_enable() twice, once for each stream.  The same
> would happen if you didn't implement sync start and let ALSA handle the
> linked streams.
> Sync start/stop is intended for hardware that can actually start two
> streams at _exactly_ the same time, by, e.g., writing a value with two
> bits set to a register.

The streams are on the same MCLK. I just need to make sure they get
enabled in the same clock cycle. To ensure this I need to add some
more code to look for a clock edge before enabling them.

If I didn't use sync start wouldn't I be vulnerable to user space
getting delayed between the start calls? If I'm unlucky the second
start could come in milliseconds after the first one.

>> I'm having problems with the drain error on stop.
>> ALSA sound/core/pcm_native.c:1499: playback drain error (DMA or IRQ trouble?)
> ALSA did not get the snd_pcm_period_elapsed() call (or the correct
> pointer value) for the last samples.
> Clemens

Jon Smirl
jonsmirl at gmail.com

More information about the Alsa-devel mailing list