[alsa-devel] [PATCH] ALSA: add support for disabling period irq

Jaroslav Kysela perex at perex.cz
Tue Nov 2 09:17:33 CET 2010

On Tue, 2 Nov 2010, Takashi Iwai wrote:

> At Mon,  1 Nov 2010 17:12:53 -0500,
> Pierre-Louis Bossart wrote:
>> Merged and cleaned patch based on earlier patches posted
>> on alsa-devel by Clemens Ladisch <clemens at ladisch.de> and
>> Pierre-Louis Bossart <pierre-louis.bossart at intel.com>
>> This patch disables period interrupts which are not
>> needed when the application relies on a system timer
>> to wake-up and refill the ring buffer. The behavior of
>> the driver is left unchanged, and interrupts are only
>> disabled if the application requests this configuration.
>> The behavior in case of underruns is slightly different,
>> instead of being detected during the period interrupts the
>> underruns are detected when the application calls
>> snd_pcm_update_avail, which in turns forces a refresh of the
>> hw pointer and shows the buffer is empty.
> So, this silently assumes that the applications do call
> snd_pcm_update_avail() appropriately at the right timing?
> If so, any sense to check XRUN in the driver at all...?
> And, even more, any sense to report the incremental position by this
> approach?  The only reliable information in this case is the offset in
> the ring buffer.  The linear position as the current ALSA API provides
> isn't guaranteed without the period irq.

We can detect the buffer size crossing using jiffies, but I agree, it's 
something which should be added to the patch to not break hw_ptr in 
case when the application does not call the update function in time.
We have both values in runtime->hw_ptr_jiffies and 

Also, I would remove IRQ or interrupt from the API and use something 
like "no period ack" or so. IRQ is very hardware specific and some drivers 
does not use direct interrupts but another timing sources for period 

>> +#define SNDRV_PCM_INFO_NO_PERIOD_IRQ    0x00800000      /* period interrupt can be disabled */

#define SNDRV_PCM_INFO_NO_PERIOD_ACK	0x00800000	/* period transfer acknowledge can be disabled */


Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

More information about the Alsa-devel mailing list