[alsa-devel] Triggering a DAPM widget event

Mark Brown broonie at opensource.wolfsonmicro.com
Wed Jan 26 17:53:47 CET 2011

On Tue, Jan 25, 2011 at 05:53:13PM +0100, Harrod, John wrote:

Please CC maintianers on mails, things on mailing lists get lost easily.
Please also fix your MUA to word wrap within paragraphs, I've reflowed
your mail below so I can read it.

> I have a program that uses the ALSA PCM interface to play sounds on an
> embedded system. Does anyone know how alsa-lib triggers a
> SND_SOC_DAPM_PRE_PMD widget event in DAPM core? On my system the event
> only gets called when the pcm is closed with snd_pcm_close(). Is there
> another function that can cause a widget shutdown?

A pre-powerdown even is generated before a DAPM widget is powered down.
This will happen whenever it ceases to be part of an active audio path.
This is not something that is visible at application layer.

> Or is opening and closing the PCM every time I want to play a sound a
> good practice for saving power?

You should never need to close application layer streams.  You should
stop data flowing on them when you are not transferring audio since
obviously even ignoring the CODEC power sitting DMAing data when you're
not playing audio is going to waste power.

More information about the Alsa-devel mailing list