Skip to contentSkip to conversation

Will ALSA ever call _prepare or _hw_params while it's playing?

DISCUSSION Timur Tabi 2 participants 3 messages May 21, 2008

lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

I have an ASoC driver with a _hw_params, _prepare, and _trigger functions. I've recently discovered that I need to keep one of my devices disabled until playback starts.

So I would like to know if ALSA will ever call _hw_params, _prepare, or _startup if playback or capture is currently in process, or will ALSA first call the _trigger to stop/pause the driver.

If ALSA does stop/pause the driver before changing parameters, then I can safely assume the device is always disabled during those functions.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#1 lore raw
Quoted 7 lines · Timur Tabi

I have an ASoC driver with a _hw_params, _prepare, and _trigger functions. I've recently discovered that I need to keep one of my devices disabled until playback starts.

So I would like to know if ALSA will ever call _hw_params, _prepare, or _trigger if playback or capture is currently in process, or will ALSA first call the _trigger to stop/pause the driver.

While a stream is running (after trigger with START), ALSA will only call the pointer or the trigger (STOP/PAUSE/SUSPEND) callbacks.

Different streams are not synchronized in any way. (This also applies to the playback/capture streams of one card.)

Regards,
Clemens

author
#2 lore raw
Quoted 11 lines · Clemens Ladisch
Quoted 7 lines · Timur Tabi

I have an ASoC driver with a _hw_params, _prepare, and _trigger functions. I've recently discovered that I need to keep one of my devices disabled until playback starts.

So I would like to know if ALSA will ever call _hw_params, _prepare, or _trigger if playback or capture is currently in process, or will ALSA first call the _trigger to stop/pause the driver.

While a stream is running (after trigger with START), ALSA will only call the pointer or the trigger (STOP/PAUSE/SUSPEND) callbacks.

That's good.

Quoted 2 lines

Different streams are not synchronized in any way. (This also applies to the playback/capture streams of one card.)

Ah, I hadn't thought about that. If I'm doing simultaneous capture and playback through the same device, then I can't guarantee that it's disabled. Argh.

Thanks.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale